Salome HOME
Improving version number update
[modules/adao.git] / doc / en / ref_algorithm_GradientTest.rst
1 ..
2    Copyright (C) 2008-2014 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: GradientTest
25 .. _section_ref_algorithm_GradientTest:
26
27 Checking algorithm "*GradientTest*"
28 -----------------------------------
29
30 Description
31 +++++++++++
32
33 This algorithm allows to check the quality of the adjoint operator, by
34 calculating a residue with known theoretical properties. Different residue
35 formula are available.
36
37 In any cases, one take :math:`\mathbf{dx}_0=Normal(0,\mathbf{x})` and
38 :math:`\mathbf{dx}=\alpha*\mathbf{dx}_0`. :math:`F` is the calculation code.
39
40 "Taylor" residue
41 ****************
42
43 One observe the residue coming from the Taylor development of the :math:`F`
44 function, normalized by the value at the nominal point:
45
46 .. math:: R(\alpha) = \frac{|| F(\mathbf{x}+\alpha*\mathbf{dx}) - F(\mathbf{x}) - \alpha * \nabla_xF(\mathbf{dx}) ||}{|| F(\mathbf{x}) ||}
47
48 If the residue is decreasing and the decrease change in :math:`\alpha^2` with
49 respect to :math:`\alpha`, until a certain level after which the residue remains
50 small and constant, it signifies that the :math:`F` is linear and that the
51 residue is decreasing due to the error coming from :math:`\nabla_xF` term
52 calculation.
53
54 "Norm" residue
55 **************
56
57 One observe the residue based on the gradient approximation:
58
59 .. math:: R(\alpha) = \frac{|| F(\mathbf{x}+\alpha*\mathbf{dx}) - F(\mathbf{x}) ||}{\alpha}
60
61 which has to remain stable until the calculation precision is reached.
62
63 Optional and required commands
64 ++++++++++++++++++++++++++++++
65
66 .. index:: single: CheckingPoint
67 .. index:: single: ObservationOperator
68 .. index:: single: AmplitudeOfInitialDirection
69 .. index:: single: EpsilonMinimumExponent
70 .. index:: single: InitialDirection
71 .. index:: single: ResiduFormula
72 .. index:: single: SetSeed
73
74 The general required commands, available in the editing user interface, are the
75 following:
76
77   CheckingPoint
78     *Required command*. This indicates the vector used as the state around which
79     to perform the required check, noted :math:`\mathbf{x}` and similar to the
80     background :math:`\mathbf{x}^b`. It is defined as a "*Vector*" type object.
81
82   ObservationOperator
83     *Required command*. This indicates the observation operator, previously
84     noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
85     results :math:`\mathbf{y}` to be compared to observations
86     :math:`\mathbf{y}^o`. Its value is defined as a "*Function*" type object or
87     a "*Matrix*" type one. In the case of "*Function*" type, different
88     functional forms can be used, as described in the section
89     :ref:`section_ref_operator_requirements`. If there is some control
90     :math:`U` included in the observation, the operator has to be applied to a
91     pair :math:`(X,U)`.
92
93 The general optional commands, available in the editing user interface, are
94 indicated in :ref:`section_ref_assimilation_keywords`. In particular, the
95 optional command "*AlgorithmParameters*" allows to choose the specific options,
96 described hereafter, of the algorithm. See
97 :ref:`section_ref_options_AlgorithmParameters` for the good use of this command.
98
99 The options of the algorithm are the following:
100
101   AmplitudeOfInitialDirection
102     This key indicates the scaling of the initial perturbation build as a vector
103     used for the directional derivative around the nominal checking point. The
104     default is 1, that means no scaling.
105
106     Example : ``{"AmplitudeOfInitialDirection":0.5}``
107
108   EpsilonMinimumExponent
109     This key indicates the minimal exponent value of the power of 10 coefficient
110     to be used to decrease the increment multiplier. The default is -8, and it
111     has to be between 0 and -20. For example, its default value leads to
112     calculate the residue of the scalar product formula with a fixed increment
113     multiplied from 1.e0 to 1.e-8.
114
115     Example : ``{"EpsilonMinimumExponent":-12}``
116
117   InitialDirection
118     This key indicates the vector direction used for the directional derivative
119     around the nominal checking point. It has to be a vector. If not specified,
120     this direction defaults to a random perturbation around zero of the same
121     vector size than the checking point.
122
123     Example : ``{"InitialDirection":[0.1,0.1,100.,3}``
124
125   ResiduFormula
126     This key indicates the residue formula that has to be used for the test. The
127     default choice is "Taylor", and the possible ones are "Taylor" (residue of
128     the Taylor development of the operator, which has to decrease with the
129     square power of the perturbation) and "Norm" (residue obtained by taking the
130     norm of the Taylor development at zero order approximation, which
131     approximate the gradient, and which has to remain constant).
132
133     Example : ``{"ResiduFormula":"Taylor"}``
134
135   SetSeed
136     This key allow to give an integer in order to fix the seed of the random
137     generator used to generate the ensemble. A convenient value is for example
138     1000. By default, the seed is left uninitialized, and so use the default
139     initialization from the computer.
140
141     Example : ``{"SetSeed":1000}``
142
143 See also
144 ++++++++
145
146 References to other sections:
147   - :ref:`section_ref_algorithm_FunctionTest`
148   - :ref:`section_ref_algorithm_TangentTest`
149   - :ref:`section_ref_algorithm_AdjointTest`