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: TangentTest
25 .. _section_ref_algorithm_TangentTest:
27 Checking algorithm "*TangentTest*"
28 ----------------------------------
33 This algorithm allows to check the quality of the tangent operator, by
34 calculating a residue with known theoretical properties.
36 One can observe the following residue, which is the comparison of increments
37 using the tangent linear operator:
39 .. math:: R(\alpha) = \frac{|| F(\mathbf{x}+\alpha*\mathbf{dx}) - F(\mathbf{x}) ||}{|| \alpha * TangentF_x * \mathbf{dx} ||}
41 which has to remain stable in :math:`1+O(\alpha)` until the calculation
44 When :math:`|R-1|/\alpha` is less or equal to a stable value when :math:`\alpha`
45 is varying, the tangent is valid, until the calculation precision is reached.
47 If :math:`|R-1|/\alpha` is really small, the calculation code :math:`F` is
48 almost linear or quasi-linear (which can be verified by the
49 :ref:`section_ref_algorithm_LinearityTest`), and the tangent is valid until the
50 calculation precision is reached.
52 One take :math:`\mathbf{dx}_0=Normal(0,\mathbf{x})` and
53 :math:`\mathbf{dx}=\alpha*\mathbf{dx}_0`. :math:`F` is the calculation code.
55 Optional and required commands
56 ++++++++++++++++++++++++++++++
58 .. index:: single: AlgorithmParameters
59 .. index:: single: CheckingPoint
60 .. index:: single: ObservationOperator
61 .. index:: single: AmplitudeOfInitialDirection
62 .. index:: single: EpsilonMinimumExponent
63 .. index:: single: InitialDirection
64 .. index:: single: SetSeed
65 .. index:: single: StoreSupplementaryCalculations
67 The general required commands, available in the editing user interface, are the
71 *Required command*. This indicates the vector used as the state around which
72 to perform the required check, noted :math:`\mathbf{x}` and similar to the
73 background :math:`\mathbf{x}^b`. It is defined as a "*Vector*" type object.
76 *Required command*. This indicates the observation operator, previously
77 noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
78 results :math:`\mathbf{y}` to be compared to observations
79 :math:`\mathbf{y}^o`. Its value is defined as a "*Function*" type object or
80 a "*Matrix*" type one. In the case of "*Function*" type, different
81 functional forms can be used, as described in the section
82 :ref:`section_ref_operator_requirements`. If there is some control
83 :math:`U` included in the observation, the operator has to be applied to a
86 The general optional commands, available in the editing user interface, are
87 indicated in :ref:`section_ref_assimilation_keywords`. Moreover, the parameters
88 of the command "*AlgorithmParameters*" allow to choose the specific options,
89 described hereafter, of the algorithm. See
90 :ref:`section_ref_options_Algorithm_Parameters` for the good use of this
93 The options of the algorithm are the following:
95 AmplitudeOfInitialDirection
96 This key indicates the scaling of the initial perturbation build as a vector
97 used for the directional derivative around the nominal checking point. The
98 default is 1, that means no scaling.
100 Example : ``{"AmplitudeOfInitialDirection":0.5}``
102 EpsilonMinimumExponent
103 This key indicates the minimal exponent value of the power of 10 coefficient
104 to be used to decrease the increment multiplier. The default is -8, and it
105 has to be between 0 and -20. For example, its default value leads to
106 calculate the residue of the scalar product formula with a fixed increment
107 multiplied from 1.e0 to 1.e-8.
109 Example : ``{"EpsilonMinimumExponent":-12}``
112 This key indicates the vector direction used for the directional derivative
113 around the nominal checking point. It has to be a vector. If not specified,
114 this direction defaults to a random perturbation around zero of the same
115 vector size than the checking point.
117 Example : ``{"InitialDirection":[0.1,0.1,100.,3}``
120 This key allow to give an integer in order to fix the seed of the random
121 generator used to generate the ensemble. A convenient value is for example
122 1000. By default, the seed is left uninitialized, and so use the default
123 initialization from the computer.
125 Example : ``{"SetSeed":1000}``
127 StoreSupplementaryCalculations
128 This list indicates the names of the supplementary variables that can be
129 available at the end of the algorithm. It involves potentially costly
130 calculations or memory consumptions. The default is a void list, none of
131 these variables being calculated and stored by default. The possible names
132 are in the following list: ["CurrentState", "Residu",
133 "SimulatedObservationAtCurrentState"].
135 Example : ``{"StoreSupplementaryCalculations":["CurrentState"]}``
137 Information and variables available at the end of the algorithm
138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
140 At the output, after executing the algorithm, there are variables and
141 information originating from the calculation. The description of
142 :ref:`section_ref_output_variables` show the way to obtain them by the method
143 named ``get`` of the variable "*ADD*" of the post-processing. The input
144 variables, available to the user at the output in order to facilitate the
145 writing of post-processing procedures, are described in the
146 :ref:`subsection_r_o_v_Inventaire`.
148 The unconditional outputs of the algorithm are the following:
151 *List of values*. Each element is the value of the particular residu
152 verified during a checking algorithm, in the order of the tests.
154 Example : ``r = ADD.get("Residu")[:]``
156 The conditional outputs of the algorithm are the following:
159 *List of vectors*. Each element is a usual state vector used during the
160 optimization algorithm procedure.
162 Example : ``Xs = ADD.get("CurrentState")[:]``
164 SimulatedObservationAtCurrentState
165 *List of vectors*. Each element is an observed vector at the current state,
166 that is, in the observation space.
168 Example : ``hxs = ADD.get("SimulatedObservationAtCurrentState")[-1]``
173 References to other sections:
174 - :ref:`section_ref_algorithm_FunctionTest`
175 - :ref:`section_ref_algorithm_LinearityTest`
176 - :ref:`section_ref_algorithm_AdjointTest`
177 - :ref:`section_ref_algorithm_GradientTest`