FV3 Bundle
PseudoModel.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2018 UCAR.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #ifndef OOPS_GENERIC_PSEUDOMODEL_H_
9 #define OOPS_GENERIC_PSEUDOMODEL_H_
10 
11 #include <string>
12 
15 #include "oops/interface/ModelBase.h"
16 #include "oops/interface/State.h"
17 #include "oops/util/Duration.h"
18 #include "oops/util/Logger.h"
19 #include "oops/util/ObjectCounter.h"
20 #include "oops/util/Printable.h"
21 #include "oops/util/Timer.h"
22 
23 namespace eckit {
24  class Configuration;
25 }
26 
27 namespace oops {
28 
29 /// Encapsulates a pseudo forecast model.
30 /*!
31  * Generic implementation of the pseudo model.
32  */
33 
34 // -----------------------------------------------------------------------------
35 
36 template <typename MODEL>
37 class PseudoModel : public ModelBase<MODEL> {
38  typedef typename MODEL::Geometry Geometry_;
39  typedef typename MODEL::ModelAuxControl ModelAux_;
40  typedef typename MODEL::State State_;
41 
42  public:
43  static const std::string classname() {return "oops::PseudoModel";}
44 
45  PseudoModel(const Geometry_ &, const eckit::Configuration &);
46  ~PseudoModel();
47 
48 // Run the Pseudo forecast
49  void initialize(State_ &) const override;
50  void step(State_ &, const ModelAux_ &) const override;
51  void finalize(State_ &) const override;
52 
53 // Information and diagnostics
54  const util::Duration & timeResolution() const override {return tstep_;}
55  void print(std::ostream &) const override {}
56 
57  private:
59  const util::Duration tstep_;
60 };
61 
62 // =============================================================================
63 
64 template<typename MODEL>
65 PseudoModel<MODEL>::PseudoModel(const Geometry_ & resol, const eckit::Configuration & tlConf)
66  : resol_(resol), tstep_(util::Duration(tlConf.getString("tstep")))
67 {
68  Log::trace() << "PseudoModel<MODEL>::PseudoModel done" << std::endl;
69 }
70 
71 // -----------------------------------------------------------------------------
72 
73 template<typename MODEL>
75  Log::trace() << "PseudoModel<MODEL>::~PseudoModel done" << std::endl;
76 }
77 
78 // -----------------------------------------------------------------------------
79 
80 template<typename MODEL>
82  Log::info() << "PseudoModel<MODEL>:initialize Starting " << std::endl;
83  Log::trace() << "PseudoModel<MODEL>::initialize done" << std::endl;
84 }
85 
86 // -----------------------------------------------------------------------------
87 
88 template<typename MODEL>
89 void PseudoModel<MODEL>::step(State_ & xx, const ModelAux_ & merr) const {
90  Log::info() << "PseudoModel<MODEL>:step Starting " << std::endl;
91  xx.updateTime(tstep_);
92  Log::trace() << "PseudoModel<MODEL>::step done" << std::endl;
93 }
94 
95 // -----------------------------------------------------------------------------
96 
97 template<typename MODEL>
99  Log::info() << "PseudoModel<MODEL>:finalize Starting " << std::endl;
100  Log::trace() << "PseudoModel<MODEL>::finalize done" << std::endl;
101 }
102 
103 // -----------------------------------------------------------------------------
104 
105 } // namespace oops
106 
107 #endif // OOPS_GENERIC_PSEUDOMODEL_H_
MODEL::Geometry Geometry_
Definition: PseudoModel.h:38
Encapsulates a pseudo forecast model.
Definition: PseudoModel.h:37
void initialize(State_ &) const override
Definition: PseudoModel.h:81
Encapsulates the model state.
MODEL::State State_
Definition: PseudoModel.h:40
void finalize(State_ &) const override
Definition: PseudoModel.h:98
The namespace for the main oops code.
subroutine, public info(self)
const util::Duration tstep_
Definition: PseudoModel.h:59
void print(std::ostream &) const override
Definition: PseudoModel.h:55
const util::Duration & timeResolution() const override
Definition: PseudoModel.h:54
void step(State_ &, const ModelAux_ &) const override
Definition: PseudoModel.h:89
Base class for encapsulation of the forecast model.
Definition: ModelBase.h:40
const Geometry_ resol_
Definition: PseudoModel.h:58
MODEL::ModelAuxControl ModelAux_
Definition: PseudoModel.h:39
PseudoModel(const Geometry_ &, const eckit::Configuration &)
Definition: PseudoModel.h:65
static const std::string classname()
Definition: PseudoModel.h:43