11 #ifndef OOPS_ASSIMILATION_RPCGMINIMIZER_H_ 12 #define OOPS_ASSIMILATION_RPCGMINIMIZER_H_ 23 #include "oops/util/dot_product.h" 24 #include "oops/util/formats.h" 25 #include "oops/util/Logger.h" 74 const std::string
classname()
const override {
return "RPCGMinimizer";}
80 const int &,
const double &,
Dual_ &,
const double &)
override;
85 template<
typename MODEL>
88 const int & maxiter,
const double &
tolerance,
113 std::vector<Dual_> vVEC;
114 std::vector<Dual_> wVEC;
115 std::vector<double> vpVEC;
116 std::vector<double> wpVEC;
121 llp = dot_product(dy, rr) +
sigma*rrp;
131 double dotwr = dot_product(rr, ww) + rrp*wwp;
132 double normReduction = 1.0;
133 double dotw0r0 = dotwr;
134 double dotwr_old = 0.0;
156 for (
int jiter = 0; jiter < maxiter; ++jiter) {
157 Log::info() <<
"RPCG Starting Iteration " << jiter+1 << std::endl;
160 double beta = dotwr/dotwr_old;
181 double alpha = dotwr/(dot_product(qq, tt) + qqp *
ttp);
185 vvp = vvp +
alpha*ppp;
188 rrp = rrp -
alpha*qqp;
191 for (
int iiter = 0; iiter < jiter; ++iiter) {
192 double proj = dot_product(rr, wVEC[iiter]) + rrp * wpVEC[iiter];
193 rr.
axpy(-proj, vVEC[iiter]);
194 rrp -= proj*vpVEC[iiter];
200 llp = dot_product(dy, rr) +
sigma * rrp;
211 dotwr = dot_product(ww, rr) + rrp * wwp;
227 normReduction = sqrt(dotwr/dotw0r0);
229 Log::info() <<
"RPCG end of iteration " << jiter+1 <<
". Norm reduction= " 230 << util::full_precision(normReduction) << std::endl << std::endl;
233 Log::info() <<
"RPCG: Achieved required reduction in residual norm." << std::endl;
237 return normReduction;
244 #endif // OOPS_ASSIMILATION_RPCGMINIMIZER_H_
void multiply(const Dual_ &dx, Dual_ &dy) const
Container of dual space vectors for all terms of the cost function.
const std::string classname() const override
integer, parameter sigma
Flags to indicate where climatology pressure levels are pressure or sigma levels. ...
The namespace for the main oops code.
RinvMatrix< MODEL > Rinv_
DualVector< MODEL > Dual_
HBHtMatrix< MODEL > HBHt_
double solve(Dual_ &, double &, Dual_ &, const HBHt_ &, const Rinv_ &, const int &, const double &, Dual_ &, const double &) override
subroutine, public info(self)
RPCGMinimizer(const eckit::Configuration &, const CostFct_ &J)
real(fp), parameter, public tolerance
CostFunction< MODEL > CostFct_
void multiply(const VECTOR &a, VECTOR &b) const
void multiply(const Dual_ &dy, Dual_ &dz) const
void axpy(const double, const DualVector &)