FV3 Bundle
IncrementFV3JEDI.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-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 
9 #include <algorithm>
10 #include <string>
11 #include <vector>
12 
13 #include "eckit/config/LocalConfiguration.h"
14 #include "oops/base/Variables.h"
16 #include "oops/util/DateTime.h"
17 #include "oops/util/Duration.h"
18 #include "oops/util/Logger.h"
19 
20 #include "ioda/Locations.h"
21 #include "ufo/GeoVaLs.h"
22 
24 #include "ErrorCovarianceFV3JEDI.h"
25 #include "GeometryFV3JEDI.h"
26 #include "GetValuesTrajFV3JEDI.h"
28 #include "StateFV3JEDI.h"
29 
30 namespace fv3jedi {
31 
32 // -----------------------------------------------------------------------------
33 /// Constructor, destructor
34 // -----------------------------------------------------------------------------
36  const oops::Variables & vars,
37  const util::DateTime & time):
38  geom_(new GeometryFV3JEDI(geom)), vars_(vars), time_(time)
39 {
40  const eckit::Configuration * conf = &vars_.toFortran();
43  oops::Log::trace() << "IncrementFV3JEDI constructed." << std::endl;
44 }
45 // -----------------------------------------------------------------------------
47  const IncrementFV3JEDI & other)
48  : geom_(new GeometryFV3JEDI(geom)), vars_(other.vars_), time_(other.time_)
49 {
50  const eckit::Configuration * conf = &vars_.toFortran();
53  oops::Log::trace() << "IncrementFV3JEDI constructed from other." << std::endl;
54 }
55 // -----------------------------------------------------------------------------
57  const bool copy)
58  : geom_(other.geom_), vars_(other.vars_), time_(other.time_)
59 {
60  const eckit::Configuration * conf = &vars_.toFortran();
62  if (copy) {
64  } else {
66  }
67  oops::Log::trace() << "IncrementFV3JEDI copy-created." << std::endl;
68 }
69 // -----------------------------------------------------------------------------
71  : geom_(other.geom_), vars_(other.vars_), time_(other.time_)
72 {
73  const eckit::Configuration * conf = &vars_.toFortran();
76  oops::Log::trace() << "IncrementFV3JEDI copy-created." << std::endl;
77 }
78 // -----------------------------------------------------------------------------
81  oops::Log::trace() << "IncrementFV3JEDI destructed" << std::endl;
82 }
83 // -----------------------------------------------------------------------------
84 /// Basic operators
85 // -----------------------------------------------------------------------------
86 void IncrementFV3JEDI::diff(const StateFV3JEDI & x1, const StateFV3JEDI & x2) {
87  ASSERT(this->validTime() == x1.validTime());
88  ASSERT(this->validTime() == x2.validTime());
90 }
91 // -----------------------------------------------------------------------------
94  time_ = rhs.time_;
95  return *this;
96 }
97 // -----------------------------------------------------------------------------
99  ASSERT(this->validTime() == dx.validTime());
101  return *this;
102 }
103 // -----------------------------------------------------------------------------
105  ASSERT(this->validTime() == dx.validTime());
107  return *this;
108 }
109 // -----------------------------------------------------------------------------
112  return *this;
113 }
114 // -----------------------------------------------------------------------------
117 }
118 // -----------------------------------------------------------------------------
119 void IncrementFV3JEDI::zero(const util::DateTime & vt) {
121  time_ = vt;
122 }
123 // -----------------------------------------------------------------------------
124 void IncrementFV3JEDI::axpy(const double & zz, const IncrementFV3JEDI & dx,
125  const bool check) {
126  ASSERT(!check || this->validTime() == dx.validTime());
128 }
129 // -----------------------------------------------------------------------------
130 void IncrementFV3JEDI::accumul(const double & zz, const StateFV3JEDI & xx) {
132 }
133 // -----------------------------------------------------------------------------
136 }
137 // -----------------------------------------------------------------------------
139  const {
140  double zz;
142  return zz;
143 }
144 // -----------------------------------------------------------------------------
147 }
148 // -----------------------------------------------------------------------------
149 /// Get increment values at observation locations
150 // -----------------------------------------------------------------------------
152  const oops::Variables & vars,
153  ufo::GeoVaLs & gom,
154  const GetValuesTrajFV3JEDI & traj) const {
155  const eckit::Configuration * conf = &vars.toFortran();
157  keyInc_,
158  locs.toFortran(),
159  &conf,
160  gom.toFortran(),
161  traj.toFortran());
162 }
163 // -----------------------------------------------------------------------------
165  const oops::Variables & vars,
166  const ufo::GeoVaLs & gom,
167  const GetValuesTrajFV3JEDI & traj) {
168  const eckit::Configuration * conf = &vars.toFortran();
170  keyInc_, locs.toFortran(),
171  &conf,
172  gom.toFortran(),
173  traj.toFortran());
174 }
175 // -----------------------------------------------------------------------------
177  const int & colocated) const {
179  geom_->toFortran());
180 }
181 // -----------------------------------------------------------------------------
183  const int & colocated) const {
185 }
186 // -----------------------------------------------------------------------------
189 }
190 // -----------------------------------------------------------------------------
191 /// I/O and diagnostics
192 // -----------------------------------------------------------------------------
193 void IncrementFV3JEDI::read(const eckit::Configuration & config) {
194  const eckit::Configuration * conf = &config;
195  util::DateTime * dtp = &time_;
196  fv3jedi_increment_read_file_f90(geom_->toFortran(), keyInc_, &conf, &dtp);
197 }
198 // -----------------------------------------------------------------------------
199 void IncrementFV3JEDI::write(const eckit::Configuration & config) const {
200  const eckit::Configuration * conf = &config;
201  const util::DateTime * dtp = &time_;
202  fv3jedi_increment_write_file_f90(geom_->toFortran(), keyInc_, &conf, &dtp);
203 }
204 // -----------------------------------------------------------------------------
205 double IncrementFV3JEDI::norm() const {
206  double zz = 0.0;
208  return zz;
209 }
210 // -----------------------------------------------------------------------------
211 void IncrementFV3JEDI::print(std::ostream & os) const {
212  oops::Log::trace() << "IncrementFV3JEDI print starting" << std::endl;
213  os << std::endl << " Valid time: " << validTime();
214  int nx = 0;
215  int ny = 0;
216  int nf = 8;
218  os << std::endl << "Cube faces = "<< nx << "x" << ny
219  << ", Number of increment fields = " << nf;
220  std::vector<double> zstat(3*nf);
221  fv3jedi_increment_gpnorm_f90(keyInc_, nf, zstat[0]);
222  for (int jj = 0; jj < nf; ++jj) {
223  os << std::endl <<"Increment=" << jj+1 <<" Min=" << zstat[3*jj]
224  << ", Max=" << zstat[3*jj+1] << ", RMS=" << zstat[3*jj+2];
225  }
226  oops::Log::trace() << "IncrementFV3JEDI print done" << std::endl;
227 }
228 // -----------------------------------------------------------------------------
229 void IncrementFV3JEDI::dirac(const eckit::Configuration & config) {
230  const eckit::Configuration * conf = &config;
232 }
233 // -----------------------------------------------------------------------------
235  const eckit::Configuration & config) {
236  oops::Log::trace() << "IncrementFV3JEDI jnormgrad starting" << std::endl;
237  const eckit::Configuration * conf = &config;
239  xxf.toFortran(), &conf);
240  oops::Log::trace() << "IncrementFV3JEDI jnormgrad done" << std::endl;
241 }
242 // -----------------------------------------------------------------------------
243 } // namespace fv3jedi
IncrementFV3JEDI(const GeometryFV3JEDI &, const oops::Variables &, const util::DateTime &)
Constructor, destructor.
void jnormgrad(const StateFV3JEDI &, const eckit::Configuration &)
void dirac(const eckit::Configuration &)
void fv3jedi_increment_self_sub_f90(const F90inc &, const F90inc &)
IncrementFV3JEDI & operator+=(const IncrementFV3JEDI &)
void fv3jedi_increment_self_schur_f90(const F90inc &, const F90inc &)
subroutine, public copy(self, rhs)
void accumul(const double &, const StateFV3JEDI &)
Other.
Definition: conf.py:1
void fv3jedi_increment_random_f90(const F90inc &)
integer, parameter nx
void getValuesTL(const ioda::Locations &, const oops::Variables &, ufo::GeoVaLs &, const GetValuesTrajFV3JEDI &) const
Get increment values at observation locations.
void fv3jedi_increment_write_file_f90(const F90geom &, const F90inc &, const eckit::Configuration *const *, const util::DateTime *const *)
void read(const eckit::Configuration &)
I/O and diagnostics.
void fv3jedi_increment_copy_f90(const F90inc &, const F90inc &)
void fv3jedi_increment_increment_to_ug_f90(const F90inc &, const int &, const int &)
IncrementFV3JEDI & operator=(const IncrementFV3JEDI &)
void fv3jedi_increment_change_resol_f90(const F90inc &, const F90inc &)
integer, parameter ny
void field_from_ug(const oops::UnstructuredGrid &)
void fv3jedi_increment_diff_incr_f90(const F90inc &, const F90state &, const F90state &)
void fv3jedi_increment_axpy_inc_f90(const F90inc &, const double &, const F90inc &)
void schur_product_with(const IncrementFV3JEDI &)
void fv3jedi_increment_delete_f90(F90inc &)
void field_to_ug(oops::UnstructuredGrid &, const int &) const
void fv3jedi_increment_axpy_state_f90(const F90inc &, const double &, const F90state &)
GeoVaLs: geophysical values at locations.
void fv3jedi_increment_jnormgrad_f90(const F90inc &, const F90geom &, const F90state &, const eckit::Configuration *const *)
void ug_coord(oops::UnstructuredGrid &, const int &) const
Unstructured grid.
real, dimension(:,:,:), allocatable vt
void print(std::ostream &) const
void fv3jedi_increment_create_f90(F90inc &, const F90geom &, const eckit::Configuration *const *)
double dot_product_with(const IncrementFV3JEDI &) const
void fv3jedi_increment_getvalues_tl_f90(const F90geom &, const F90inc &, const F90locs &, const eckit::Configuration *const *, const F90goms &, const F90ootrj &)
IncrementFV3JEDI & operator-=(const IncrementFV3JEDI &)
void axpy(const double &, const IncrementFV3JEDI &, const bool check=true)
void fv3jedi_increment_gpnorm_f90(const F90inc &, const int &, double &)
const util::DateTime & validTime() const
Definition: StateFV3JEDI.h:91
void fv3jedi_increment_self_add_f90(const F90inc &, const F90inc &)
Locations class to handle locations for IODA.
void write(const eckit::Configuration &) const
void fv3jedi_increment_getvalues_ad_f90(const F90geom &, const F90inc &, const F90locs &, const eckit::Configuration *const *, const F90goms &, const F90ootrj &)
void fv3jedi_increment_rms_f90(const F90inc &, double &)
void fv3jedi_increment_zero_f90(const F90inc &)
void fv3jedi_increment_read_file_f90(const F90geom &, const F90inc &, const eckit::Configuration *const *, util::DateTime *const *)
void getValuesAD(const ioda::Locations &, const oops::Variables &, const ufo::GeoVaLs &, const GetValuesTrajFV3JEDI &)
IncrementFV3JEDI & operator*=(const double &)
void fv3jedi_increment_sizes_f90(const F90inc &, int &, int &, int &)
GeometryFV3JEDI handles geometry for FV3JEDI model.
void fv3jedi_increment_self_mul_f90(const F90inc &, const double &)
void fv3jedi_increment_increment_from_ug_f90(const F90inc &, const int &)
boost::shared_ptr< const GeometryFV3JEDI > geom_
void fv3jedi_increment_dot_prod_f90(const F90inc &, const F90inc &, double &)
const eckit::Configuration & toFortran() const
Definition: Variables.h:36
void diff(const StateFV3JEDI &, const StateFV3JEDI &)
Basic operators.
const util::DateTime & validTime() const
void fv3jedi_increment_dirac_f90(const F90inc &, const eckit::Configuration *const *, const F90geom &)
void fv3jedi_increment_ug_coord_f90(const F90inc &, const int &, const int &, const F90geom &)