PISM, A Parallel Ice Sheet Model  stable v2.0.6 committed by Constantine Khrulev on 2023-01-23 15:14:38 -0900
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
pism::Component Class Reference

A class defining a common interface for most PISM sub-models. More...

#include <Component.hh>

+ Inheritance diagram for pism::Component:

Public Member Functions

 Component (IceGrid::ConstPtr g)
virtual ~Component ()=default
DiagnosticList diagnostics () const
TSDiagnosticList ts_diagnostics () const
IceGrid::ConstPtr grid () const
void define_model_state (const File &output) const
 Define model state variables in an output file. More...
void write_model_state (const File &output) const
 Write model state variables to an output file. More...
MaxTimestep max_timestep (double t) const
 Reports the maximum time-step the model can take at time t. More...

Protected Types

 This flag determines whether a variable is read from the -regrid_file file even if it is not listed among variables in -regrid_vars. More...

Protected Member Functions

virtual MaxTimestep max_timestep_impl (double t) const
virtual void define_model_state_impl (const File &output) const
 The default (empty implementation). More...
virtual void write_model_state_impl (const File &output) const
 The default (empty implementation). More...
virtual DiagnosticList diagnostics_impl () const
virtual TSDiagnosticList ts_diagnostics_impl () const
virtual void regrid (const std::string &module_name, IceModelVec &variable, RegriddingFlag flag=NO_REGRID_WITHOUT_REGRID_VARS)

Protected Attributes

const IceGrid::ConstPtr m_grid
 grid used by this component More...
const Config::ConstPtr m_config
 configuration database used by this component More...
const units::System::Ptr m_sys
 unit system used by this component More...
const Logger::ConstPtr m_log
 logger (for easy access) More...

Detailed Description

A class defining a common interface for most PISM sub-models.

PISM's model components and their interface

We've found that many sub-models in PISM share some tasks: they need to be "initialized", "updated", asked for diagnostic quantities, asked to write the model state...

Component and its derived classes were created to have a common interface for PISM sub-models, such as surface, atmosphere, ocean and bed deformation models.


Component::init() should contain all the initialization code, excluding memory-allocation. (We might need to "re-initialize" a component.)

Many PISM sub-models read data from the same file the rest of PISM reads from. Component::find_pism_input() checks options -i and -bootstrap options to simplify finding this file.

Writing to an output file

A PISM component needs to implement the following I/O methods:

Why are all these methods needed? In PISM we separate defining and writing NetCDF variables because defining all the NetCDF variables before writing data is a lot faster than defining a variable, writing it, defining the second variable, etc. (See http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Parts-of-a-NetCDF-Classic-File.html#Parts-of-a-NetCDF-Classic-File for a technical explanation.)

Within IceModel the following steps are done to write 2D and 3D fields to an output file:

Restricting time-steps

Implement Component::max_timestep() to affect PISM's adaptive time-stepping mechanism.

Definition at line 101 of file Component.hh.

The documentation for this class was generated from the following files: