The Joint Effort for Data assimilation Integration Model

  • Slides: 12
Download presentation
The Joint Effort for Data assimilation Integration Model Space Structures Joint Center for Satellite

The Joint Effort for Data assimilation Integration Model Space Structures Joint Center for Satellite Data Assimilation (JCSDA)

Interfaces Classes All model or observation specific classes are wrapped into an interface class

Interfaces Classes All model or observation specific classes are wrapped into an interface class Using the C++ templates this is not strictly necessary but provides a convenient place to group all interfaces and make them visible Each interface class contains a (smart) pointer to the actual implementation defined by the “model trait” and passes the calls down The interface layer is also used to instrument the code Timing statistics Trace execution Interface classes are all in oops/src/oops/interface

Interfaces Classes template <typename MODEL> class State { typedef typename MODEL: : State_; public:

Interfaces Classes template <typename MODEL> class State { typedef typename MODEL: : State_; public: /// Most methods have been removed for readability /// Interfacing State_ & state() {return *state_; } const State_ & state() const {return *state_; } /// Get state values at observation locations void get. Values(const Locations_ &, const Variables &, Geo. Va. Ls_ &) const; private: boost: : scoped_ptr<State_> state_; ; { Class of specific implementation (from trait) Access specific object (only for use in interface classes) Name of method is name of class in lowercase Smart pointer to actual object

Interfaces Classes Example of a method in an interface class template<typename MODEL> void State<MODEL>:

Interfaces Classes Example of a method in an interface class template<typename MODEL> void State<MODEL>: : get. Values(const Locations_ & locs, const Variables & vars, Geo. Va. Ls_ & gvals) const} Log: : trace() << "State<MODEL>: : get. Values starting" << std: : endl; util: : Timer timer(classname(), "get. Values"); state_->get. Values(locs. locations(), vars, gvals. geovals()); Log: : trace() << "State<MODEL>: : get. Values done" << std: : endl; } Trace method on entry and exit Timer will be destructed when going out of scope Constructor and destructor do the work Method of specific implementation is called, with actual arguments

Model Space Interface Classes Model space-related classes required by OOPS-JEDI Geometry State Increment Geometry,

Model Space Interface Classes Model space-related classes required by OOPS-JEDI Geometry State Increment Geometry, State and Increment Model Linear. Models Error. Covariance Localization Background error covariance Model. Aux. Control Model. Aux. Covariance Model. Aux. Increment Model bias correction or parameter estimation (empty for now)

Geometry Class template <typename MODEL> class Geometry : public util: : Printable, private util:

Geometry Class template <typename MODEL> class Geometry : public util: : Printable, private util: : Object. Counter<Geometry<MODEL> > { typedef typename MODEL: : Geometry_; public: static const std: : string classname() {return "oops: : Geometry"; } explicit Geometry(const eckit: : Configuration &); Geometry(const Geometry &); explicit Geometry(boost: : shared_ptr<const Geometry_>); ~Geometry(); /// Interfacing const Geometry_ & geometry() const {return *geom_; } private: Geometry & operator=(const Geometry &); void print(std: : ostream &) const; boost: : shared_ptr<const Geometry_> geom_; ; {

State Class template <typename MODEL> class State : public util: : Printable, private util:

State Class template <typename MODEL> class State : public util: : Printable, private util: : Object. Counter<State<MODEL> > { public: static const std: : string classname() {return "oops: : State"; } /// Constructor, destructor State(const Geometry_ &, const eckit: : Configuration &); State(const Geometry_ &, const State &); State(const State &); ~ State; () State & operator=(const State &); /// Interfacing State_ & state() {return *state_; } const State_ & state() const {return *state_; } /// Get state values at observation locations void get. Values(const Locations_ &, const Variables &, Geo. Va. Ls_ &) const; void get. Values(const Locations_ &, const Variables &, Geo. Va. Ls_ &, Interpolator. Traj_ &) const; ///Time const util: : Date. Time valid. Time() const {return state_->valid. Time(); } /// I/O and diagnostics void read(const eckit: : Configuration &); void write(const eckit: : Configuration &) const; double norm() const; Geometry_ geometry() const; private: void print(std: : ostream &) const; boost: : scoped_ptr<State_> state_; ; {

Increment Class template <typename MODEL> class Increment { public: static const std: : string

Increment Class template <typename MODEL> class Increment { public: static const std: : string classname() {return "oops: : Increment"; } /// Constructor, destructor Increment(const Geometry_ &, const Variables &, const util: : Date. Time &); Increment(const Geometry_ &, const Increment &); Increment(const Increment &, const bool copy = true); virtual ~Increment(); /// Interfacing Increment_ & increment() {return *increment_; } const Increment_ & increment() const {return *increment_; } /// Get increment values at observation locations void get. Values. TL(const Locations_ &, const Variables &, Geo. Va. Ls_ &, const Interpolator. Traj_ &) const; void get. Values. AD(const Locations_ &, const Variables &, const Geo. Va. Ls_ &, const Interpolator. Traj_ &); /// Interactions with State void diff(const State_ &, const State_ &); ///Time const util: : Date. Time valid. Time() const {return increment_->valid. Time(); } void update. Time(const util: : Duration & dt) {increment_->update. Time(dt); } /// Linear algebra operators void zero(); void zero(const util: : Date. Time &); Increment & operator =(const Increment &); Increment & operator+=(const Increment &); Increment & operator-=(const Increment &); Increment & operator*=(const double &); void axpy(const double &, const Increment &, const bool check = true); double dot_product_with(const Increment &) const; void schur_product_with(const Increment &); void random(); void accumul(const double &, const State_ &); /// I/O and diagnostics void read(const eckit: : Configuration &); void write(const eckit: : Configuration &) const; private: void print(std: : ostream &) const; boost: : scoped_ptr<Increment_> increment_; ; {

Model Class template <typename MODEL> class Model : public util: : Printable, private boost:

Model Class template <typename MODEL> class Model : public util: : Printable, private boost: : noncopyable, private util: : Object. Counter<Model<MODEL> > { typedef typename MODEL: : Model_; typedef Geometry<MODEL> Geometry_; typedef Model. Aux. Control<MODEL> Model. Aux_; typedef State<MODEL> State; _ public: static const std: : string classname() {return "oops: : Model"; } Model(const Geometry_ &, const eckit: : Configuration &); ~ Model; () // Run the forecast void forecast(State_ &, const Model. Aux_ &, const util: : Duration &, Post. Processor<State_> &) const; // Information and diagnostics const util: : Duration & time. Resolution() const {return model_->time. Resolution(); } private: void initialize(State_ &) const; void step(State_ &, const Model. Aux_ &) const; void finalize(State_ &) const; void print(std: : ostream &) const; boost: : scoped_ptr<Model_> model_; ; {

Model Class template<typename MODEL> void Model<MODEL>: : forecast(State_ & xx, const Model. Aux_ &

Model Class template<typename MODEL> void Model<MODEL>: : forecast(State_ & xx, const Model. Aux_ & maux, const util: : Duration & len, Post. Processor<State_> & post) const} Log: : trace() << "Model<MODEL>: : forecast starting" << std: : endl; util: : Timer timer(classname(), "forecast"); const util: : Date. Time end(xx. valid. Time() + len); this->initialize(xx); post. initialize(xx, end, model_->time. Resolution()); post. process(xx); while (xx. valid. Time() < end) { this->step(xx, maux); post. process(xx); { post. finalize(xx); this->finalize(xx); ASSERT(xx. valid. Time() == end); Log: : trace() << "Model<MODEL>: : forecast done" << std: : endl; }

Linear. Model Class template <typename MODEL> class Linear. Model : public util: : Printable,

Linear. Model Class template <typename MODEL> class Linear. Model : public util: : Printable, private boost: : noncopyable, private util: : Object. Counter<Linear. Model<MODEL> > { public: static const std: : string classname() {return "oops: : Linear. Model"; } Linear. Model(const Geometry_ &, const eckit: : Configuration &); ~Linear. Model(); /// Run the tangent linear forecast void forecast. TL(Increment_ &, const Model. Aux. Incr_ &, const util: : Duration &, Post. Processor<Increment_> post = Post. Processor<Increment_>(), Post. Processor. TLAD<MODEL> cost = Post. Processor. TLAD<MODEL>(), const bool idmodel = false) const; /// Run the adjoint forecast void forecast. AD(Increment_ &, Model. Aux. Incr_ &, const util: : Duration &, Post. Processor<Increment_> post = Post. Processor<Increment_>(), Post. Processor. TLAD<MODEL> cost = Post. Processor. TLAD<MODEL>(), const bool idmodel = false) const; // Set the linearization trajectory void set. Trajectory(const State_ &, const Model. Aux_ &); // Information and diagnostics const util: : Duration & time. Resolution() const {return tlm_->time. Resolution(); } protected: // Run the TL forecast void initialize. TL(Increment_ &) const; void step. TL(Increment_ &, const Model. Aux. Incr_ &) const; void finalize. TL(Increment_ &) const; // Run the AD forecast void initialize. AD(Increment_ &) const; void step. AD(Increment_ &, Model. Aux. Incr_ &) const; void finalize. AD(Increment_ &) const; private: // diagnostics void print(std: : ostream &) const; boost: : scoped_ptr<Linear. Model. Base_> tlm_; ; {

Error. Covariance Class template <typename MODEL> class Error. Covariance : public oops: : Model.

Error. Covariance Class template <typename MODEL> class Error. Covariance : public oops: : Model. Space. Covariance. Base<MODEL>, public util: : Printable, private util: : Object. Counter<Error. Covariance<MODEL> >, private boost: : noncopyable} typedef typename MODEL: : Covariance_; typedef Geometry<MODEL> Geometry_; typedef Increment<MODEL> Increment_; typedef State<MODEL> State; _ public: static const std: : string classname() {return "oops: : Error. Covariance"; } Error. Covariance(const Geometry_ &, const Variables &, const eckit: : Configuration &, const State; (& _ virtual ~Error. Covariance(); void linearize(const State_ &, const Geometry_ &) override; void multiply(const Increment_ &, Increment_ &) const override; void inverse. Multiply(const Increment_ &, Increment_ &) const override; void randomize(Increment_ &) const override; private: void print(std: : ostream &) const override; boost: : scoped_ptr<Covariance_> covariance_; ; {