11 #ifndef OOPS_ASSIMILATION_COSTFCT4DENSVAR_H_
12 #define OOPS_ASSIMILATION_COSTFCT4DENSVAR_H_
18 #include "eckit/config/LocalConfiguration.h"
19 #include "eckit/mpi/Comm.h"
33 #include "oops/util/DateTime.h"
34 #include "oops/util/Duration.h"
35 #include "oops/util/Logger.h"
59 CostFct4DEnsVar(
const eckit::Configuration &,
const eckit::mpi::Comm &);
64 const bool idModel =
false)
const override;
67 const bool idModel =
false)
const override;
98 template<
typename MODEL,
typename OBS>
100 const eckit::mpi::Comm & comm)
102 resol_(), ctlvars_(config,
"analysis variables")
104 Log::trace() <<
"CostFct4DEnsVar::CostFct4DEnsVar start" << std::endl;
105 util::Duration windowLength(config.getString(
"window length"));
106 util::DateTime windowBegin(config.getString(
"window begin"));
107 util::DateTime windowEnd = windowBegin + windowLength;
108 subWinLength_ = util::Duration(config.getString(
"subwindow"));
113 size_t ntasks = comm.size();
115 size_t myrank = comm.rank();
116 size_t ntaskpslot = ntasks /
nsubwin_;
129 std::string sgeom =
"comm_geom_" + std::to_string(
mysubwin_);
130 char const *geomName = sgeom.c_str();
135 std::string stime =
"comm_time_" + std::to_string(myarea);
136 char const *timeName = stime.c_str();
137 commTime_ = &comm.split(myarea, timeName);
141 resol_.reset(
new Geometry_(eckit::LocalConfiguration(config,
"geometry"),
146 Log::trace() <<
"CostFct4DEnsVar::CostFct4DEnsVar done" << std::endl;
151 template <
typename MODEL,
typename OBS>
155 Log::trace() <<
"CostFct4DEnsVar::newJb" << std::endl;
161 template <
typename MODEL,
typename OBS>
163 Log::trace() <<
"CostFct4DEnsVar::newJo" << std::endl;
165 subWinBegin_, subWinEnd_, *commTime_);
170 template <
typename MODEL,
typename OBS>
173 Log::trace() <<
"CostFct4DEnsVar::newJc" << std::endl;
177 Log::warning() <<
"CostFct4DEnsVar::newJc NO Jc" << std::endl;
184 template <
typename MODEL,
typename OBS>
186 Log::trace() <<
"CostFct4DEnsVar::runNL start" << std::endl;
193 Log::info() <<
"CostFct4DEnsVar::runNL: " << xx << std::endl;
194 Log::trace() <<
"CostFct4DEnsVar::runNL done" << std::endl;
199 template<
typename MODEL,
typename OBS>
201 const eckit::Configuration & conf,
205 Log::trace() <<
"CostFct4DEnsVar::doLinearize start" << std::endl;
207 Log::trace() <<
"CostFct4DEnsVar::doLinearize done" << std::endl;
212 template <
typename MODEL,
typename OBS>
217 Log::trace() <<
"CostFct4DEnsVar::runTLM start" << std::endl;
229 Log::info() <<
"CostFct4DEnsVar::runTLM: " << dx << std::endl;
230 Log::trace() <<
"CostFct4DEnsVar::runTLM done" << std::endl;
235 template <
typename MODEL,
typename OBS>
237 Log::trace() <<
"CostFct4DEnsVar::zeroAD start" << std::endl;
241 Log::trace() <<
"CostFct4DEnsVar::zeroAD done" << std::endl;
246 template <
typename MODEL,
typename OBS>
251 Log::trace() <<
"CostFct4DEnsVar::runADJ start" << std::endl;
262 Log::info() <<
"CostFct4DEnsVar::runADJ: " << dx << std::endl;
263 Log::trace() <<
"CostFct4DEnsVar::runADJ done" << std::endl;
268 template<
typename MODEL,
typename OBS>
271 Log::trace() <<
"CostFct4DEnsVar::addIncr start" << std::endl;
275 Log::trace() <<
"CostFct4DEnsVar::addIncr done" << std::endl;
ObsAuxIncrs_ & obsVar()
Get augmented observation control variable.
Increment_ & state()
Get state control variable.
ModelAuxIncr_ & modVar()
Get augmented model control variable.
State_ & state()
Get state control variable.
ControlVariable< MODEL, OBS > CtrlVar_
util::DateTime subWinEnd_
eckit::mpi::Comm * commTime_
ControlIncrement< MODEL, OBS > CtrlInc_
Increment< MODEL > Increment_
void addIncr(CtrlVar_ &, const CtrlInc_ &, PostProcessor< Increment_ > &) const override
void runADJ(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ >, const bool idModel=false) const override
void runNL(CtrlVar_ &, PostProcessor< State_ > &) const override
eckit::mpi::Comm * commSpace_
std::unique_ptr< Geometry_ > resol_
CostTermBase< MODEL, OBS > * newJc(const eckit::Configuration &, const Geometry_ &) const override
CostFct4DEnsVar(const eckit::Configuration &, const eckit::mpi::Comm &)
const Geometry_ & geometry() const override
CostFunction< MODEL, OBS > CostFct_
util::DateTime subWinTime_
CostJb4D< MODEL > * newJb(const eckit::Configuration &, const Geometry_ &, const CtrlVar_ &) const override
CostJo< MODEL, OBS > * newJo(const eckit::Configuration &) const override
void zeroAD(CtrlInc_ &) const override
util::DateTime subWinBegin_
Geometry< MODEL > Geometry_
void runTLM(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ >, const bool idModel=false) const override
util::Duration subWinLength_
void doLinearize(const Geometry_ &, const eckit::Configuration &, const CtrlVar_ &, const CtrlVar_ &, PostProcessor< State_ > &, PostProcessorTLAD< MODEL > &) 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.
void zero()
Zero out this ModelAuxIncrement.
Control model post processing.
void enrollProcessor(PostBase_ *pp)
void process(const FLDS &xx)
void finalize(const FLDS &xx)
void initialize(const FLDS &xx, const util::DateTime &end, const util::Duration &step)
Control model post processing.
void finalizeAD(Increment_ &dx)
void processTL(const Increment_ &dx)
void processAD(Increment_ &dx)
void finalizeTL(const Increment_ &dx)
void initializeTL(const Increment_ &dx, const util::DateTime &end, const util::Duration &step)
Tangent linear methods.
void initializeAD(Increment_ &dx, const util::DateTime &bgn, const util::Duration &step)
Adjoint methods.
State class used in oops; subclass of interface class interface::State.
Save trajectory during forecast run.
void zero()
Zero out this Increment.
const util::DateTime validTime() const
Accessor to the time of this Increment.
const util::DateTime validTime() const
Accessor to the time of this State.
The namespace for the main oops code.