FV3 Bundle
IncrementL95.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_INCREMENTL95_H_
12 #define LORENZ95_INCREMENTL95_H_
13 
14 #include <ostream>
15 #include <string>
16 #include <vector>
17 
18 #include "lorenz95/FieldL95.h"
19 #include "lorenz95/Resolution.h"
20 
22 #include "oops/util/DateTime.h"
23 #include "oops/util/Duration.h"
24 #include "oops/util/ObjectCounter.h"
25 #include "oops/util/Printable.h"
26 
27 namespace eckit {
28  class Configuration;
29 }
30 
31 namespace oops {
32  class UnstructuredGrid;
33  class Variables;
34 }
35 
36 namespace lorenz95 {
37  class GomL95;
38  class LocsL95;
39  class ModelBiasCorrection;
40  class StateL95;
41  class Nothing;
42 
43 /// Increment Class: Difference between two states
44 /*!
45  * Some fields that are present in a State may not be present in
46  * an Increment. The Increment contains everything that is needed by
47  * the tangent-linear and adjoint models.
48  */
49 
50 // -----------------------------------------------------------------------------
51 class IncrementL95 : public util::Printable,
53  private util::ObjectCounter<IncrementL95> {
54  public:
55  static const std::string classname() {return "lorenz95::IncrementL95";}
56 
57 /// Constructor, destructor
58  IncrementL95(const Resolution &, const oops::Variables &, const util::DateTime &);
59  IncrementL95(const Resolution &, const IncrementL95 &);
60  IncrementL95(const IncrementL95 &, const bool);
61  virtual ~IncrementL95();
62 
63 /// Basic operators
64  void diff(const StateL95 &, const StateL95 &);
65  void zero();
66  void zero(const util::DateTime &);
67  void dirac(const eckit::Configuration &);
71  IncrementL95 & operator*=(const double &);
72  void axpy(const double &, const IncrementL95 &, const bool check = true);
73  double dot_product_with(const IncrementL95 &) const;
74  void schur_product_with(const IncrementL95 &);
75  void random();
76 
77 /// Get increment values at obs locations
78  void getValuesTL(const LocsL95 &, const oops::Variables &,
79  GomL95 &, const Nothing &) const;
80  void getValuesAD(const LocsL95 &, const oops::Variables &,
81  const GomL95 &, const Nothing &);
82 
83 /// Unstructured grid
84  void ug_coord(oops::UnstructuredGrid &, const int &) const;
85  void field_to_ug(oops::UnstructuredGrid &, const int &) const;
87 
88 // Utilities
89  void read(const eckit::Configuration &);
90  void write(const eckit::Configuration &) const;
91  double norm () const {return fld_.rms();}
92  const util::DateTime & validTime() const {return time_;}
93  util::DateTime & validTime() {return time_;}
94  void updateTime(const util::Duration & dt) {time_ += dt;}
95 
96 /// Access to data
97  const FieldL95 & getField() const {return fld_;}
98  FieldL95 & getField() {return fld_;}
99  boost::shared_ptr<const Resolution> geometry() const {
100  boost::shared_ptr<const Resolution> geom(new Resolution(fld_.resol()));
101  return geom;
102  }
103  std::vector<double> & asVector() {return fld_.asVector();}
104  const std::vector<double> & asVector() const {return fld_.asVector();}
105 
106  void accumul(const double &, const StateL95 &);
107 
108  private:
109  void print(std::ostream &) const;
111  util::DateTime time_;
112 };
113 
114 // -----------------------------------------------------------------------------
115 
116 } // namespace lorenz95
117 
118 #endif // LORENZ95_INCREMENTL95_H_
FieldL95 & getField()
Definition: IncrementL95.h:98
double norm() const
Definition: IncrementL95.h:91
void diff(const StateL95 &, const StateL95 &)
Basic operators.
GomL95 class to handle locations for L95 model.
Definition: GomL95.h:32
double dot_product_with(const IncrementL95 &) const
boost::shared_ptr< const Resolution > geometry() const
Definition: IncrementL95.h:99
Increment Class: Difference between two states.
Definition: IncrementL95.h:51
void field_from_ug(const oops::UnstructuredGrid &)
void getValuesAD(const LocsL95 &, const oops::Variables &, const GomL95 &, const Nothing &)
void updateTime(const util::Duration &dt)
Definition: IncrementL95.h:94
void field_to_ug(oops::UnstructuredGrid &, const int &) const
void getValuesTL(const LocsL95 &, const oops::Variables &, GomL95 &, const Nothing &) const
Get increment values at obs locations.
LocsL95 class to handle locations for L95 model.
Definition: LocsL95.h:28
Handles resolution.
Definition: Resolution.h:25
The namespace for the main oops code.
double rms() const
Definition: FieldL95.cc:192
const FieldL95 & getField() const
Access to data.
Definition: IncrementL95.h:97
IncrementL95 & operator-=(const IncrementL95 &)
const std::vector< double > & asVector() const
Definition: IncrementL95.h:104
void ug_coord(oops::UnstructuredGrid &, const int &) const
Unstructured grid.
void dirac(const eckit::Configuration &)
void accumul(const double &, const StateL95 &)
void axpy(const double &, const IncrementL95 &, const bool check=true)
The namespace for the L95 model.
std::vector< double > & asVector()
Definition: IncrementL95.h:103
static const std::string classname()
Definition: IncrementL95.h:55
util::DateTime & validTime()
Definition: IncrementL95.h:93
const int & resol() const
Set and get.
Definition: FieldL95.h:66
util::DateTime time_
Definition: IncrementL95.h:111
IncrementL95 & operator+=(const IncrementL95 &)
void write(const eckit::Configuration &) const
IncrementL95 & operator=(const IncrementL95 &)
void read(const eckit::Configuration &)
Utilities.
void schur_product_with(const IncrementL95 &)
IncrementL95(const Resolution &, const oops::Variables &, const util::DateTime &)
Constructor, destructor.
L95 model state.
Definition: StateL95.h:50
std::vector< double > & asVector()
Definition: FieldL95.h:69
Abstract base class for quantities.
IncrementL95 & operator*=(const double &)
const util::DateTime & validTime() const
Definition: IncrementL95.h:92
void print(std::ostream &) const
Class to represent fields for the L95 model.
Definition: FieldL95.h:36