FV3 Bundle
IncrementalAssimilation.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
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  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef OOPS_ASSIMILATION_INCREMENTALASSIMILATION_H_
12 #define OOPS_ASSIMILATION_INCREMENTALASSIMILATION_H_
13 
14 #include <vector>
15 #include <boost/scoped_ptr.hpp>
16 
17 #include "eckit/config/Configuration.h"
23 #include "oops/base/StateInfo.h"
24 #include "oops/interface/State.h"
25 #include "oops/util/Logger.h"
26 
27 namespace oops {
28 
29 template<typename MODEL>
31  const eckit::Configuration & config) {
32  typedef ControlIncrement<MODEL> CtrlInc_;
33  typedef Minimizer<MODEL> Minimizer_;
34  typedef State<MODEL> State_;
35 
36 // Setup outer loop
37  std::vector<eckit::LocalConfiguration> iterconfs;
38  config.get("variational.iteration", iterconfs);
39  const unsigned int nouter = iterconfs.size();
40  Log::info() << "Running incremental assimilation with " << nouter
41  << " outer iterations." << std::endl;
42 
43 // Setup minimizer
44  eckit::LocalConfiguration minConf(config, "minimizer");
45  minConf.set("nouter", static_cast<const int>(nouter));
46  boost::scoped_ptr<Minimizer_> minim(MinFactory<MODEL>::create(minConf, J));
47 
48  for (unsigned jouter = 0; jouter < nouter; ++jouter) {
49 // Get configuration for current outer iteration
50  Log::info() << "IncrementalAssimilation: Configuration for outer iteration "
51  << jouter << ":\n" << iterconfs[jouter];
52 
53 // Setup for the trajectory run
55  if (iterconfs[jouter].has("prints")) {
56  const eckit::LocalConfiguration prtConfig(iterconfs[jouter], "prints");
57  post.enrollProcessor(new StateInfo<State_>("traj", prtConfig));
58  }
59 
60 // Setup quadratic problem
61  J.linearize(xx, iterconfs[jouter], post);
62 
63 // Minimization
64  boost::scoped_ptr<CtrlInc_> dx(minim->minimize(iterconfs[jouter]));
65 
66 // Compute analysis in physical space
67  J.addIncrement(xx, *dx);
68 
69 // Clean-up trajectory, etc...
71  }
72 }
73 
74 } // namespace oops
75 #endif // OOPS_ASSIMILATION_INCREMENTALASSIMILATION_H_
Minimizer Factory.
Definition: Minimizer.h:360
void addIncrement(CtrlVar_ &, const CtrlInc_ &, PostProcessor< Increment_ > post=PostProcessor< Increment_ >()) const
Definition: CostFunction.h:337
double linearize(const CtrlVar_ &, const eckit::Configuration &, PostProcessor< State_ > post=PostProcessor< State_ >())
Definition: CostFunction.h:277
Cost Function.
Definition: CostFunction.h:56
Encapsulates the model state.
void IncrementalAssimilation(ControlVariable< MODEL > &xx, CostFunction< MODEL > &J, const eckit::Configuration &config)
Control variable.
The namespace for the main oops code.
Handles writing-out of forecast fields.
Definition: StateInfo.h:28
subroutine, public info(self)
Control model post processing.
Definition: PostProcessor.h:31
A Minimizer knows how to minimize a cost function.
Definition: Minimizer.h:39
void enrollProcessor(PostBase_ *pp)
Definition: PostProcessor.h:39