diff --git a/README_on_CTSM.md b/README_on_CTSM.md index e59074e1b7..0dbcbae64e 100644 --- a/README_on_CTSM.md +++ b/README_on_CTSM.md @@ -120,7 +120,6 @@ Important files in main directories (under $CTSMROOT): - `cime_config/usermods_dirs/clm`: Directories of sets of user-modification subdirs; these are directories that add specific user modifications to simulations created using `cime/scripts/create_newcase --user-mods-dir clm/*` - `tools/mksurfdata_esmf`: Directory to build program to create surface dataset at any resolution -- `tools/mkmapgrids`: NCL script to create a SCRIP grid file for a regular lat/lon grid (deprecated) - `tools/crop_calendars`: Tools to process and process and create crop calendar datasets for CTSM - `tools/modify_input_files`: Script to modify existing CTSM input datasets in standard ways - `tools/site_and_regional`: Scripts to create input datasets for single site and regional cases, primarily by modifying existing global datasets diff --git a/doc/ChangeLog b/doc/ChangeLog index 38ca52bbf5..a76eaa9582 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,62 @@ =============================================================== +Tag name: ctsm5.4.041 +Originator(s): samrabin (Sam Rabin, UCAR/TSS) +Date: Thu May 21 14:33:36 MDT 2026 +One-line Summary: Merge b4b-dev 2026-05-21 + +Purpose and description of changes +---------------------------------- + +Regular biweekly merge of b4b-dev to master. Includes the following PRs: +- [ESCOMP/CTSM Pull Request #3199: Update documentation for generating fsurdat/landuse files by slevis-lmwg](https://github.com/ESCOMP/CTSM/pull/3199) +- [ESCOMP/CTSM Pull Request #4007: Improve ctsm_pylib docs by samsrabin](https://github.com/ESCOMP/CTSM/pull/4007) +- [ESCOMP/CTSM Pull Request #3999: Revision of Section 1.5.6 Spinning up the Satellite Phenology Model in user's guide for CLM6 by olyson](https://github.com/ESCOMP/CTSM/pull/3999) +- [ESCOMP/CTSM Pull Request #3947: Technote updates for Hillslope Hydrology, biomass heat storage, and Methane model by swensosc](https://github.com/ESCOMP/CTSM/pull/3947) +- [ESCOMP/CTSM Pull Request #3909: updated BVOC documentation by lkemmons](https://github.com/ESCOMP/CTSM/pull/3909) +- [ESCOMP/CTSM Pull Request #4020: CN allocation tech notes improvements by huiqi-wang](https://github.com/ESCOMP/CTSM/pull/4020) +- [ESCOMP/CTSM Pull Request #4033: Remove table in CN Pools and link to table in CN Allocation by slevis-lmwg](https://github.com/ESCOMP/CTSM/pull/4033) +- [ESCOMP/CTSM Pull Request #4036: User's Guide: Delete "Building the CLM tools*" sections. by samsrabin](https://github.com/ESCOMP/CTSM/pull/4036) +- [ESCOMP/CTSM Pull Request #3223: Fix broken documentation links by adrifoster](https://github.com/ESCOMP/CTSM/pull/3223) + +Bugs fixed +---------- + +List of CTSM issues fixed (include CTSM Issue # and description): +- [ESCOMP/CTSM Issue #1718: User's Guide: How to use the new mksurfdata_esmf tool](https://github.com/ESCOMP/CTSM/issues/1718) +- [ESCOMP/CTSM Issue #3478: Update and delete outdated docs for creating input data](https://github.com/ESCOMP/CTSM/issues/3478) +- [ESCOMP/CTSM Issue #3075: Improve ctsm_pylib documentation](https://github.com/ESCOMP/CTSM/issues/3075) +- [ESCOMP/CTSM Issue #3976: User's Guide update: Section 1.5.6 Sp spin-ups](https://github.com/ESCOMP/CTSM/issues/3976) +- [ESCOMP/CTSM Issue #3735: Document the biomass heat storage parameterization in the technical note](https://github.com/ESCOMP/CTSM/issues/3735) +- [ESCOMP/CTSM Issue #3872: Review 2.26. Methane Model](https://github.com/ESCOMP/CTSM/issues/3872) +- [ESCOMP/CTSM Issue #3876: Review 2.30. Biogenic Volatile Organic Compounds (BVOCs)](https://github.com/ESCOMP/CTSM/issues/3876) +- [ESCOMP/CTSM Issue #3866: Review 2.20. C and N Allocation; and make updates](https://github.com/ESCOMP/CTSM/issues/3866) +- [ESCOMP/CTSM Issue #3863: Review 2.17. CN Pools; and update](https://github.com/ESCOMP/CTSM/issues/3863) +- [ESCOMP/CTSM Issue #2767: Broken external links in Tech Note and User's Guide](https://github.com/ESCOMP/CTSM/issues/2767) + +Notes of particular relevance for users +--------------------------------------- + +Changes to documentation: Lots. See lists of PRs and issues above. + +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): + + derecho ----- OK + izumi ------- OK + +Other details +------------- + +Pull Requests that document the changes (include PR ids): +- [ESCOMP/CTSM Pull Request #4040: ctsm5.4.041: b4b-dev merge 2026-05-21 by samsrabin](https://github.com/ESCOMP/CTSM/pull/4040) +- See also list of PRs in "Purpose and description of changes" above. + +=============================================================== +=============================================================== Tag name: ctsm5.4.040 Originator(s): slevis (Samuel Levis,UCAR/TSS,303-665-1310) Date: Wed May 20 04:13:57 PM MDT 2026 diff --git a/doc/ChangeSum b/doc/ChangeSum index 2fe23db0e5..0a494954f3 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.4.041 samrabin 05/21/2026 Merge b4b-dev 2026-05-21 ctsm5.4.040 multiple 05/20/2026 Paramfile updates ctsm5.4.039 multiple 05/14/2026 Add FATES namelist option to initialize cohorts with diameter at breast height (DBH) ctsm5.4.038 slevis 05/07/2026 Merge b4b-dev to master 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 fcd8235b62..8f0261b0ed 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 @@ -127,7 +127,7 @@ if you are using a machine that has been ported to CIME_; the second works if yo 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 +`_), but 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 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 acb1cad9be..6391352bad 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 @@ -105,8 +105,7 @@ 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`. + mask. - ``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 diff --git a/doc/source/lilac/specific-atm-models/wrf-tools.rst b/doc/source/lilac/specific-atm-models/wrf-tools.rst index 1222a16f10..ab9ef318b2 100644 --- a/doc/source/lilac/specific-atm-models/wrf-tools.rst +++ b/doc/source/lilac/specific-atm-models/wrf-tools.rst @@ -16,61 +16,21 @@ 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:: +1. Create ESMF mesh file from WRF ``geo_em*`` files, using the make_mesh tool. Details in section :numref:`how-to-make-mesh`. - ncl create_scrip_file.ncl +2. Create surface datasets in ``tools/mksurfdata_esmf``. Details in section :numref:`creating-surface-datasets`. - 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 - -.. todo:: - Update the below, as domain files aren't needed with nuopc. - -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 - -.. todo:: - Update the below, as ``mksurfdata.pl`` no longer exists. - -6. Create surface datasets in ``tools/mksurfdata_esmf``:: - - ./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_esmf" -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 +The following procedure is if you'd wish to merge WRF inital conditions from ``wrfinput`` file into CTSM initial condition file :: + 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:: - Sam, can you please make the above ncl script available. + Versions of the transfer_wrfinput ncl script are available in /glade/work/slevis/git_wrf/ctsm_init/. diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 7b7025c16e..c0d157f0b5 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -25,7 +25,7 @@ and :numref:`wrf-set-ctsm-runtime-options`. 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 ``derecho`` HPC system in particular. @@ -171,7 +171,7 @@ skip to section :numref:`wrf-set-ctsm-runtime-options`. 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/get_source.html New users must complete a registration form in this step. @@ -354,7 +354,7 @@ the following files to your WRF run directory:: Now run WRF-CTSM. On derecho this means submitting a batch job to PBS (Pro workload management system). Please check NCAR CISL's `instructions on running a batch job on derecho. -`__ +`__ A simple PBS script to run WRF-CTSM on ``derecho`` looks like this: 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 5d34fdce64..f4bca6df04 100644 --- a/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst +++ b/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst @@ -3,24 +3,63 @@ 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 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: 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 4) emission factors mapped to the specific PFTs of the CLM. +This section briefly describes the biogenic volatile organic compound (BVOC) emissions model implemented in CLM. The CLM3 version (:ref:`Levis et al. 2003 `; :ref:`Oleson et al. 2004 `) was based on :ref:`Guenther et al. (1995) `. :ref:`Heald et al. (2008) ` updated this scheme in CLM4 based on :ref:`Guenther et al (2006) `. The current version was first implemented in CLM4.5 and is currently based on MEGAN2.1 discussed in detail in :ref:`Guenther et al. (2012) `. As of CLM5, CLM-MEGAN has included these 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`, 4) emission factors mapped to the specific PFTs of the CLM. As of CLM6, CLM-MEGAN includes two new features: 5) the impact of drought, and 6) high-latitude specific isoprene emissions. -MEGAN2.1 now describes the emissions of speciated monoterpenes, 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 is therefore defined through a namelist parameter in drv\_flds\_in, e.g. megan\_specifier = 'ISOP = isoprene', 'BIGALK pentane + hexane + heptane + tricyclene'. +MEGAN2.1 describes the emissions of speciated monoterpenes, 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 is 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\ :sup:`-2` ground area h\ :sup:`-1`), for emission of chemical compound :math:`i` .. math:: - :label: ZEqnNum964222 + :label: flux equation 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\ :sup:`-2` ground area h\ :sup:`-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\ :sub:`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: +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\ :sup:`-2` ground area h\ :sup:`-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\ :sub:`2` inhibition is now included as described by :ref:`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: 28.2) + :label: light-dependent activity factor \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:`\epsilon _{i,\, j}` are 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. +The values for each emission factor :math:`\epsilon _{i,\, j}` are now available for each of the plant functional types in the CLM and each chemical compound. This information is provided in an external file, allowing for more frequent and easier updates. + +The impact of drought on isoprene emissions is based on the theory proposed by :ref:`Potosnak et al. (2014) `. Specifically, isoprene emissions are expected to increase under mild to moderate drought because drought raises leaf temperature, which stimulates isoprene emissions. Under severe drought, however, isoprene emissions are inhibited because substrate supply becomes constrained. Because the effect of leaf temperature is already represented by the leaf temperature activity factor :math:`\gamma _{T}` and its influence on isoprene emissions, only the inhibitory effect of severe drought (substrate supply impact, :math:`\gamma _{sub}` ) is parameterized as: + +.. math:: + :label: drought factor + + \gamma _{sub} =\frac{1}{1+b_{1} e^{a1 (\beta -0.2)}} + +where :math:`a_1=-7.4463` and :math:`b_1=3.2552` are empirical parameters (described in :ref:`Wang et al., 2022 `). + +Compared with Guenther et al. (2012), updates have been made to represent isoprene emissions from high-latitude plants, specifically boreal broadleaf deciduous shrubs (BBDS) and C3 Arctic grass (C3AG), in order to account for acclimation processes. These updates are based on leaf-enclosure and in situ measurements conducted at Toolik Field Station in Alaska, USA (:ref:`Wang et al., 2024a, 2024b `). +For BBDS, the isoprene emission factor is adjusted according to the mean temperature of the previous day as: + +.. math:: + :label: boreal shrub adjustment factor + + \text{For BBDS:} E_{opt} = 7.9 e^{0.217 (T_{24}-297.15)} + +where :math:`T_{24}` denotes the mean air temperature of the preceding day (Wang et al., 2024a). +For C3AG, the isoprene emission factor responds over a longer timescale of 10 days (Wang et al., 2024b) and is parameterized as a function of the mean air temperature over the preceding 10 days (:math:`T_{240}`): + +.. math:: + :label: C3 arctic grass adjustment factor + + \text{For C3AG:} E_{opt\_g} = e^{0.12 (T_{240}-288.15)} + +In addition, a dynamic temperature response curve for C3AG depends on recent temperature history as: + +.. math:: + :label: C3 arctic grass leaf temperature factor + + \text{For C3AG:} \gamma_{T\_g} = E_{opt\_g} e^{(C_{g} (1/303.15 - 1/T_{leaf}) / R)} + +where :math:`T_{leaf}` denotes the leaf temperature, :math:`R` is the gas constant (ct3 in code, 0.00831 kJ/mol) and :math:`C_{g}` is the parameter controlling the isoprene temperature response of C3AG and changes varies with :math:`T_{240}` as: + +.. math:: + :label: C3 arctic grass parameter + + C_{g} = 95 + 9.49 e^{0.53 (288.15-T_{240})} 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 c3eeee1946..2aa64219c7 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,14 +6,14 @@ Carbon and Nitrogen Allocation Introduction ----------------- -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. +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. CLM6 follows the allocation approach applied in CLM5. 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 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. +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`). 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) (:ref:`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 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`): +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 (Chapter :numref:`rst_Plant Respiration`). 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: 19.1 @@ -42,14 +42,14 @@ The storage pool that supplies carbon for maintenance respiration in excess of c 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}`. +where :math:`\tau_{xs}` is the time constant (currently set to 30 days) controlling the rate of replenishment of :math:`CS_{xs}`. The factor :math:`86400` (s day\ :sup:`-1`) converts :math:`\tau_{xs}` from days to seconds so that the flux is consistent with the per-second units used elsewhere. 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. 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 +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\_alloc}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 19.6 @@ -61,92 +61,106 @@ Potential allocation to new growth is calculated for all of the plant carbon and .. math:: :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} + \begin{aligned} + a_{1} &= \text{ratio of new fine root : new leaf carbon allocation} \\ + a_{2} &= \text{ratio of new coarse root : new stem carbon allocation} \\ + a_{3} &= \text{ratio of new stem : new leaf carbon allocation} \\ + a_{4} &= \text{ratio of new live wood : new total wood allocation} \\ + g_{1} &= \text{ratio of growth respiration carbon : new growth carbon} + \end{aligned} -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). +Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined as constants for a given PFT (:numref:`Table Allocation and CN ratio parameters`). The growth respiration coefficient :math:`g_{1}` = 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) `). 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 + a_{3} = \frac{2.7}{1 + e^{-0.004 (NPP_{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). +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 CN ratio parameters: -.. table:: Allocation and target 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:`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}` | Target :math:`CN_{leaf}` | Target :math:`CN_{fr}` | Target :math:`CN_{lw}` | Target :math:`CN_{dw}` | +==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ - | NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | + | NET Temperate | 1.50 | 0.3 | -1 | 0.1 | 58.00 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | NET Boreal | 1 | 0.3 | -1 | 0.1 | 40 | 42 | 50 | 500 | + | NET Boreal | 1.45 | 0.3 | -1 | 0.1 | 60.24 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | NDT Boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + | NDT Boreal | 0.73 | 0.3 | -1 | 0.1 | 28.92 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | BET Tropical | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | + | BET Tropical | 1.47 | 0.3 | -1 | 0.1 | 36.03 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | BET temperate | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | + | BET temperate | 1.63 | 0.3 | -1 | 0.1 | 34.59 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | BDT tropical | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + | BDT tropical | 1.28 | 0.3 | -1 | 0.1 | 18.63 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | BDT temperate | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + | BDT temperate | 1.39 | 0.3 | -1 | 0.1 | 21.64 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | BDT boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + | BDT boreal | 0.60 | 0.3 | -1 | 0.1 | 17.09 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | BES temperate | 1 | 0.3 | 0.2 | 0.5 | 30 | 42 | 50 | 500 | + | BES temperate | 1.50 | 0.3 | 1.40 | 0.5 | 36.42 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | BDS temperate | 1 | 0.3 | 0.2 | 0.5 | 25 | 42 | 50 | 500 | + | BDS temperate | 1.50 | 0.3 | 0.24 | 0.5 | 23.26 | 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 | + | BDS boreal | 1.20 | 0.3 | 0.24 | 0.1 | 21.40 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | C\ :sub:`3` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + | C\ :sub:`3` arctic grass | 1.20 | 0 | 0 | 0 | 20.70 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | C\ :sub:`4` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + | C\ :sub:`3` grass | 1.57 | 0 | 0 | 0 | 29.39 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Crop R | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + | C\ :sub:`4` grass | 1.50 | 0 | 0 | 0 | 35.36 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Crop I | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + | Crop R | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Crop I | 1 | 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 R | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Temp Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Temp Cereal I | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Winter Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Winter Cereal R | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Winter Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Winter Cereal I | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Soybean R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Soybean R | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Soybean I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Soybean I | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Miscanthus R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Miscanthus R | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Miscanthus I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Miscanthus I | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Switchgrass R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Switchgrass R | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Switchgrass I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + | Switchgrass I | 2 | 0 | 0 | 1 | 20 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +PFT name abbreviations: NET = Needleleaf Evergreen Tree, NDT = Needleleaf Deciduous Tree, BET = Broadleaf Evergreen Tree, BDT = Broadleaf Deciduous Tree, BES = Broadleaf Evergreen Shrub, BDS = Broadleaf Deciduous Shrub. The "R" and "I" suffixes on crop PFT names denote rainfed and irrigated management, respectively. + Carbon to nitrogen ratios are defined for different tissue types as follows: .. math:: :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} + \begin{aligned} + CN_{leaf} &= \text{C:N for leaf} \\ + CN_{fr} &= \text{C:N for fine root} \\ + CN_{lw} &= \text{C:N for live wood (in stem and coarse root)} \\ + CN_{dw} &= \text{C:N for dead wood (in stem and coarse root)} + \end{aligned} 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`): +Given values for the parameters in :eq:`19.7` and :eq:`19.9`, 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.10 @@ -165,7 +179,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: +Since the C:N stoichiometry for new growth allocation is defined, from :eq:`19.10` together with :eq:`19.11` and :eq:`19.12`, as :math:`C_{allom} / 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 @@ -239,7 +253,7 @@ There are two carbon pools associated with each plant tissue – one which repre CF_{alloc,deadcroot\_ stor} =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). -Nitrogen allocation +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: @@ -247,7 +261,7 @@ The total flux of nitrogen to be allocated is given by the FUN model (Chapter :n .. math:: :label: 19.26 - NF_{alloc,i} = min \left( NF_{demand, i}, NF_{supply, i} \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: @@ -309,7 +323,7 @@ The demand for each tissue, calculated for the tissue to remain on stoichiometry .. math:: :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). + NF_{demand,deadcroot\_ stor} =\frac{CF_{alloc,leaf\_ tot} 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: @@ -323,4 +337,4 @@ and the total supply for each tissue :math:`i` is the product of the fractional .. math:: :label: 19.40 - NF_{alloc,i} = N_{uptake} NF_{demand,i} / NF_{demand,tot} + NF_{supply,i} = N_{uptake} \, \frac{NF_{demand,i}}{NF_{demand,tot}} 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 80f3e95398..7bc6d03ba6 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 @@ -23,7 +23,7 @@ In addition to the vegetation pools, CLM includes a series of decomposing carbon 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, with the target leaf C\:N, :math:`CN_{\text{target}}^\text{pft}`, varying by plant functional type (PFT) (:numref:`Table PFT target leaf CN`). Nitrogen is allocated at each timestep to allow the plant to best match the target stoichiometry. Nitrogen downregulation of productivity acts by increasing the actual 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`. +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, with the target leaf C\:N, :math:`CN_{\text{target}}^\text{pft}`, varying by plant functional type (PFT) (:numref:`Table Allocation and CN ratio parameters`). Nitrogen is allocated at each timestep to allow the plant to best match the target stoichiometry. Nitrogen downregulation of productivity acts by increasing the actual 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`. As of CLM5.4, the target leaf C\:N may be time-evolving, :math:`CN_{\text{target}}^{\text{pft,CO2}}`, as a logarithmic function of atmospheric CO\ :sub:`2` that we denote :math:`CN_{\text{perturb}}^{\text{CO2}}`: @@ -37,59 +37,3 @@ As of CLM5.4, the target leaf C\:N may be time-evolving, :math:`CN_{\text{target where :math:`CN_{\text{target}}^\text{pft}` is the time-invarying target leaf C\:N at reference CO\ :sub:`2` that depends on PFT, :math:`CN_{\text{slope}}^{\text{CO2}}` (unitless) is the slope of the function, :math:`\text{CO2}_{\text{atm}}` is atmospheric CO\ :sub:`2` in parts per million by volume (ppmv), and :math:`\text{CO2}_{\text{atm}}^{\text{ref}}` is the reference CO\ :sub:`2` (ppmv) above which atmospheric CO\ :sub:`2` begins to scale the target leaf C\:N. The optional time-evolving target leaf C\:N was documented in :ref:`Hauser et al. (2023) `, and its current default is off by setting :math:`CN_{\text{slope}}^{\text{CO2}} = 0`. -.. _Table PFT target leaf CN: - -.. table:: Plant functional type (PFT) target leaf C:N, :math:`CN_{\text{target}}^\text{pft}`. - - +--------------------------+-----------------+ - | PFT | target leaf C:N | - +==========================+=================+ - | NET Temperate | 58.00 | - +--------------------------+-----------------+ - | NET Boreal | 60.24 | - +--------------------------+-----------------+ - | NDT Boreal | 28.92 | - +--------------------------+-----------------+ - | BET Tropical | 36.03 | - +--------------------------+-----------------+ - | BET temperate | 34.59 | - +--------------------------+-----------------+ - | BDT tropical | 18.63 | - +--------------------------+-----------------+ - | BDT temperate | 21.64 | - +--------------------------+-----------------+ - | BDT boreal | 17.09 | - +--------------------------+-----------------+ - | BES temperate | 36.42 | - +--------------------------+-----------------+ - | BDS temperate | 23.26 | - +--------------------------+-----------------+ - | BDS boreal | 21.40 | - +--------------------------+-----------------+ - | C\ :sub:`3` arctic grass | 20.70 | - +--------------------------+-----------------+ - | C\ :sub:`3` grass | 29.39 | - +--------------------------+-----------------+ - | 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 | - +--------------------------+-----------------+ - | Miscanthus | 20.00 | - +--------------------------+-----------------+ - | Switchgrass | 20.00 | - +--------------------------+-----------------+ - 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 846821e3a5..c755200ad6 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -294,7 +294,7 @@ The current state of the atmosphere (:numref:`Table Atmospheric input to land mo :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\ :sub:`y` and NH\ :sub:`x`. The rate is supplied either as a time-varying spatially-varying monthly mean rate fixed for a particular year for control simulations or advancing yearly for transient simulation. This is for the case when CTSM reads it's own datasets, but when coupled to CAM it can also use the Nitrogen deposition calculated or read in by CAM. For the datasets that CTSM uses, Nitrogen deposition rates were calculated from the same CAM chemistry simulation that generated the aerosol deposition rates. -:sup:`5`\ Climatological 3-hourly lightning frequency at :math:`\sim`\ 1.8° 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° lightning frequency data. In future versions of the model, lightning data may be obtained directly from the atmosphere model. +:sup:`5`\ Climatological 3-hourly lightning frequency at :math:`\sim`\ 1.8° resolution is provided, which was calculated via bilinear interpolation from 1995-2011 NASA LIS/OTD grid product v2.2 (https://cmr.earthdata.nasa.gov/search/concepts/C1995863244-GHRC_DAAC.html) 2-hourly, 2.5° 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\ :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\ :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 :math:`e_{atm} =\frac{q_{atm} P_{atm} }{0.622+0.378q_{atm} }`. 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 3b3247bcb9..fb69877849 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -349,7 +349,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:`CN_{target}`) a model parameter (:numref:`Table PFT target leaf CN`), and the existing C:N ratio (:math:`CN_{plant}`) +We first calculate a :math:`\delta_{CN}`, which is the difference between the target C:N (:math:`CN_{target}`) a model parameter (:numref:`Table Allocation and CN ratio parameters`), and the existing C:N ratio (:math:`CN_{plant}`) .. math:: :label: CN_plant 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 0fe347d2b3..d73e002ec2 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -730,24 +730,29 @@ In the case of a vegetated surface, the sensible heat :math:`H` and water vapor 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}` +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_{leaf}` and :math:`H_{stem}`) and the ground (:math:`H_{g}`) .. math:: :label: 5.86 - H=H_{v} +H_{g} + H=H_{leaf}+H_{stem}+H_{g} where, with reference to :numref:`Figure Schematic diagram of sensible heat fluxes`, .. math:: :label: 5.87 - H=-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{s} \right)}{r_{ah} } + H=-\rho _{atm} C_{p} \frac{\left(\theta _{atm}-T_{s} \right)}{r_{ah} } .. math:: :label: 5.88 - H_{v} =-\rho _{atm} C_{p} \left(T_{s} -T_{v} \right)\frac{\left(L+S\right)}{r_{b} } + H_{leaf} =-\rho _{atm} C_{p} \frac{\left(T_{s}-T_{leaf} \right)}{r_{leaf} } + +.. math:: + :label: 5.88b + + H_{stem} =-\rho _{atm} C_{p} \frac{\left(T_{s}-T_{stem} \right)}{r_{stem} } .. math:: :label: 5.89 @@ -759,12 +764,12 @@ where .. math:: :label: 5.90 - H_{soil} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{1} \right)}{r_{ah} ^{{'} } } + H_{soil} =-\rho _{atm} C_{p} \frac{\left(T_{s}-T_{1} \right)}{r_{ah} ^{{'} } } .. math:: :label: 5.91 - H_{sno} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{snl+1} \right)}{r_{ah} ^{{'} } } + H_{sno} =-\rho _{atm} C_{p} \frac{\left(T_{s}-T_{snl+1} \right)}{r_{ah} ^{{'} } } .. math:: :label: 5.92 @@ -773,28 +778,53 @@ where 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`) (: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`). -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 :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`. +Here, :math:`T_{s}` is the surface temperature at height :math:`z_{0h} +d`, also referred to as the canopy air temperature. :math:`T_{leaf}` and :math:`T_{stem}` are the leaf and stem temperatures, :math:`r_{leaf}` and :math:`r_{stem}` are the resistances to sensible heat transfer (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`. + +The leaf resistance is + +.. math:: + :label: 5.92b + + r_{leaf} =\frac{r_{b}}{A_{leaf} } + +where :math:`r_{b}` is the leaf boundary layer resistance (s m\ :sup:`-1`), :math:`A_{leaf} = 2 L` is the (two-sided) surface area of leaves per unit ground area and :math:`L` is the exposed leaf area index (section :numref:`Phenology and vegetation burial by snow`). + +The stem resistance is + +.. math:: + :label: 5.92c + + r_{stem} =\frac{\left(r_{b} + r_{bole}\right)}{A_{stem} } + +where :math:`r_{bole}` is the resistance to heat transfer between the interior of the tree and the tree surface (s m\ :sup:`-1`), and :math:`A_{stem}` is the surface area of stems per unit ground area. + +The stem surface area is + +.. math:: + :label: 5.92d + + A_{stem} =N_{tree} k_{A} \left(\pi D_{bh}\right) h_{tree} + +where :math:`N_{tree}` is the number of trees per m\ :sup:`2`, :math:`k_{A}` is an adjustable parameter to account for the departure of tree area from a cylinder, :math:`D_{bh}` is the mean tree breast-height diameter (m), and :math:`h_{tree}` is the mean tree height (m). .. _Figure Schematic diagram of sensible heat fluxes: .. figure:: image1.png - Figure Schematic diagram of sensible heat fluxes for (a) - non-vegetated surfaces and (b) vegetated surfaces. + 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 Schematic diagram of water vapor fluxes for (a) - non-vegetated surfaces and (b) vegetated surfaces. + Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. Equations :eq:`5.86` - :eq:`5.89` can be solved for the canopy air temperature :math:`T_{s}` .. math:: :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} } + T_{s} =\frac{c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} +c_{leaf}^{h} T_{leaf} +c_{stem}^{h} T_{stem} }{c_{a}^{h} +c_{g}^{h} +c_{leaf}^{h} +c_{stem}^{h} } where @@ -811,24 +841,36 @@ where .. math:: :label: 5.96 - c_{v}^{h} =\frac{\left(L+S\right)}{r_{b} } + c_{leaf}^{h} =\frac{1}{r_{leaf} } -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`). +.. math:: + :label: 5.96b + + c_{stem}^{h} =\frac{1}{r_{stem} } + +are the sensible heat conductances from the canopy air to the atmosphere, the ground to canopy air, the leaf surface to canopy air, and the stem surface to canopy air, respectively (m s\ :sup:`-1`). -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}` +When the expression for :math:`T_{s}` is substituted into equation :eq:`5.88`, the sensible heat flux from leaves :math:`H_{leaf}` is a function of :math:`\theta _{atm}`, :math:`T_{g}`, :math:`T_{leaf}`, and :math:`T_{stem}` .. math:: :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_{leaf} = -\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} +c_{stem}^{h} T_{stem} -\left(c_{a}^{h} +c_{g}^{h} +c_{stem}^{h} \right)T_{leaf} \right]\frac{c_{leaf}^{h} }{c_{a}^{h} +c_{leaf}^{h} +c_{stem}^{h} +c_{g}^{h} } . -Similarly, the expression for :math:`T_{s}` can be substituted into equations :eq:`5.89`, :eq:`5.90`, :eq:`5.91`, and :eq:`5.92` to obtain the sensible heat flux from ground :math:`H_{g}` +Similarly, :math:`T_{s}` can be substituted into equation :eq:`5.88b` to obtain the sensible heat flux from stems :math:`H_{stem}` .. math:: - :label: 5.98 + :label: 5.97b + + H_{stem} = -\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} +c_{leaf}^{h} T_{leaf} -\left(c_{a}^{h} +c_{g}^{h} +c_{leaf}^{h} \right)T_{stem} \right]\frac{c_{stem}^{h} }{c_{a}^{h} +c_{leaf}^{h} +c_{stem}^{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} } . +and :math:`T_{s}` can be substituted into equations :eq:`5.89`, :eq:`5.90`, :eq:`5.91`, and :eq:`5.92` to obtain the sensible heat flux from ground :math:`H_{g}` +.. math:: + :label: 5.98 + + H_{g} = -\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{leaf}^{h} T_{leaf} +c_{stem}^{h} T_{stem}-\left(c_{a}^{h} +c_{leaf}^{h} +c_{stem}^{h} \right)T_{g} \right]\frac{c_{g}^{h} }{c_{a}^{h} +c_{leaf}^{h} +c_{stem}^{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:: @@ -1033,7 +1075,7 @@ The ratio of wind speed at canopy height to friction velocity, :math:`\frac{U_{h .. math:: :label: 5.125b - \frac{U_{h}} {u_{*} } =(C_{S} + \lambda C_{R})^{0.5} \exp(\frac{\min \left(\lambda, \lambda_{\max}\right) c U_{h}} {2 u_{*}}) + \frac{U_{h}} {u_{*} } =(C_{S} + \lambda C_{R})^{0.5} \exp(\frac{\min \left(\lambda, \lambda_{\max}\right) c U_{h}} {2 u_{*} }) where :math:`C_{S}` represents the drag coefficient of the ground in the absence of vegetation, :math:`C_{R}` is the drag coefficient of an isolated roughness element (plant), and :math:`c` is an empirical constant. These three are pft-dependent parameters (:numref:`Table Plant functional type aerodynamic parameters`). :math:`\lambda_{max}` is the maximum :math:`\lambda` above which :math:`\frac{U_{h}} {u_{*}}` becomes constant. :math:`\lambda_{max}` is set to the value of :math:`\lambda` for which :eq:`5.125b`, in the absence of :math:`\lambda_{max}`, would have its minimum. :math:`\lambda_{max}` is also a pft-dependent parameter (:numref:`Table Plant functional type aerodynamic parameters`). :eq:`5.125b` can be written as @@ -1150,57 +1192,141 @@ where :math:`c_{d1} =7.5`. Numerical Implementation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Canopy energy conservation gives +Canopy energy conservation gives the temperature change of the leaves within the canopy .. math:: :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 + \overrightarrow{S}_{leaf} + \overrightarrow{L}_{leaf} \left(T_{leaf} \right) + - H_{leaf} \left(T_{leaf} \right) - \lambda E_{leaf} + \left(T_{leaf} \right) = C_{leaf} \frac{dT_{leaf}}{dt} -where :math:`\overrightarrow{S}_{v}` is the solar radiation absorbed by 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}` (:numref:`Table Physical constants`). +where :math:`\overrightarrow{S}_{leaf}` is the solar radiation absorbed by the leaves (section :numref:`Solar Fluxes`), :math:`\overrightarrow{L}_{leaf}` is the net longwave radiation absorbed by the leaves (section :numref:`Longwave Fluxes`), and :math:`H_{leaf}` and :math:`\lambda E_{leaf}` are the sensible and latent heat fluxes from the leaves, respectively. :math:`C_{leaf}` is the areametric heat capacity of the leaves, and :math:`\lambda` is the latent heat of vaporization :math:`\lambda _{vap}` (:numref:`Table Physical constants`). -: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:`C_{leaf}` (J m\ :sup:`-2` K\ :sup:`-1`) is the sum of the heat capacities of the dry leaves and of the water contained in the leaves multiplied by the dry leaf mass per area .. math:: - :label: 5.129 + :label: 5.128b + + C_{leaf} = \left(c_{dry} + \frac{f_{w}}{1-f_{w}} c_{water}\right) M_{leaf} + +where :math:`M_{leaf} = M_{a} \ L` and :math:`M_{a}` (kg m\ :sup:`-2`) is the leaf mass per leaf area. + +The stem energy balance is described by + +.. math:: + :label: 5.128c + + \begin{array}{lr} + \overrightarrow{S}_{stem} + \overrightarrow{L}_{stem} \left(T_{stem} \right) + - H_{stem} \left(T_{stem} \right) + = C_{stem} \frac{dT_{stem}}{dt} + \end{array} + +where :math:`\overrightarrow{S}_{stem}` is the solar radiation absorbed by the stems, :math:`\overrightarrow{L}_{stem}` is the net longwave radiation absorbed by the stems, :math:`H_{stem}` is the sensible flux from the stems to the canopy air space, and :math:`C_{stem}` is the areametric heat capacity of the stems. - \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} } } +:math:`C_{stem}` (J m\ :sup:`-2` K\ :sup:`-1`) is the sum of the heat capacities of the dry wood and of the water contained in the stems multiplied by the mass of biomass per area -where :math:`\Delta T_{v} =T_{v}^{k+1} -T_{v}^{k}` and the subscript "k" indicates the iteration. +.. math:: + :label: 5.128d + + C_{stem} = \left(c_{dry} + \frac{f_{w}}{1-f_{w}} c_{water}\right) M_{tree} + +where :math:`c_{dry}` (J kg\ :sup:`-1` K\ :sup:`-1`) is the heat capacity of the dry wood, :math:`c_{water}` (J kg\ :sup:`-1` K\ :sup:`-1`) is the heat capacity of water, and :math:`f_{w}` is the assumed fraction of fresh biomass that is water. The tree dry mass per area is calculated as + +.. math:: + :label: 5.128e + + M_{tree} = N_{tree} \ \rho_{wood} \ V_{tree} + +where :math:`\rho_{wood}` (kg m\ :sup:`-3`) is the density of dry wood, :math:`N_{tree}` (m\ :sup:`-2`) is the number of trees per square meter, and :math:`V_{tree}` (m\ :sup:`3`), the individual tree volume, is calculated by assuming that trees are cylindrical + +.. math:: + :label: 5.128f + + V_{tree} = k_{V} \ \pi \left( \frac{D_{bh}}{2} \right)^{2} h_{tree} + +where :math:`D_{bh}` is the mean breast-height diameter and :math:`h_{tree}` is the mean tree height. :math:`k_{V}` is an adjustable parameter to account for the departure of tree volume from a cylinder. + +The radiation absorbed by leaves and stems is assumed to be a constant fraction of the radiation absorbed by the canopy + +.. math:: + :label: 5.128g + + \begin{array}{lr} + \overrightarrow{S}_{leaf} & = & f_{leaf} \ \overrightarrow{S}_{canopy} \\ + \overrightarrow{L}_{leaf} & = & f_{leaf} \ \overrightarrow{L}_{canopy} \\ + \overrightarrow{S}_{stem} & = & f_{stem} \ \overrightarrow{S}_{canopy} \\ + \overrightarrow{L}_{stem} & = & f_{stem} \ \overrightarrow{L}_{canopy} , + \end{array} + +where the stem fraction is + +.. math:: + :label: 5.128h + + f_{stem} = k_{vert} \frac{S}{L + S} , + +where :math:`k_{vert}` is an adjustable parameter to account for the vertical distribution of stem area through the canopy. The leaf fraction is :math:`f_{leaf} = 1 - f_{stem}`. + + +:math:`\overrightarrow{L}_{leaf}`, :math:`H_{leaf}`, and :math:`\lambda E_{leaf}` depend on the vegetation temperature :math:`T_{leaf}`. The Newton-Raphson method for finding roots of non-linear systems of equations can be applied to iteratively solve for :math:`T_{leaf}` as + +.. math:: + :label: 5.129 + + \Delta T_{leaf} =\frac{\overrightarrow{S}_{leaf} -\overrightarrow{L}_{leaf} -H_{leaf} -\lambda E_{leaf} - \frac{C_{leaf}}{dt} (T_{leaf}^{n} - T_{leaf}^{0}) }{\frac{\partial \overrightarrow{L}_{leaf} }{\partial T_{leaf} } +\frac{\partial H_{leaf} }{\partial T_{leaf} } +\frac{\partial \lambda E_{leaf} }{\partial T_{leaf} } +\frac{C_{leaf}}{dt}} + +where :math:`\Delta T_{leaf} =T_{leaf}^{n+1} -T_{leaf}^{n}` and the subscript "n" indicates the iteration. The partial derivatives are .. math:: :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} + \frac{\partial \overrightarrow{L}_{leaf} }{\partial T_{leaf} } =4\varepsilon _{leaf} \sigma \left[2-\varepsilon _{leaf} \left(1-\varepsilon _{g} \right)\right]T_{leaf}^{3} .. math:: :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} } + \frac{\partial H_{leaf} }{\partial T_{leaf} } =\rho _{atm} C_{p} \left(c_{a}^{h} +c_{stem}^{h} +c_{g}^{h} \right)\frac{c_{leaf}^{h} }{c_{a}^{h} +c_{leaf}^{h} +c_{stem}^{h} +c_{g}^{h} } .. math:: :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} } . + \frac{\partial \lambda E_{leaf} }{\partial T_{leaf} } =\lambda \rho _{atm} \left(c_{a}^{w} +c_{g}^{w} \right)\frac{c_{leaf}^{w} }{c_{a}^{w} +c_{leaf}^{w} +c_{g}^{w} } \frac{dq_{sat}^{T_{leaf} } }{dT_{leaf} } . -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 +The partial derivatives :math:`\frac{\partial r_{ah} }{\partial T_{leaf} }` and :math:`\frac{\partial r_{aw} }{\partial T_{leaf} }`, which cannot be determined analytically, are ignored for :math:`\frac{\partial H_{leaf} }{\partial T_{leaf} }` and :math:`\frac{\partial \lambda E_{leaf} }{\partial T_{leaf} }`. 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_{leaf}`, transpiration flux :math:`E_{leaf}^{t}`, and sensible heat flux :math:`H_{leaf}` are updated for changes in leaf temperature as .. math:: :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} } + E_{leaf} =-\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_{leaf} } +\frac{dq_{sat}^{T_{leaf} } }{dT_{leaf} } \Delta T_{leaf} \right)\right]\frac{c_{leaf}^{w} }{c_{a}^{w} +c_{leaf}^{w} +c_{g}^{w} } .. math:: :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} } + E_{leaf}^{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_{leaf} } +\frac{dq_{sat}^{T_{leaf} } }{dT_{leaf} } \Delta T_{leaf} \right)\right]\frac{c_{leaf}^{h} }{c_{a}^{w} +c_{leaf}^{w} +c_{g}^{w} } .. math:: :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} } . + H_{leaf} =-\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_{leaf} +\Delta T_{leaf} \right)\right]\frac{c_{leaf}^{h} }{c_{a}^{h} +c_{leaf}^{h} +c_{g}^{h} } . + +Stem temperature is updated using + +.. math:: + :label: 5.135b + + \Delta T_{stem} =\frac{\overrightarrow{S}_{stem} -\overrightarrow{L}_{stem} -H_{stem} }{\frac{\partial \overrightarrow{L}_{stem} }{\partial T_{stem} } +\frac{C_{stem}}{dt}} . + +The change in biomass heat storage from leaves and stems is + +.. math:: + :label: 5.135c + + H_{canopy} = \frac{C_{leaf} \Delta T_{leaf} + C_{stem} \Delta T_{stem}}{dt} . + The numerical solution for vegetation temperature and the fluxes of momentum, sensible heat, and water vapor flux from vegetated surfaces proceeds as follows: diff --git a/doc/source/tech_note/Fluxes/image1.png b/doc/source/tech_note/Fluxes/image1.png old mode 100755 new mode 100644 index b74d0a0c92..1e3db6a291 --- a/doc/source/tech_note/Fluxes/image1.png +++ b/doc/source/tech_note/Fluxes/image1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e1c868e187fac803a6b051b0148936909d3994bc2e89de2d58bf2c96bcfaef7 -size 9847 +oid sha256:517b729ffa486194b48d5250e4070e04abe255a22d39da6d41cfe71f121042a9 +size 28285 diff --git a/doc/source/tech_note/Fluxes/image1_no_bhs.png b/doc/source/tech_note/Fluxes/image1_no_bhs.png new file mode 100755 index 0000000000..b74d0a0c92 --- /dev/null +++ b/doc/source/tech_note/Fluxes/image1_no_bhs.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/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index 81c017276e..e8a4b81298 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -3,7 +3,7 @@ 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; :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). +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; see the `CISM documentation and user's guide _` for more information). 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). .. _Glaciers summary of CLM5.0 updates relative to CLM4.5: diff --git a/doc/source/tech_note/Hillslope_Hydrology/CLM50_Tech_Note_Hillslope_Hydrology.rst b/doc/source/tech_note/Hillslope_Hydrology/CLM50_Tech_Note_Hillslope_Hydrology.rst new file mode 100644 index 0000000000..848e19aa79 --- /dev/null +++ b/doc/source/tech_note/Hillslope_Hydrology/CLM50_Tech_Note_Hillslope_Hydrology.rst @@ -0,0 +1,58 @@ +.. _rst_Hillslope_Hydrology: + +Hillslope Hydrology +===================== + +CLM is typically operated using a single column to represent the hydrologic state of the vegetated land unit. The CLM 'Hillslope Hydrology' configuration extends the standard configuration by instantiating multiple columns per gridcell, each performing the standard vertical model physics (:ref:`Swenson et al. 2019b`). A set of connected columns in a gridcell is referred to as a hillslope, and lateral runoff fluxes can be passed between hillslope columns. In addition to calculating lateral moisture fluxes, meteorological downscaling is enabled in the hillslope configuration (:numref:`Figure Hillslope Hydrology Schematic`). These processes require a description of the columns' topographic characteristics, which are described by specifying six geomorphic parameters: the column area :math:`A`, the mean column height :math:`h`, the width of the column at its downslope interface :math:`w`, the mean distance of the column from the channel :math:`d`, the mean slope of the column :math:`\alpha`, and the column's aspect (defined with respect to North) :math:`\beta` (:numref:`Figure Hillslope Hydrology Geomorphic Parameters`). A method for estimating the geomorphic parameters from a digital elevation model (DEM) is described by :ref:`Swenson and Lawrence 2025`. + +.. _Figure Hillslope Hydrology Schematic: + +.. Figure:: image1.png + :align: center + + Processes enabled in Hillslope Hydrology: lateral subsurface flow passed between columns, slope/aspect based insolation, elevation-based downscaling. + +.. _Figure Hillslope Hydrology Geomorphic Parameters: + +.. Figure:: image2.png + :align: center + + Hillslope geomorphic parameters specified for each column via input data file. + +Saturated subsurface flow along the hillslope profile is described by Darcy's law + +.. math:: + :label: hh.eqn.1 + + q = - K_{s} \frac{d\Psi}{dx} , + +where :math:`q` is the moisture flux (m\ :sup:`3` m\ :sup:`-2` s\ :sup:`-1`), :math:`K_{s}` is the saturated hydraulic conductivity (m/s), :math:`\Psi` is the hydraulic head (m), and :math:`x` is the distance from the base of the hillslope (m). In unconfined saturated flow, the hydraulic head is the absolute water table height. To calculate the hydraulic head gradient, each column's water table depth :math:`z_{\nabla}` is subtracted from the relative hillslope elevation :math:`h`. + +Each hillslope has a stream channel, whose state variable is described by the volume of water in the channel :math:`V_{stream}`. The stream channel is defined by the bankfull width :math:`W_{channel}` (m) and depth :math:`D_{channel}` (m), which are given by + +.. math:: + :label: hh.eqn.2 + + \begin{array}{l} + W_{channel} = c_{w} A_{hill}^{b_{w}} \\ + D_{channel} = c_{d} A_{hill}^{b_{d}} , + \end{array} + +where :math:`c_{w}` and :math:`c_{d}` are scaling parameters, :math:`A_{hill}` (m\ :sup:`2`) is the total hillslope area, and :math:`b_{w}=0.6` and :math:`b_{d}=0.4` are power law exponents. Channel flow is described by the Manning equation (:ref:`Dingman 2002`). When :math:`V_{stream}` is greater than the bankfull volume, a floodplain described by a constant slope is assumed. + +Downscaling of incoming solar radiation uses topographic slope :math:`\alpha` and aspect :math:`\beta` to redistribute insolation between the gridcell's hillslope columns, while conserving the total energy flux. Incoming direct solar radiation, :math:`S_{gridcell}`, is divided by the gridcell cosine of the solar zenith angle, :math:`cosz_{gridcell}`, then multiplied by the column's cosine of the solar zenith angle, :math:`cosz_{column}`, which is calculated using the column's topographic slope and aspect + +.. math:: + :label: hh.eqn.3 + + S_{column} = S_{gridcell} \frac{cosz_{column}}{cosz_{gridcell}} , + +Other meteorological inputs, e.g. temperature and precipitation, can be adjusted using elevation‐based downscaling. For such variables, the gridcell-level value is modified by an anomaly defined by the lapse rate :math:`\lambda` + +.. math:: + :label: hh.eqn.4 + + X_{column} = X_{gridcell} + \lambda \ \Delta Z_{column} + +where :math:`X` represents a meteorological variable and :math:`\Delta Z_{column}` represents the column elevation anomaly with respect to the gridcell mean elevation. + diff --git a/doc/source/tech_note/Hillslope_Hydrology/image1.png b/doc/source/tech_note/Hillslope_Hydrology/image1.png new file mode 100644 index 0000000000..633d1cbded --- /dev/null +++ b/doc/source/tech_note/Hillslope_Hydrology/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53880cbc2c33c4699b500d84671026159e46901b70b97cec0822d663395e7ada +size 44239 diff --git a/doc/source/tech_note/Hillslope_Hydrology/image2.png b/doc/source/tech_note/Hillslope_Hydrology/image2.png new file mode 100644 index 0000000000..88e224e2c0 --- /dev/null +++ b/doc/source/tech_note/Hillslope_Hydrology/image2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92f6ed79efac07cb130c9a830ab7c8eda8dd23df8337c17cf1965fbe428665d5 +size 44198 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 ac45114a28..c7f9a7bcbd 100644 --- a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst +++ b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst @@ -12,7 +12,7 @@ Mechanistically modeling net surface CH\ :sub:`4` emissions requires representin 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\ :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\ :sub:`4` calculations associated with a changing inundated fraction; performs a mass balance check; and calculates the average gridcell CH\ :sub:`4` production, oxidation, and exchanges with the atmosphere. +The driver routine for the methane biogeochemistry calculations controls the initialization of boundary conditions, inundation, and impact of redox conditions; calls to routines to 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\ :sub:`4` calculations associated with a changing inundated fraction; performs a mass balance check; and calculates the average column CH\ :sub:`4` production, oxidation, and exchanges with the atmosphere. .. _Governing Mass-Balance Relationship: @@ -30,22 +30,21 @@ Here *z* (m) represents the vertical dimension, *t* (s) is time, and *R* account An analogous version of equation :eq:`24.1` is concurrently solved for 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 :eq:`24.1` is solved four times for each gridcell and time step: in the inundated and non-inundated 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\ :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. +As currently implemented, each column contains an inundated and a non-inundated fraction. Therefore, equation :eq:`24.1` is solved four times for each column and time step: in the inundated and non-inundated 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\ :sub:`4` quantity is conserved by adjusting the non-inundated concentration and the inundated concentration when the inundated fraction changes. .. _Figure Methane Schematic: -.. 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. +.. Figure:: image1.png + :align: center + + 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 column and (right) variably saturated portion of a column. .. _CH4 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\ :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\ :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\ :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): +Because CLM does not currently specifically represent wetland plant functional types or soil biogeochemical processes, we used column-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\ :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\ :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 column estimate of heterotrophic respiration from soil and litter (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:`{Q}_{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: 24.2 @@ -54,9 +53,7 @@ Because CLM does not currently specifically represent wetland plant functional t 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 :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°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 (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 :math:`{R}_{H}` is used to estimate CH\ :sub:`4` production. +The prognosed :math:`{R}_{H}` is used to estimate the vertical distribution of CH\ :sub:`4` production. CLM allows heterotrophic respiration below freezing, so :math:`f_{T}` may be nonzero and CH\ :sub:`4` production continues when temperatures are below freezing, although liquid water stress limits decomposition. The base temperature for the :math:`{Q}_{10}` factor, :math:`{T}_{B}`, is 22°C and effectively modified the base :math:`f_{CH_{4}}` value. The factor :math:`f_{pH}` is nominally set to 1, although a static spatial map of *pH* can be used to determine this factor (:ref:`Dunfield et al. 1993`) by applying: @@ -65,7 +62,7 @@ The factor :math:`f_{pH}` is nominally set to 1, although a static spatial map o 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. +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 column. 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\ :sub:`4` production in anoxic microsites above the water table, we apply the Arah and Stephen (1998) estimate of anaerobic fraction: @@ -256,7 +253,8 @@ To simplify the solution, we assumed that gaseous diffusion dominates above the Boundary Conditions ^^^^^^^^^^^^^^^^^^^^^^^^^^ -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 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 :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 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 :math:`{K}_{H}` is the Henry's law equilibrium constant. +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 surface soil layer (for the non-inundated calculation) or in equilibrium with the surface water (for the inundated calculation). In addition to the resolved soil layers, a surface layer is used in the methane module to account for the presence of surface water in the inundated fraction of the column or unsaturated conditions in the non-inundated fraction of the column. The thickness of the surface layer, :math:`\Delta z_{sfc}`, is given by the surface water thickness :math:`W_{sfc}` (in meters) for the inundated calculation or by :math:`3 \ \sigma _{micro} - W_{sfc}` for the non-inundated calculation, where :math:`\sigma _{micro}` is the standard deviation of microtopography :eq:`7.68`. The inclusion of the surface layer ensures that an unsaturated zone exists in the non-inundated fraction of the column even if the top soil layer is saturated. The surface boundary layer conductance, :math:`w`, is 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 :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 :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 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. @@ -321,15 +319,14 @@ and the soil element below the interface: Inundated Fraction Prediction ---------------------------------- - -A simplified dynamic representation of spatial inundation based on recent work by :ref:`Prigent et al. (2007)` is used. :ref:`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) 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 :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 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}`): +When surface water (:math:`W_{sfc}`) is nonzero, the fraction of the land surface that is inundated, :math:`f_{h2osfc}`, is given by equation :eq:`7.67`. For cases in which the prognosed inundated fraction is deemed unrealistic, an observationally based inundated area, :math:`{f}_{s}`, based on work by :ref:`Prigent et al. (2007)` can be used. :ref:`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) 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 :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 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} =fws_{slope} TWS + fws_{intercept} . -These parameters were evaluated at the 0.5° resolution, and aggregated for 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. +These parameters were evaluated at the 0.5° resolution, and aggregated for coarser simulations. .. _Seasonal Inundation: 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 6d79f0c64f..e5191e247c 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -290,7 +290,7 @@ Dai, Y., and Zeng, Q. 1997. A land surface model (IAP94) for climate studies. Pa .. _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]. +Dai, Y., et al. 2001. Common Land Model: Technical documentation and user's guide [Available online at https://journals.ametsoc.org/view/journals/bams/84/8/bams-84-8-1013.xml]. .. _Daietal2003: @@ -406,7 +406,7 @@ Fécan, F., Marticorena, B. and Bergametti, G., 1998, December. Parametrization .. _FeddemaKauffman2016: -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. +Feddema, J., Kauffman, B. 2016. Urban Properties Tool (Version 1.2). NCAR THESIS Tools Library. Retrieved from: https://zenodo.org/records/15501878. doi:10.5065/zrph-dq73 .. _Ferrari1999: @@ -622,7 +622,7 @@ Huang, M., and Liang, X. 2006. On the assessment of the impact of reducing param .. _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/). +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 (https://essd.copernicus.org/articles/5/3/2013/essd-5-3-2013.html). .. _Huntetal1988: @@ -912,10 +912,6 @@ Liang, X., Lettenmaier, D.P., Wood, E.F., and Burges, S.J. 1994. A simple hydrol 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: - -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: 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 @@ -1139,7 +1135,7 @@ Oleson, K.W., et al. 2013. Technical description of version 4.5 of the Community .. _OlesonFeddema2020: -Oleson, K.W., and Feddema, J. 2020. Parameterization and surface data improvements and new capabilities for the Community Land Model Urban (CLMU). JAMES, 12, e2018MS0001586, https://doi.org/10.1029/2018MS001596. +Oleson, K.W., and Feddema, J. 2020. Parameterization and surface data improvements and new capabilities for the Community Land Model Urban (CLMU). JAMES, 12, e2018MS0001586, https://doi.org/10.1029/2018MS001586. .. _Olson1963: @@ -1241,6 +1237,10 @@ Pomeroy, J. W., D. M. Gray, K. R. Shook, B. Toth, R. L. H. Essery, A. Pietroniro 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. +.. _Potosnaketal2014: + +Potosnak, M. J., LeStourgeon, L., Pallardy, S. G., Hosman, K. P., Gu, L., Karl, T., et al. (2014). Observed and modeled ecosystem isoprene fluxes from an oak-dominated temperate forest and the influence of drought stress. Atmospheric Environment, 84, 314–322. http://www.sciencedirect.com/science/article/pii/S1352231013009059 + .. _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. @@ -1530,6 +1530,18 @@ Swenson, S.C., and D. M. Lawrence. 2014. Assessing a dry surface layer-based soi 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. +.. _Swensonetal2019: + +Swenson, S.C., M. Clark, Y. Fan, D.M. Lawrence, and J. Perket. 2019. Representing intra-hillslope lateral subsurface flow in the community land model. JAMES, 11, doi:10.1002/2015WR017582. + +.. _Swensonetal2019b: + +Swenson, S.C., S.P. Burns, and D. M. Lawrence. 2019. The impact of biomass heat storage on the canopy energy balance and atmospheric stability in the community land model. JAMES, 11, https://doi.org/10.1029/2018MS001476. + +.. _SwensonLawrence2025: + +Swenson, S.C., and D. M. Lawrence. 2025. Development of a global representative hillslope data set for use in Earth system modelsA GRACE-based assessment of interannual groundwater dynamics in the Community Land Model. JAMES, 17, https://doi.org/10.1029/2024MS004410. + .. _TaWeiland1992: Ta, C.T. and Weiland, R.T. 1992. Nitrogen partitioning in maize during ear development. Crop Sci. 32:443-451. @@ -1656,7 +1668,7 @@ Vionnet, V., E. Brun, S. Morin, A. Boone, S. Faroux, P. Le Moigne, E. Martin, an .. _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/]. +Viovy, N. 2011. CRUNCEP dataset. [Description available at https://rda.ucar.edu/datasets/d314003/ Data available at https://rda.ucar.edu/datasets/d314003/dataaccess/]. .. _VitousekHowarth1991: @@ -1670,6 +1682,22 @@ Walker, A. P., Beckerman, A. P., Gu, L., Kattge, J., Cernusak, L. A., Domingues, 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. +.. _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. + +.. _Wangetal2022: + +Wang, H., Lu, X., Seco, R., Stavrakou, T., Karl, T., Jiang, X., et al. 2022. Modeling Isoprene Emission Response to Drought and Heatwaves Within MEGAN Using Evapotranspiration Data and by Coupling With the Community Land Model. Journal of Advances in Modeling Earth Systems, 14, e2022MS003174. https://doi.org/10.1029/2022MS003174. + +.. _Wangetal2024a: + +Wang, H., Welch, A., Nagalingam, S., Leong, C., Kittitananuvong, P., Barsanti, K. C., et al. 2024a. Arctic Heatwaves Could Significantly Influence the Isoprene Emissions From Shrubs. Geophysical Research Letters, 51, e2023GL107599. https://doi.org/10.1029/2023GL107599. + +.. _Wangetal2024b: + +Wang, H., Welch, A. M., Nagalingam, S., Leong, C., Czimczik, C. I., Tang, J., et al. 2024b. High temperature sensitivity of Arctic isoprene emissions explained by sedges. Nature Communications, 15(1), 6144. https://doi.org/10.1038/s41467-024-49960-0. + .. _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. @@ -1678,10 +1706,6 @@ Wania, R., Ross, I. and Prentice, I.C. 2009. Integrating peatlands and permafros 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. - .. _weng2014: 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. @@ -1742,6 +1766,10 @@ Xiaodong, Y. and H.H. Shugart, 2005. FAREAST: a forest gap model to simulate dyn 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. +.. _Yangetal1995: + +Yang, Z.-L., R.E. Dickinson, A. Henderson-Sellers, and A.J. Pitman, 1995. Preliminary study of spin-up processes in land surface models with the first stage data of Project for Intercomparison of Land Surface Parameterization Schemes Phase 1(a). J. Geophys. Res. 100:16,553-16,578. + .. _Yang1998: Yang, Z.-L. 1998. Technical note of a 10-layer soil moisture and temperature model. Unpublished manuscript. diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index bff1c31688..61ccae4361 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -47,6 +47,7 @@ CLM Technical Note DGVM/CLM50_Tech_Note_DGVM.rst BVOCs/CLM50_Tech_Note_BVOCs.rst Dust/CLM50_Tech_Note_Dust.rst + Hillslope_Hydrology/CLM50_Tech_Note_Hillslope_Hydrology.rst Isotopes/CLM50_Tech_Note_Isotopes.rst Land-Only_Mode/CLM50_Tech_Note_Land-Only_Mode.rst References/CLM50_Tech_Note_References.rst diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index 7c33071db9..439d764823 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -35,7 +35,7 @@ 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, its history, developers, as well as downloads for previous model versions. Some other links are available at the `CESM2 land component webpage `. There are also documentation text files in the `$CTSMROOT/doc directory `_ that give some quick information on using CLM. +The main `CLM web page `_ contains information on the CLM, its history, developers, as well as downloads for previous model versions. Some other links are available at the `CESM2 land component webpage `. There are also documentation text files in the `$CTSMROOT/doc directory `_ that give some quick information on using CLM. Also note that several of the XML database files can help with namelist options, namelist defaults, or compsets. For the most recent release: @@ -56,7 +56,7 @@ Some archives are available for previous versions: Reporting bugs in |version| ---------------------------- -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. +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. .. _acronyms-and-terms: diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 28cba7917d..1dcf901ff8 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -71,7 +71,7 @@ In :ref:`running-special-cases-section`, again for the expert user, we give deta In the appendices we talk about some issues that are useful for advanced users and developers of |version|. -Finally on Github 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. +Finally on Github 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. .. _readme: diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index a41aacc3ec..1040b25ba0 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -12,7 +12,7 @@ In this section we go over what has been extensively tested and scientifically v 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. +See `https://files.cesm.ucar.edu/models/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. diff --git a/doc/source/users_guide/running-special-cases/Clm60SP_ctsm54030_1deg_CRUJRA2024_arbi_2000_SP_Spinup.png b/doc/source/users_guide/running-special-cases/Clm60SP_ctsm54030_1deg_CRUJRA2024_arbi_2000_SP_Spinup.png new file mode 100644 index 0000000000..0b5718f657 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/Clm60SP_ctsm54030_1deg_CRUJRA2024_arbi_2000_SP_Spinup.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5e40d4c7d804e46c4e0081fb14a373572a80428735b0df44713bd1d1ff3ce41 +size 309672 diff --git a/doc/source/users_guide/running-special-cases/Clm60SP_ctsm54030_1deg_CRUJRA2024_fini_2000_SP_Spinup.png b/doc/source/users_guide/running-special-cases/Clm60SP_ctsm54030_1deg_CRUJRA2024_fini_2000_SP_Spinup.png new file mode 100644 index 0000000000..e133508b89 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/Clm60SP_ctsm54030_1deg_CRUJRA2024_fini_2000_SP_Spinup.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:037bb5e14e492cb2d661b75b1e8dc8baa10ee0019f71365ca6cb70fd7fc3327f +size 301363 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 eb482efdd6..6580860a83 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 @@ -6,20 +6,77 @@ Spinning up the Satellite Phenology Model =========================================== -To spin-up the CLMSP model you merely need to run CLMSP for about 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 :numref:`eg-final-clmbgc-spinup` as an example of doing this as the last step for CLMCN. +The spin-up of a land surface model is generally defined as an adjustment process as the model approaches equilibrium in its state variables (:ref:`Yang et al. 1995`). This is usually accomplished by forcing the model with repeated years of identical atmospheric forcing until the model state at year ``n+1`` is the same as that at year ``n`` within some defined threshold in the state variables. -You can also start from a default initial file that is setup as part of the selected compset. :numref:`Figure SP spinup plot for 1850` shows spinup behavior for an 1850 SP case that loops over one year of coupler history output for atmospheric forcing (generated from the fully coupled model), initialized with an initial file generated from a GSWP3 atmospheric forcing case. Note that it takes less than 10 years for state variables such as FSH (sensible heat flux), EFLX_LH_TOT (latent heat flux), GPP (photosynthesis), H2OSOI (soil water), and TSOI (soil temperature) to reach a specified equilibrium state (denoted by the dotted lines) due to the different atmospheric forcing. TWS (total water storage) may take a bit longer. +To spin-up the CLM60SP model you generally need to run CLM60SP for a few cycles of repeated atmospheric forcing starting from arbitrary initial conditions, the main goal being to ensure that the turbulent fluxes and soil water and temperature have reached equilibrium (minimal trends). You then use the final restart file resulting from that simulation as initial conditions in other simulations. Alternatively, you can also start from an initial file that is typically already provided for you as part of the selected compset. Generally, this will allow for shorter spinup times if your simulation configuration is similar to the one run to generate the default initial file. -.. _Figure SP spinup plot for 1850: +The following steps illustrate how to setup and run a 51 year CLM60SP spinup from arbitrary initial conditions using the ``I2000Clm60SpCrujra`` compset and ``f09_t232`` spatial resolution. From a checkout of the CLM code (choose your own case name): +:: -.. figure:: image1.png + cd cime/scripts + ./create_newcase --case Clm60SP_ctsm54030_1deg_CRUJRA2024_arbi_2000 --compset I2000Clm60SpCrujra --res f09_t232 --run-unsupported --project XX + cd Clm60SP_ctsm54030_1deg_CRUJRA2024_arbi_2000/ + ./case.setup + ./xmlchange CLM_FORCE_COLDSTART=on + ./xmlchange RUN_STARTDATE=0001-01-01 + ./xmlchange DATM_YR_START=1991 + ./xmlchange DATM_YR_END=2000 + ./xmlchange DATM_YR_ALIGN=1 + ./xmlchange STOP_OPTION=nyears + ./xmlchange STOP_N=51 + ./case.build + ./case.submit - 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. +Setting ``CLM_FORCE_COLDSTART=on`` forces the model to use arbitrary initial conditions (see Section :numref:`Initialization` for a description of these initial conditions). This will result in ``finidat=' '`` in the ``lnd_in`` namelist. Spinups are generally started at year 1 (``RUN_STARTDATE=0001-01-01``). Here we've chosen to loop over years 1991-2000 (``DATM_YR_START=1991``, ``DATM_YR_END=2000``) of the atmospheric forcing (10 years total), align model year 1 (``DATM_YR_ALIGN=1``) with the first year of atmospheric forcing, and run for 51 years (``STOP_OPTION=nyears``, ``STOP_N=51``). Ten years of atmospheric forcing was chosen to introduce some interannual variability in the forcing, e.g., to increase the chances of the model being forced by wet and dry years. -:numref:`Figure SP spinup plot for 2000 CO2` shows spinup behavior for the same case but also changes CO2 to present-day conditions (379ppmv). Again, it takes about 10 years to reach equilibrium. +The spinup stability script available in the CLM checkout at ``tools/contrib/SpinupStability_SP_v10.ncl`` can be used to assess the stability or equilibrium of key model variables. Key settings in that script for this example simulation are +:: -.. _Figure SP spinup plot for 2000 CO2: + caseid = "Clm60SP_ctsm54030_1deg_CRUJRA2024_arbi_2000" + subper = 10 -.. figure:: image2.png +The ``subper`` setting tells the script how many years of atmospheric forcing were repeated, thus the equilibrium state of the model in this example is evaluated every 10 years. - 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. +:numref:`Figure CLM60SP spinup plot for arbitrary initial conditions` shows spinup behavior for this simulation. Variables are plotted every 10 years, hence six points (years 1, 11, 21, 31, 41, and 51) are plotted in the leftmost plots for each variable. These include FSH (sensible heat flux), EFLX_LH_TOT (latent heat flux), FPSN (photosynthesis), H2OSOI (soil water at layer 8 which is about 1 meter), TSOI (soil temperature at layer 10 which is about 3 meters), and TWS (total water storage). The speed at which these variables reach a specified equilibrium state (denoted by falling within the dotted lines in the rightmost plots for each variable) varies by variable, TWS generally takes the longest to equilibrium. The plot in the lower left denotes the percent of land area that is not in TWS equilibrium. The contour plots show which grid cells are not in equilibrium for the last two cycles of atmospheric forcing. The equilibrium thresholds are fairly arbitrary for the SP configuration and can be chosen by the user. The current settings are +:: + + glob_thresh_fsh = 0.02 ; global threshold for FSH equilibrium (delta W m-2 / yr) + glob_thresh_lh = 0.02 ; global threshold for EFLX_LH_TOT equilibrium (delta W m-2 / yr) + glob_thresh_gpp = 0.02 ; global threshold for FPSN equilibrium (delta PgC / yr) + glob_thresh_tws = 0.001 ; global threshold for TWS equilibrium (delta m / yr) + glob_thresh_h2osoi = 0.01 ; global threshold for H2OSOI equilibrium (delta mm mm-3 / yr) + glob_thresh_tsoi = 0.02 ; global threshold for TSOI equilibrium (delta K / yr) + glob_thresh_area = 3.0 ; global threshold percent area with TWS disequilibrium gt 0.01 m + +.. _Figure CLM60SP spinup plot for arbitrary initial conditions: + +.. figure:: Clm60SP_ctsm54030_1deg_CRUJRA2024_arbi_2000_SP_Spinup.png + + SP spinup plot for arbitrary initial conditions. 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_v10.ncl``. + +You can also start from a default initial file that is provided as part of the selected compset. The following steps illustrate how to setup and run a 51 year CLM60SP spinup from default initial conditions again using the ``I2000Clm60SpCrujra`` compset and ``f09_t232`` spatial resolution. From a checkout of the CLM code (choose your own case name): +:: + + cd cime/scripts + ./create_newcase --case Clm60SP_ctsm54030_1deg_CRUJRA2024_fini_2000 --compset I2000Clm60SpCrujra --res f09_t232 --run-unsupported --project XX + cd Clm60SP_ctsm54030_1deg_CRUJRA2024_fini_2000/ + ./case.setup + echo "use_init_interp = .true" >> user_nl_clm + ./xmlchange RUN_STARTDATE=0001-01-01 + ./xmlchange DATM_YR_START=1991 + ./xmlchange DATM_YR_END=2000 + ./xmlchange DATM_YR_ALIGN=1 + ./xmlchange STOP_OPTION=nyears + ./xmlchange STOP_N=51 + ./case.build + ./case.submit + +The difference from the previous simulation is that we don't set ``CLM_FORCE_COLDSTART=on`` so that the model uses the default provided initial conditions. In this case, setting ``use_init_interp = .true`` is required because the model configuration used is slightly different from that used to generate the initial file. + +:numref:`Figure CLM60SP spinup plot for default initial conditions` shows spinup behavior for this simulation. Here we can see that equilbrium is reached much sooner because the default initial file is from a spinup where the model configuration was very similar to this one. + +.. _Figure CLM60SP spinup plot for default initial conditions: + +.. figure:: Clm60SP_ctsm54030_1deg_CRUJRA2024_fini_2000_SP_Spinup.png + + SP spinup plot for default initial conditions. 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_v10.ncl``. diff --git a/doc/source/users_guide/running-special-cases/image1.png b/doc/source/users_guide/running-special-cases/image1.png deleted file mode 100644 index fba40ddfa1..0000000000 --- a/doc/source/users_guide/running-special-cases/image1.png +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 79cc812929..0000000000 --- a/doc/source/users_guide/running-special-cases/image2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bf3d0b888e7c442838f1fa4290987b29c4a54f82a49aac7d5070db5e3e5abfe1 -size 320601 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 7b1a4d8ad0..112e8f5a84 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 @@ -6,7 +6,7 @@ Customizing CLM's Configuration ******************************** -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. +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: @@ -18,7 +18,7 @@ When customizing your case at the ``case.setup`` step you are able to modify the 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 CLM script, configuration, build and run items is found under ``$CTSMROOT/cime_config/config_component.xml``. See `CLM CASEROOT Variable Definitions `_. +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 @@ -503,7 +503,7 @@ Like other datasets, if you want to use a given initial condition file to be use 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. The list of DATM settings is `here `_. If you are running a 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 +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. The list of DATM settings is `here `_, although note that the values there are currently out of date. If you are running a 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 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 d92d4e3a3e..91239ee1de 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 Namelist group** (``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. +The `Data Model Documentation `_ gives the details of all the options for the data models and for DATM specifically, although note that the values there are currently out of date. 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: @@ -56,7 +56,7 @@ 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. ``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/ `_. +For more information on CRUNCEP forcing see `https://rda.ucar.edu/datasets/d314003/ `_. .. _clmcruncep-and-its-datm: diff --git a/doc/source/users_guide/testing/testing.rst b/doc/source/users_guide/testing/testing.rst index 8375e97902..0534226f84 100644 --- a/doc/source/users_guide/testing/testing.rst +++ b/doc/source/users_guide/testing/testing.rst @@ -14,7 +14,7 @@ Technically, you could use the customization we gave in :ref:`customizing_sectio 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. 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 derecho with intel and gnu compilers as well as the CGD machine izumi for intel, nag, and pgi compilers. There's also a shorter test list called "clm_short". Also see the `CTSM Wiki on Testing `_. +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. 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 derecho with intel and gnu compilers as well as the CGD machine izumi for intel, nag, and pgi compilers. There's also a shorter test list called "clm_short". Also see the `CTSM Wiki on Testing `_. CTSM Fortran Unit Tests ======================= diff --git a/doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg b/doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg deleted file mode 100644 index 7e2df5ad90..0000000000 --- a/doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index e0f1559cbd..0000000000 --- a/doc/source/users_guide/using-clm-tools/LegendCLMToolDataFlow.jpeg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d71ecdf638e4582f66f1c2b101b6548bd9d47fe2cb3de0f58386048f6ce6cfbc -size 15711 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 deleted file mode 100644 index b0d30d11c7..0000000000 --- a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst +++ /dev/null @@ -1,24 +0,0 @@ -======================== - Building the CLM tools -======================== - -.. include:: ../substitutions.rst - -.. todo:: - Update the below, as domain files aren't needed with nuopc. - -The tools **cprnc** and **gen_domain** use the CIME configure/build system which is described in the next section. - -The only CLM FORTRAN tool is mksurfdata_esmf which has it's own build system that takes advantage of the cime build. - -================================================================ - Building the CLM tools that use the CIME configure/build system -================================================================ - -.. todo:: - Update the below, as domain files aren't needed with nuopc. - -``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 81418877c9..bae6982fd6 100644 --- a/doc/source/users_guide/using-clm-tools/cprnc.rst +++ b/doc/source/users_guide/using-clm-tools/cprnc.rst @@ -20,5 +20,5 @@ Options: -kpr -See the ``cprnc`` `README `_ file for more details. +See the ``cprnc`` `README `_ file for more details. 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 deleted file mode 100644 index 90814e1927..0000000000 --- a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst +++ /dev/null @@ -1,40 +0,0 @@ -.. include:: ../substitutions.rst - -.. _creating-domain-files: - -***************************** - Creating CLM domain files -***************************** - -.. todo:: - Delete this page? Domain files aren't needed with nuopc. - -``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 :ref:`using-mkocnmap`) 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. - -Global Domain file creation -=========================== - -.. _Figure Global-Domain: - -.. 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 :ref:`using-mkocnmap`). Next we create domain files for a single-point or regional domain. - -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 :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 a78aeacb82..0949236164 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 @@ -6,105 +6,10 @@ Creating input for surface dataset generation ********************************************* -Generating SCRIP grid files +Generating ESMF mesh 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. +The ``mksurfdata_esmf`` tool requires ESMF mesh files to describe the input and output grids used for generating fsurdat and landuse files. CLM provides the ``mesh_maker`` tool for generating such files. See section :numref:`how-to-make-mesh` for details. -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. +ESMF mesh files for all the standard model resolutions and the raw surface datasets already exist and the files are in the XML database. Hence, you may skip this step -- UNLESS YOU ARE CREATING YOUR OWN GRIDS. -.. _using-mkocnmap: - -Using mknocnmap.pl to create grid and maps for single-point regional grids --------------------------------------------------------------------------- - -.. todo:: - Update the below, as domain files aren't needed with nuopc. - -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 - 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 :numref:`Figure mknoocnmap.pl` for a visual representation of this process. - -Creating mapping files for mksurfdata_esmf -============================================== - -``mkmapdata.sh`` uses the above SCRIP grid input files to create SCRIP mapping data files (uses ESMF). - -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_esmf``. 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 :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 :numref:`adding-new-resolutions-section`), or leave the files in place and use the ``-res usrspec -usr_gname -usr_gdate`` options to ``mksurfdata_esmf``. ``mkmapdata.sh`` has a help option with the following -:: - - ../../tools/mkmapdata/mkmapdata.sh - - ********************** - usage on derecho:Figure mkmapdata.sh - ./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) - [-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 ' - ********************** - -.. _Figure mkmapdata.sh: - -.. figure:: mkmapdata_details.jpeg - - Details of running mkmapdata.sh - -Each of the raw datasets for ``mksurfdata_esmf`` 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_esmf``. 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_esmf`` see :numref:`Figure Workflow of CLM5 Land Use Data Tool and mksurfdata_esmf Tool`. 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 bb07a7414f..f45afe9ec6 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 @@ -2,59 +2,72 @@ .. _creating-surface-datasets: -=========================== - 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 :numref:`reqd-files-table` 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. +mksurfdata_esmf purpose +----------------------- -.. _Figure Data_Flow: +This tool is intended to generate fsurdat files (surface datasets) and landuse files for the CTSM. It can generate global, regional, and single-point fsurdat files, as long as a mesh file is available for the grid. -.. figure:: mkmapdata_mksurfdata.jpeg +The subset_data tool allows users to make fsurdat files from existing fsurdat files when a mesh file is unavailable. Generally, users are encouraged to use the subset_data tool for generating regional and single-point fsurdat files. - Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files +Build Requirements +------------------ -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_esmf`` how to map between the output grid and the raw datasets that it uses as input. The output of ``mksurfdata_esmf`` is a surface dataset that you then use for running the model. See :numref:`Figure Workflow of CLM5 Land Use Data Tool and mksurfdata_esmf Tool` for a more detailed view of how ``mksurfdata_esmf`` works. +mksurfdata_esmf is a distributed memory parallel program (using Message Passing Interface -- MPI) that utilizes both ESMF (Earth System Modelling Framework) for regridding as well as PIO (Parallel I/O) and NetCDF output. As such, libraries must be built for the following: -: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` and :numref:`Figure mknoocnmap.pl`). +1. MPI +2. NetCDF +3. PIO +4. ESMF -.. _Figure Data_Flow_Legend: +In addition for the build: python, bash-shell, CMake and GNU-Make are required -.. figure:: LegendCLMToolDataFlow.jpeg +These libraries need to be built such that they can all work together in the same executable. Hence, the above order may be required in building them. - Legend for Data Flow Figures +CTSM submodules cime and ccs_config are required, and we will show how these come in. A python environment that includes particular packages is also required. We demonstrate how to use the ctsm_pylib environment that we support in CTSM. -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. +Note, PNETCDF is an optional library that can be used, but is NOT required. -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_esmf`` is run to create the surface dataset to run the model. +.. rubric:: Use cime to manage the build requirements -Creating a Complete Set of Files for Input to CLM -------------------------------------------------- +.. important:: -1. Create SCRIP grid datasets (if NOT already done) + CURRENTLY WORKS ONLY ON DERECHO IN CTSM (not CESM) CHECKOUTS - 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. +For users working on cime machines you can use the build script to build the tool. On other machines you'll need to do a port to cime and tell how to build for that machine. That's talked about in the cime documentation. And you'll have to make some modifications to the build script. -.. todo:: - Update the below, as domain files aren't needed with nuopc. +https://github.com/ESMCI/cime/wiki/Porting-Overview -2. Create domain dataset (if NOT already done) +Machines that already run CTSM or CESM have been ported to cime. So if you can run the model on your machine, you will be able to build the tool there. - 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. +To get a list of the machines that have been ported to cime: -3. Create mapping files for ``mksurfdata_esmf`` (if NOT already done) +.. code-block:: - Create mapping files for ``mksurfdata_esmf`` with ``mkmapdata.sh`` in ``$CTSMROOT/tools/mkmapdata``. See the Section called Creating mapping files that ``mksurfdata_esmf`` will use for more information on this. + # Assuming pwd is your CTSM or CESM checkout + cd cime/scripts + ./query_config --machines -4. Create surface datasets +.. note:: - Next use ``mksurfdata_esmf`` 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_esmf`` to create surface datasets from grid datasets for more information on this. + In addition to having a port to cime, the machine also needs to have PIO built and able to be referenced with the env variable PIO which will need to be in the porting instructions for the machine. An independent PIO library is available on supported CESM machines. -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. +.. important:: -The ``$CTSMROOT/tools/README.md`` goes through the complete process for creating input files needed to run CLM. We repeat that file here: + Currently we have run and tested mksurfdata_esmf on Derecho. Please see this github issue about mksurfdata_esmf on other CESM machines: + +https://github.com/ESCOMP/CTSM/issues/2341 + +The complete process +-------------------- + +If you have read the previous section, you are ready to proceed. The ``$CTSMROOT/tools/README.md`` goes through the complete process for creating input files needed to run CLM. The ``$CTSMROOT/tools/mksurfdata_esmf/README.md`` specifically goes through the complete process of generating surface and landuse datasets. We repeat those files here: .. include:: ../../../../tools/README.md :code: markdown +.. include:: ../../../../tools/mksurfdata_esmf/README.md + :code: markdown + diff --git a/doc/source/users_guide/using-clm-tools/index.rst b/doc/source/users_guide/using-clm-tools/index.rst index b721b3e7d6..53e904b6c4 100644 --- a/doc/source/users_guide/using-clm-tools/index.rst +++ b/doc/source/users_guide/using-clm-tools/index.rst @@ -15,11 +15,9 @@ Using CLM tools :maxdepth: 2 what-are-the-clm-tools.rst - building-the-clm-tools.rst using-ctsm-pylib.rst creating-input-for-surface-dataset-generation.rst creating-surface-datasets.rst - creating-domain-files.rst observational-sites-datasets.rst cprnc.rst paramfile-tools.md diff --git a/doc/source/users_guide/using-clm-tools/mkmapdata_details.jpeg b/doc/source/users_guide/using-clm-tools/mkmapdata_details.jpeg deleted file mode 100644 index b8d33578b8..0000000000 --- a/doc/source/users_guide/using-clm-tools/mkmapdata_details.jpeg +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 7e59cee7f3..0000000000 --- a/doc/source/users_guide/using-clm-tools/mkmapdata_mksurfdata.jpeg +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 308fde0e1c..0000000000 --- a/doc/source/users_guide/using-clm-tools/mknoocnmap.jpeg +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 9d6e829891..0000000000 --- a/doc/source/users_guide/using-clm-tools/mksurfdata_details.jpeg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:32104479195bd2612b09df1322b97c5b2db220d8d0115e32e6020e17ade597e0 -size 41837 diff --git a/doc/source/users_guide/using-clm-tools/using-ctsm-pylib.rst b/doc/source/users_guide/using-clm-tools/using-ctsm-pylib.rst index da4ba0eb05..8975556596 100644 --- a/doc/source/users_guide/using-clm-tools/using-ctsm-pylib.rst +++ b/doc/source/users_guide/using-clm-tools/using-ctsm-pylib.rst @@ -12,3 +12,5 @@ Many of our Python-based tools require non-standard Python modules to be install ./py_env_create and that script will install the ``ctsm_pylib`` environment for you. If ``ctsm_pylib`` already exists, it will give you options on how to handle that. + +As CTSM Python tools continue to be developed, they may evolve to require an updated version of ``ctsm_pylib``. If you encounter "Module not found" errors, you may need to run ``py_env_create`` again; for a given CTSM commit (version), this will always install what's needed to run all the CTSM Python tools in that commmit. 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 27c7c8efe4..ce721ebbef 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 @@ -6,27 +6,13 @@ What are the CLM tools ======================== -.. todo:: - Remove references to mkprocdata_map? - 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 ``$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 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. ``./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). - -#. ``mksurfdata_esmf`` to create surface datasets from grid datasets (clm4_0 and |version| versions). - -.. todo:: - Update the below, as domain files aren't needed with nuopc. - -#. *$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/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. +1. ``mksurfdata_esmf`` to create surface datasets from gridded datasets that we refer to as raw datasets (ctsm5_2 and newer versions). #. ``$CIMEROOT/tools/cprnc`` to compare two NetCDF files. @@ -40,21 +26,9 @@ In the following sections, we will outline how to make these files available for Running FORTRAN tools with namelists ------------------------------------ -``mksurfdata_esmf`` 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: -:: +``mksurfdata_esmf`` runs with a namelist that is read from standard input. First you create a namelist, then you create a jobscript that runs mksurfdata_esmf by redirecting the namelist file into standard input as follows:: ./program < namelist -**mksurfdata_esmf** also has a script that creates the namelist and runs the program for you. The namelist values are also documented along with the other namelists in the: -:: - - $CTSMROOT/tools/mksurfdata_esmf/gen_mksurfdata_namelist.xml`` file - ------------------------------------------------ -Running FORTRAN tools with command line options ------------------------------------------------ - -.. todo:: - Update the below, as domain files aren't needed with nuopc. +There is a tool that generates the namelist called ``$CTSMROOT/tools/mksurfdata_esmf/gen_mksurfdata_namelist.py``. The namelist contains information gathered from the file ``$CTSMROOT/tools/mksurfdata_esmf/gen_mksurfdata_namelist.xml``. There is also a tool that generates a jobscript for running, and this is called ``$CTSMROOT/tools/mksurfdata_esmf/gen_mksurfdata_jobscript_single.py``. -**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. diff --git a/doc/source/users_guide/working-with-documentation/building-docs-multiple-versions.rst b/doc/source/users_guide/working-with-documentation/building-docs-multiple-versions.rst index bc28dfd891..e8a3e2f4df 100644 --- a/doc/source/users_guide/working-with-documentation/building-docs-multiple-versions.rst +++ b/doc/source/users_guide/working-with-documentation/building-docs-multiple-versions.rst @@ -26,4 +26,4 @@ How this works For each member of ``VERSION_LIST``, ``build_docs_to_publish`` checks out its ``ref``, then builds the documentation in a build directory. (``LATEST_REF`` is set because some files, folders, and submodules are important for how the build works and need to stay the same for each build.) Once the build is complete, ``build_docs_to_publish`` should reset your local repo copy (CTSM clone) to how it was before you called ``build_docs_to_publish``. -Next, ``build_docs_to_publish`` moves the HTML files from the build directory to the publish directory. The publish directory has a structure that matches the paths in the version dropdown menu's links. If a member of ``VERSION_LIST`` has ``landing_version=True``, its HTML will be at the top level. That makes it simple for people to find the default version of the docs at https://escomp.github.io/CTSM, rather than having to drill down further into something like ``https://escomp.github.io/CTSM/versions/latest``. +Next, ``build_docs_to_publish`` moves the HTML files from the build directory to the publish directory. The publish directory has a structure that matches the paths in the version dropdown menu's links. If a member of ``VERSION_LIST`` has ``landing_version=True``, its HTML will be at the top level. That makes it simple for people to find the default version of the docs at https://escomp.github.io/CTSM, rather than having to search for the latest version. diff --git a/python/ctsm/test/test_sys_mesh_modifier.py b/python/ctsm/test/test_sys_mesh_modifier.py index 69ec8afdac..b28a77e7a5 100755 --- a/python/ctsm/test/test_sys_mesh_modifier.py +++ b/python/ctsm/test/test_sys_mesh_modifier.py @@ -81,7 +81,7 @@ def createScripGridAndMask(self, fsurdat_in): # The mask will be idnetically 1, no matter the input grid (you can, change it, but you have to get it from a mapping file) # Since, the mask is going to be changed later, it's fine that the mask at this point is identically 1. - # This could also alturnatively be done, by using the stored SCRIP grid file for the resolution under CESM inputdata + # This could also alternatively be done, by using the stored SCRIP grid file for the resolution under CESM inputdata ncks_cmd = ( f"ncks --rgr infer --rgr scrip={self.scrip_file} {fsurdat_in} {self.metadata_file}" ) diff --git a/tools/README.md b/tools/README.md index 3e74fd6f3e..29c8ce48f6 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,5 +1,5 @@ # CTSM Tools for Preprocessing of Input Datasets or Postprocessing of History Output -#### $CTSMROOT/tools/README +#### $CTSMROOT/tools/README.md CTSM tools for analysis of CTSM history files -- or for creation or modification of CTSM input files. @@ -11,8 +11,6 @@ I. General directory structure: crop_calendars --- Regrid and process GGCMI sowing and harvest date files for use in CTSM. - mkmapgrids ------- Create regular lat/lon SCRIP grid files - site_and_regional Scripts for handling input datasets for site and regional cases. These scripts both help with creation of datasets using the standard process as well as subsetting existing datasets and overwriting @@ -37,7 +35,7 @@ II. Notes on building/running for each of the above tools: mkmapgrids and site_and_regional only contain scripts that do not need build files. - Some tools have copies of files from other directories -- see the README.filecopies + Some tools have copies of files from other directories -- see the README.filecopies.md file for more information on this. Tools may also have files with the directory name followed by namelist to provide sample namelists. @@ -45,7 +43,7 @@ II. Notes on building/running for each of the above tools: .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. + README.testing.md) file. > [!NOTE] > Be sure to change the path of the datasets referenced by these namelists to diff --git a/tools/contrib/README.md b/tools/contrib/README.md index c53f807ffe..d7a4c55ebb 100644 --- a/tools/contrib/README.md +++ b/tools/contrib/README.md @@ -21,8 +21,6 @@ abm_raw.ncl add_tillage_to_paramsfile.py Add tillage data to the parameter file Can this be deleted since we have modify paramfile scripts? EBK 3/12/2026 -create_scrip_file.ncl - Create a SCRIP grid file needed for running with WRF CRUJRA_antarctica.ipynb Jupyter notebook to add forcing data over Antarctica for the CRUJRA forcing CRUJRA_greenland.ipynb diff --git a/tools/contrib/create_scrip_file.ncl b/tools/contrib/create_scrip_file.ncl deleted file mode 100644 index c2d911743b..0000000000 --- a/tools/contrib/create_scrip_file.ncl +++ /dev/null @@ -1,58 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" -begin - -nums = (/"00","01","02","03","04","05","06","07","08","09", \ - "10","11","12","13","14","15","16","17","18","19", \ - "20","21","22","23","24","25","26","27","28","29", \ - "30","31","32","33","34","35","36","37","38","39"/) - -;************************************************ -; get WRF fields -;************************************************ - -;change this to point to the relevant geo_em file. -wrf_file = addfile("geo_em.d01.nc", "r") - - -lat2d = wrf_file->XLAT_M(0,:,:) -lon2d = wrf_file->XLONG_M(0,:,:) -lon2d = where(lon2d.lt.0, lon2d+360.0, lon2d) -landmask = wrf_file->LANDMASK(0,:,:) - -ns_corner_lat = wrf_file->XLAT_V(0,:,:) -ns_corner_lon = wrf_file->XLONG_U(0,:,:) -ew_corner_lat = wrf_file->XLAT_U(0,:,:) -ew_corner_lon = wrf_file->XLONG_U(0,:,:) - -print(lat2d(0,0)) -print(lon2d(0,0)) - -print(ns_corner_lat(0:1,0:1)) -print(ns_corner_lon(0:1,0:1)) -print(ew_corner_lat(0:1,0:1)) -print(ew_corner_lon(0:1,0:1)) - -opt = True -opt@GridMask = landmask -opt@ForceOverwrite = True - -curvilinear_to_SCRIP("wrf2clm_land.nc",lat2d,lon2d,opt) - -opt@GridMask = where(landmask.eq.0,1,0) -curvilinear_to_SCRIP("wrf2clm_ocean.nc",lat2d,lon2d,opt) - -infile = addfile("wrf2clm_land.nc","r") - -lat1d = infile->grid_center_lat -lon1d = infile->grid_center_lon - -lat1dc = infile->grid_corner_lat -lon1dc = infile->grid_corner_lon - -print(lat1d(0)) -print(lon1d(0)) -print(lat1dc(0,:)) -print(lon1dc(0,:)) - -end diff --git a/tools/mkmapgrids/README.md b/tools/mkmapgrids/README.md deleted file mode 100644 index 2b455ae289..0000000000 --- a/tools/mkmapgrids/README.md +++ /dev/null @@ -1,24 +0,0 @@ -$CTSMROOT/tools/mkmapgrids/README June08/2018 - -NCL script to create a SCRIP grid file for a regular lat/lon grid. - -To use the script, set the following environment variables: - -Required (or defaults to a single point over Boulder Colorado): -``` -PTNAME ! name of your grid -S_LAT ! Southern latitude corner -N_LAT ! Northern latitude corner -E_LON ! Eastern longitude corner -W_LON ! Western longitude corner -``` - -Optional: -``` -NX ! Number of grid points along longitude (default 1) -NY ! Number of grid points along latitude (default 1) -IMASK ! 0 or 1, mask to use if all points are active or not (default active) -PRINT ! TRUE/FALSE do extra verbose printing or not (default FALSE) -GRIDFILE ! Output filename -``` - diff --git a/tools/mkmapgrids/mkscripgrid.ncl b/tools/mkmapgrids/mkscripgrid.ncl deleted file mode 100644 index 0cbd1a8960..0000000000 --- a/tools/mkmapgrids/mkscripgrid.ncl +++ /dev/null @@ -1,188 +0,0 @@ -; -; mkscripgrid.ncl -; -; Create SCRIP grid and mapping file for a land-only point or region. -; Requires NCL 6.1.0 or later for the ESMF regridding functions -; -; Erik Kluzek -; Dec/07/2011 -; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" -begin - ; =========================================================================================================== - ; Set a few constants needed later - cdate = systemfunc( "date +%y%m%d" ); - ldate = systemfunc( "date" ); - ; - ; IMPORTANT NOTE: EDIT THE FOLLOWING TO CUSTOMIZE or use ENV VARIABLE SETTINGS - ; Edit the following as needed to interpolate to a new resolution. - ; - ; Input resolution and position - ; - name = getenv("PTNAME"); ; Get name of this point - - latS = stringtodouble( getenv("S_LAT") ); ; Get south latitude from env variable - latN = stringtodouble( getenv("N_LAT") ); ; Get north latitude from env variable - lonE = stringtodouble( getenv("E_LON") ); ; Get east longitude from env variable - lonW = stringtodouble( getenv("W_LON") ); ; Get west longitude from env variable - - nx = stringtointeger( getenv("NX" ) ); ; Get number of grids along longitude lines - ny = stringtointeger( getenv("NY" ) ); ; Get number of grids along latitude lines - - imask = stringtointeger( getenv("IMASK") ); ; Get imask to use from env variable - - print_str = getenv("PRINT"); ; Do Extra printing for debugging - - 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 - if ( ismissing(ny) )then - ny = 1; - end if - if ( ismissing(imask) )then - imask = 1; - end if - if ( ismissing(name) )then - name = nx+"x"+ny+"pt_US-UMB"; - end if - if ( ismissing(latS) )then - latS = 45.5098; - end if - if ( ismissing(latN) )then - latN = 45.6098; - end if - if ( ismissing(lonW) )then - lonW = 275.2362; - end if - if ( ismissing(lonE) )then - lonE = 275.3362; - end if - if ( ismissing(print_str) )then - printn = False; - else - if ( print_str .eq. "TRUE" )then - printn = True; - else - printn = False; - end if - end if - - if ( ismissing(outfilename) )then - if ( imask .eq. 1 )then - outfilename = "SCRIPgrid_"+name+"_nomask_c"+cdate+".nc"; - else - if ( imask .eq. 0 )then - outfilename = "SCRIPgrid_"+name+"_noocean_c"+cdate+".nc"; - else - outfilename = "SCRIPgrid_"+name+"_mask_c"+cdate+".nc"; - end if - 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 ); - end if - -function fspan1up( fbegin [*]:double, fend [*]:double, number:integer ) -; -; An "fspan" that can handle size of 1 and up. -; Do fspan for arrays of two or more, or average of end points for array of one. -; -local farray; -begin - if ( number .eq. 1) then - farray = (/ (fbegin + fend) / 2.0d00 /); - else - farray = fspan( fbegin, fend, number ); - end if - return( farray ); -end - - ; - ; Compute derived quantities - ; - - delX = (lonE - lonW) / int2dble(nx); - delY = (latN - latS) / int2dble(ny); - - lonCenters = fspan1up( (lonW + delX/2.d0), (lonE - delX/2.d0), nx) - latCenters = fspan1up( (latS + delY/2.d0), (latN - delY/2.d0), ny) - 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; - 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; - latCorners(:,i,3) = latCenters + delY/2.d0; - end if - end do - do j = 0, ny-1 - lon(j,:) = lonCenters; - 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; - 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 - Mask2D = new( (/ny,nx/), "integer", "No_FillValue" ) - Mask2D(:,:) = imask - gridSize = delX+"x"+delY - - ; - ; Create SCRIP grid file - ; - - Opt = True - Opt@Mask2D = Mask2D - if ( (nx .eq. 1) .or. (ny .eq. 1) )then - Opt@GridCornerLat = latCorners - Opt@GridCornerLon = lonCorners - end if - Opt@Title = "SCRIP grid file for "+name - if (printn) then - Opt@Debug = True - end if - curvilinear_to_SCRIP(outfilename, lat, lon, Opt) - - ; - ; Add global attributes to file - ; - - nc = addfile( outfilename, "w" ); - nc@history = ldate+": create using mkscripgrid.ncl"; - nc@comment = "Ocean is assumed to be non-existant in this region"; - nc@Version = gitdescribe; - if ( printn )then - print( "================================================================================================" ); - print( "Successfully created SCRIP grid file: "+outfilename); - end if - - ; =========================================================================================================== - -end diff --git a/tools/mksurfdata_esmf/README.md b/tools/mksurfdata_esmf/README.md index 95064a9839..5182f03b2d 100644 --- a/tools/mksurfdata_esmf/README.md +++ b/tools/mksurfdata_esmf/README.md @@ -1,89 +1,13 @@ # Instructions for Using mksurfdata_esmf to Create Surface Datasets +#### $CTSMROOT/tools/mksurfdata_esmf/README.md ## Table of contents -1. [Purpose](#purpose) -1. [Building](#building) -1. [Running a Single Submission](#running-for-a-single-submission) -1. [Running for Multiple Datasets](#running-for-the-generation-of-multiple-datasets) -1. [Notes](#notes) - - -## Purpose - -This tool is intended to generate fsurdat files (surface datasets) for the -CTSM. It can generate global, regional, and single-point fsurdat files, as long -as a mesh file is available for the grid. - -The subset_data tool allows users to make fsurdat files from existing fsurdat -files when a mesh file is unavailable. Generally, users should consider the -subset_data tool for generating regional and single-point fsurdat files. - - -## Building - - - -### Build Requirements - - -mksurfdata_esmf is a distributed memory parallel program (using Message Passing -Interface -- MPI) that utilizes both ESMF (Earth System Modelling Framework) -for regridding as well as PIO (Parallel I/O) and NetCDF output. As -such, libraries must be built for the following: - -1. MPI -2. NetCDF -3. PIO -4. ESMF - -In addition for the build: python, bash-shell, CMake and GNU-Make are required - -These libraries need to be built such that they can all work together in the -same executable. Hence, the above order may be required in building them. - -CTSM submodules that are required are: cime and ccs_config. See [Building](#building-the-executable) on getting -those. A python environment that includes particular packages is also required -we demonstrate how to use the ctsm_pylib environment that we support in CTSM. - -Note, PNETCDF is an optional library that can be used, but is NOT required. - -#### Use cime to manage the build requirements - -See [IMPORTANT NOTE](important note-only-working-on-derecho-currently) - -For users working on cime machines you can use the build script to build the -tool. On other machines you'll need to do a port to cime and tell how to build -for that machine. That's talked about in the cime documentation. -And you'll have to make some modifications to the build script. - -https://github.com/ESMCI/cime/wiki/Porting-Overview - -Machines that already run CTSM or CESM have been ported to cime. So if you can -run the model on your machine, you will be able to build the tool there. - -To get a list of the machines that have been ported to cime: - -``` shell -# Assuming pwd is the tools/mksurfdata_esmf directory -cd ../../cime/scripts # or ../../../../cime/scripts for a CESM checkout -./query_config --machines -``` - -#### NOTE: -In addition to having a port to cime, the machine also needs to have PIO built -and able to be referenced with the env variable PIO which will need to be in -the porting instructions for the machine. An independent PIO library -is available on supported CESM machines. - - -#### IMPORTANT NOTE: ONLY WORKING ON DERECHO CURRENTLY - - - -> [!IMPORTANT] -> Currently we have run and tested mksurfdata_esmf on Derecho. Please see this github issue about mksurfdata_esmf on other CESM machines: - -https://github.com/ESCOMP/CTSM/issues/2341 +1. Purpose NOW IN THE USER'S GUIDE https://escomp.github.io/CTSM/users_guide/using-clm-tools/creating-surface-datasets.html#mksurfdata-esmf-purpose +2. Build Requirements NOW IN THE USER'S GUIDE https://escomp.github.io/CTSM/users_guide/using-clm-tools/creating-surface-datasets.html#build-requirements +3. [Building the executable](#building-the-executable) +4. [Running a Single Submission](#running-for-a-single-submission) +5. [Running for Multiple Datasets](#running-for-the-generation-of-multiple-datasets) +6. [Notes](#notes) ### Building the executable @@ -217,4 +141,3 @@ ncks --mk_rec_dmn time file_with_time_equals_12.nc -o file_with_time_unlimited.n In general we recommend using subset_data and/or fsurdat_modifier for regional grids. - diff --git a/tools/site_and_regional/README.md b/tools/site_and_regional/README.md index e2ec7cda95..56f0ff451c 100644 --- a/tools/site_and_regional/README.md +++ b/tools/site_and_regional/README.md @@ -51,14 +51,3 @@ neon_gcs_upload Script to rename and upload NEON site finidat files to NEON server for use in transient startup cases -## DEPRECATED SCRIPTS: - -mknoocnmap.pl - Script to create unity mapping dataset for single-point - or regional studies over land-only (no ocean). - -NCL Scripts available: - -mkunitymap.ncl - NCL script to create a unity map -- ran by above script (mknoocnmap.pl) - diff --git a/tools/site_and_regional/mknoocnmap.pl b/tools/site_and_regional/mknoocnmap.pl deleted file mode 100755 index 5438c8bcd3..0000000000 --- a/tools/site_and_regional/mknoocnmap.pl +++ /dev/null @@ -1,302 +0,0 @@ -#!/usr/bin/env perl -# -# mknoocnmap.pl Erik Kluzek -# Dec/07/2011 -# -# Create SCRIP grid and mapping files for a single-point or region -# that is assumed to be a land land-only region. -# -use Cwd; -use strict; -use English; -use IO::File; -use Getopt::Long; - -# -# Global constants -# -my $degsiz = 0.1; - -#----------------------------------------------------------------------------------------------- -# Set the directory that contains this 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 $scrdir; # absolute pathname of directory that contains this script -my $nm = "${ProgName}::"; # name to use if script dies -if ($ProgDir) { - $scrdir = absolute_path($ProgDir); -} else { - $scrdir = $cwd; -} - - -#----------------------------------------------------------------------------------------------- - -sub usage { - die < 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 $degsiz) - -dy Size of total grid in degrees in latitude direction - (default is $degsiz) - -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) -EOF -} - -#----------------------------------------------------------------------------------------------- - -sub get_latlon { -# -# Return the latitude and longitude of the input string and validate it -# - my $string = shift; - my $desc = shift; - my $dx = shift; - my $dy = shift; - - my $lat = undef; - my $lon = undef; - my $valreal1 = "[+-]?[0-9]*\.?[0-9]*[EedDqQ]?[0-9+-]*"; - - if ( $string =~ /^($valreal1)\s*,\s*($valreal1)$/ ) { - $lat = $1; - $lon = $2; - } else { - die <<"EOF"; -** $ProgName - Error in entering latitude/longitude for $desc ** -EOF - } - if ( $dx <= 0.0 || $dx > 360. ) { - die <<"EOF"; -** $ProgName - Bad value for dx (=$dx) for $desc ** - } - if ( $dy <= 0.0 || $dy > 180. ) { - die <<"EOF"; -** $ProgName - Bad value for dy (=$dy) for $desc ** - } - if ( ($lat < -90.+$dy/2.0) || ($lat > 90.0-$dy/2.0) ) { - die <<"EOF"; -** $ProgName - Bad value for latitude (=$lat) for $desc ** -EOF - } - if ( ($lon < $dx/2.0) || ($lon > 360.0-$dx/2.0) ) { - die <<"EOF"; -** $ProgName - Bad value for longitude (=$lat) for $desc ** -EOF - } - return( $lat, $lon ); - -} - -#------------------------------------------------------------------------------- - -sub absolute_path { -# -# Convert a pathname into an absolute pathname, expanding any . or .. characters. -# Assumes pathnames refer to a local filesystem. -# Assumes the directory separator is "/". -# - my $path = shift; - my $cwd = getcwd(); # current working directory - my $abspath; # resulting absolute pathname - -# Strip off any leading or trailing whitespace. (This pattern won't match if -# there's embedded whitespace. - $path =~ s!^\s*(\S*)\s*$!$1!; - -# Convert relative to absolute path. - - if ($path =~ m!^\.$!) { # path is "." - return $cwd; - } elsif ($path =~ m!^\./!) { # path starts with "./" - $path =~ s!^\.!$cwd!; - } elsif ($path =~ m!^\.\.$!) { # path is ".." - $path = "$cwd/.."; - } elsif ($path =~ m!^\.\./!) { # path starts with "../" - $path = "$cwd/$path"; - } elsif ($path =~ m!^[^/]!) { # path starts with non-slash character - $path = "$cwd/$path"; - } - - my ($dir, @dirs2); - my @dirs = split "/", $path, -1; # The -1 prevents split from stripping trailing nulls - # This enables correct processing of the input "/". - - # Remove any "" that are not leading. - for (my $i=0; $i<=$#dirs; ++$i) { - if ($i == 0 or $dirs[$i] ne "") { - push @dirs2, $dirs[$i]; - } - } - @dirs = (); - - # Remove any "." - foreach $dir (@dirs2) { - unless ($dir eq ".") { - push @dirs, $dir; - } - } - @dirs2 = (); - - # Remove the "subdir/.." parts. - foreach $dir (@dirs) { - if ( $dir !~ /^\.\.$/ ) { - push @dirs2, $dir; - } else { - pop @dirs2; # remove previous dir when current dir is .. - } - } - if ($#dirs2 == 0 and $dirs2[0] eq "") { return "/"; } - $abspath = join '/', @dirs2; - return( $abspath ); -} - -#------------------------------------------------------------------------------- - -# Process command-line options - -my %opts = ( - ctr => undef, - help => undef, - name => undef, - nx => 1, - ny => 1, - dx => $degsiz, - dy => $degsiz, - silent => 0, - verbose => 0, - ); - -GetOptions( - "p|centerpoint=s" => \$opts{'ctr'}, - "n|name=s" => \$opts{'name'}, - "nx=i" => \$opts{'nx'}, - "ny=i" => \$opts{'ny'}, - "dx=f" => \$opts{'dx'}, - "dy=f" => \$opts{'dy'}, - "h|help" => \$opts{'help'}, - "s|silent" => \$opts{'silent'}, - "v|verbose" => \$opts{'verbose'}, -) or usage(); - -# Check for unparsed arguments -if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); -} - -if ( $opts{'verbose'} && $opts{'silent'} ) { - print "ERROR: Can NOT set both silent and verbose at once!\n"; - usage(); -} -my $printlev; -if ( $opts{'verbose'} ) { - $printlev = 2; -} elsif ( $opts{'silent'} ) { - $printlev = 0; -} else { - $printlev = 1; -} - -if ( ! defined($opts{'ctr'}) ) { - print "ERROR: MUST set the center point\n"; - usage(); -} -if ( ! defined($opts{'name'}) ) { - print "ERROR: MUST set the name of the point\n"; - usage(); -} -my $name = $opts{'name'}; - -my ($lat,$lon) = get_latlon( $opts{'ctr'}, $name, $opts{'dx'}, $opts{'dy'} ); -my $S_lat = $lat - $opts{'dy'}/2.0; -my $N_lat = $lat + $opts{'dy'}/2.0; -my $W_lon = $lon - $opts{'dx'}/2.0; -my $E_lon = $lon + $opts{'dx'}/2.0; - -my $nx = $opts{'nx'}; -my $ny = $opts{'ny'}; -if ( $opts{'nx'} < 1 ) { - print "ERROR: nx MUST be greater than or equal to 1\n"; - usage(); -} -if ( $opts{'ny'} < 1 ) { - print "ERROR: ny MUST be greater than or equal to 1\n"; - usage(); -} - -#----------------------------------------------------------------------------------------------- -my $print; -if ( $printlev > 1 ) { - $print = "PRINT=TRUE"; -} - -# Creation date -my $cdate = `date +%y%m%d`; chomp( $cdate ); - -if ( $printlev > 0 ) { - 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 $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 GITDES=$GITDES $print "; - -my $cmd = "$cmdenv GRIDFILE=$grid1 ncl $scrdir/../mkmapgrids/mkscripgrid.ncl"; -if ( $printlev > 0 ) { - print "Create land SCRIP gridfile\n"; - print "Execute: $cmd\n"; -} -system( $cmd ); - -# ocean grid... -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"; -} -system( $cmd ); - -# Now create a unity mapping between the two... -# Note reversal of grid1 & grid2, because we want an ocean -> land -# mapping file -my $mapfile = "$datdir/map_${name}_noocean_to_${name}_nomask_aave_da_${cdate}.nc"; -my $cmd = "env GRIDFILE1=$grid2 GRIDFILE2=$grid1 MAPFILE=$mapfile " . - "GITDES=$GITDES $print ncl $scrdir/mkunitymap.ncl"; - -if ( $printlev > 0 ) { - print "Create unity mapping file between the two gridfile\n"; - print "Execute: $cmd\n"; -} -system( $cmd ); - -if ( $printlev > 0 ) { - print "\n\nSuccessfully created grid/mapping files for single-point\n"; -} diff --git a/tools/site_and_regional/mkunitymap.ncl b/tools/site_and_regional/mkunitymap.ncl deleted file mode 100644 index 7570f7eedd..0000000000 --- a/tools/site_and_regional/mkunitymap.ncl +++ /dev/null @@ -1,166 +0,0 @@ -; -; mkunitymap.ncl -; -; Create a unity map file either between two identical grids or between two -; grids that do NOT intersect at all. -; -; Erik Kluzek -; Dec/07/2011 -; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -begin - ; Set a few constants needed later - cdate = systemfunc( "date +%y%m%d" ); - ldate = systemfunc( "date" ); - ; =========================================================================================================== - ; - ; IMPORTANT NOTE: EDIT THE FOLLOWING TO CUSTOMIZE or use ENV VARIABLE SETTINGS - ; Edit the following as needed to interpolate to a new resolution. - gridfile1 = getenv("GRIDFILE1"); ; Get name of the first SCRIP grid file - gridfile2 = getenv("GRIDFILE2"); ; Get name of the second SCRIP grid file - - outfilename = getenv("MAPFILE"); ; Get name of the output mapping file - - 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 - end if - if ( ismissing(gridfile2) )then - print( "ERROR: GRIDFILE2 is missing!" ); - exit - end if - if ( ismissing(outfilename) )then - print( "ERROR: MAPFILE is missing!" ); - exit - end if - if ( ismissing(print_str) )then - printn = False; - else - if ( print_str .eq. "TRUE" )then - printn = True; - else - printn = False; - end if - end if - - if ( ismissing(gitdescribe) )then - gitdescribe = systemfunc( "git describe" ) - end if - - ; - ; Open up the input grid files - ; - nca = addfile( gridfile1, "r" ); - ncb = addfile( gridfile2, "r" ); - - system( "/bin/rm -f "+outfilename ); - if ( printn )then - print( "output mapping file to create: "+outfilename ); - end if - nc = addfile( outfilename, "c" ); - ; - ; Define dimensions - ; - n_a = dimsizes( nca->grid_center_lat ); - n_b = dimsizes( ncb->grid_center_lat ); - if ( n_a .ne. n_b )then - print( "ERROR: dimensions of input SCRIP grid files is NOT the same!" ); - exit - end if - if ( any(ncb->grid_imask .ne. 1.0d00) )then - print( "ERROR: the mask of the second file isn't identically 1!" ); - print( "(second file should be land grid file)"); - exit - end if - chkvars = (/ "grid_center_lat", "grid_center_lon", "grid_corner_lat", "grid_corner_lon" /); - do i = 1, dimsizes(chkvars)-1 - if ( any(nca->$chkvars(i)$ .ne. ncb->$chkvars(i)$) )then - print( "ERROR: the grid variables are different between the two files!: "+chkvars(i) ); - exit - end if - end do - n_s = n_a; - dimnames = (/ "n_a", "n_b", "n_s", "nv_a", "nv_b", "num_wgts", "src_grid_rank", "dst_grid_rank" /); - dsizes = (/ n_a, n_b, n_a, 4, 4, 1, 2, 2/); - is_unlim = (/ False, False, False, False, False, False, False, False /); - filedimdef( nc, dimnames, dsizes, is_unlim ); - - ; - ; Define grid dimensions - ; - filevardef( nc, "src_grid_dims", "integer", (/ "src_grid_rank" /)) - nc->src_grid_dims = (/nca->grid_dims/) - filevardef( nc, "dst_grid_dims", "integer", (/ "dst_grid_rank" /)) - nc->dst_grid_dims = (/ncb->grid_dims/) - - ; - ; Define variables - ; - cvars = (/ "yc", "xc", "yv", "xv", "mask" /); - gvars = (/ "grid_center_lat", "grid_center_lon", "grid_corner_lat", "grid_corner_lon", "grid_imask" /); - - do i = 0, dimsizes(cvars)-1 - var = cvars(i)+"_a"; - if ( cvars(i) .eq. "yv" .or. cvars(i) .eq. "xv" )then - dnamesa = (/ "n_a", "nv_a" /); - dnamesb = (/ "n_b", "nv_b" /); - else - dnamesa = (/ "n_a" /); - dnamesb = (/ "n_b" /); - end if - filevardef ( nc, var, typeof(nca->$gvars(i)$), dnamesa ); - filevarattdef ( nc, var, nca->$gvars(i)$ ); - nc->$var$ = (/ nca->$gvars(i)$ /); - var = cvars(i)+"_b"; - filevardef ( nc, var, typeof(nca->$gvars(i)$), dnamesb ); - filevarattdef ( nc, var, ncb->$gvars(i)$ ); - nc->$var$ = (/ ncb->$gvars(i)$ /); - delete( dnamesa ); - delete( dnamesb ); - end do - filevardef ( nc, "area_a", "double", (/ "n_a" /) ); - filevardef ( nc, "area_b", "double", (/ "n_b" /) ); - filevardef ( nc, "frac_a", "double", (/ "n_a" /) ); - filevardef ( nc, "frac_b", "double", (/ "n_b" /) ); - ; - ; Attributes - ; - nc->area_a@units = "square radians"; - nc->frac_a@units = "unitless"; - nc->area_b@units = nc->area_a@units; - nc->frac_b@units = nc->frac_a@units; - nc@conventions = "NCAR-CESM"; - nc@domain_a = gridfile1; - nc@domain_b = gridfile2; - nc@grid_file_src = gridfile1; - nc@grid_file_dst = gridfile2; - nc@title = "SCRIP mapping file between identical grids without ocean"; - nc@history = ldate+": create using mkunitymap.ncl"; - nc@Version = gitdescribe; - - ; - ; Fraction - ; - nc->frac_a = int2dble( (/nc->mask_a/) ); - nc->frac_b = int2dble( (/nc->mask_b/) ); - ; - ; Area - ; - nc->area_a = gc_qarea( nc->yv_a(:,:), nc->xv_a(:,:) ); - nc->area_b = gc_qarea( nc->yv_b(:,:), nc->xv_b(:,:) ); - ; - ; Weights - ; - filevardef ( nc, "col", "integer", (/ "n_s" /) ); - filevardef ( nc, "row", "integer", (/ "n_s" /) ); - filevardef ( nc, "S", "double", (/ "n_s" /) ); - - nc->col = ispan( 1, n_s, 1 ); - nc->row = nc->col; - nc->S = 1.0d00; - -end