2 Copyright (C) 2008-2015 EDF R&D
4 This file is part of SALOME ADAO module.
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.
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.
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
20 See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24 .. index:: single: 3DVAR
25 .. _section_ref_algorithm_3DVAR:
27 Calculation algorithm "*3DVAR*"
28 -------------------------------
33 This algorithm performs a state estimation by variational minimization of the
34 classical :math:`J` function in static data assimilation:
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})
38 which is usually designed as the "*3D-VAR*" function (see for example
41 Optional and required commands
42 ++++++++++++++++++++++++++++++
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: StoreSupplementaryCalculations
56 .. index:: single: Quantiles
57 .. index:: single: SetSeed
58 .. index:: single: NumberOfSamplesForQuantiles
59 .. index:: single: SimulationForQuantiles
61 The general required commands, available in the editing user interface, are the
65 *Required command*. This indicates the background or initial vector used,
66 previously noted as :math:`\mathbf{x}^b`. Its value is defined as a
67 "*Vector*" or a *VectorSerie*" type object.
70 *Required command*. This indicates the background error covariance matrix,
71 previously noted as :math:`\mathbf{B}`. Its value is defined as a "*Matrix*"
72 type object, a "*ScalarSparseMatrix*" type object, or a
73 "*DiagonalSparseMatrix*" type object.
76 *Required command*. This indicates the observation vector used for data
77 assimilation or optimization, previously noted as :math:`\mathbf{y}^o`. It
78 is defined as a "*Vector*" or a *VectorSerie* type object.
81 *Required command*. This indicates the observation error covariance matrix,
82 previously noted as :math:`\mathbf{R}`. It is defined as a "*Matrix*" type
83 object, a "*ScalarSparseMatrix*" type object, or a "*DiagonalSparseMatrix*"
87 *Required command*. This indicates the observation operator, previously
88 noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
89 results :math:`\mathbf{y}` to be compared to observations
90 :math:`\mathbf{y}^o`. Its value is defined as a "*Function*" type object or
91 a "*Matrix*" type one. In the case of "*Function*" type, different
92 functional forms can be used, as described in the section
93 :ref:`section_ref_operator_requirements`. If there is some control :math:`U`
94 included in the observation, the operator has to be applied to a pair
97 The general optional commands, available in the editing user interface, are
98 indicated in :ref:`section_ref_assimilation_keywords`. In particular, the
99 optional command "*AlgorithmParameters*" allows to choose the specific options,
100 described hereafter, of the algorithm. See
101 :ref:`section_ref_options_AlgorithmParameters` for the good use of this command.
103 The options of the algorithm are the following:
106 This key allows to choose the optimization minimizer. The default choice is
107 "LBFGSB", and the possible ones are "LBFGSB" (nonlinear constrained
108 minimizer, see [Byrd95]_, [Morales11]_ and [Zhu97]_), "TNC" (nonlinear
109 constrained minimizer), "CG" (nonlinear unconstrained minimizer), "BFGS"
110 (nonlinear unconstrained minimizer), "NCG" (Newton CG minimizer). It is
111 strongly recommended to stay with the default.
113 Example : ``{"Minimizer":"LBFGSB"}``
116 This key allows to define upper and lower bounds for every state variable
117 being optimized. Bounds have to be given by a list of list of pairs of
118 lower/upper bounds for each variable, with possibly ``None`` every time
119 there is no bound. The bounds can always be specified, but they are taken
120 into account only by the constrained optimizers.
122 Example : ``{"Bounds":[[2.,5.],[1.e-2,10.],[-30.,None],[None,None]]}``
125 This key indicates the maximum number of iterations allowed for iterative
126 optimization. The default is 15000, which is very similar to no limit on
127 iterations. It is then recommended to adapt this parameter to the needs on
128 real problems. For some optimizers, the effective stopping step can be
129 slightly different of the limit due to algorithm internal control
132 Example : ``{"MaximumNumberOfSteps":100}``
134 CostDecrementTolerance
135 This key indicates a limit value, leading to stop successfully the
136 iterative optimization process when the cost function decreases less than
137 this tolerance at the last step. The default is 1.e-7, and it is
138 recommended to adapt it to the needs on real problems.
140 Example : ``{"CostDecrementTolerance":1.e-7}``
142 ProjectedGradientTolerance
143 This key indicates a limit value, leading to stop successfully the iterative
144 optimization process when all the components of the projected gradient are
145 under this limit. It is only used for constrained optimizers. The default is
146 -1, that is the internal default of each minimizer (generally 1.e-5), and it
147 is not recommended to change it.
149 Example : ``{"ProjectedGradientTolerance":-1}``
151 GradientNormTolerance
152 This key indicates a limit value, leading to stop successfully the
153 iterative optimization process when the norm of the gradient is under this
154 limit. It is only used for non-constrained optimizers. The default is
155 1.e-5 and it is not recommended to change it.
157 Example : ``{"GradientNormTolerance":1.e-5}``
159 StoreSupplementaryCalculations
160 This list indicates the names of the supplementary variables that can be
161 available at the end of the algorithm. It involves potentially costly
162 calculations or memory consumptions. The default is a void list, none of
163 these variables being calculated and stored by default. The possible names
164 are in the following list: ["APosterioriCovariance", "BMA", "CostFunctionJ",
165 "CurrentState", "OMA", "OMB", "Innovation", "SigmaObs2",
166 "MahalanobisConsistency", "SimulatedObservationAtBackground",
167 "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum",
168 "SimulationQuantiles"].
170 Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
173 This list indicates the values of quantile, between 0 and 1, to be estimated
174 by simulation around the optimal state. The sampling uses a multivariate
175 gaussian random sampling, directed by the *a posteriori* covariance matrix.
176 This option is useful only if the supplementary calculation
177 "SimulationQuantiles" has been chosen. The default is a void list.
179 Example : ``{"Quantiles":[0.1,0.9]}``
182 This key allow to give an integer in order to fix the seed of the random
183 generator used to generate the ensemble. A convenient value is for example
184 1000. By default, the seed is left uninitialized, and so use the default
185 initialization from the computer.
187 Example : ``{"SetSeed":1000}``
189 NumberOfSamplesForQuantiles
190 This key indicates the number of simulation to be done in order to estimate
191 the quantiles. This option is useful only if the supplementary calculation
192 "SimulationQuantiles" has been chosen. The default is 100, which is often
193 sufficient for correct estimation of common quantiles at 5%, 10%, 90% or
196 Example : ``{"NumberOfSamplesForQuantiles":100}``
198 SimulationForQuantiles
199 This key indicates the type of simulation, linear (with the tangent
200 observation operator applied to perturbation increments around the optimal
201 state) or non-linear (with standard observation operator applied to
202 perturbated states), one want to do for each perturbation. It changes mainly
203 the time of each elementary calculation, usually longer in non-linear than
204 in linear. This option is useful only if the supplementary calculation
205 "SimulationQuantiles" has been chosen. The default value is "Linear", and
206 the possible choices are "Linear" and "NonLinear".
208 Example : ``{"SimulationForQuantiles":"Linear"}``
210 Information and variables available at the end of the algorithm
211 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
213 At the output, after executing the algorithm, there are variables and
214 information originating from the calculation. The description of
215 :ref:`section_ref_output_variables` show the way to obtain them by the method
216 named ``get`` of the variable "*ADD*" of the post-processing. The input
217 variables, available to the user at the output in order to facilitate the
218 writing of post-processing procedures, are described in the
219 :ref:`subsection_r_o_v_Inventaire`.
221 The unconditional outputs of the algorithm are the following:
224 *List of vectors*. Each element is an optimal state :math:`\mathbf{x}*` in
225 optimization or an analysis :math:`\mathbf{x}^a` in data assimilation.
227 Example : ``Xa = ADD.get("Analysis")[-1]``
230 *List of values*. Each element is a value of the error function :math:`J`.
232 Example : ``J = ADD.get("CostFunctionJ")[:]``
235 *List of values*. Each element is a value of the error function :math:`J^b`,
236 that is of the background difference part.
238 Example : ``Jb = ADD.get("CostFunctionJb")[:]``
241 *List of values*. Each element is a value of the error function :math:`J^o`,
242 that is of the observation difference part.
244 Example : ``Jo = ADD.get("CostFunctionJo")[:]``
246 The conditional outputs of the algorithm are the following:
248 APosterioriCovariance
249 *List of matrices*. Each element is an *a posteriori* error covariance
250 matrix :math:`\mathbf{A}*` of the optimal state.
252 Example : ``A = ADD.get("APosterioriCovariance")[-1]``
255 *List of vectors*. Each element is a vector of difference between the
256 background and the optimal state.
258 Example : ``bma = ADD.get("BMA")[-1]``
261 *List of vectors*. Each element is a usual state vector used during the
262 optimization algorithm procedure.
264 Example : ``Xs = ADD.get("CurrentState")[:]``
267 *List of vectors*. Each element is an innovation vector, which is in static
268 the difference between the optimal and the background, and in dynamic the
271 Example : ``d = ADD.get("Innovation")[-1]``
273 MahalanobisConsistency
274 *List of values*. Each element is a value of the Mahalanobis quality
277 Example : ``m = ADD.get("MahalanobisConsistency")[-1]``
280 *List of vectors*. Each element is a vector of difference between the
281 observation and the optimal state in the observation space.
283 Example : ``oma = ADD.get("OMA")[-1]``
286 *List of vectors*. Each element is a vector of difference between the
287 observation and the background state in the observation space.
289 Example : ``omb = ADD.get("OMB")[-1]``
292 *List of values*. Each element is a value of the quality indicator
293 :math:`(\sigma^o)^2` of the observation part.
295 Example : ``so2 = ADD.get("SigmaObs")[-1]``
297 SimulatedObservationAtBackground
298 *List of vectors*. Each element is a vector of observation simulated from
299 the background :math:`\mathbf{x}^b`.
301 Example : ``hxb = ADD.get("SimulatedObservationAtBackground")[-1]``
303 SimulatedObservationAtCurrentState
304 *List of vectors*. Each element is an observed vector at the current state,
305 that is, in the observation space.
307 Example : ``Ys = ADD.get("SimulatedObservationAtCurrentState")[-1]``
309 SimulatedObservationAtOptimum
310 *List of vectors*. Each element is a vector of observation simulated from
311 the analysis or optimal state :math:`\mathbf{x}^a`.
313 Example : ``hxa = ADD.get("SimulatedObservationAtOptimum")[-1]``
316 *List of vectors*. Each element is a vector corresponding to the observed
317 state which realize the required quantile, in the same order than the
318 quantiles required by the user.
320 Example : ``sQuantiles = ADD.get("SimulationQuantiles")[:]``
325 References to other sections:
326 - :ref:`section_ref_algorithm_Blue`
327 - :ref:`section_ref_algorithm_ExtendedBlue`
328 - :ref:`section_ref_algorithm_LinearityTest`
330 Bibliographical references: