diff --git a/site/conversion/ccpp-conversion-guide/index.html b/site/conversion/ccpp-conversion-guide/index.html index 89501a31..fd813ead 100644 --- a/site/conversion/ccpp-conversion-guide/index.html +++ b/site/conversion/ccpp-conversion-guide/index.html @@ -1004,7 +1004,9 @@

Setting up your sandbox

text

And select the Create new fork option. This will bring you to the "Create new fork" screen: text

-

!!! note Uncheck the "Copy the main branch only" option

+
+

Uncheck the \"Copy the main branch only\" option

+

Failure to uncheck this will prevent you from pulling in updates from the development branch easily.

As you make changes and want to commit them to your github repos, you will be managing two separate repos. When you issue git commands, be aware of where you are in your code tree. If you want to see changes in CAM-SIMA, you can issue a git status in the main CAM-SIMA directory. If you want to see changes in the atmospheric_physics repo, make sure you are in src/physics/ncar_ccpp before you issue the git status command. All other git commands will be relative to your current working directory as well.

diff --git a/site/search/search_index.json b/site/search/search_index.json index 4cdfca9e..33f941f6 100644 --- a/site/search/search_index.json +++ b/site/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"CAM-SIMA developer documentation","text":""},{"location":"conversion/ccpp-conversion-guide/","title":"CAM Parameterization to CCPP","text":""},{"location":"conversion/ccpp-conversion-guide/#background","title":"Background","text":""},{"location":"conversion/ccpp-conversion-guide/#running-jobs-in-cam-and-cam-sima-primer-experienced-users-can-jump-to-the-next-section","title":"Running jobs in CAM and CAM-SIMA primer (experienced users can jump to the next section)","text":"

To make runs in either CAM or CAM-SIMA the commands are identical:

./create_newcase\u2026 #(the commands will differ and are specified later in this document)\ncd YourCaseDirectory\n./xmlchange\u2026 #(specific commands are specified later in this document)\n./case.setup\n./case.build\n./case.submit\n

Depending on which machine you are on, you may prefer to run the ./case.build command on a compute node instead of the login node due to user resource utilization limits on the login nodes.

For more detailed information on case creation and building, see https://ncar.github.io/CAM/doc/build/html/users_guide/building-and-running-cam.html

"},{"location":"conversion/ccpp-conversion-guide/#prep-work","title":"Prep Work","text":""},{"location":"conversion/ccpp-conversion-guide/#conversion-spreadsheet","title":"Conversion Spreadsheet","text":"

Put the parameterization that you are going to convert into the conversion spreadsheet https://docs.google.com/spreadsheets/d/1_1TTpnejam5jfrDqAORCCZtfkNhMRcu7cul37YTr_WM/edit#gid=0

"},{"location":"conversion/ccpp-conversion-guide/#create-github-issues","title":"Create Github Issues","text":"

Create a Github Issue in the ESCOMP/CAM repo that states which physics parameterization you are planning to convert to the CCPP framework. Then create another issue in the ESCOMP atmospheric physics repo describing the same physics parameterization that you are now planning to add to the collection of NCAR CCPP physics suites. Doing this allows the software engineers to keep track of which physics routines are being worked on, and which still need to be assigned. The goal of converting the physics parameterization is to ultimately have the CCPP-ized physics package reside in ESCOMP atmospheric physics and be removed from ESCOMP/CAM.

"},{"location":"conversion/ccpp-conversion-guide/#setting-up-your-sandbox","title":"Setting up your sandbox","text":"

Make sure you have github forks for both ESCOMP/CAM-SIMA and ESCOMP/atmospheric_physics. If needed see https://github.com/ESCOMP/Cam/wiki/CAM-Development-Workflow-in-GitHub#how-to-makestore-revisions-to-your-personal-cam-repository-github-fork

To begin, fork ESCOMP/CAM-SIMA:

And select the Create new fork option. This will bring you to the \"Create new fork\" screen:

!!! note Uncheck the \"Copy the main branch only\" option

Failure to uncheck this will prevent you from pulling in updates from the development branch easily.

As you make changes and want to commit them to your github repos, you will be managing two separate repos. When you issue git commands, be aware of where you are in your code tree. If you want to see changes in CAM-SIMA, you can issue a git status in the main CAM-SIMA directory. If you want to see changes in the atmospheric_physics repo, make sure you are in src/physics/ncar_ccpp before you issue the git status command. All other git commands will be relative to your current working directory as well.

"},{"location":"design/cam-build-process/","title":"Build process","text":"

In order to describe the build process, we need to define several source and build directories:

"},{"location":"design/cam-build-process/#build-sequence","title":"Build Sequence","text":"

Given the context above, the following is the CAM-SIMA build sequence:

  1. Create a ConfigCAM object, used to store build configuration information. Code can be found in <srcroot>/cime_config/cam_config.py
  2. Generate CAM-SIMA source code. This sequence has several steps, each of which is performed if any of its inputs has changed.
"},{"location":"design/cam-build-process/#cam-sima-source-and-namelist-generation-buildnml-workflow","title":"CAM-SIMA source and namelist generation (buildnml) workflow","text":"

The diagram above displays everything that occurs when CAM-SIMA's buildnml is called by CIME, which occurs after the user calls preview_namelists, case.build, or case.submit.

All blue boxes represent source code, and are listed as \"source file: function/object used\", and all objects or functions that have a \"+\" are automatically tested whenever a Pull Request is opened, updated, or merged.

All orange boxes are input files that are used by the code, while all green boxes are output files that are generated. It is important to note that additional files are generated as well, specifically a build cache and a CCPP datatable, but those files are used internally in the build scripts shown here and not by the final model executable, and thus aren't listed here.

Finally, the arrows show the order of operations, starting with buildnml, with the top two source code boxes representing python classes that are used by the functions/objects directly below them.

"},{"location":"design/cam-run-process/","title":"Run process","text":"CAM-SIMA run sequence*

*Static images can be found at the bottom of this page

"},{"location":"design/cam-run-process/#cam-sima-api","title":"CAM-SIMA API","text":"

Upon running ./case.submit the core CAM-SIMA driver code* is in $CAM-SIMA/src/control/cam_comp.F90. This section lays out each of the subroutines within cam_comp.F90. The subroutines in cam_comp.F90 are set up to mirror the phases of the Common Community Physics Package (CCPP).

* cam_comp.F90 subroutines are called by the NUOPC cap: $CAM-SIMA/src/cpl/nuopc/atm_comp_nuopc.F90

"},{"location":"design/cam-run-process/#cam_init","title":"cam_init","text":"

cam_init sets up the metadata and configuration objects/modules for the run. It is called once at startup. Below are the variables passed in:

Variable (intent) Definition How it's Used caseid (in) case name (as input to ./create_newcase) metadata for cam_control_mod and cam_history ctitle (in) case title (matches caseid) metadata for cam_control_mod and cam_history model_doi_url (in) CESM model DOI (currently hard-coded to \"non_set\") metadata for cam_history initial_run_in (in) logical that is TRUE if this is a startup run** determines whether to call dyn_init or read restart restart_run_in (in) logical that is TRUE if this is a restart run** metadata for cam_control_mod branch_run_in (in) logical that is TRUE if this is a branch run** metadata for cam_control_mod post_assim_in (in) logical that is TRUE if data assimilation mode (DART) is on metadata for cam_control_mod calendar (in) calendar type (NOLEAP or GREGORIAN) input to time manager init brnch_retain_casename (in) flag to allow a branch to use the same caseid as the run being branched from metadata for cam_control_mod aqua_planet (in) flag to run model in aqua planet mode metadata for cam_control_mod single_column (in) flag to run the single column model (SCAM) passed into scam_readnl (not yet enabled in CAM-SIMA scmlat (in) SCAM latitude passed into scam_readnl (not yet enabled in CAM-SIMA) scmlon (in) SCAM longitude passed into scam_readnl (not yet enabled in CAM-SIMA) eccen (in) Earth's eccentricity factor used to set module-level eccen in cam_control_mod obliqr (in) Earth's obliquity in radians used to set module-level obliqr in cam_control_mod lambm0 (in) Mean longitude of perihelion at the vernal equinox (radians) used to set module-level lambm0 in cam_control_mod mvelpp (in) Earth's moving vernal equinox longitude of perihelion plus pi (radians) used to set module-level mvelpp in cam_control_mod perpetual_run (in) flag to determine if perpetual mode is enabled passed to time manager init perpetual_ymd (in) perpetual year, month, day (YYYYMMDD) used to determine the sun position and interpolate boundary data sets passed to time manager init dtime (in) model timestep size in seconds passed to time manager init start_ymd (in) start date (YYYYMMDD) passed to time manager init start_tod (in) start time of day (sec) passed to time manager init ref_ymd (in) reference date (YYYYMMDD) (defaults to start_ymd) passed to time manager init ref_tod (in) reference time of day (sec) (defaults to start_tod) passed to time manager init stop_ymd (in) stop date (YYYYMMDD) passed to time manager init stop_tod (in) stop time of day (sec) passed to time manager init curr_ymd (in) current date (YYYYMMDD) (same as start date) passed to time manager init curr_tod (in) current time of day (sec) (same as start tod) passed to time manager init cam_in (inout) surface exchange object - coupler to CAM-SIMA allocated if this is an initial run cam_out (inout) surface exchange object - CAM-SIMA to coupler allocated if this is an initial run

** For additional information on run types, see the CESM Tutorial

cam_init calls the following key subroutines (locations) in this order:

  1. cam_ctrl_init (src/control/cam_control_mod.F90): Sets the module-level run configuration variables; logs configurations to the atm log
  2. cam_ctrl_set_orbit (src/control/cam_control_mod.F90): Sets the module-level orbital variables
  3. timemgr_init (src/utils/time_manager.F90`): Initializes the time manager; logs configurations to the atm log
  4. read_namelist (src/control/runtime_opts.F90): Reads all namelists for the run, including auto-generated scheme namelists (see build process)
  5. cam_ctrl_set_physics_type (src/control/cam_control_mod.F90): sets module-level configuration for variables for simple physics and moist physics schemes; logs configurations to atm log
  6. cam_initfiles_open (src/control/cam_initfiles.F90): Opens initial or restart file, and topography file if specified
  7. cam_register_constituents (src/control/cam_comp.F90): Sets the total number and advected number of constituents; currently ALWAYS adds water vapor as constituent (expected by the SE dycore)
  8. air_composition_init (src/data/air_composition.F90): Initializes air-composition-dependent model constants
  9. model_grid_init (src/dynamics/<dycore>/dyn_grid.F90): Initializes model grids and decompositions
  10. cam_ccpp_initialize_constituents ($CASE/bld/atm/obj/ccpp/cam_ccpp_cap.F90): initializes the constituent data array; after this point, we cannot add new constituents
  11. dyn_init (src/dynamics/<dycore>/dyn_comp.F90): Initializes the dynamical core
  12. atm2hub_alloc and hub2atm_alloc (src/control/camsrfexch.F90): Allocates and sets up surface exchange data
  13. phys_init (src/physics/utils/phys_comp.F90): Initializes physics (includes call to CCPP cap to run init phases of schemes in the Suite Definition File (SDF)
  14. stepon_init (src/dynamics/<dycore>/stepon.F90): Initializes dynamics <--> physics coupling
"},{"location":"design/cam-run-process/#cam_timestep_init","title":"cam_timestep_init","text":"

cam_timestep_init is called at the start of each timestep. It has no input/output/inout variables.

The routine calls the following subroutines (locations) in this order:

  1. stepon_timestep_init (src/dynamics/<dycore>/stepon.F90): First phase of dynamics (couple from dynamics to physics); also returns timestep for physics
  2. phys_timestep_init (src/physics/utils/phys_comp.F90):
    1. Read un-initialized data from initial data file
      • For the null dycore, this means we're reading most physics input variables (as defined in src/data/registry.xml) from the ncdata file
      • For the SE dycore, we are reading in any variables not marked as initialized by the SE dycore initialization
    2. Calls the CCPP cap to run timestep_init phases of all schemes in the user-specified SDF
"},{"location":"design/cam-run-process/#cam_run1","title":"cam_run1","text":"

cam_run1 is the first \"run\" phase called in the physics loop. It is called every timestep BEFORE the mediator/surface coupler and calls the following subroutine (location):

  1. phys_run1 (src/physics/utils/phys_comp.F90): Calls the run phase for all physics schemes in the \"physics_before_coupler\" group in the SDF
"},{"location":"design/cam-run-process/#cam_run2","title":"cam_run2","text":"

cam_run2 is the second \"run\" phase called in the physics loop. It is called every timestep AFTER the mediator/coupler. Input/output variables:

Variable (intent) Definition How it's Used cam_in (inout) surface exchange object - input to CAM-SIMA Passed into stepon_run2 cam_out (inout) surface exchange object - output from CAM-SIMA Passed into stepon_run2

cam_run2 calls these subroutines (locations):

  1. phys_run2 (src/physics/utils/phys_comp.F90): Calls the run phase for all physics schemes in the \"physics_after_coupler\" group in the SDF
  2. stepon_run2 (src/dynamics/<dycore>/stepon.F90): The second phase of dynamics (couple from physics to dynamics)
"},{"location":"design/cam-run-process/#cam_run3","title":"cam_run3","text":"

cam_run3 is the third \"run\" phase called in the physics loop. It is called every timestep AFTER cam_run3 and BEFORE cam_run4 (unsurprisingly). In/out variables:

Variable (intent) Definition How it's Used cam_out (inout) surface exchange object - output from CAM-SIMA Passed into stepon_run3

cam_run3 calls the following subroutine (location):

  1. stepon_run3 (src/dynamics/<dycore>/stepon.F90): Calls dyn_run, which runs the dycore
"},{"location":"design/cam-run-process/#cam_run4","title":"cam_run4","text":"

cam_run4 currently does nothing! (but it is called every timestep)

"},{"location":"design/cam-run-process/#cam_timestep_final","title":"cam_timestep_final","text":"

cam_timestep_final runs at the end of each timestep. In/out variables:

Variable (intent) Definition How it's Used rstwr (in) flag to write a restart file Passed into history_wrap_up nlend (in) flag to indicate whether this is the final timestep Passed into history_wrap_up

cam_timestep_final calls the following subroutines (locations):

  1. History routines. If it's not the last (half) timestep,
    1. history_write_files (src/history/cam_history.F90): Writes fields to user-configured history files (if applicable)
    2. history_wrap_up (src/history/cam_history.F90): Closes files and zeros buffers as necessary
  2. phys_timestep_final (src/physics/utils/phys_comp.F90):
    1. Calls the timestep_final phase for all physics schemes in the SDF
    2. If ncdata_check is set in user_nl_cam, calls physics_check_data ($CASE/bld/atm/obj/phys_init/physics_inputs.F90) to perform snapshot checking
"},{"location":"design/cam-run-process/#cam_final","title":"cam_final","text":"

cam_final is called once at the end of the model execution. In/out variables:

Variable (intent) Definition How it's Used cam_in (inout) surface exchange object - input to CAM-SIMA Deallocated cam_out (inout) surface exchange object - output from CAM-SIMA Deallocated

cam_final calls the following subroutines (locations):

  1. phys_final (src/physics/utils/phys_comp.F90): calls \"final\" phase of all schemes in the SDF
  2. stepon_final (src/dynamics/<dycore>/stepon.F90): finalizes dycore (doesn't currently do anything)
  3. atm2hub_deallocate and hub2atm_deallocate (src/control/camsrfexch.F90): deallocate cam_in/cam_out objects
"},{"location":"design/cam-run-process/#static-run-sequence-images","title":"Static run sequence images","text":""},{"location":"design/ccpp-in-cam-sima/","title":"CCPP in CAM-SIMA","text":""},{"location":"design/ccpp-in-cam-sima/#overview","title":"Overview","text":"

The core Common Community Physics Package (CCPP) documentation can be found here. This section details the code structure and implementation of the CCPP Framework within CAM-SIMA. That said here's a quick overview of the CCPP:

CCPP-compliant physics schemes must adhere to the following criteria:

Metadata example (snippet taken from kessler.meta)

[ precl ]\n  standard_name = total_precipitation_rate_at_surface\n  long_name = Total precipitation rate at surface\n  units = m s-1\n  dimensions = (horizontal_loop_extent)\n  type = real | kind = kind_phys\n  intent = out\n[ relhum ]\n  standard_name = relative_humidity\n  long_name = Relative humidity\n  units = percent\n  dimensions = (horizontal_loop_extent, vertical_layer_dimension)\n  type = real | kind = kind_phys\n  intent = out\n[ scheme_name ]\n  standard_name = scheme_name\n  units = none\n  type = character | kind = len=64\n  dimensions = ()\n  intent = out\n\n

CCPP-compliant physics schemes are organized into suite definition files (SDFs). An SDF tells the framework which schemes will be run in what order. Separating schemes into \"groups\" also allows the run phases of those groups to be called separately by the host model. Here's an example SDF (from suite_kessler.xml):

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<suite name=\"kessler\" version=\"1.0\">\n  <group name=\"physics_before_coupler\">\n    <scheme>calc_exner</scheme>\n    <scheme>temp_to_potential_temp</scheme>\n    <scheme>calc_dry_air_ideal_gas_density</scheme>\n    <scheme>wet_to_dry_water_vapor</scheme>\n    <scheme>wet_to_dry_cloud_liquid_water</scheme>\n    <scheme>wet_to_dry_rain</scheme>\n    <scheme>kessler</scheme>\n    <scheme>potential_temp_to_temp</scheme>\n    <scheme>dry_to_wet_water_vapor</scheme>\n    <scheme>dry_to_wet_cloud_liquid_water</scheme>\n    <scheme>dry_to_wet_rain</scheme>\n    <scheme>kessler_update</scheme>\n    <scheme>qneg</scheme>\n    <scheme>geopotential_temp</scheme>\n    <scheme>cam_state_diagnostics</scheme>\n    <scheme>kessler_diagnostics</scheme>\n  </group>\n  <group name=\"physics_after_coupler\">\n    <scheme>cam_tend_diagnostics</scheme>\n  </group>\n</suite>\n

The framework code is primarily python code that generates Fortran caps. The class structure looks like:

Given CCPP-compliant physics schemes and one or more SDF, the framework generates caps for the host model to call at the appropriate time. The core files generated by the framework are:

"},{"location":"design/ccpp-in-cam-sima/#code-structure","title":"Code Structure","text":"

How CAM-SIMA and the CCPP come together:

"},{"location":"design/ccpp-in-cam-sima/#host-model","title":"Host Model","text":"

The core host model code is what is held in the CAM-SIMA github repository, plus code that is generated at build-time (or preview_namelists-time) based on the registry (src/data/registry.xml).

"},{"location":"design/ccpp-in-cam-sima/#physics","title":"Physics","text":"

The CCPP physics scheme code exists in the atmospheric_physics repository, which exists as a submodule of CAM-SIMA in the following location: $CAM-SIMA/src/physics/ncar_ccpp

SDFs are located in the root directory of the repository and scheme source code is in the relevant subdirectories.

The diagnostics directory contains all diagnostic schemes (the global ones used for state and tendency output, as well as the scheme-specific diagnostic schemes).

The to_be_ccppized directory contains physics schemes and utilties that have not been CCPP-ized, but were needed by an CCPP-ized scheme.

The utilities directory contains schemes that are used regularly, such as tendency applicators and state converters. See below for more.

"},{"location":"design/ccpp-in-cam-sima/#generated-caps","title":"Generated caps","text":"

The caps generated by the CCPP Framework at model build time (or preview_namelists-time) can be found in the following location: $CASE/bld/atm/obj/ccpp/

"},{"location":"design/ccpp-in-cam-sima/#implementation","title":"Implementation","text":"

All CCPP phases are called from the physics driver (src/physics/utils/phys_comp.F90). You can see the order of these calls more thoroughly in the documented run sequence.

"},{"location":"design/ccpp-in-cam-sima/#host-side-variables-and-metadata","title":"Host-side variables and metadata","text":"

For a CCPP-ized physics scheme to work, the framework needs to be able to find a matching variable on the host side for each input variable for the suite(s) in question. This means that CAM-SIMA needs to allocate, initialize, and provide metadata for these variables. We do this in two ways:

The registry-based code generator is run before the CCPP framework does its magic, so, when it's time, the framework can connect the dots between the host model and the physics.

"},{"location":"design/ccpp-in-cam-sima/#state-and-tendency-variables","title":"State and tendency variables","text":"

Two of the most commonly used and referred-to objects in CAM-SIMA are:

The Fortran for both objects is auto-generated by CAM-SIMA based on the registry ($CAM-SIMA/src/data/registry.xml). The generated code can be found here: $CASE/bld/atm/obj/cam_registry/physics_types.F90. The objects are used by the host model (CAM-SIMA), while the CCPP physics take the individual component variables as inputs.

"},{"location":"design/ccpp-in-cam-sima/#physics-state","title":"Physics state","text":"

The physics_state object in CAM-SIMA contains the current values for a select set of variables that describe the atmosphere, at the resolution specified by the input grid.

Some examples of these core \"state\" variables include temperature (T), eastward wind (U), and northward wind (V)

As a rule, CAM-SIMA physics schemes do not update the state directly and instead return tendencies (see below) which are then applied to the state later in the run phase. This is called time splitting, which means that all physics since the last state update get the same input state. The alternative, process splitting, means that the output state of one scheme serves as the input state of the next.

NOTE: Although constituents are handled independently of the physics_state object (they are handled by the CCPP framework), they ARE considered state variables.

"},{"location":"design/ccpp-in-cam-sima/#physics-tendencies","title":"Physics tendencies","text":"

The physics tendencies represent how a given scheme (or schemes) changes the state in a single model timestep. The tendencies are accumulated until it is time to apply them to the state. There is one tendency for each state variable being \"updated\" by the scheme. Some of these tendency variables are held within the physics_tend object, but others are internal to the physics.

The module $CAM-SIMA/src/physics/ncar_ccpp/utilities/physics_tendency_updaters.F90 includes the schemes to apply the tendencies to the relevant state variables. These schemes are added to the SDF whenever the state should be updated. Each calculation looks like: state_var = state_var + tend*dt where dt is the timestep size.

"},{"location":"design/constituents/","title":"Constituents","text":""},{"location":"design/constituents/#introductionoverview","title":"Introduction/Overview","text":"

Some definitions to start (as written by a non-scientist, so there is more nuance than this!):

"},{"location":"design/constituents/#cam-sima-constituent-handling","title":"CAM-SIMA constituent handling","text":""},{"location":"design/constituents/#determining-constituents","title":"Determining constituents","text":"

There are three ways to identify a quantity as a constituent in CAM-SIMA:

  1. Constituent is provided by host (CAM-SIMA):
  2. Constituent is a build-time physics constituent in a CCPP-ized scheme:
  3. Constituent is a run-time physics constituent in a CCPP-ized scheme:
"},{"location":"design/constituents/#registering-initializing-constituents","title":"Registering & Initializing Constituents","text":"

The registration and initializaiton of the constituent data array and the constituent properties object are done through calls to the generated CCPP cap.

"},{"location":"design/constituents/#constituent-usage","title":"Constituent Usage","text":"

Constituent values and properties can be accessed from the host side and from the physics in the following ways:

[ q ]\n  standard_name = ccpp_constituents\n  units = none\n  type = real | kind = kind_phys\n  dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_ccpp_constituents)\n  intent = inout\n[ const_props ]\n  standard_name = ccpp_constituent_properties\n  units = None\n  type = ccpp_constituent_prop_ptr_t\n  dimensions = (number_of_ccpp_constituents)\n  intent = in\n
"},{"location":"design/constituents/#ccpp-framework-constituent-handling","title":"CCPP Framework constituent handling","text":"

This section can be removed when constituents are documented in the CCPP Framework documentation.

"},{"location":"design/constituents/#constituent-object-fortran","title":"Constituent object (Fortran)","text":"

The constituent object (found in $CAM-SIMA/ccpp_framework/src/ccpp_constituent_prop_ mod.F90) is a flexible and extendable means of containing necessary constituent data for the framework. The primary object is ccpp_model_constituents_t.

This object, importantly, contains the following properties (for which there is metadata; CCPP standard name in parenthesis):

The const_metadata property is of type ccpp_constituent_prop_ptr_t, which contains a pointer to a ccpp_constituent_properties_t object, as depicted above. This object contains all of the constituent properties for the constituents in the constituents array, with the same indices as the constituents array.

The ccpp_model_constituents_t type also contains a hash table of constituent properties for more efficient searching, as well as several methods used by the generated cap code. Some methods are highlighted below:

"},{"location":"design/constituents/#code-generation-python","title":"Code generation (python)","text":"

The constituents-related code generation routines provide an interface to the constituents object. These routines can be found in $CAM-SIMA/ccpp_framework/scripts/constituents.py, primarily within the \u201cwrite_host_routines\u201d function. The (most often used) generated routines related to constituents are:

The routines above are generated during ./preview_namelists or ./case.build and can be found here: $CASE/bld/atm/obj/ccpp/cam_ccpp_cap.F90

"},{"location":"design/history/","title":"History & model output","text":"

CAM-SIMA history is the mechanism for configuring and generating diagnostic output from a model run. It is also used to generate initial-data files and aids in the model-restart process by saving the state of diagnostic fields whose processing window (e.g., averaging, standard deviation) crosses a restart-write cycle. This page describes the implementation of CAM-SIMA history in CAM-SIMA.

"},{"location":"design/history/#history-initialization","title":"History Initialization","text":""},{"location":"design/history/#reading-and-processing-the-history-configuration","title":"Reading and processing the history configuration","text":" Configuration Keyword Description atm_in equivalent hist_add_avg_fields hist_add_inst_fieldshist_add_min_fields hist_add_max_field hist_add_var_field hist_remove_fields These configuration keywords add/remove fields to the specified volume with the indicated accumulation flag (average, instantaneous, minimum, maximum, standard deviation). The closest CAM7 equivalent is \u201cfinclX\u201d &hist_config_arrays_nl\u2002hist_num_avg_fields\u2002hist_num_inst_fields\u2002hist_num_min_fields\u2002hist_num_max_fields\u2002hist_num_var_fields&hist_file_config_nl\u2002hist_avg_fields\u2002hist_inst_fields\u2002hist_min_fields\u2002hist_max_fields\u2002hist_var_fields hist_file_type This keyword determines the type of file. Options are: \u201chistory,\u201d \u201csatellite,\u201d and \u201cinitial_value\u201dDefaults to \u201chistory\u201d &hist_file_config_nl\u2002hist_file_type hist_max_frames Indicates the maximum number of samples/frames that can be written to a file before that file is considered \u201cfull\u201d. The CAM7 equivalent is \u201cmfilt\u201d.Defaults to 1 for h0 and 30 for all other volumes. &hist_file_config_nl\u2002hist_max_frames hist_output_frequency Specifies the frequency of writes to the volume. The syntax is \"<integer>*<time period>\" where \u201ctime_period\u201d can be: steps, seconds, minutes, hours, days, months, years. The closest CAM7 equivalent is \u201cnhtfrq\u201d. &hist_file_config_nl\u2002hist_output_frequency hist_precision Denotes the precision for the volume. Options are \"REAL32\" and \"REAL64\".Defaults to \"REAL32\" &hist_file_config_nl\u2002hist_precision hist_write_nstep0 Indicates whether or not to write the nstep=0 sample to the volume.Defaults to .false. &hist_file_config_nl\u2002hist_write_nstep0 hist_filename_template Specifies the template for the filename for the volume. Defaults to \"%c.cam.%u.%y-%m-%d-%s.nc\" where \"%c\" is the case name, \"%u\" is the volume, \"%y\" is the year, \"%m\" is the month, \"%d\" is the day, and \"%s\" is the number of seconds since midnight GMT, with the timestamp itself representing the model time when the file is created. &hist_file_config_nl\u2002hist_filename_spec "},{"location":"design/history/#setting-up-the-history-data-structures","title":"Setting up the history data structures","text":""},{"location":"design/history/#populating-the-possible-field-list","title":"Populating the possible field list","text":"

The possible fields to be output by the history infrastructure are tracked in cam_history.F90 via the possible_field_list hash table. It is populated during init time by calls to the subroutine history_add_field (found in src/history/cam_history.F90). \u201cInit time,\u201d means that all calls to history_add_field must occur during the execution of cam_init (found in src/control/cam_comp.F90).