PISM, A Parallel Ice Sheet Model
stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
|
A class defining a common interface for most PISM sub-models. More...
#include <Component.hh>
Public Member Functions | |
Component (std::shared_ptr< const Grid > grid) | |
virtual | ~Component ()=default |
DiagnosticList | diagnostics () const |
TSDiagnosticList | ts_diagnostics () const |
std::shared_ptr< const Grid > | grid () const |
const Time & | time () const |
const Profiling & | profiling () 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 | |
enum | RegriddingFlag { REGRID_WITHOUT_REGRID_VARS , NO_REGRID_WITHOUT_REGRID_VARS } |
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 |
void | regrid (const std::string &module_name, array::Array &variable, RegriddingFlag flag=NO_REGRID_WITHOUT_REGRID_VARS) |
Protected Attributes | |
const std::shared_ptr< const Grid > | 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... | |
A class defining a common interface for most PISM sub-models.
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.
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:
Implement Component::max_timestep() to affect PISM's adaptive time-stepping mechanism.
Definition at line 118 of file Component.hh.