Salome HOME
Minor documentation and source correction for outputs
[modules/adao.git] / doc / en / ref_algorithm_3DVAR.rst
1 ..
2    Copyright (C) 2008-2015 EDF R&D
3
4    This file is part of SALOME ADAO module.
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19
20    See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
22    Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23
24 .. index:: single: 3DVAR
25 .. _section_ref_algorithm_3DVAR:
26
27 Calculation algorithm "*3DVAR*"
28 -------------------------------
29
30 Description
31 +++++++++++
32
33 This algorithm performs a state estimation by variational minimization of the
34 classical :math:`J` function in static data assimilation:
35
36 .. math:: J(\mathbf{x})=(\mathbf{x}-\mathbf{x}^b)^T.\mathbf{B}^{-1}.(\mathbf{x}-\mathbf{x}^b)+(\mathbf{y}^o-\mathbf{H}.\mathbf{x})^T.\mathbf{R}^{-1}.(\mathbf{y}^o-\mathbf{H}.\mathbf{x})
37
38 which is usually designed as the "*3D-VAR*" function (see for example
39 [Talagrand97]_).
40
41 Optional and required commands
42 ++++++++++++++++++++++++++++++
43
44 .. index:: single: Background
45 .. index:: single: BackgroundError
46 .. index:: single: Observation
47 .. index:: single: ObservationError
48 .. index:: single: ObservationOperator
49 .. index:: single: Minimizer
50 .. index:: single: Bounds
51 .. index:: single: MaximumNumberOfSteps
52 .. index:: single: CostDecrementTolerance
53 .. index:: single: ProjectedGradientTolerance
54 .. index:: single: GradientNormTolerance
55 .. index:: single: StoreInternalVariables
56 .. index:: single: StoreSupplementaryCalculations
57 .. index:: single: Quantiles
58 .. index:: single: SetSeed
59 .. index:: single: NumberOfSamplesForQuantiles
60 .. index:: single: SimulationForQuantiles
61
62 The general required commands, available in the editing user interface, are the
63 following:
64
65   Background
66     *Required command*. This indicates the background or initial vector used,
67     previously noted as :math:`\mathbf{x}^b`. Its value is defined as a
68     "*Vector*" or a *VectorSerie*" type object.
69
70   BackgroundError
71     *Required command*. This indicates the background error covariance matrix,
72     previously noted as :math:`\mathbf{B}`. Its value is defined as a "*Matrix*"
73     type object, a "*ScalarSparseMatrix*" type object, or a
74     "*DiagonalSparseMatrix*" type object.
75
76   Observation
77     *Required command*. This indicates the observation vector used for data
78     assimilation or optimization, previously noted as :math:`\mathbf{y}^o`. It
79     is defined as a "*Vector*" or a *VectorSerie* type object.
80
81   ObservationError
82     *Required command*. This indicates the observation error covariance matrix,
83     previously noted as :math:`\mathbf{R}`. It is defined as a "*Matrix*" type
84     object, a "*ScalarSparseMatrix*" type object, or a "*DiagonalSparseMatrix*"
85     type object.
86
87   ObservationOperator
88     *Required command*. This indicates the observation operator, previously
89     noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
90     results :math:`\mathbf{y}` to be compared to observations
91     :math:`\mathbf{y}^o`. Its value is defined as a "*Function*" type object or
92     a "*Matrix*" type one. In the case of "*Function*" type, different
93     functional forms can be used, as described in the section
94     :ref:`section_ref_operator_requirements`. If there is some control :math:`U`
95     included in the observation, the operator has to be applied to a pair
96     :math:`(X,U)`.
97
98 The general optional commands, available in the editing user interface, are
99 indicated in :ref:`section_ref_assimilation_keywords`. In particular, the
100 optional command "*AlgorithmParameters*" allows to choose the specific options,
101 described hereafter, of the algorithm. See
102 :ref:`section_ref_options_AlgorithmParameters` for the good use of this command.
103
104 The options of the algorithm are the following:
105
106   Minimizer
107     This key allows to choose the optimization minimizer. The default choice is
108     "LBFGSB", and the possible ones are "LBFGSB" (nonlinear constrained
109     minimizer, see [Byrd95]_, [Morales11]_ and [Zhu97]_), "TNC" (nonlinear
110     constrained minimizer), "CG" (nonlinear unconstrained minimizer), "BFGS"
111     (nonlinear unconstrained minimizer), "NCG" (Newton CG minimizer). It is
112     strongly recommended to stay with the default.
113
114     Example : ``{"Minimizer":"LBFGSB"}``
115
116   Bounds
117     This key allows to define upper and lower bounds for every state variable
118     being optimized. Bounds have to be given by a list of list of pairs of
119     lower/upper bounds for each variable, with possibly ``None`` every time
120     there is no bound. The bounds can always be specified, but they are taken
121     into account only by the constrained optimizers.
122
123     Example : ``{"Bounds":[[2.,5.],[1.e-2,10.],[-30.,None],[None,None]]}``
124
125   MaximumNumberOfSteps
126     This key indicates the maximum number of iterations allowed for iterative
127     optimization. The default is 15000, which is very similar to no limit on
128     iterations. It is then recommended to adapt this parameter to the needs on
129     real problems. For some optimizers, the effective stopping step can be
130     slightly different of the limit due to algorithm internal control
131     requirements.
132
133     Example : ``{"MaximumNumberOfSteps":100}``
134
135   CostDecrementTolerance
136     This key indicates a limit value, leading to stop successfully the
137     iterative optimization process when the cost function decreases less than
138     this tolerance at the last step. The default is 1.e-7, and it is
139     recommended to adapt it to the needs on real problems.
140
141     Example : ``{"CostDecrementTolerance":1.e-7}``
142
143   ProjectedGradientTolerance
144     This key indicates a limit value, leading to stop successfully the iterative
145     optimization process when all the components of the projected gradient are
146     under this limit. It is only used for constrained optimizers. The default is
147     -1, that is the internal default of each minimizer (generally 1.e-5), and it
148     is not recommended to change it.
149
150     Example : ``{"ProjectedGradientTolerance":-1}``
151
152   GradientNormTolerance
153     This key indicates a limit value, leading to stop successfully the
154     iterative optimization process when the norm of the gradient is under this
155     limit. It is only used for non-constrained optimizers.  The default is
156     1.e-5 and it is not recommended to change it.
157
158     Example : ``{"GradientNormTolerance":1.e-5}``
159
160   StoreInternalVariables
161     This Boolean key allows to store default internal variables, mainly the
162     current state during iterative optimization process. Be careful, this can be
163     a numerically costly choice in certain calculation cases. The default is
164     "False".
165
166     Example : ``{"StoreInternalVariables":True}``
167
168   StoreSupplementaryCalculations
169     This list indicates the names of the supplementary variables that can be
170     available at the end of the algorithm. It involves potentially costly
171     calculations or memory consumptions. The default is a void list, none of
172     these variables being calculated and stored by default. The possible names
173     are in the following list: ["APosterioriCovariance", "BMA", "OMA", "OMB",
174     "Innovation", "SigmaObs2", "MahalanobisConsistency", "SimulationQuantiles"].
175
176     Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
177
178   Quantiles
179     This list indicates the values of quantile, between 0 and 1, to be estimated
180     by simulation around the optimal state. The sampling uses a multivariate
181     gaussian random sampling, directed by the *a posteriori* covariance matrix.
182     This option is useful only if the supplementary calculation
183     "SimulationQuantiles" has been chosen. The default is a void list.
184
185     Example : ``{"Quantiles":[0.1,0.9]}``
186
187   SetSeed
188     This key allow to give an integer in order to fix the seed of the random
189     generator used to generate the ensemble. A convenient value is for example
190     1000. By default, the seed is left uninitialized, and so use the default
191     initialization from the computer.
192
193     Example : ``{"SetSeed":1000}``
194
195   NumberOfSamplesForQuantiles
196     This key indicates the number of simulation to be done in order to estimate
197     the quantiles. This option is useful only if the supplementary calculation
198     "SimulationQuantiles" has been chosen. The default is 100, which is often
199     sufficient for correct estimation of common quantiles at 5%, 10%, 90% or
200     95%.
201
202     Example : ``{"NumberOfSamplesForQuantiles":100}``
203
204   SimulationForQuantiles
205     This key indicates the type of simulation, linear (with the tangent
206     observation operator applied to perturbation increments around the optimal
207     state) or non-linear (with standard observation operator applied to
208     perturbated states), one want to do for each perturbation. It changes mainly
209     the time of each elementary calculation, usually longer in non-linear than
210     in linear. This option is useful only if the supplementary calculation
211     "SimulationQuantiles" has been chosen. The default value is "Linear", and
212     the possible choices are "Linear" and "NonLinear".
213
214     Example : ``{"SimulationForQuantiles":"Linear"}``
215
216 Information and variables available at the end of the algorithm
217 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
218
219 At the output, after executing the algorithm, there are variables and
220 information originating from the calculation. The description of
221 :ref:`section_ref_output_variables` show the way to obtain them by the method
222 named ``get`` of the variable "*ADD*" of the post-processing. The input
223 variables, available to the user at the output in order to facilitate the
224 writing of post-processing procedures, are described in the
225 :ref:`subsection_r_o_v_Inventaire`.
226
227 The unconditional outputs of the algorithm are the following:
228
229   Analysis
230     *List of vectors*. Each element is an optimal state :math:`\mathbf{x}*` in
231     optimization or an analysis :math:`\mathbf{x}^a` in data assimilation.
232
233     Example : ``Xa = ADD.get("Analysis")[-1]``
234
235   CostFunctionJ
236     *List of values*. Each element is a value of the error function :math:`J`.
237
238     Example : ``J = ADD.get("CostFunctionJ")[:]``
239
240   CostFunctionJb
241     *List of values*. Each element is a value of the error function :math:`J^b`,
242     that is of the background difference part.
243
244     Example : ``Jb = ADD.get("CostFunctionJb")[:]``
245
246   CostFunctionJo
247     *List of values*. Each element is a value of the error function :math:`J^o`,
248     that is of the observation difference part.
249
250     Example : ``Jo = ADD.get("CostFunctionJo")[:]``
251
252 The conditional outputs of the algorithm are the following:
253
254   APosterioriCovariance
255     *List of matrices*. Each element is an *a posteriori* error covariance
256     matrix :math:`\mathbf{A}*` of the optimal state.
257
258     Example : ``A = ADD.get("APosterioriCovariance")[-1]``
259
260   BMA
261     *List of vectors*. Each element is a vector of difference between the
262     background and the optimal state.
263
264     Example : ``bma = ADD.get("BMA")[-1]``
265
266   CurrentState
267     *List of vectors*. Each element is a usual state vector used during the
268     optimization algorithm procedure.
269
270     Example : ``Xs = ADD.get("CurrentState")[:]``
271
272   Innovation
273     *List of vectors*. Each element is an innovation vector, which is in static
274     the difference between the optimal and the background, and in dynamic the
275     evolution increment.
276
277     Example : ``d = ADD.get("Innovation")[-1]``
278
279   MahalanobisConsistency
280     *List of values*. Each element is a value of the Mahalanobis quality
281     indicator.
282
283     Example : ``m = ADD.get("MahalanobisConsistency")[-1]``
284
285   OMA
286     *List of vectors*. Each element is a vector of difference between the
287     observation and the optimal state in the observation space.
288
289     Example : ``oma = ADD.get("OMA")[-1]``
290
291   OMB
292     *List of vectors*. Each element is a vector of difference between the
293     observation and the background state in the observation space.
294
295     Example : ``omb = ADD.get("OMB")[-1]``
296
297   SigmaObs2
298     *List of values*. Each element is a value of the quality indicator
299     :math:`(\sigma^o)^2` of the observation part.
300
301     Example : ``so2 = ADD.get("SigmaObs")[-1]``
302
303   SimulatedObservationAtBackground
304     *List of vectors*. Each element is a vector of observation simulated from
305     the background :math:`\mathbf{x}^b`.
306
307     Example : ``hxb = ADD.get("SimulatedObservationAtBackground")[-1]``
308
309   SimulatedObservationAtCurrentState
310     *List of vectors*. Each element is an observed vector at the current state,
311     that is, in the observation space.
312
313     Example : ``Ys = ADD.get("SimulatedObservationAtCurrentState")[-1]``
314
315   SimulatedObservationAtOptimum
316     *List of vectors*. Each element is a vector of observation simulated from
317     the analysis or optimal state :math:`\mathbf{x}^a`.
318
319     Example : ``hxa = ADD.get("SimulatedObservationAtOptimum")[-1]``
320
321   SimulationQuantiles
322     *List of vectors*. Each element is a vector corresponding to the observed
323     state which realize the required quantile, in the same order than the
324     quantiles required by the user.
325
326     Example : ``sQuantiles = ADD.get("SimulationQuantiles")[:]``
327
328 See also
329 ++++++++
330
331 References to other sections:
332   - :ref:`section_ref_algorithm_Blue`
333   - :ref:`section_ref_algorithm_ExtendedBlue`
334   - :ref:`section_ref_algorithm_LinearityTest`
335
336 Bibliographical references:
337   - [Byrd95]_
338   - [Morales11]_
339   - [Talagrand97]_