12 #ifndef OOPS_ASSIMILATION_COSTFCT4DVAR_H_
13 #define OOPS_ASSIMILATION_COSTFCT4DVAR_H_
17 #include "eckit/config/LocalConfiguration.h"
18 #include "eckit/mpi/Comm.h"
36 #include "oops/util/DateTime.h"
37 #include "oops/util/Duration.h"
38 #include "oops/util/Logger.h"
64 CostFct4DVar(
const eckit::Configuration &,
const eckit::mpi::Comm &);
69 const bool idModel =
false)
const override;
72 const bool idModel =
false)
const override;
96 std::shared_ptr<LinearModel_>
tlm_;
103 template<
typename MODEL,
typename OBS>
105 const eckit::mpi::Comm & comm)
107 resol_(
eckit::LocalConfiguration(config,
"geometry"), comm),
108 model_(resol_,
eckit::LocalConfiguration(config,
"model")),
109 ctlvars_(config,
"analysis variables"), tlm_(), an2model_(resol_, config),
112 Log::trace() <<
"CostFct4DVar:CostFct4DVar" << std::endl;
113 windowLength_ = util::Duration(config.getString(
"window length"));
114 windowBegin_ = util::DateTime(config.getString(
"window begin"));
118 Log::trace() <<
"CostFct4DVar constructed" << std::endl;
123 template <
typename MODEL,
typename OBS>
132 template <
typename MODEL,
typename OBS>
139 template <
typename MODEL,
typename OBS>
142 const eckit::LocalConfiguration jcdfi(jcConf,
"jcdfi");
143 const util::DateTime vt(windowBegin_ + windowLength_/2);
149 template <
typename MODEL,
typename OBS>
154 an2model_.changeVar(xx.
state(), xm);
155 model_.forecast(xm, xx.
modVar(), windowLength_, post);
156 an2model_.changeVarInverse(xm, xx.
state());
163 template<
typename MODEL,
typename OBS>
165 const eckit::Configuration & innerConf,
169 Log::trace() <<
"CostFct4DVar::doLinearize start" << std::endl;
170 eckit::LocalConfiguration conf(innerConf,
"linear model");
178 inc2model_->setInputVariables(ctlvars_);
179 Log::trace() <<
"CostFct4DVar::doLinearize done" << std::endl;
184 template <
typename MODEL,
typename OBS>
188 const bool idModel)
const {
189 inc2model_->setOutputVariables(tlm_->variables());
194 inc2model_->multiply(dx.
state(), dxmodel);
195 tlm_->forecastTL(dxmodel, dx.
modVar(), windowLength_, post, cost, idModel);
196 inc2model_->multiplyInverse(dxmodel, dx.
state());
203 template <
typename MODEL,
typename OBS>
212 template <
typename MODEL,
typename OBS>
216 const bool idModel)
const {
220 inc2model_->setOutputVariables(tlm_->variables());
221 inc2model_->multiplyInverseAD(dx.
state(), dxmodel);
222 tlm_->forecastAD(dxmodel, dx.
modVar(), windowLength_, post, cost, idModel);
223 inc2model_->multiplyAD(dxmodel, dx.
state());
230 template<
typename MODEL,
typename OBS>
ObsAuxIncrs_ & obsVar()
Get augmented observation control variable.
Increment_ & state()
Get state control variable.
ModelAuxIncr_ & modVar()
Get augmented model control variable.
ModelAux_ & modVar()
Get augmented model control variable.
State_ & state()
Get state control variable.
Strong Constraint 4D-Var Cost Function.
VariableChange< MODEL > VarCha_
std::shared_ptr< LinearModel_ > tlm_
void runADJ(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ >, const bool idModel=false) const override
CostJb3D< MODEL > * newJb(const eckit::Configuration &, const Geometry_ &, const CtrlVar_ &) const override
Geometry< MODEL > Geometry_
void runNL(CtrlVar_ &, PostProcessor< State_ > &) const override
const Geometry_ & geometry() const override
CostFct4DVar(const eckit::Configuration &, const eckit::mpi::Comm &)
util::DateTime windowEnd_
util::DateTime windowBegin_
std::unique_ptr< LinVarCha_ > inc2model_
util::Duration windowLength_
const eckit::mpi::Comm & comm_
ControlIncrement< MODEL, OBS > CtrlInc_
Increment< MODEL > Increment_
void doLinearize(const Geometry_ &, const eckit::Configuration &, const CtrlVar_ &, const CtrlVar_ &, PostProcessor< State_ > &, PostProcessorTLAD< MODEL > &) override
void zeroAD(CtrlInc_ &) const override
CostFunction< MODEL, OBS > CostFct_
LinearModel< MODEL > LinearModel_
CostJo< MODEL, OBS > * newJo(const eckit::Configuration &) const override
void runTLM(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ >, const bool idModel=false) const override
ControlVariable< MODEL, OBS > CtrlVar_
void addIncr(CtrlVar_ &, const CtrlInc_ &, PostProcessor< Increment_ > &) const override
LinearVariableChangeBase< MODEL > LinVarCha_
CostTermBase< MODEL, OBS > * newJc(const eckit::Configuration &, const Geometry_ &) const override
void setupTerms(const eckit::Configuration &)
Base Class for Cost Function Terms.
Geometry class used in oops; subclass of interface class interface::Geometry.
Increment class used in oops.
Abstract linear forecast model used by high level algorithms and applications.
LinearVariableChange factory.
void zero()
Zero out this ModelAuxIncrement.
Abstract nonlinear forecast model used by high level algorithms and applications.
Control model post processing.
void enrollProcessor(PostBase_ *pp)
Control model post processing.
State class used in oops; subclass of interface class interface::State.
Save trajectory during forecast run.
Encapsulates the nonlinear variable change Note: to see methods that need to be implemented in the im...
Geometry_ geometry() const
Accessor to geometry associated with this Increment.
void zero()
Zero out this Increment.
const util::DateTime validTime() const
Accessor to the time of this Increment.
Geometry_ geometry() const
Accessor to geometry associated with this State.
const util::DateTime validTime() const
Accessor to the time of this State.
The namespace for the main oops code.