Understanding Model.Space Interface Classes in Forecast Models
In a series of talks, we delve into using the JEDI data assimilation system for forecast models and grids via Model.Space interface classes. Discover the importance of interface classes, the power they hold, and their implementation for specific models. Explore how these classes facilitate code instrumentation and execution tracking. Learn about OOPS abstract applications, the application layer, and various model implementations. Uncover the significance of interface templates in OOPS coding.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Model Space Jedi Academy
Introduction Over the course of the next two talks we ll examine the interface to the forecast model and see examples of using the JEDI data assimilation system for some forecast model and grid. It is not necessary to extensively understand the JEDI software to write an interface to a forecast model. Understanding needs to extend only to the interface classes associated with the forecast model and then how to implement them for some specific model. The interface classes associated with the forecast model are referred to as the Model Space. In this talk we will discuss the interface classes from a generic perspective. In the next talk we ll show an example of implementing a model.
Why Interface classes Using the C++ templates this is not strictly necessary, but it provides a convenient place to group all interfaces and make them visible Each interface class contains a pointer to the actual implementation defined by the model trait and essentially just passes the calls down An advantage of using the interface layer is that it can also be used to instrument the code Timing statistics Trace execution Interface classes are all in oops/src/oops/interface/
The power of interface classes OOPS abstract applications and interfaces Application layer Forecast EnDA 4DEnVar EnKF 4DVar H(x) Linear Model Observation Operator Observation Space Background Error State Increment GEOS GFS MOM6 SABER UFO IODA QG Model Generic implementations Specific implementations Implementations don t know which applications they are part of, and the applications don t know which model is being used.
Interfaces to templates Everywhere in the OOPS code are lines like this that proceed classes, methods, types etc. template <typename MODEL, typename OBS> This templating (described in other lectures) lets the classes or methods behave a certain way, for a certain model. MODEL contains what we call model space and is a list of the ways the interface classes that depend on the forecast model are templated.
The Model Interface Classes Class Description ErrorCovariance Background error covariance model (also implemented in SABER). Geometry The geometry of the forecast model/background grid. GeometryIterator Iterator over the grid points, needed only for LETKF applications. GetValues Interpolation from the model space state to observation locations. Increment Everything associated with an increment with model variables on the model grid. LinearModel The tangent linear and adjoint version of the forecast model. LinearVariableChange Transform between an increment with one set of fields and another. Localization Model ensemble localization (also implemented in SABER). Model The actual forecast model. ModelAuxControl ModelAuxCovariance Classes for dealing with model error. ModelAuxIncrement State Everything associated with the model state. VariableChange Transform between a state with one set of fields and another with different fields.
Implementation leads to applications incrementally You can also think of these classes as generic building blocks for applications: LinearModel ErrorCovariance Available applications - - - - - 3D or nomodel H(x) 3DVar / 4DEnVar Hybrid 3DVar / 4DEnVar H(x), forecast and 3DVar-FGAT Hybrid-4DVar Localization Geometry Model GetValues State Increment
Implementation leads to applications incrementally You can also think of these classes as generic building blocks for applications: LinearModel ErrorCovariance Available applications - - - - - 3D or nomodel H(x) 3DVar / 4DEnVar Hybrid 3DVar / 4DEnVar H(x), forecast and 3DVar-FGAT Hybrid-4DVar Localization Geometry Model GetValues State Increment
Implementation leads to applications incrementally You can also think of these classes as generic building blocks for applications: LinearModel ErrorCovariance Available applications - - - - - 3D or nomodel H(x) 3DVar / 4DEnVar Hybrid 3DVar / 4DEnVar H(x), forecast and 3DVar-FGAT Hybrid-4DVar Localization Geometry Model GetValues State Increment
Implementation leads to applications incrementally You can also think of these classes as generic building blocks for applications: LinearModel ErrorCovariance Available applications - - - - - 3D or nomodel H(x) 3DVar / 4DEnVar Hybrid 3DVar / 4DEnVar H(x), forecast and 3DVar-FGAT Hybrid-4DVar Localization Geometry Model GetValues State Increment
Implementation leads to applications incrementally You can also think of these classes as generic building blocks for applications: LinearModel ErrorCovariance Available applications - - - - - 3D or nomodel H(x) 3DVar / 4DEnVar Hybrid 3DVar / 4DEnVar H(x), forecast and 3DVar-FGAT Hybrid-4DVar Localization Geometry Model GetValues State Increment
Hybrid 4DVar application Incremental hybrid-4DVar involves a number of linear and nonlinear variable transforms: LinearModel Increment LinearVariableChange ErrorCovariance State Localization
Interface class - specification Class of specific implementation (from trait) Defines interfaces of methods Accessor functions Shared pointer to actual object
Interface class - method Example of a method in an interface class Timer will be destructed when going out of scope Constructor and destructor do the work Trace method on entry and exit Method of specific implementation is called, with actual arguments
Geometry class constructors Create a new Geometry object from scratch: Configuration Geometry::Geometry Communicator Create a new Geometry by copying an existing object: Geometry Geometry::Geometry
State class constructors Geometry Creates an empty state with given variables, resolution and date time. Variables State::State Datetime Creates a state with given geometry. Variables to allocate and file to read provided through configuration. Geometry State::State Configuration Create a state with a certain Geometry. Copy data from another state, changing resolution if needed. Geometry State::State State
State methods Update the time of the state Read and write the state Access the Geometry and Variables associated with this State Compute the norm of the state Zero the state data Accumulate (x = x+ax) Convert the state to a vector so can be communicated.
GetValues Constructor: Geometry Set up an interpolation object from the grid defined in the model geometry to the observation Locations. GetValues::GetValues Locations Method: State (obs operator variables) DateTime (subwindow begin) GeoVaLs GetValues::fillGeoVaLs Interpolate the incoming state to the observation locations, only filling the locations that are valid for the subwindow. DateTime (subwindow end)
OBSMODEL interface JEDI/UFO introduces standard interfaces between the model and observation worlds. Observation operators are independent of the model, easy sharing, exchange and comparison. Observation Locations Observation space GetValues Constructor MODEL Geometry IODA Observation operator Variables OOPS Variable names Observation vector GetValues Apply Step UFO GeoVals State Data
Increment class constructors Geometry Create an empty increment with given variables, resolution and date time. Variables Increment:: Increment Datetime Create an increment with a certain Geometry. Copy data from another increment, changing resolution if needed. Geometry Increment:: Increment Increment Create a new increment based on the Variables and Geometry of another increment. Copy the data if copy is true. Increment Increment:: Increment Bool copy
Increment methods All the methods in the State class plus the following: General operations on the increment needed for data assimilation operations. Interaction with SABER is conducted through Atlas field structures.
LinearGetValues Called once per outer loop Called every nonlinear time step Called every time step every inner loop
Model Class Constructor and destructor Public Forecast method Accessor functions Private forecast component methods Implementation
Forecasts in JEDI Model::Model Loop over forecasts Model constructor and destructor are called once per applications. PostProcessor Model::Initialize Loop over time steps Model::Initialize and Model::Finalize are called once per forecast. PostProcessor Model::Step Model::Step is called once per timestep per forecast. Model::Finalize PostProcessor Model::~Model
Forecast Method Note that the model does not have to implement the Forecast method in the State class
Model Class The model class is where JEDI interacts with the actual forecast model. JEDI views the forecast model as being able to propagate a state from one time step to the next. Geometry Model::Model Configuration State Model::Model State ModelAux
LinearModel Class The LinearModel interfaces are very similar to the Model interfaces. When calling the forecasts Increments are passed in place of States and there s an additional setTrajectory method for saving the 4D low resolution States.
VariableChange class Geometry VariableChange::VariableChange Configuration VariableChange:: changeVar VariableChange:: changeVarInverse State A State B State A
LinearVariableChange Constructor and destructor Convert increments