diff --git a/site/404.html b/site/404.html index a5d736a9..209fde14 100644 --- a/site/404.html +++ b/site/404.html @@ -242,7 +242,7 @@ - Welcome to MkDocs + CAM-SIMA developer documentation @@ -360,7 +360,7 @@ - CAM-SIMA Build Process + Build process @@ -381,7 +381,7 @@ - CAM-SIMA Run Process + Run process @@ -398,11 +398,11 @@
  • - + - CCPP Physics + CCPP in CAM-SIMA @@ -444,7 +444,301 @@ - History & Model Output + History & model output + + + + +
  • + + + + + + + + + + +
  • + + + + + Design goals & features + + + + +
  • + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + +
  • + + + + + + + + + + + + + +
  • + + + + + + + + + + +
  • + + + + + + + + + + + + + +
  • + + + + + + + + + + +
  • + + + + + + + + + + + + + +
  • + + + + + + + + + + +
  • + + + + + + + + + + + + + +
  • + + + + + + + + + + +
  • + + + + + + + + + + + + + +
  • + + + + + + + + + +
  • + +
  • + + + Static run sequence images + + +
  • @@ -536,11 +545,11 @@
  • - + - CCPP Physics + CCPP in CAM-SIMA @@ -582,7 +591,301 @@ - History & Model Output + History & model output + + + + +
  • + + + + + + + + + + +
  • + + + + + Design goals & features + + + + +
  • + + + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + + + +
  • + + + + + + + + + + + + + +
  • + + + + + + + + + +
  • + +
  • + + + Static run sequence images + + +
  • @@ -727,14 +1039,18 @@ -

    CAM-SIMA Run Process

    -

    text

    +

    Run process

    +
    + text +
    CAM-SIMA run sequence*
    +
    +

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

    CAM-SIMA API

    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

    cam_init

    -

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

    +

    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:

    @@ -902,15 +1218,15 @@

    cam_init

  • cam_ctrl_init (src/control/cam_control_mod.F90): Sets the module-level run configuration variables; logs configurations to the atm log
  • cam_ctrl_set_orbit (src/control/cam_control_mod.F90): Sets the module-level orbital variables
  • timemgr_init (src/utils/time_manager.F90`): Initializes the time manager; logs configurations to the atm log
  • -
  • read_namelist (src/control/runtime_opts.F90): Reads all namelists for the run, including auto-generated scheme namelists (see build process)
  • +
  • read_namelist (src/control/runtime_opts.F90): Reads all namelists for the run, including auto-generated scheme namelists (see build process)
  • 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
  • cam_initfiles_open (src/control/cam_initfiles.F90): Opens initial or restart file, and topography file if specified
  • -
  • 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)
  • +
  • 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)
  • air_composition_init (src/data/air_composition.F90): Initializes air-composition-dependent model constants
  • model_grid_init (src/dynamics/<dycore>/dyn_grid.F90): Initializes model grids and decompositions
  • 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
  • dyn_init (src/dynamics/<dycore>/dyn_comp.F90): Initializes the dynamical core
  • -
  • atm2hub_alloc and hub2atm_alloc (src/control/camsrfexch.F90): Allocate and set up surface exchange data
  • +
  • atm2hub_alloc and hub2atm_alloc (src/control/camsrfexch.F90): Allocates and sets up surface exchange data
  • 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)
  • stepon_init (src/dynamics/<dycore>/stepon.F90): Initializes dynamics <--> physics coupling
  • @@ -920,18 +1236,22 @@

    cam_timestep_init

    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 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. -
      3. Call the CCPP cap to run timestep_init phases of all schemes in the user-specified suite definition file (SDF)
      4. +
      5. 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
        • +
        +
      6. +
      7. Calls the CCPP cap to run timestep_init phases of all schemes in the user-specified SDF

    cam_run1

    -

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

    +

    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 suite definition file (SDF)
    2. +
    3. 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

    cam_run2

    -

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

    +

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

    @@ -955,11 +1275,11 @@

    cam_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 suite definition file (SDF)
    2. +
    3. 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
    4. stepon_run2 (src/dynamics/<dycore>/stepon.F90): The second phase of dynamics (couple from physics to dynamics)

    cam_run3

    -

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

    +

    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:

    @@ -972,7 +1292,7 @@

    cam_run3

    - +
    cam_out (inout) surface exchange object - output from CAM-SIMAPassed into stepon_run2Passed into stepon_run3
    @@ -981,7 +1301,7 @@

    cam_run3

  • stepon_run3 (src/dynamics/<dycore>/stepon.F90): Calls dyn_run, which runs the dycore
  • cam_run4

    -

    cam_run4 currently does nothing!

    +

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

    cam_timestep_final

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

    @@ -1007,19 +1327,19 @@

    cam_timestep_final

    cam_timestep_final calls the following subroutines (locations):

      -
    1. History routines. If it's not the last (half) timestep,
        +
      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 suite definition file (SDF)
        2. +
        3. Calls the timestep_final phase for all physics schemes in the SDF
        4. 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

      cam_final

      -

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

      +

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

      @@ -1043,10 +1363,15 @@

      cam_final

      cam_final calls the following subroutines (locations):

        -
      1. phys_final (src/physics/utils/phys_comp.F90): calls "final" phase of all schemes in the suite definition file (SDF)
      2. -
      3. stepon_final (src/dynamics/<dycore>/stepon.F90): finalize dycore (doesn't currently do anything)
      4. +
      5. phys_final (src/physics/utils/phys_comp.F90): calls "final" phase of all schemes in the SDF
      6. +
      7. stepon_final (src/dynamics/<dycore>/stepon.F90): finalizes dycore (doesn't currently do anything)
      8. atm2hub_deallocate and hub2atm_deallocate (src/control/camsrfexch.F90): deallocate cam_in/cam_out objects
      +

      Static run sequence images

      +

      text +text +text +text

      @@ -1093,7 +1418,7 @@

      cam_final

      - + diff --git a/site/design/ccpp-in-cam-sima/index.html b/site/design/ccpp-in-cam-sima/index.html new file mode 100644 index 00000000..80752d5f --- /dev/null +++ b/site/design/ccpp-in-cam-sima/index.html @@ -0,0 +1,1261 @@ + + + + + + + + + + + + + + + + + + + + + + + CCPP in CAM-SIMA - CAM-SIMA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + Skip to content + + +
      +
      + +
      + + + + + + +
      + + +
      + +
      + + + + + + +
      +
      + + + +
      +
      +
      + + + + + +
      +
      +
      + + + +
      +
      +
      + + + +
      +
      +
      + + + +
      +
      + + + + +

      CCPP in CAM-SIMA

      +

      Overview

      +

      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:

      +
        +
      • A CCPP-enabled model consists of the following components (depicted in the diagram below):
          +
        • Host model and dynamical core
        • +
        • CCPP-compliant physics schemes (organized into Suite Definition Files [SDFs])
        • +
        • Caps generated by the CCPP framework to connect the host model to the physics schemes
        • +
        +
      • +
      +

      text

      +

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

      +
        +
      • Must be broken up into only the following phases:
          +
        • register (anything in the scheme that must be done before the grid is initialized) - run once at startup
        • +
        • init - run once at startup
        • +
        • timestep_init - run at beginning of every physics timestep
        • +
        • run - run on every timestep
        • +
        • timestep_final - run at the end of every timestep
        • +
        • final - run once at the end of model execution
        • +
        +
      • +
      • Must contain metadata for all input/output/inout variables passed into each phase (see metadata example below)
      • +
      • Must not have use statements outside of the following allowed CCPP use statements (with the exception of dependencies, but we're not getting into that now):
          +
        • ccpp_kinds
        • +
        • ccpp_constituent_prop_mod
        • +
        +
      • +
      +

      Metadata example +(snippet taken from kessler.meta)

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

      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"?>
      +
      +<suite name="kessler" version="1.0">
      +  <group name="physics_before_coupler">
      +    <scheme>calc_exner</scheme>
      +    <scheme>temp_to_potential_temp</scheme>
      +    <scheme>calc_dry_air_ideal_gas_density</scheme>
      +    <scheme>wet_to_dry_water_vapor</scheme>
      +    <scheme>wet_to_dry_cloud_liquid_water</scheme>
      +    <scheme>wet_to_dry_rain</scheme>
      +    <scheme>kessler</scheme>
      +    <scheme>potential_temp_to_temp</scheme>
      +    <scheme>dry_to_wet_water_vapor</scheme>
      +    <scheme>dry_to_wet_cloud_liquid_water</scheme>
      +    <scheme>dry_to_wet_rain</scheme>
      +    <scheme>kessler_update</scheme>
      +    <scheme>qneg</scheme>
      +    <scheme>geopotential_temp</scheme>
      +    <scheme>cam_state_diagnostics</scheme>
      +    <scheme>kessler_diagnostics</scheme>
      +  </group>
      +  <group name="physics_after_coupler">
      +    <scheme>cam_tend_diagnostics</scheme>
      +  </group>
      +</suite>
      +
      +

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

      +
      +text +
      +

      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:

      +
        +
      • <host>_ccpp_cap.F90: contains the interface layer between the host and the suite(s)
      • +
      • ccpp_<suite>_cap.F90: contains one subroutine per phase (including one run phase per group) in which the phases of the schemes within the suite are called in order
          +
        • There is one suite cap generated for each suite being run
        • +
        +
      • +
      • ccpp_datatable.xml: consolidates metadata into an XML file to be used as desired by the host model
      • +
      +

      Code Structure

      +

      How CAM-SIMA and the CCPP come together: +text

      +

      Host Model

      +

      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).

      +

      Physics

      +

      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.

      +

      Generated caps

      +

      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/

      +

      Implementation

      +

      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.

      +

      Host-side variables and metadata

      +

      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:

      +
        +
      • Adding metadata to existing CAM modules (such as src/data/physconst.F90) so that a scheme can access an existing host model variable
          +
        • All static host-side metadata schemes are included at the top of the registry
        • +
        +
      • +
      • Adding a variable to the registry (src/data/registry.xml)
          +
        • You can learn more about how the registry is used to generate a Fortran module and corresponding metadata here
        • +
        +
      • +
      +

      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.

      +

      State and tendency variables

      +

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

      +
        +
      • physics_state
      • +
      • physics_tend
      • +
      +

      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.

      +

      Physics state

      +

      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.

      +
      +text +
      +

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

      +

      Physics tendencies

      +

      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.

      + + + + + + + + + + + + + +
      +
      + + + +
      + +
      + + + +
      +
      +
      +
      + + + + + + + + + + \ No newline at end of file diff --git a/site/design/constituents/index.html b/site/design/constituents/index.html index c6270489..b18ed003 100644 --- a/site/design/constituents/index.html +++ b/site/design/constituents/index.html @@ -9,7 +9,7 @@ - + @@ -251,7 +251,7 @@ - Welcome to MkDocs + CAM-SIMA developer documentation @@ -371,7 +371,7 @@ - CAM-SIMA Build Process + Build process @@ -392,7 +392,7 @@ - CAM-SIMA Run Process + Run process @@ -409,11 +409,11 @@
    2. - + - CCPP Physics + CCPP in CAM-SIMA @@ -579,7 +579,301 @@ - History & Model Output + History & model output + + + + +
    3. + + + + + + + + + + +
    4. + + + + + Design goals & features + + + + +
    5. + + + + + + + + + + + + + + + + + + + + + +
    6. + + + + + + + + + + +
    7. + + + + + + + + + + + + + +
    8. + + + + + + + + + + +
    9. + + + + + + + + + + + + + +
    10. + + + + + + + + + + +
    11. + + + + + + + + + + + + + +
    12. + + + + + + + + + @@ -743,7 +1039,7 @@ -

      History & Model Output

      +

      History & model output

      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.

      History Initialization

      Reading and processing the history configuration

      @@ -781,7 +1077,7 @@

      Reading and processing hist_output_frequency -Specifies the frequency of writes to the volume. The syntax is “*” where “time_period” can be: steps, seconds, minutes, hours, days, months, years. The closest CAM7 equivalent is “nhtfrq”. +Specifies the frequency of writes to the volume. The syntax is "<integer>*<time period>" where “time_period” can be: steps, seconds, minutes, hours, days, months, years. The closest CAM7 equivalent is “nhtfrq”. &hist_file_config_nl
       hist_output_frequency @@ -791,7 +1087,12 @@

      Reading and processing hist_write_nstep0 -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 seconds +Indicates whether or not to write the nstep=0 sample to the volume.
      Defaults to .false. +&hist_file_config_nl
       hist_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
       hist_filename_spec @@ -801,64 +1102,7 @@

      Reading and processing
    13. The HistoryConfig object is created in buildnml out of entries in user_nl_cam and written to run/atm_in.
    14. In order to ensure that all relevant runtime (namelist) values show up in atm_in, the HistoryConfig object must contain all the logic in setting default values.
    15. -

      text

      -

      Example -Take the following sample user_nl_cam:

      -
      hist_output_frequency;h1: 5*ndays
      -hist_max_frames;h1: 3
      -hist_add_inst_fields;h1: U
      -hist_add_inst_fields;h1: V, Q
      -hist_precision;h1: REAL64
      -hist_filename_spec;h1: my-history-file%m-%d
      -hist_write_nstep0;h1: .false.
      -
      -

      It will be parsed by hist_config.py and this will be the relevant section of atm_in:

      -
      &hist_config_arrays_nl
      -    hist_num_inst_fields = 3
      -    hist_num_avg_fields = 2
      -    hist_num_min_fields = 0
      -    hist_num_max_fields = 0
      -    hist_num_var_fields = 0
      -/
      -
      -&hist_file_config_nl
      -    hist_volume = 'h0'
      -    hist_avg_fields = 'T', 'Q'
      -    hist_max_frames = 1
      -    hist_output_frequency = '1*month'
      -    hist_precision = 'REAL32'
      -    hist_file_type = 'history'
      -    hist_filename_spec = '%c.cam.%u.%y-%m-%d-%s.nc'
      -    hist_write_nstep0 = .false.
      -/
      -
      -&hist_file_config_nl
      -    hist_volume = 'h1'
      -    hist_inst_fields = 'U', ‘V’, ‘Q’
      -    hist_max_frames = 3
      -    hist_output_frequency = '5*ndays'
      -    hist_precision = 'REAL64'
      -    hist_file_type = 'history'
      -    hist_filename_spec = 'my-history-file%m-%d'
      -    hist_write_nstep0 = .false.
      -/
      -
      -

      In plain English, a one-month run with these history configuration will result in a total of three files that will look something like these: -- my-history-file01-06.nc - - This file will contain instantaneous output for U, V, and Q (eastward_wind, northward_wind, and water vapor) - - It will contain three frames, one at each of the following times: - - 0001-01-06 (time=5) - - 0001-01-11 (time=10) - - 0001-01-16 (time=15) -- my-history-file01-21.nc - - This file will contain instantaneous output for U, V, and Q (eastward_wind, northward_wind, and water vapor) - - It will contain three frames, one at each of the following times: - - 0001-01-21 (time=20) - - 0001-01-26 (time=25) - - 0001-01-31 (time=30) -- .cam.h0a.0001-02-01-00000.nc - - This file will contain averaged output for T and Q (air_temperature and water vapor) - - It will have one frame with the time calculated at the midpoint of the month

      +

      text

      Setting up the history data structures

      -

      text

      +

      text

      Populating the possible field list

      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). “Init time,” means that all calls to history_add_field must occur during the execution of cam_init (found in src/control/cam_comp.F90).

      + + +
    16. + + + + + + + + + + + + + + + +
    17. + + + + + + + + + + +
    18. + + + + + + + + + + + + + +
    19. + + + + + + + + + @@ -515,7 +919,18 @@ -

      CCPP Physics

      +

      Tool recommendations

      +

      This page lists recommendations for various tools one might use during CAM-SIMA development.

      +

      Please note that these standards are currently in development, and thus any of them could change at any time.

      +

      Version Control

      +

      The recommended version control tool is git.

      +

      Repository Hosting

      +

      We recommend Github for hosting software repositories

      +

      CI/CD

      +

      When possible, we recommend running any CI/CD workflows using Github Actions.

      +

      Container Software

      +

      We recommend using Docker for building and running containers.

      +

      More to Come!

      @@ -562,7 +977,7 @@

      CCPP Physics

      - + diff --git a/site/index.html b/site/index.html index 7a66bf18..11b6d681 100644 --- a/site/index.html +++ b/site/index.html @@ -80,7 +80,7 @@
      - + Skip to content @@ -116,7 +116,7 @@
      - Welcome to MkDocs + CAM-SIMA developer documentation
      @@ -254,64 +254,16 @@ - - - Welcome to MkDocs + CAM-SIMA developer documentation - - - -
    20. @@ -425,7 +377,7 @@ - CAM-SIMA Build Process + Build process @@ -446,7 +398,7 @@ - CAM-SIMA Run Process + Run process @@ -463,11 +415,11 @@
    21. - + - CCPP Physics + CCPP in CAM-SIMA @@ -509,7 +461,301 @@ - History & Model Output + History & model output + + + + +
    22. + + + + + + + + + + +
    23. + + + + + Design goals & features + + + + +
    24. + + + + + + + + + + + + + + + + + + + + + +
    25. + + + + + + + + + + +
    26. + + + + + + + + + + + + + +
    27. + + + + + + + + + @@ -585,21 +805,7 @@ -

      Welcome to MkDocs

      -

      For full documentation visit mkdocs.org.

      -

      Commands

      - -

      Project layout

      -
      mkdocs.yml    # The configuration file.
      -docs/
      -    index.md  # The documentation homepage.
      -    ...       # Other markdown pages, images and other files.
      -
      +

      CAM-SIMA developer documentation

      @@ -646,7 +852,7 @@

      Project layout

      - + diff --git a/site/search/search_index.json b/site/search/search_index.json index ea722e58..4cdfca9e 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":"Welcome to MkDocs","text":"

      For full documentation visit mkdocs.org.

      "},{"location":"#commands","title":"Commands","text":""},{"location":"#project-layout","title":"Project layout","text":"
      mkdocs.yml    # The configuration file.\ndocs/\n    index.md  # The documentation homepage.\n    ...       # Other markdown pages, images and other files.\n
      "},{"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:

      git clone  https://github.com/<GithubUserID>/CAM-SIMA\ncd CAM-SIMA\n\n

      NOTE: As you make changes and want to commit them to your github repos, you\u2019ll 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 \u201cgit status\u201d 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 \u201cgit status\u201d command. All other git commands will be relative to your current working directory as well.

      "},{"location":"design/cam-build-process/","title":"CAM-SIMA 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
        • Inputs:
          • <case>: A CIME case object
          • <case_log>: A python logger, which is usually created by CIME itself
        • Outputs:
          • config_dict: A dictionary of configure options, with the dictionary keys being the name of the config variable/option, and the dictionary values being special config variable objects that contain the following properties:
            • name: The name of the config option/variable. This is what is used as the key in the config_dict dictionary
            • desc: A text description of what this particular config option is, and what sort of values the config option should have.
            • value: The value of that config option/variable. Currently can only be an integer, string, or list of integers or strings.
            • valid_vals: Optional property that contains either a list or range of valid values for this particular config entry
            • valid_type: Optional property for a list-type config option that states what data type the list elements can have.
            • is_nml_attr: Logical that states whether this config option can be used as an XML attribute in a namelist definition file.
        • Additional info:
          • The ConfigCAM object also has various build-in methods that are used to call other steps in the build workflow, change the value of a given config variable, or print extra config info to the provided python logger.
          • The ConfigCAM object currently has no uses outside buildnml and buildlib, and so is not saved after those steps are complete.
      2. Generate CAM-SIMA source code. This sequence has several steps, each of which is performed if any of its inputs has changed.
        • Create or read in a BuildCacheCAM object (<srcroot>/cime_config/cam_build_cache.py).
          • <build_cache>: An optional cache file (created by previous build). This file is created in the case build directory (bld/atm/obj).
        • Create the physics derived data types using the registry (if required).
        • Find all scheme metadata files for configured suites.
        • Find any active schemes with namelist XML variables
          • Create metadata file with namelist variables
          • Create namelist-reading module (to go with metadata file).
        • Call the CCPP Framework to generate glue code (CAPS), (if required).
      "},{"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":"CAM-SIMA Run Process","text":""},{"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 by atm_comp_nuopc.F90 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): Allocate and set 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 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. Call the CCPP cap to run timestep_init phases of all schemes in the user-specified suite definition file (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 BEFORE the mediator/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 suite definition file (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 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 suite definition file (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 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_run2

      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!

      "},{"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 suite definition file (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 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 suite definition file (SDF)
      2. stepon_final (src/dynamics/<dycore>/stepon.F90): finalize dycore (doesn't currently do anything)
      3. atm2hub_deallocate and hub2atm_deallocate (src/control/camsrfexch.F90): deallocate cam_in/cam_out objects
      "},{"location":"design/ccpp-physics/","title":"CCPP Physics","text":""},{"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):
        • Host model constituents allow for constituents to be added as a constituent independent of the physics being run
        • Host constituents are added in cam_register_constituents (in src/control/cam_comp.F90). Currently, we are always adding water vapor as a host constituent because it is expected by the SE dycore.
      2. Constituent is a build-time physics constituent in a CCPP-ized scheme:
        • If a quantity is known to be a constituent at build-time, it is identified in the metadata for the scheme with: advected = True
      3. Constituent is a run-time physics constituent in a CCPP-ized scheme:
        • Sometimes, a scheme does not know what constituents it will require until run-time. In this case, an array of constituent properties (one for each needed constituent) is returned from the cam register phase. An example of how this works can be found in src/physics/ncar_ccpp/musica/micm/micm.F90
      "},{"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 \u201c*\u201d 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 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 seconds &hist_file_config_nl\u2002hist_filename_spec

      Example Take the following sample user_nl_cam:

      hist_output_frequency;h1: 5*ndays\nhist_max_frames;h1: 3\nhist_add_inst_fields;h1: U\nhist_add_inst_fields;h1: V, Q\nhist_precision;h1: REAL64\nhist_filename_spec;h1: my-history-file%m-%d\nhist_write_nstep0;h1: .false.\n

      It will be parsed by hist_config.py and this will be the relevant section of atm_in:

      &hist_config_arrays_nl\n    hist_num_inst_fields = 3\n    hist_num_avg_fields = 2\n    hist_num_min_fields = 0\n    hist_num_max_fields = 0\n    hist_num_var_fields = 0\n/\n\n&hist_file_config_nl\n    hist_volume = 'h0'\n    hist_avg_fields = 'T', 'Q'\n    hist_max_frames = 1\n    hist_output_frequency = '1*month'\n    hist_precision = 'REAL32'\n    hist_file_type = 'history'\n    hist_filename_spec = '%c.cam.%u.%y-%m-%d-%s.nc'\n    hist_write_nstep0 = .false.\n/\n\n&hist_file_config_nl\n    hist_volume = 'h1'\n    hist_inst_fields = 'U', \u2018V\u2019, \u2018Q\u2019\n    hist_max_frames = 3\n    hist_output_frequency = '5*ndays'\n    hist_precision = 'REAL64'\n    hist_file_type = 'history'\n    hist_filename_spec = 'my-history-file%m-%d'\n    hist_write_nstep0 = .false.\n/\n

      In plain English, a one-month run with these history configuration will result in a total of three files that will look something like these: - my-history-file01-06.nc - This file will contain instantaneous output for U, V, and Q (eastward_wind, northward_wind, and water vapor) - It will contain three frames, one at each of the following times: - 0001-01-06 (time=5) - 0001-01-11 (time=10) - 0001-01-16 (time=15) - my-history-file01-21.nc - This file will contain instantaneous output for U, V, and Q (eastward_wind, northward_wind, and water vapor) - It will contain three frames, one at each of the following times: - 0001-01-21 (time=20) - 0001-01-26 (time=25) - 0001-01-31 (time=30) - .cam.h0a.0001-02-01-00000.nc - This file will contain averaged output for T and Q (air_temperature and water vapor) - It will have one frame with the time calculated at the midpoint of the month"},{"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).