3 ================================================================================
4 Reference description of the ADAO commands and keywords
5 ================================================================================
7 This section presents the reference description of the ADAO commands and
8 keywords available through the GUI or through scripts.
10 Each command or keyword to be defined through the ADAO GUI has some properties.
11 The first property is to be *required*, *optional* or only factual, describing a
12 type of input. The second property is to be an "open" variable with a fixed type
13 but with any value allowed by the type, or a "restricted" variable, limited to
14 some specified values. The EFICAS editor GUI having build-in validating
15 capacities, the properties of the commands or keywords given through this GUI
16 are automatically correct.
18 The mathematical notations used afterward are explained in the section
19 :ref:`section_theory`.
21 Examples of using these commands are available in the section
22 :ref:`section_examples` and in example files installed with ADAO module.
24 List of possible input types
25 ----------------------------
27 .. index:: single: Dict
28 .. index:: single: Function
29 .. index:: single: Matrix
30 .. index:: single: String
31 .. index:: single: Script
32 .. index:: single: Vector
34 Each ADAO variable has a pseudo-type to help filling it and validation. The
35 different pseudo-types are:
38 This indicates a variable that has to be filled by a dictionary, usually
42 This indicates a variable that has to be filled by a function, usually given
43 as a script or a component method.
46 This indicates a variable that has to be filled by a matrix, usually given
47 either as a string or as a script.
50 This indicates a string giving a literal representation of a matrix, a
51 vector or a vector serie, such as "1 2 ; 3 4" for a square 2x2 matrix.
54 This indicates a script given as an external file. It can be described by a
55 full absolute path name or only by the file name without path.
58 This indicates a variable that has to be filled by a vector, usually given
59 either as a string or as a script.
61 **VectorSerie** This indicates a variable that has to be filled by a list of
62 vectors, usually given either as a string or as a script.
64 When a command or keyword can be filled by a script file name, the script has to
65 contain a variable or a method that has the same name as the one to be filled.
66 In other words, when importing the script in a YACS Python node, it must create
67 a variable of the good name in the current namespace.
69 Reference description for ADAO calculation cases
70 ------------------------------------------------
72 List of commands and keywords for an ADAO calculation case
73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
75 .. index:: single: ASSIMILATION_STUDY
76 .. index:: single: Algorithm
77 .. index:: single: AlgorithmParameters
78 .. index:: single: Background
79 .. index:: single: BackgroundError
80 .. index:: single: ControlInput
81 .. index:: single: Debug
82 .. index:: single: EvolutionError
83 .. index:: single: EvolutionModel
84 .. index:: single: InputVariables
85 .. index:: single: Observation
86 .. index:: single: ObservationError
87 .. index:: single: ObservationOperator
88 .. index:: single: Observers
89 .. index:: single: OutputVariables
90 .. index:: single: Study_name
91 .. index:: single: Study_repertory
92 .. index:: single: UserDataInit
93 .. index:: single: UserPostAnalysis
95 The first set of commands is related to the description of a calculation case,
96 that is a *Data Assimilation* procedure or an *Optimization* procedure. The
97 terms are ordered in alphabetical order, except the first, which describes
98 choice between calculation or checking. The different commands are the
101 **ASSIMILATION_STUDY**
102 *Required command*. This is the general command describing the data
103 assimilation or optimization case. It hierarchically contains all the other
107 *Required command*. This is a string to indicate the data assimilation or
108 optimization algorithm chosen. The choices are limited and available through
109 the GUI. There exists for example "3DVAR", "Blue"... See below the list of
110 algorithms and associated parameters in the following subsection `Options
111 and required commands for calculation algorithms`_.
113 **AlgorithmParameters**
114 *Optional command*. This command allows to add some optional parameters to
115 control the data assimilation or optimization algorithm. It is defined as a
116 "*Dict*" type object, that is, given as a script. See below the list of
117 algorithms and associated parameters in the following subsection `Options
118 and required commands for calculation algorithms`_.
121 *Required command*. This indicates the background or initial vector used,
122 previously noted as :math:`\mathbf{x}^b`. It is defined as a "*Vector*" type
123 object, that is, given either as a string or as a script.
126 *Required command*. This indicates the background error covariance matrix,
127 previously noted as :math:`\mathbf{B}`. It is defined as a "*Matrix*" type
128 object, that is, given either as a string or as a script.
131 *Optional command*. This indicates the control vector used to force the
132 evolution model at each step, usually noted as :math:`\mathbf{U}`. It is
133 defined as a "*Vector*" or a *VectorSerie* type object, that is, given
134 either as a string or as a script. When there is no control, it has to be a
138 *Required command*. This define the level of trace and intermediary debug
139 information. The choices are limited between 0 (for False) and 1 (for
143 *Optional command*. This indicates the evolution error covariance matrix,
144 usually noted as :math:`\mathbf{Q}`. It is defined as a "*Matrix*" type
145 object, that is, given either as a string or as a script.
148 *Optional command*. This indicates the evolution model operator, usually
149 noted :math:`M`, which describes a step of evolution. It is defined as a
150 "*Function*" type object, that is, given as a script. Different functional
151 forms can be used, as described in the following subsection `Requirements
152 for functions describing an operator`_. If there is some control :math:`U`
153 included in the evolution model, the operator has to be applied to a pair
157 *Optional command*. This command allows to indicates the name and size of
158 physical variables that are bundled together in the control vector. This
159 information is dedicated to data processed inside an algorithm.
162 *Required command*. This indicates the observation vector used for data
163 assimilation or optimization, previously noted as :math:`\mathbf{y}^o`. It
164 is defined as a "*Vector*" or a *VectorSerie* type object, that is, given
165 either as a string or as a script.
168 *Required command*. This indicates the observation error covariance matrix,
169 previously noted as :math:`\mathbf{R}`. It is defined as a "*Matrix*" type
170 object, that is, given either as a string or as a script.
172 **ObservationOperator**
173 *Required command*. This indicates the observation operator, previously
174 noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
175 results :math:`\mathbf{y}` to be compared to observations
176 :math:`\mathbf{y}^o`. It is defined as a "*Function*" type object, that is,
177 given as a script. Different functional forms can be used, as described in
178 the following subsection `Requirements for functions describing an
179 operator`_. If there is some control :math:`U` included in the observation,
180 the operator has to be applied to a pair :math:`(X,U)`.
183 *Optional command*. This command allows to set internal observers, that are
184 functions linked with a particular variable, which will be executed each
185 time this variable is modified. It is a convenient way to monitor interest
186 variables during the data assimilation or optimization process, by printing
190 *Optional command*. This command allows to indicates the name and size of
191 physical variables that are bundled together in the output observation
192 vector. This information is dedicated to data processed inside an algorithm.
195 *Required command*. This is an open string to describe the study by a name
199 *Optional command*. If available, this repertory is used to find all the
200 script files that can be used to define some other commands by scripts.
203 *Optional command*. This commands allows to initialize some parameters or
204 data automatically before data assimilation algorithm processing.
207 *Optional command*. This commands allows to process some parameters or data
208 automatically after data assimilation algorithm processing. It is defined as
209 a script or a string, allowing to put post-processing code directly inside
212 Options and required commands for calculation algorithms
213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
215 .. index:: single: 3DVAR
216 .. index:: single: Blue
217 .. index:: single: EnsembleBlue
218 .. index:: single: KalmanFilter
219 .. index:: single: ExtendedKalmanFilter
220 .. index:: single: LinearLeastSquares
221 .. index:: single: NonLinearLeastSquares
222 .. index:: single: ParticleSwarmOptimization
223 .. index:: single: QuantileRegression
225 .. index:: single: AlgorithmParameters
226 .. index:: single: Bounds
227 .. index:: single: CostDecrementTolerance
228 .. index:: single: GradientNormTolerance
229 .. index:: single: GroupRecallRate
230 .. index:: single: MaximumNumberOfSteps
231 .. index:: single: Minimizer
232 .. index:: single: NumberOfInsects
233 .. index:: single: ProjectedGradientTolerance
234 .. index:: single: QualityCriterion
235 .. index:: single: Quantile
236 .. index:: single: SetSeed
237 .. index:: single: StoreInternalVariables
238 .. index:: single: StoreSupplementaryCalculations
239 .. index:: single: SwarmVelocity
241 Each algorithm can be controlled using some generic or specific options given
242 through the "*AlgorithmParameters*" optional command, as follows for example::
244 AlgorithmParameters = {
245 "Minimizer" : "LBFGSB",
246 "MaximumNumberOfSteps" : 25,
247 "StoreSupplementaryCalculations" : ["APosterioriCovariance","OMA"],
250 This section describes the available options algorithm by algorithm. If an
251 option is specified for an algorithm that doesn't support it, the option is
252 simply left unused. The meaning of the acronyms or particular names can be found
253 in the :ref:`genindex` or the :ref:`section_glossary`. In addition, for each
254 algorithm, the required commands/keywords are given, being described in `List of
255 commands and keywords for an ADAO calculation case`_.
260 *"Background", "BackgroundError",
261 "Observation", "ObservationError",
262 "ObservationOperator"*
264 StoreSupplementaryCalculations
265 This list indicates the names of the supplementary variables that can be
266 available at the end of the algorithm. It involves potentially costly
267 calculations. The default is a void list, none of these variables being
268 calculated and stored by default. The possible names are in the following
269 list: ["APosterioriCovariance", "BMA", "OMA", "OMB", "Innovation",
270 "SigmaBck2", "SigmaObs2", "MahalanobisConsistency"].
272 **"LinearLeastSquares"**
275 *"Observation", "ObservationError",
276 "ObservationOperator"*
278 StoreSupplementaryCalculations
279 This list indicates the names of the supplementary variables that can be
280 available at the end of the algorithm. It involves potentially costly
281 calculations. The default is a void list, none of these variables being
282 calculated and stored by default. The possible names are in the following
288 *"Background", "BackgroundError",
289 "Observation", "ObservationError",
290 "ObservationOperator"*
293 This key allows to choose the optimization minimizer. The default choice
294 is "LBFGSB", and the possible ones are "LBFGSB" (nonlinear constrained
295 minimizer, see [Byrd95]_ and [Zhu97]_), "TNC" (nonlinear constrained
296 minimizer), "CG" (nonlinear unconstrained minimizer), "BFGS" (nonlinear
297 unconstrained minimizer), "NCG" (Newton CG minimizer).
300 This key allows to define upper and lower bounds for every control
301 variable being optimized. Bounds can be given by a list of list of pairs
302 of lower/upper bounds for each variable, with possibly ``None`` every time
303 there is no bound. The bounds can always be specified, but they are taken
304 into account only by the constrained minimizers.
307 This key indicates the maximum number of iterations allowed for iterative
308 optimization. The default is 15000, which is very similar to no limit on
309 iterations. It is then recommended to adapt this parameter to the needs on
310 real problems. For some minimizers, the effective stopping step can be
311 slightly different due to algorithm internal control requirements.
313 CostDecrementTolerance
314 This key indicates a limit value, leading to stop successfully the
315 iterative optimization process when the cost function decreases less than
316 this tolerance at the last step. The default is 1.e-7, and it is
317 recommended to adapt it to the needs on real problems.
319 ProjectedGradientTolerance
320 This key indicates a limit value, leading to stop successfully the iterative
321 optimization process when all the components of the projected gradient are
322 under this limit. It is only used for constrained minimizers. The default is
323 -1, that is the internal default of each minimizer (generally 1.e-5), and it
324 is not recommended to change it.
326 GradientNormTolerance
327 This key indicates a limit value, leading to stop successfully the
328 iterative optimization process when the norm of the gradient is under this
329 limit. It is only used for non-constrained minimizers. The default is
330 1.e-5 and it is not recommended to change it.
332 StoreInternalVariables
333 This boolean key allows to store default internal variables, mainly the
334 current state during iterative optimization process. Be careful, this can be
335 a numerically costly choice in certain calculation cases. The default is
338 StoreSupplementaryCalculations
339 This list indicates the names of the supplementary variables that can be
340 available at the end of the algorithm. It involves potentially costly
341 calculations. The default is a void list, none of these variables being
342 calculated and stored by default. The possible names are in the following
343 list: ["APosterioriCovariance", "BMA", "OMA", "OMB", "Innovation",
344 "SigmaObs2", "MahalanobisConsistency"].
346 **"NonLinearLeastSquares"**
350 "Observation", "ObservationError",
351 "ObservationOperator"*
354 This key allows to choose the optimization minimizer. The default choice
355 is "LBFGSB", and the possible ones are "LBFGSB" (nonlinear constrained
356 minimizer, see [Byrd95]_ and [Zhu97]_), "TNC" (nonlinear constrained
357 minimizer), "CG" (nonlinear unconstrained minimizer), "BFGS" (nonlinear
358 unconstrained minimizer), "NCG" (Newton CG minimizer).
361 This key allows to define upper and lower bounds for every control
362 variable being optimized. Bounds can be given by a list of list of pairs
363 of lower/upper bounds for each variable, with possibly ``None`` every time
364 there is no bound. The bounds can always be specified, but they are taken
365 into account only by the constrained minimizers.
368 This key indicates the maximum number of iterations allowed for iterative
369 optimization. The default is 15000, which is very similar to no limit on
370 iterations. It is then recommended to adapt this parameter to the needs on
371 real problems. For some minimizers, the effective stopping step can be
372 slightly different due to algorithm internal control requirements.
374 CostDecrementTolerance
375 This key indicates a limit value, leading to stop successfully the
376 iterative optimization process when the cost function decreases less than
377 this tolerance at the last step. The default is 1.e-7, and it is
378 recommended to adapt it to the needs on real problems.
380 ProjectedGradientTolerance
381 This key indicates a limit value, leading to stop successfully the iterative
382 optimization process when all the components of the projected gradient are
383 under this limit. It is only used for constrained minimizers. The default is
384 -1, that is the internal default of each minimizer (generally 1.e-5), and it
385 is not recommended to change it.
387 GradientNormTolerance
388 This key indicates a limit value, leading to stop successfully the
389 iterative optimization process when the norm of the gradient is under this
390 limit. It is only used for non-constrained minimizers. The default is
391 1.e-5 and it is not recommended to change it.
393 StoreInternalVariables
394 This boolean key allows to store default internal variables, mainly the
395 current state during iterative optimization process. Be careful, this can be
396 a numerically costly choice in certain calculation cases. The default is
399 StoreSupplementaryCalculations
400 This list indicates the names of the supplementary variables that can be
401 available at the end of the algorithm. It involves potentially costly
402 calculations. The default is a void list, none of these variables being
403 calculated and stored by default. The possible names are in the following
404 list: ["BMA", "OMA", "OMB", "Innovation"].
409 *"Background", "BackgroundError",
410 "Observation", "ObservationError",
411 "ObservationOperator"*
414 This key allow to give an integer in order to fix the seed of the random
415 generator used to generate the ensemble. A convenient value is for example
416 1000. By default, the seed is left uninitialized, and so use the default
417 initialization from the computer.
422 *"Background", "BackgroundError",
423 "Observation", "ObservationError",
424 "ObservationOperator",
425 "EvolutionModel", "EvolutionError",
429 This key allows to choose the type of estimation to be performed. It can be
430 either state-estimation, named "State", or parameter-estimation, named
431 "Parameters". The default choice is "State".
433 StoreSupplementaryCalculations
434 This list indicates the names of the supplementary variables that can be
435 available at the end of the algorithm. It involves potentially costly
436 calculations. The default is a void list, none of these variables being
437 calculated and stored by default. The possible names are in the following
438 list: ["APosterioriCovariance", "BMA", "Innovation"].
440 **"ExtendedKalmanFilter"**
443 *"Background", "BackgroundError",
444 "Observation", "ObservationError",
445 "ObservationOperator",
446 "EvolutionModel", "EvolutionError",
450 This key allows to define upper and lower bounds for every control variable
451 being optimized. Bounds can be given by a list of list of pairs of
452 lower/upper bounds for each variable, with extreme values every time there
453 is no bound. The bounds can always be specified, but they are taken into
454 account only by the constrained minimizers.
457 This key allows to define the method to take bounds into account. The
458 possible methods are in the following list: ["EstimateProjection"].
461 This key allows to choose the type of estimation to be performed. It can be
462 either state-estimation, named "State", or parameter-estimation, named
463 "Parameters". The default choice is "State".
465 StoreSupplementaryCalculations
466 This list indicates the names of the supplementary variables that can be
467 available at the end of the algorithm. It involves potentially costly
468 calculations. The default is a void list, none of these variables being
469 calculated and stored by default. The possible names are in the following
470 list: ["APosterioriCovariance", "BMA", "Innovation"].
472 **"ParticleSwarmOptimization"**
475 *"Background", "BackgroundError",
476 "Observation", "ObservationError",
477 "ObservationOperator"*
480 This key indicates the maximum number of iterations allowed for iterative
481 optimization. The default is 50, which is an arbitrary limit. It is then
482 recommended to adapt this parameter to the needs on real problems.
485 This key indicates the number of insects or particles in the swarm. The
486 default is 100, which is a usual default for this algorithm.
489 This key indicates the part of the insect velocity which is imposed by the
490 swarm. It is a positive floating point value. The default value is 1.
493 This key indicates the recall rate at the best swarm insect. It is a
494 floating point value between 0 and 1. The default value is 0.5.
497 This key indicates the quality criterion, minimized to find the optimal
498 state estimate. The default is the usual data assimilation criterion named
499 "DA", the augmented ponderated least squares. The possible criteria has to
500 be in the following list, where the equivalent names are indicated by "=":
501 ["AugmentedPonderatedLeastSquares"="APLS"="DA",
502 "PonderatedLeastSquares"="PLS", "LeastSquares"="LS"="L2",
503 "AbsoluteValue"="L1", "MaximumError"="ME"]
506 This key allow to give an integer in order to fix the seed of the random
507 generator used to generate the ensemble. A convenient value is for example
508 1000. By default, the seed is left uninitialized, and so use the default
509 initialization from the computer.
511 StoreInternalVariables
512 This boolean key allows to store default internal variables, mainly the
513 current state during iterative optimization process. Be careful, this can be
514 a numerically costly choice in certain calculation cases. The default is
517 StoreSupplementaryCalculations
518 This list indicates the names of the supplementary variables that can be
519 available at the end of the algorithm. It involves potentially costly
520 calculations. The default is a void list, none of these variables being
521 calculated and stored by default. The possible names are in the following
522 list: ["BMA", "OMA", "OMB", "Innovation"].
524 **"QuantileRegression"**
529 "ObservationOperator"*
532 This key allows to define the real value of the desired quantile, between
533 0 and 1. The default is 0.5, corresponding to the median.
536 This key allows to choose the optimization minimizer. The default choice
537 and only available choice is "MMQR" (Majorize-Minimize for Quantile
541 This key indicates the maximum number of iterations allowed for iterative
542 optimization. The default is 15000, which is very similar to no limit on
543 iterations. It is then recommended to adapt this parameter to the needs on
546 CostDecrementTolerance
547 This key indicates a limit value, leading to stop successfully the
548 iterative optimization process when the cost function or the surrogate
549 decreases less than this tolerance at the last step. The default is 1.e-6,
550 and it is recommended to adapt it to the needs on real problems.
552 StoreInternalVariables
553 This boolean key allows to store default internal variables, mainly the
554 current state during iterative optimization process. Be careful, this can be
555 a numerically costly choice in certain calculation cases. The default is
558 StoreSupplementaryCalculations
559 This list indicates the names of the supplementary variables that can be
560 available at the end of the algorithm. It involves potentially costly
561 calculations. The default is a void list, none of these variables being
562 calculated and stored by default. The possible names are in the following
563 list: ["BMA", "OMA", "OMB", "Innovation"].
565 Reference description for ADAO checking cases
566 ---------------------------------------------
568 List of commands and keywords for an ADAO checking case
569 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
571 .. index:: single: CHECKING_STUDY
572 .. index:: single: Algorithm
573 .. index:: single: AlgorithmParameters
574 .. index:: single: CheckingPoint
575 .. index:: single: Debug
576 .. index:: single: ObservationOperator
577 .. index:: single: Study_name
578 .. index:: single: Study_repertory
579 .. index:: single: UserDataInit
581 The second set of commands is related to the description of a checking case,
582 that is a procedure to check required properties on information somewhere else
583 by a calculation case. The terms are ordered in alphabetical order, except the
584 first, which describes choice between calculation or checking. The different
585 commands are the following:
588 *Required command*. This is the general command describing the checking
589 case. It hierarchically contains all the other commands.
592 *Required command*. This is a string to indicate the data assimilation or
593 optimization algorithm chosen. The choices are limited and available through
594 the GUI. There exists for example "FunctionTest", "AdjointTest"... See below
595 the list of algorithms and associated parameters in the following subsection
596 `Options and required commands for checking algorithms`_.
598 **AlgorithmParameters**
599 *Optional command*. This command allows to add some optional parameters to
600 control the data assimilation or optimization algorithm. It is defined as a
601 "*Dict*" type object, that is, given as a script. See below the list of
602 algorithms and associated parameters in the following subsection `Options
603 and required commands for checking algorithms`_.
606 *Required command*. This indicates the vector used,
607 previously noted as :math:`\mathbf{x}^b`. It is defined as a "*Vector*" type
608 object, that is, given either as a string or as a script.
611 *Required command*. This define the level of trace and intermediary debug
612 information. The choices are limited between 0 (for False) and 1 (for
615 **ObservationOperator**
616 *Required command*. This indicates the observation operator, previously
617 noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
618 results :math:`\mathbf{y}` to be compared to observations
619 :math:`\mathbf{y}^o`. It is defined as a "*Function*" type object, that is,
620 given as a script. Different functional forms can be used, as described in
621 the following subsection `Requirements for functions describing an
625 *Required command*. This is an open string to describe the study by a name
629 *Optional command*. If available, this repertory is used to find all the
630 script files that can be used to define some other commands by scripts.
633 *Optional command*. This commands allows to initialize some parameters or
634 data automatically before data assimilation algorithm processing.
636 Options and required commands for checking algorithms
637 +++++++++++++++++++++++++++++++++++++++++++++++++++++
639 .. index:: single: AdjointTest
640 .. index:: single: FunctionTest
641 .. index:: single: GradientTest
643 .. index:: single: AlgorithmParameters
644 .. index:: single: AmplitudeOfInitialDirection
645 .. index:: single: EpsilonMinimumExponent
646 .. index:: single: InitialDirection
647 .. index:: single: ResiduFormula
648 .. index:: single: SetSeed
650 We recall that each algorithm can be controlled using some generic or specific
651 options given through the "*AlgorithmParameters*" optional command, as follows
654 AlgorithmParameters = {
655 "AmplitudeOfInitialDirection" : 1,
656 "EpsilonMinimumExponent" : -8,
659 If an option is specified for an algorithm that doesn't support it, the option
660 is simply left unused. The meaning of the acronyms or particular names can be
661 found in the :ref:`genindex` or the :ref:`section_glossary`. In addition, for
662 each algorithm, the required commands/keywords are given, being described in
663 `List of commands and keywords for an ADAO checking case`_.
669 "ObservationOperator"*
671 AmplitudeOfInitialDirection
672 This key indicates the scaling of the initial perturbation build as a vector
673 used for the directional derivative around the nominal checking point. The
674 default is 1, that means no scaling.
676 EpsilonMinimumExponent
677 This key indicates the minimal exponent value of the power of 10 coefficient
678 to be used to decrease the increment multiplier. The default is -8, and it
679 has to be between 0 and -20. For example, its default value leads to
680 calculate the residue of the scalar product formula with a fixed increment
681 multiplied from 1.e0 to 1.e-8.
684 This key indicates the vector direction used for the directional derivative
685 around the nominal checking point. It has to be a vector. If not specified,
686 this direction defaults to a random perturbation around zero of the same
687 vector size than the checking point.
690 This key allow to give an integer in order to fix the seed of the random
691 generator used to generate the ensemble. A convenient value is for example
692 1000. By default, the seed is left uninitialized, and so use the default
693 initialization from the computer.
699 "ObservationOperator"*
707 "ObservationOperator"*
709 AmplitudeOfInitialDirection
710 This key indicates the scaling of the initial perturbation build as a vector
711 used for the directional derivative around the nominal checking point. The
712 default is 1, that means no scaling.
714 EpsilonMinimumExponent
715 This key indicates the minimal exponent value of the power of 10 coefficient
716 to be used to decrease the increment multiplier. The default is -8, and it
717 has to be between 0 and -20. For example, its default value leads to
718 calculate the residue of the scalar product formula with a fixed increment
719 multiplied from 1.e0 to 1.e-8.
722 This key indicates the vector direction used for the directional derivative
723 around the nominal checking point. It has to be a vector. If not specified,
724 this direction defaults to a random perturbation around zero of the same
725 vector size than the checking point.
728 This key indicates the residue formula that has to be used for the test. The
729 default choice is "Taylor", and the possible ones are "Taylor" (residue of
730 the Taylor development of the operator, which has to decrease with the power
731 of 2 in perturbation) and "Norm" (residue obtained by taking the norm of the
732 Taylor development at zero order approximation, which approximate the
733 gradient, and which has to remain constant).
736 This key allow to give an integer in order to fix the seed of the random
737 generator used to generate the ensemble. A convenient value is for example
738 1000. By default, the seed is left uninitialized, and so use the default
739 initialization from the computer.
741 Requirements for functions describing an operator
742 -------------------------------------------------
744 The operators for observation and evolution are required to implement the data
745 assimilation or optimization procedures. They include the physical simulation
746 numerical simulations, but also the filtering and restriction to compare the
747 simulation to observation. The evolution operator is considered here in its
748 incremental form, representing the transition between two successive states, and
749 is then similar to the observation operator.
751 Schematically, an operator has to give a output solution given the input
752 parameters. Part of the input parameters can be modified during the optimization
753 procedure. So the mathematical representation of such a process is a function.
754 It was briefly described in the section :ref:`section_theory` and is generalized
755 here by the relation:
757 .. math:: \mathbf{y} = O( \mathbf{x} )
759 between the pseudo-observations :math:`\mathbf{y}` and the parameters
760 :math:`\mathbf{x}` using the observation or evolution operator :math:`O`. The
761 same functional representation can be used for the linear tangent model
762 :math:`\mathbf{O}` of :math:`O` and its adjoint :math:`\mathbf{O}^*`, also
763 required by some data assimilation or optimization algorithms.
765 Then, **to describe completely an operator, the user has only to provide a
766 function that fully and only realize the functional operation**.
768 This function is usually given as a script that can be executed in a YACS node.
769 This script can without difference launch external codes or use internal SALOME
770 calls and methods. If the algorithm requires the 3 aspects of the operator
771 (direct form, tangent form and adjoint form), the user has to give the 3
772 functions or to approximate them.
774 There are 3 practical methods for the user to provide the operator functional
777 First functional form: using "*ScriptWithOneFunction*"
778 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
780 The first one consist in providing only one potentially non-linear function, and
781 to approximate the tangent and the adjoint operators. This is done by using the
782 keyword "*ScriptWithOneFunction*" for the description of the chosen operator in
783 the ADAO GUI. The user have to provide the function in a script, with a
784 mandatory name "*DirectOperator*". For example, the script can follow the
787 def DirectOperator( X ):
788 """ Direct non-linear simulation operator """
794 In this case, the user can also provide a value for the differential increment,
795 using through the GUI the keyword "*DifferentialIncrement*", which has a default
796 value of 1%. This coefficient will be used in the finite difference
797 approximation to build the tangent and adjoint operators.
799 This first operator definition allow easily to test the functional form before
800 its use in an ADAO case, greatly reducing the complexity of implementation.
802 **Important warning:** the name "*DirectOperator*" is mandatory, and the type of
803 the X argument can be either a python list, a numpy array or a numpy 1D-matrix.
804 The user has to treat these cases in his script.
806 Second functional form: using "*ScriptWithFunctions*"
807 +++++++++++++++++++++++++++++++++++++++++++++++++++++
809 The second one consist in providing directly the three associated operators
810 :math:`O`, :math:`\mathbf{O}` and :math:`\mathbf{O}^*`. This is done by using
811 the keyword "*ScriptWithFunctions*" for the description of the chosen operator
812 in the ADAO GUI. The user have to provide three functions in one script, with
813 three mandatory names "*DirectOperator*", "*TangentOperator*" and
814 "*AdjointOperator*". For example, the script can follow the template::
816 def DirectOperator( X ):
817 """ Direct non-linear simulation operator """
821 return something like Y
823 def TangentOperator( (X, dX) ):
824 """ Tangent linear operator, around X, applied to dX """
828 return something like Y
830 def AdjointOperator( (X, Y) ):
831 """ Adjoint operator, around X, applied to Y """
835 return something like X
837 Another time, this second operator definition allow easily to test the
838 functional forms before their use in an ADAO case, reducing the complexity of
841 **Important warning:** the names "*DirectOperator*", "*TangentOperator*" and
842 "*AdjointOperator*" are mandatory, and the type of the X, Y, dX arguments can be
843 either a python list, a numpy array or a numpy 1D-matrix. The user has to treat
844 these cases in his script.
846 Third functional form: using "*ScriptWithSwitch*"
847 +++++++++++++++++++++++++++++++++++++++++++++++++
849 This third form give more possibilities to control the execution of the three
850 functions representing the operator, allowing advanced usage and control over
851 each execution of the simulation code. This is done by using the keyword
852 "*ScriptWithSwitch*" for the description of the chosen operator in the ADAO GUI.
853 The user have to provide a switch in one script to control the execution of the
854 direct, tangent and adjoint forms of its simulation code. The user can then, for
855 example, use other approximations for the tangent and adjoint codes, or
856 introduce more complexity in the argument treatment of the functions. But it
857 will be far more complicated to implement and debug.
859 **It is recommended not to use this third functional form without a solid
860 numerical or physical reason.**
862 If, however, you want to use this third form, we recommend using the following
863 template for the switch. It requires an external script or code named
864 "*Physical_simulation_functions.py*", containing three functions named
865 "*DirectOperator*", "*TangentOperator*" and "*AdjointOperator*" as previously.
866 Here is the switch template::
868 import Physical_simulation_functions
869 import numpy, logging
872 for param in computation["specificParameters"]:
873 if param["name"] == "method":
874 method = param["value"]
875 if method not in ["Direct", "Tangent", "Adjoint"]:
876 raise ValueError("No valid computation method is given")
877 logging.info("Found method is \'%s\'"%method)
879 logging.info("Loading operator functions")
880 Function = Physical_simulation_functions.DirectOperator
881 Tangent = Physical_simulation_functions.TangentOperator
882 Adjoint = Physical_simulation_functions.AdjointOperator
884 logging.info("Executing the possible computations")
886 if method == "Direct":
887 logging.info("Direct computation")
888 Xcurrent = computation["inputValues"][0][0][0]
889 data = Function(numpy.matrix( Xcurrent ).T)
890 if method == "Tangent":
891 logging.info("Tangent computation")
892 Xcurrent = computation["inputValues"][0][0][0]
893 dXcurrent = computation["inputValues"][0][0][1]
894 data = Tangent(numpy.matrix(Xcurrent).T, numpy.matrix(dXcurrent).T)
895 if method == "Adjoint":
896 logging.info("Adjoint computation")
897 Xcurrent = computation["inputValues"][0][0][0]
898 Ycurrent = computation["inputValues"][0][0][1]
899 data = Adjoint((numpy.matrix(Xcurrent).T, numpy.matrix(Ycurrent).T))
901 logging.info("Formatting the output")
902 it = numpy.ravel(data)
903 outputValues = [[[[]]]]
905 outputValues[0][0][0].append(val)
908 result["outputValues"] = outputValues
909 result["specificOutputInfos"] = []
910 result["returnCode"] = 0
911 result["errorMessage"] = ""
913 All various modifications could be done from this template hypothesis.
915 Special case of controled evolution operator
916 ++++++++++++++++++++++++++++++++++++++++++++
918 In some cases, the evolution or the observation operators are required to be
919 controled by an external input control, given a priori. In this case, the
920 generic form of the incremental evolution model is slightly modified as follows:
922 .. math:: \mathbf{y} = O( \mathbf{x}, \mathbf{u})
924 where :math:`\mathbf{u}` is the control over one state increment. In this case,
925 the direct operator has to be applied to a pair of variables :math:`(X,U)`.
926 Schematically, the operator has to be set as::
928 def DirectOperator( (X, U) ):
929 """ Direct non-linear simulation operator """
933 return something like X(n+1) or Y(n+1)
935 The tangent and adjoint operators have the same signature as previously, noting
936 that the derivatives has to be done only partially against :math:`\mathbf{x}`.
937 In such a case with explicit control, only the second functional form (using
938 "*ScriptWithFunctions*") and third functional form (using "*ScriptWithSwitch*")