FV3 Bundle
TLML95.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
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  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef LORENZ95_TLML95_H_
12 #define LORENZ95_TLML95_H_
13 
14 #include <map>
15 #include <ostream>
16 #include <string>
17 
18 #include <boost/noncopyable.hpp>
19 
21 #include "oops/base/Variables.h"
22 #include "oops/util/Duration.h"
23 #include "oops/util/ObjectCounter.h"
24 #include "oops/util/Printable.h"
25 
26 #include "lorenz95/L95Traits.h"
27 #include "lorenz95/ModelL95.h"
28 
29 // Forward declarations
30 namespace eckit {
31  class Configuration;
32 }
33 
34 namespace util {
35  class DateTime;
36 }
37 
38 namespace lorenz95 {
39  class FieldL95;
40 
41 // -----------------------------------------------------------------------------
42 /// Lorenz 95 linear model definition.
43 
44 class TLML95: public oops::LinearModelBase<L95Traits>,
45  private util::ObjectCounter<TLML95> {
46  public:
47  static const std::string classname() {return "lorenz95::TLML95";}
48 
49  TLML95(const Resolution &, const eckit::Configuration &);
50  ~TLML95();
51 
52 /// Model trajectory computation
53  void setTrajectory(const StateL95 &, StateL95 &, const ModelBias &) override;
54 
55 /// Run TLM and its adjoint
56  void initializeTL(IncrementL95 &) const override;
57  void stepTL(IncrementL95 &, const ModelBiasCorrection &) const override;
58  void finalizeTL(IncrementL95 &) const override;
59 
60  void initializeAD(IncrementL95 &) const override;
61  void stepAD(IncrementL95 &, ModelBiasCorrection &) const override;
62  void finalizeAD(IncrementL95 &) const override;
63 
64 /// Other utilities
65  const util::Duration & timeResolution() const override {return tstep_;}
66  const Resolution & resolution() const {return resol_;}
67  const oops::Variables & variables() const {return vars_;}
68 
69  private:
70  const ModelTrajectory * getTrajectory(const util::DateTime &) const;
71  void tendenciesTL(const FieldL95 &, const double &, const FieldL95 &, FieldL95 &) const;
72  void tendenciesAD(FieldL95 &, double &, const FieldL95 &, const FieldL95 &) const;
73  void print(std::ostream &) const override;
74 
75  typedef std::map< util::DateTime, ModelTrajectory * >::iterator trajIter;
76  typedef std::map< util::DateTime, ModelTrajectory * >::const_iterator trajICst;
77 
78 // Data
80  const util::Duration tstep_;
81  const double dt_;
82  std::map< util::DateTime, ModelTrajectory * > traj_;
85 };
86 
87 // -----------------------------------------------------------------------------
88 
89 } // namespace lorenz95
90 
91 #endif // LORENZ95_TLML95_H_
void stepAD(IncrementL95 &, ModelBiasCorrection &) const override
const util::Duration tstep_
Definition: TLML95.h:80
Increment Class: Difference between two states.
Definition: IncrementL95.h:51
std::map< util::DateTime, ModelTrajectory *>::const_iterator trajICst
Definition: TLML95.h:76
void tendenciesAD(FieldL95 &, double &, const FieldL95 &, const FieldL95 &) const
void finalizeAD(IncrementL95 &) const override
const double dt_
Definition: TLML95.h:81
const ModelTrajectory * getTrajectory(const util::DateTime &) const
Lorenz 95 linear model definition.
Definition: TLML95.h:44
void tendenciesTL(const FieldL95 &, const double &, const FieldL95 &, FieldL95 &) const
Lorenz 95 model configuration and computations.
Definition: ModelL95.h:38
Handles resolution.
Definition: Resolution.h:25
const oops::Variables & variables() const
Definition: TLML95.h:67
const ModelL95 lrmodel_
Definition: TLML95.h:83
void finalizeTL(IncrementL95 &) const override
const util::Duration & timeResolution() const override
Other utilities.
Definition: TLML95.h:65
std::map< util::DateTime, ModelTrajectory *>::iterator trajIter
Definition: TLML95.h:75
void stepTL(IncrementL95 &, const ModelBiasCorrection &) const override
The namespace for the L95 model.
Base class for encapsulation of the linear forecast model.
void print(std::ostream &) const override
void setTrajectory(const StateL95 &, StateL95 &, const ModelBias &) override
Model trajectory computation.
std::map< util::DateTime, ModelTrajectory *> traj_
Definition: TLML95.h:82
const Resolution & resolution() const
Definition: TLML95.h:66
Model error for Lorenz 95 model.
static const std::string classname()
Definition: TLML95.h:47
void initializeTL(IncrementL95 &) const override
Run TLM and its adjoint.
L95 model trajectory.
const oops::Variables vars_
Definition: TLML95.h:84
const Resolution resol_
Definition: TLML95.h:79
L95 model state.
Definition: StateL95.h:50
void initializeAD(IncrementL95 &) const override
TLML95(const Resolution &, const eckit::Configuration &)
Class to represent fields for the L95 model.
Definition: FieldL95.h:36