MPAS-JEDI
TlmMPAS.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017 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 MPASJEDI_TLMMPAS_H_
9 #define MPASJEDI_TLMMPAS_H_
10 
11 #include <map>
12 #include <ostream>
13 #include <string>
14 #include <vector>
15 
16 #include "oops/base/Variables.h"
17 #include "oops/interface/LinearModelBase.h"
18 
19 #include "mpasjedi/Fortran.h"
20 #include "mpasjedi/ModelMPAS.h"
21 #include "mpasjedi/MPASTraits.h"
22 
23 // Forward declarations
24 namespace eckit {
25  class Configuration;
26 }
27 
28 namespace mpas {
29  class StateMPAS;
30  class IncrementMPAS;
31 
32 // -----------------------------------------------------------------------------
33 /// LFRic linear model definition.
34 /*!
35  * LFRic linear model definition and configuration parameters.
36  */
37 
38 class TlmMPAS: public oops::interface::LinearModelBase<MPASTraits>,
39  private util::ObjectCounter<TlmMPAS> {
40  public:
41  static const std::string classname() {return "mpas::TlmMPAS";}
42 
43  TlmMPAS(const GeometryMPAS &, const eckit::Configuration &);
44  ~TlmMPAS();
45 
46 /// Model trajectory computation
47  void setTrajectory(const StateMPAS &, StateMPAS &, const ModelBiasMPAS &)
48  override;
49 
50 /// Run TLM and its adjoint
51  void initializeTL(IncrementMPAS &) const override;
52  void stepTL(IncrementMPAS &, const ModelBiasIncrementMPAS &) const override;
53  void finalizeTL(IncrementMPAS &) const override;
54 
55  void initializeAD(IncrementMPAS &) const override;
56  void stepAD(IncrementMPAS &, ModelBiasIncrementMPAS &) const override;
57  void finalizeAD(IncrementMPAS &) const override;
58 
59 /// Other utilities
60  const util::Duration & timeResolution() const override {return tstep_;}
61  const GeometryMPAS & resolution() const {return resol_;}
62  const oops::Variables & variables() const override {return linvars_;}
63 
64  private:
65  void print(std::ostream &) const override;
66  typedef std::map< util::DateTime, int >::iterator trajIter;
67  typedef std::map< util::DateTime, int >::const_iterator trajICst;
68 
69 // Data
71  util::Duration tstep_;
73  std::map< util::DateTime, F90traj> traj_;
75  const oops::Variables linvars_;
76 };
77 // -----------------------------------------------------------------------------
78 
79 } // namespace mpas
80 #endif // MPASJEDI_TLMMPAS_H_
GeometryMPAS handles geometry for MPAS model.
Definition: GeometryMPAS.h:37
Increment Class: Difference between two states.
Definition: IncrementMPAS.h:57
Model error for the MPAS model.
Definition: ModelBiasMPAS.h:38
MPAS model definition.
Definition: ModelMPAS.h:41
MPAS model state.
Definition: StateMPAS.h:51
LFRic linear model definition.
Definition: TlmMPAS.h:39
void finalizeTL(IncrementMPAS &) const override
Definition: TlmMPAS.cc:84
void stepAD(IncrementMPAS &, ModelBiasIncrementMPAS &) const override
Definition: TlmMPAS.cc:92
TlmMPAS(const GeometryMPAS &, const eckit::Configuration &)
Definition: TlmMPAS.cc:24
void stepTL(IncrementMPAS &, const ModelBiasIncrementMPAS &) const override
Definition: TlmMPAS.cc:70
F90model keyConfig_
Definition: TlmMPAS.h:70
void initializeTL(IncrementMPAS &) const override
Run TLM and its adjoint.
Definition: TlmMPAS.cc:65
const GeometryMPAS & resolution() const
Definition: TlmMPAS.h:61
std::map< util::DateTime, F90traj > traj_
Definition: TlmMPAS.h:73
const util::Duration & timeResolution() const override
Other utilities.
Definition: TlmMPAS.h:60
void print(std::ostream &) const override
Definition: TlmMPAS.cc:111
const ModelMPAS lrmodel_
Definition: TlmMPAS.h:74
void initializeAD(IncrementMPAS &) const override
Definition: TlmMPAS.cc:88
std::map< util::DateTime, int >::iterator trajIter
Definition: TlmMPAS.h:66
static const std::string classname()
Definition: TlmMPAS.h:41
const GeometryMPAS resol_
Definition: TlmMPAS.h:72
const oops::Variables linvars_
Definition: TlmMPAS.h:75
util::Duration tstep_
Definition: TlmMPAS.h:71
const oops::Variables & variables() const override
Definition: TlmMPAS.h:62
void setTrajectory(const StateMPAS &, StateMPAS &, const ModelBiasMPAS &) override
Model trajectory computation.
Definition: TlmMPAS.cc:46
std::map< util::DateTime, int >::const_iterator trajICst
Definition: TlmMPAS.h:67
void finalizeAD(IncrementMPAS &) const override
Definition: TlmMPAS.cc:106
Definition: Fortran.h:17
int F90model
Definition: Fortran.h:34