SOCA
ErrorCovariance.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-2021 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 #include <cmath>
9 
12 #include "soca/Geometry/Geometry.h"
14 #include "soca/State/State.h"
15 
16 #include "eckit/config/Configuration.h"
17 
18 #include "oops/assimilation/GMRESR.h"
19 #include "oops/base/IdentityMatrix.h"
20 #include "oops/base/Variables.h"
21 #include "oops/util/Logger.h"
22 
23 using oops::Log;
24 
25 // -----------------------------------------------------------------------------
26 namespace soca {
27  // -----------------------------------------------------------------------------
28 
30  const oops::Variables &,
31  const eckit::Configuration & conf,
32  const State & bkg,
33  const State & traj) {
34  // bkg: Background state, invariant wrt outer-loop.
35  const eckit::Configuration * configc = &conf;
36  vars_ = oops::Variables(conf, "analysis variables");
37  soca_b_setup_f90(keyFtnConfig_, &configc, resol.toFortran(),
38  bkg.toFortran(), vars_);
39  Log::trace() << "ErrorCovariance created" << std::endl;
40  }
41 
42  // -----------------------------------------------------------------------------
43 
46  Log::trace() << "ErrorCovariance destructed" << std::endl;
47  }
48 
49  // -----------------------------------------------------------------------------
50 
51  void ErrorCovariance::linearize(const State & traj, const Geometry & resol) {
52  geom_.reset(new Geometry(resol));
53  Log::trace() << "Trajectory for ErrorCovariance" << std::endl;
54  }
55 
56  // -----------------------------------------------------------------------------
57 
58  void ErrorCovariance::multiply(const Increment & dxin, Increment & dxout)
59  const {
60  dxout = dxin;
62  Log::trace() << "ErrorCovariance multiply" << std::endl;
63  }
64 
65  // -----------------------------------------------------------------------------
66 
68  Increment & dxout) const {
69  // oops::IdentityMatrix<Increment> Id;
70  // dxout.zero();
71  // GMRESR(dxout, dxin, *this, Id, 10, 1.0e-6);
72  dxout = dxin;
73  Log::trace() << "ErrorCovariance inversemultiply" << std::endl;
74  }
75 
76  // -----------------------------------------------------------------------------
77 
78  // void ErrorCovariance::doRandomize(Increment & dx) const {
81  }
82 
83  // -----------------------------------------------------------------------------
84 
85  void ErrorCovariance::print(std::ostream & os) const {
86  os << "ErrorCovariance::print not implemented";
87  }
88 
89  // -----------------------------------------------------------------------------
90 
91 } // namespace soca
void randomize(Increment &) const
void inverseMultiply(const Increment &, Increment &) const
oops::Variables vars_
ErrorCovariance(const Geometry &, const oops::Variables &, const eckit::Configuration &, const State &, const State &)
void multiply(const Increment &, Increment &) const
boost::scoped_ptr< const Geometry > geom_
void print(std::ostream &) const
void linearize(const State &, const Geometry &)
Geometry handles geometry for SOCA model.
Definition: Geometry.h:48
int & toFortran()
Definition: Geometry.h:61
Increment Class: Difference between two states.
Definition: Increment.h:61
int & toFortran()
Definition: Increment.h:112
SOCA model state.
Definition: State.h:48
int & toFortran()
Definition: State.h:88
void soca_b_delete_f90(F90bmat &)
void soca_b_randomize_f90(const F90bmat &, const F90flds &)
void soca_b_mult_f90(const F90bmat &, const F90flds &, const F90flds &)
void soca_b_setup_f90(F90bmat &, const eckit::Configuration *const *, const F90geom &, const F90flds &, const oops::Variables &)