From 64971448ca094cb03b76bc346424b99e9412b426 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Mon, 2 Oct 2023 11:52:35 +0200 Subject: [PATCH] Documentation update and examples improvement --- doc/en/examples.rst | 3 +- ...thm_EnsembleOfSimulationGenerationTask.rst | 5 -- doc/en/ref_algorithm_InputValuesTest.rst | 3 - ...orithm_InterpolationByReducedModelTask.rst | 34 ++++++-- ...thm_MeasurementsOptimalPositioningTask.rst | 12 ++- ...ef_algorithm_ParticleSwarmOptimization.rst | 3 - doc/en/ref_assimilation_keywords.rst | 34 ++++---- doc/en/ref_checking_keywords.rst | 21 ++--- doc/en/ref_task_keywords.rst | 18 +++-- ...simple_InterpolationByReducedModelTask1.py | 80 +++++++++++++++++++ ...imple_InterpolationByReducedModelTask1.res | 30 +++++++ ...imple_InterpolationByReducedModelTask1.rst | 16 ++++ ...ple_MeasurementsOptimalPositioningTask1.py | 4 +- ...le_MeasurementsOptimalPositioningTask1.res | 4 +- ...le_MeasurementsOptimalPositioningTask1.rst | 2 +- ...ple_MeasurementsOptimalPositioningTask2.py | 10 +-- ...le_MeasurementsOptimalPositioningTask2.res | 10 +-- ...le_MeasurementsOptimalPositioningTask2.rst | 2 +- doc/en/snippets/Header2Algo00.rst | 6 +- doc/en/snippets/Header2Algo99.rst | 4 + doc/en/snippets/ModuleCompatibility.rst | 2 +- doc/en/snippets/ReducedCoordinates.rst | 8 ++ doc/fr/examples.rst | 3 +- ...thm_EnsembleOfSimulationGenerationTask.rst | 5 -- doc/fr/ref_algorithm_InputValuesTest.rst | 3 - ...orithm_InterpolationByReducedModelTask.rst | 36 +++++++-- ...thm_MeasurementsOptimalPositioningTask.rst | 12 ++- ...ef_algorithm_ParticleSwarmOptimization.rst | 3 - doc/fr/ref_assimilation_keywords.rst | 35 ++++---- doc/fr/ref_checking_keywords.rst | 23 +++--- doc/fr/ref_task_keywords.rst | 19 +++-- ...simple_InterpolationByReducedModelTask1.py | 79 ++++++++++++++++++ ...imple_InterpolationByReducedModelTask1.res | 30 +++++++ ...imple_InterpolationByReducedModelTask1.rst | 16 ++++ ...ple_MeasurementsOptimalPositioningTask1.py | 4 +- ...le_MeasurementsOptimalPositioningTask1.res | 4 +- ...ple_MeasurementsOptimalPositioningTask2.py | 10 +-- ...le_MeasurementsOptimalPositioningTask2.res | 10 +-- doc/fr/snippets/Header2Algo00.rst | 7 +- doc/fr/snippets/Header2Algo99.rst | 5 ++ doc/fr/snippets/ModuleCompatibility.rst | 2 +- doc/fr/snippets/ReducedCoordinates.rst | 9 +++ src/daComposant/daAlgorithms/Atoms/ecweim.py | 2 + .../InterpolationByReducedModelTask.py | 1 + .../InterpolationByReducedModelTest.py | 29 ++++++- src/daComposant/daCore/BasicObjects.py | 2 + 46 files changed, 492 insertions(+), 168 deletions(-) create mode 100644 doc/en/scripts/simple_InterpolationByReducedModelTask1.py create mode 100644 doc/en/scripts/simple_InterpolationByReducedModelTask1.res create mode 100644 doc/en/scripts/simple_InterpolationByReducedModelTask1.rst create mode 100644 doc/en/snippets/Header2Algo99.rst create mode 100644 doc/en/snippets/ReducedCoordinates.rst create mode 100644 doc/fr/scripts/simple_InterpolationByReducedModelTask1.py create mode 100644 doc/fr/scripts/simple_InterpolationByReducedModelTask1.res create mode 100644 doc/fr/scripts/simple_InterpolationByReducedModelTask1.rst create mode 100644 doc/fr/snippets/Header2Algo99.rst create mode 100644 doc/fr/snippets/ReducedCoordinates.rst diff --git a/doc/en/examples.rst b/doc/en/examples.rst index 0387e83..87769af 100644 --- a/doc/en/examples.rst +++ b/doc/en/examples.rst @@ -63,7 +63,8 @@ Checking algorithms uses Dedicated tasks or study oriented cases uses -------------------------------------------- -#. :ref:`Examples with the "MeasurementsOptimalPositioningTask" case` +#. :ref:`Examples with the "InterpolationByReducedModelTask" study` +#. :ref:`Examples with the "MeasurementsOptimalPositioningTask" study` Advanced uses ------------- diff --git a/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst b/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst index 909dd09..a1ca8e4 100644 --- a/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst +++ b/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst @@ -35,11 +35,6 @@ Task algorithm "*EnsembleOfSimulationGenerationTask*" .. ------------------------------------ .. .. include:: snippets/Header2Algo00.rst -.. warning:: - - This algorithm is only available in textual user interface (TUI) and not in - graphical user interface (GUI). - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst diff --git a/doc/en/ref_algorithm_InputValuesTest.rst b/doc/en/ref_algorithm_InputValuesTest.rst index aa49e3e..8561269 100644 --- a/doc/en/ref_algorithm_InputValuesTest.rst +++ b/doc/en/ref_algorithm_InputValuesTest.rst @@ -27,9 +27,6 @@ Checking algorithm "*InputValuesTest*" -------------------------------------- -.. ------------------------------------ .. -.. include:: snippets/Header2Algo00.rst - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst diff --git a/doc/en/ref_algorithm_InterpolationByReducedModelTask.rst b/doc/en/ref_algorithm_InterpolationByReducedModelTask.rst index 99e4228..caa3d50 100644 --- a/doc/en/ref_algorithm_InterpolationByReducedModelTask.rst +++ b/doc/en/ref_algorithm_InterpolationByReducedModelTask.rst @@ -23,19 +23,20 @@ .. index:: single: InterpolationByReducedModelTask .. index:: single: Measurements interpolation +.. index:: single: Field reconstruction .. index:: single: Snapshots (Ensemble) +.. index:: single: Reduced Order Model +.. index:: single: ROM .. _section_ref_algorithm_InterpolationByReducedModelTask: Task algorithm "*InterpolationByReducedModelTask*" -------------------------------------------------- .. ------------------------------------ .. -.. include:: snippets/Header2Algo00.rst - -.. warning:: +.. include:: snippets/Header2Algo99.rst - This algorithm is only available in textual user interface (TUI) and not in - graphical user interface (GUI). +.. ------------------------------------ .. +.. include:: snippets/Header2Algo00.rst .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst @@ -43,11 +44,12 @@ Task algorithm "*InterpolationByReducedModelTask*" This algorithm enables highly efficient interpolation of physical measurements using a reduced representation of the model for that physics. The output, for each set of measurements supplied at the required positions, is a complete -field :math:`\mathbf{y}` by interpolation. +field :math:`\mathbf{y}` by interpolation. Put another way, it's a physical +field reconstruction using measurements and a reduced numerical model. To interpolate these measurements, a method of Empirical Interpolation Method -(EIM [Barrault04]_) type is used, which establishes a reduced model, with or -without measurement positioning constraints. +(EIM [Barrault04]_) type is used, which uses a reduced model of type Reduced +Order Model (ROM), with or without measurement positioning constraints. To use this algorithm, you need the optimally positioned measurements and the associated reduced basis for model representation. This can be achieved as @@ -92,6 +94,7 @@ StoreSupplementaryCalculations sub-section "*Information and variables available at the end of the algorithm*"): [ "Analysis", + "ReducedCoordinates", ]. Example : @@ -107,9 +110,24 @@ StoreSupplementaryCalculations .. include:: snippets/Analysis.rst +.. include:: snippets/ReducedCoordinates.rst + .. ------------------------------------ .. .. _section_ref_algorithm_InterpolationByReducedModelTask_examples: +.. include:: snippets/Header2Algo09.rst + +.. --------- .. +.. include:: scripts/simple_InterpolationByReducedModelTask1.rst + +.. literalinclude:: scripts/simple_InterpolationByReducedModelTask1.py + +.. include:: snippets/Header2Algo10.rst + +.. literalinclude:: scripts/simple_InterpolationByReducedModelTask1.res + :language: none + +.. ------------------------------------ .. .. include:: snippets/Header2Algo06.rst - :ref:`section_ref_algorithm_MeasurementsOptimalPositioningTask` diff --git a/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst b/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst index a798b9e..4979d64 100644 --- a/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst +++ b/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst @@ -29,6 +29,8 @@ .. index:: single: Ensemble of snapshots .. index:: single: Simulations (Ensemble) .. index:: single: Snapshots (Ensemble) +.. index:: single: Reduced Order Model +.. index:: single: ROM .. _section_ref_algorithm_MeasurementsOptimalPositioningTask: Task algorithm "*MeasurementsOptimalPositioningTask*" @@ -37,11 +39,6 @@ Task algorithm "*MeasurementsOptimalPositioningTask*" .. ------------------------------------ .. .. include:: snippets/Header2Algo00.rst -.. warning:: - - This algorithm is only available in textual user interface (TUI) and not in - graphical user interface (GUI). - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst @@ -57,8 +54,9 @@ returns the complete field(s) for a given set of parameters :math:`\mathbf{x}`, or of an explicit observation of the complete field(s) :math:`\mathbf{y}`. To determine the optimum positioning of measurements, an Empirical -Interpolation Method (EIM [Barrault04]_) is used, with (variant "*lcEIM*") or -without (variant "*EIM*") positioning constraints. +Interpolation Method (EIM [Barrault04]_) is used, which establishes a reduced +model of type Reduced Order Model (ROM), with (variant "*lcEIM*") or without +(variant "*EIM*") positioning constraints. There are two ways to use this algorithm: diff --git a/doc/en/ref_algorithm_ParticleSwarmOptimization.rst b/doc/en/ref_algorithm_ParticleSwarmOptimization.rst index 5f0eaee..5a2f78c 100644 --- a/doc/en/ref_algorithm_ParticleSwarmOptimization.rst +++ b/doc/en/ref_algorithm_ParticleSwarmOptimization.rst @@ -28,9 +28,6 @@ Calculation algorithm "*ParticleSwarmOptimization*" --------------------------------------------------- -.. ------------------------------------ .. -.. include:: snippets/Header2Algo00.rst - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst diff --git a/doc/en/ref_assimilation_keywords.rst b/doc/en/ref_assimilation_keywords.rst index 83e24ca..ff43032 100644 --- a/doc/en/ref_assimilation_keywords.rst +++ b/doc/en/ref_assimilation_keywords.rst @@ -26,31 +26,25 @@ List of commands and keywords for data assimilation or optimisation case ------------------------------------------------------------------------ -We summarize here all the commands available to describe a calculation case by -avoiding the particularities of each algorithm. It is therefore a common -inventory of commands. +We summarize here all the commands and keywords available to describe a +calculation case, by avoiding the particularities of each algorithm. It is +therefore a common inventory of commands. The set of commands for an data assimilation or optimisation case is related to the description of a calculation case, that is a *Data Assimilation* procedure -or an *Optimization* procedure. +(chosen in graphical user interface by the command "*ASSIMILATION_STUDY*"), a +*Reduction Method* procedure (chosen in graphical user interface by the +command "*REDUCTION_STUDY*") or an *Optimization* procedure (chosen in +graphical user interface by the command "*OPTIMIZATION_STUDY*"). -The first term describes the choice between calculation or checking. In the -graphical interface, each of the three types of calculation, individually more -oriented to *data assimilation*, *optimization methods* or *methods with -reduction* (some algorithms are simultaneously in various categories), is -imperatively indicated by one of these commands: - -.. include:: snippets/ASSIMILATION_STUDY.rst - -.. include:: snippets/OPTIMIZATION_STUDY.rst - -.. include:: snippets/REDUCTION_STUDY.rst - -The nested terms are sorted in alphabetical order. They are not necessarily -required for all algorithms. The various commands are the following: +All the possible terms, nested or not, are listed by alphabetical order. They +are not required for all the algorithms. The commands or keywords available are +the following .. include:: snippets/AlgorithmParameters.rst +.. include:: snippets/ASSIMILATION_STUDY.rst + .. include:: snippets/Background.rst .. include:: snippets/BackgroundError.rst @@ -75,8 +69,12 @@ required for all algorithms. The various commands are the following: .. include:: snippets/Observers.rst +.. include:: snippets/OPTIMIZATION_STUDY.rst + .. include:: snippets/OutputVariables.rst +.. include:: snippets/REDUCTION_STUDY.rst + .. include:: snippets/StudyName.rst .. include:: snippets/StudyRepertory.rst diff --git a/doc/en/ref_checking_keywords.rst b/doc/en/ref_checking_keywords.rst index 944b2a0..ff31af9 100644 --- a/doc/en/ref_checking_keywords.rst +++ b/doc/en/ref_checking_keywords.rst @@ -26,23 +26,24 @@ List of commands and keywords for an ADAO checking case ------------------------------------------------------- -This set of commands is related to the description of a checking case, that is a -procedure to check required properties on information, used somewhere else by a -calculation case. +We summarize here all the commands and keywords available to describe a +checking case, by avoiding the particularities of each algorithm. It is +therefore a common inventory of commands. -The first term describes the choice between calculation or checking. In the -graphical interface, the choice is imperatively indicated by the command: +A special term allow to choose explicitly a checking. In the graphical user +interface, this choice is done by the command "*CHECKING_STUDY*". -.. include:: snippets/CHECKING_STUDY.rst - -The nested terms are sorted in alphabetical order. They are not necessarily -required for all algorithms. The various commands are the following: +All the possible terms, nested or not, are listed by alphabetical order. They +are not required for all the algorithms. The commands or keywords available are +the following .. include:: snippets/AlgorithmParameters.rst +.. include:: snippets/BackgroundError.rst + .. include:: snippets/CheckingPoint.rst -.. include:: snippets/BackgroundError.rst +.. include:: snippets/CHECKING_STUDY.rst .. include:: snippets/Debug.rst diff --git a/doc/en/ref_task_keywords.rst b/doc/en/ref_task_keywords.rst index a510283..7d120dc 100644 --- a/doc/en/ref_task_keywords.rst +++ b/doc/en/ref_task_keywords.rst @@ -26,18 +26,24 @@ List of commands and keywords for a dedicated task or study oriented case ------------------------------------------------------------------------- -This set of commands is related to the description of a dedicated task or study -oriented case, which consists of a simple specific procedure to perform a -computational task dedicated to a general application of data assimilation or -optimization methods. +We summarize here all the commands and keywords available to describe a +dedicated task or study oriented case by avoiding the particularities of each +algorithm. It is therefore a common inventory of commands. -The nested terms are sorted in alphabetical order. They are not necessarily -required for all algorithms. The various commands are the following: +All the possible terms, nested or not, are listed by alphabetical order. They +are not required for all the algorithms. The commands or keywords available are +the following .. include:: snippets/AlgorithmParameters.rst +.. include:: snippets/Background.rst + .. include:: snippets/Debug.rst +.. include:: snippets/Observation.rst + +.. include:: snippets/ObservationOperator.rst + .. include:: snippets/Observers.rst .. include:: snippets/StudyName.rst diff --git a/doc/en/scripts/simple_InterpolationByReducedModelTask1.py b/doc/en/scripts/simple_InterpolationByReducedModelTask1.py new file mode 100644 index 0000000..3d60821 --- /dev/null +++ b/doc/en/scripts/simple_InterpolationByReducedModelTask1.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# +from numpy import array, arange, ravel, set_printoptions +set_printoptions(precision=3) +# +dimension = 7 +# +print("Defining a set of artificial physical fields") +print("--------------------------------------------") +Ensemble = array( [i+arange(dimension) for i in range(7)] ).T +print("- Dimension of physical field space....................: %i"%dimension) +print("- Number of physical field vectors.....................: %i"%Ensemble.shape[1]) +print() +# +print("Search for optimal measurement positions") +print("-------------------------------------------") +from adao import adaoBuilder +case = adaoBuilder.New() +case.setAlgorithmParameters( + Algorithm = 'MeasurementsOptimalPositioningTask', + Parameters = { + "EnsembleOfSnapshots":Ensemble, + "MaximumNumberOfLocations":3, + "ErrorNorm":"L2", + "StoreSupplementaryCalculations":[ + "ReducedBasis", + "Residus", + ], + } +) +case.execute() +print("- ADAO calculation performed") +print() +# +print("Display of optimal positioning of measures") +print("------------------------------------------") +op = case.get("OptimalPoints")[-1] +print("- Number of optimal measurement positions..............: %i"%op.size) +print("- Optimal measurement positions, numbered by default...: %s"%op) +print() +# +print("Reconstruction by interpolation of known measured states") +print("--------------------------------------------------------") +rb = case.get("ReducedBasis")[-1] +measures_at_op = Ensemble[op,1] +# +interpolation = adaoBuilder.New() +interpolation.setAlgorithmParameters( + Algorithm = 'InterpolationByReducedModelTask', + Parameters = { + "ReducedBasis":rb, + "OptimalLocations":op, + } + ) +interpolation.setObservation( Vector = measures_at_op ) +interpolation.execute() +field = interpolation.get("Analysis")[-1] +print("- Reference state 1 used for the learning..............:",ravel(Ensemble[:,1])) +print("- Optimal measurement positions, numbered by default...: %s"%op) +print("- Measures extracted from state 1 for reconstruction...:",measures_at_op) +print("- State 1 reconstructed with the precision of 1%.......:",field) + +if max(abs(ravel(Ensemble[:,1])-field)) < 1.e-2: + print(" ===> There is no difference between the two states, as expected") +else: + raise ValueError("Difference recorded in reference state 1") +print() +# +print("Reconstruction by interpolation of unknown measured states") +print("----------------------------------------------------------") +measures_at_op = array([4, 3]) +interpolation.setObservation( Vector = measures_at_op ) +interpolation.execute() +field = interpolation.get("Analysis")[-1] +print(" Illustration of an interpolation on unknown real measurements") +print("- Optimal measurement positions, numbered by default...: %s"%op) +print("- Measures not present in the known states.............:",measures_at_op) +print("- State reconstructed with the precision of 1%.........:",field) +print(" ===> At measure positions %s, the reconstructed field is equal to measures"%op) +print() diff --git a/doc/en/scripts/simple_InterpolationByReducedModelTask1.res b/doc/en/scripts/simple_InterpolationByReducedModelTask1.res new file mode 100644 index 0000000..94e7bbc --- /dev/null +++ b/doc/en/scripts/simple_InterpolationByReducedModelTask1.res @@ -0,0 +1,30 @@ +Defining a set of artificial physical fields +-------------------------------------------- +- Dimension of physical field space....................: 7 +- Number of physical field vectors.....................: 7 + +Search for optimal measurement positions +------------------------------------------- +- ADAO calculation performed + +Display of optimal positioning of measures +------------------------------------------ +- Number of optimal measurement positions..............: 2 +- Optimal measurement positions, numbered by default...: [6 0] + +Reconstruction by interpolation of known measured states +-------------------------------------------------------- +- Reference state 1 used for the learning..............: [1 2 3 4 5 6 7] +- Optimal measurement positions, numbered by default...: [6 0] +- Measures extracted from state 1 for reconstruction...: [7 1] +- State 1 reconstructed with the precision of 1%.......: [1. 2. 3. 4. 5. 6. 7.] + ===> There is no difference between the two states, as expected + +Reconstruction by interpolation of unknown measured states +---------------------------------------------------------- + Illustration of an interpolation on unknown real measurements +- Optimal measurement positions, numbered by default...: [6 0] +- Measures not present in the known states.............: [4 3] +- State reconstructed with the precision of 1%.........: [3. 3.167 3.333 3.5 3.667 3.833 4. ] + ===> At measure positions [6 0], the reconstructed field is equal to measures + diff --git a/doc/en/scripts/simple_InterpolationByReducedModelTask1.rst b/doc/en/scripts/simple_InterpolationByReducedModelTask1.rst new file mode 100644 index 0000000..6dfb2a6 --- /dev/null +++ b/doc/en/scripts/simple_InterpolationByReducedModelTask1.rst @@ -0,0 +1,16 @@ +.. index:: single: InterpolationByReducedModelTask (example) + +First example +............. + +This example describes the implementation of a reconstruction by interpolation, +following the building of a reduced representation by an **optimal measurement +positioning** search task. + +To illustrate, we use the very simple artificial fields (generated in such a +way as to exist in a vector space of dimension 2) that for the :ref:`study +examples with +"MeasurementsOptimalPositioningTask"`. +The preliminary ADAO search yields 2 optimal positions for the measurements, +which are then used to establish a physical field interpolation based on +measurements at the optimum locations. diff --git a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.py b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.py index 2612cab..6435cf5 100644 --- a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.py +++ b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.py @@ -29,8 +29,8 @@ case.execute() print("- ADAO calculation performed") print() # -print("Optimal positioning of measures") -print("-------------------------------") +print("Display the optimal positioning of measures") +print("-------------------------------------------") op = case.get("OptimalPoints")[-1] print("- Number of optimal measurement positions..............: %i"%op.size) print("- Optimal measurement positions, numbered by default...: %s"%op) diff --git a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.res b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.res index 25b1e36..3c281aa 100644 --- a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.res +++ b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.res @@ -15,8 +15,8 @@ Search for optimal measurement positions ------------------------------------------- - ADAO calculation performed -Optimal positioning of measures -------------------------------- +Display the optimal positioning of measures +------------------------------------------- - Number of optimal measurement positions..............: 2 - Optimal measurement positions, numbered by default...: [6 0] diff --git a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.rst b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.rst index eab4572..a399084 100644 --- a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.rst +++ b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask1.rst @@ -1,4 +1,4 @@ -.. index:: single: MeasurementsOptimalPositioningTask (exemple) +.. index:: single: MeasurementsOptimalPositioningTask (example) First example ............. diff --git a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.py b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.py index a6420ad..5c7c94b 100644 --- a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.py +++ b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.py @@ -33,8 +33,8 @@ case.execute() print("- ADAO calculation performed") print() # -print("Optimal positioning of measures") -print("-------------------------------") +print("Display the optimal positioning of measures") +print("-------------------------------------------") op = case.get("OptimalPoints")[-1] print("- Number of optimal measurement positions..............: %i"%op.size) print("- Optimal measurement positions, numbered by default...: %s"%op) @@ -50,8 +50,8 @@ rs = case.get("Residus")[-1] print("- Ordered residuals of reconstruction error\n ",rs) print() a0, a1 = 7, -2.5 -print("- Elementary example of second field reconstruction") -print(" as a linear combination of the two base vectors,") -print(" with the respective coefficients %.1f and %.1f:"%(a0,a1)) +print("- Elementary example of second field reconstruction as a linear") +print(" combination of the two base vectors, that can be guessed to be") +print(" multiplied with the respective coefficients %.1f and %.1f:"%(a0,a1)) print( a0*rb[:,0] + a1*rb[:,1]) print() diff --git a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.res b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.res index bb4706a..351cf64 100644 --- a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.res +++ b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.res @@ -15,8 +15,8 @@ Search for optimal measurement positions ------------------------------------------- - ADAO calculation performed -Optimal positioning of measures -------------------------------- +Display the optimal positioning of measures +------------------------------------------- - Number of optimal measurement positions..............: 2 - Optimal measurement positions, numbered by default...: [6 0] @@ -35,9 +35,9 @@ Reduced representation and error information - Ordered residuals of reconstruction error [2.43926218e+01 4.76969601e+00 2.51214793e-15] -- Elementary example of second field reconstruction - as a linear combination of the two base vectors, - with the respective coefficients 7.0 and -2.5: +- Elementary example of second field reconstruction as a linear + combination of the two base vectors, that can be guessed to be + multiplied with the respective coefficients 7.0 and -2.5: [[1.] [2.] [3.] diff --git a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.rst b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.rst index e65cd3b..485e7b3 100644 --- a/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.rst +++ b/doc/en/scripts/simple_MeasurementsOptimalPositioningTask2.rst @@ -1,4 +1,4 @@ -.. index:: single: MeasurementsOptimalPositioningTask (exemple) +.. index:: single: MeasurementsOptimalPositioningTask (example) Second example .............. diff --git a/doc/en/snippets/Header2Algo00.rst b/doc/en/snippets/Header2Algo00.rst index a892b49..44c29e1 100644 --- a/doc/en/snippets/Header2Algo00.rst +++ b/doc/en/snippets/Header2Algo00.rst @@ -1,4 +1,2 @@ -.. warning:: - - In this particular version, this algorithm or some of its variants are - experimental, and therefore remain subject to change in future versions. +This algorithm is reserved for use in the textual user interface (TUI), and +therefore not in graphical user interface (GUI). diff --git a/doc/en/snippets/Header2Algo99.rst b/doc/en/snippets/Header2Algo99.rst new file mode 100644 index 0000000..a892b49 --- /dev/null +++ b/doc/en/snippets/Header2Algo99.rst @@ -0,0 +1,4 @@ +.. warning:: + + In this particular version, this algorithm or some of its variants are + experimental, and therefore remain subject to change in future versions. diff --git a/doc/en/snippets/ModuleCompatibility.rst b/doc/en/snippets/ModuleCompatibility.rst index 2dfcf87..517c3c7 100644 --- a/doc/en/snippets/ModuleCompatibility.rst +++ b/doc/en/snippets/ModuleCompatibility.rst @@ -16,7 +16,7 @@ versions within the range described below. Python, 3.6.5, 3.11.5 Numpy, 1.14.3, 1.26.0 - Scipy, 0.19.1, 1.11.2 + Scipy, 0.19.1, 1.11.3 MatplotLib, 2.2.2, 3.8.0 GnuplotPy, 1.8, 1.8 NLopt, 2.4.2, 2.7.1 diff --git a/doc/en/snippets/ReducedCoordinates.rst b/doc/en/snippets/ReducedCoordinates.rst new file mode 100644 index 0000000..6ffb3ea --- /dev/null +++ b/doc/en/snippets/ReducedCoordinates.rst @@ -0,0 +1,8 @@ +.. index:: single: ReducedCoordinates + +ReducedCoordinates + *List of vectors*. Each element of this variable contains the coordinates of + a complete physical state :math:`\mathbf{y}` in the reduced basis. + + Example: + ``rc = ADD.get("ReducedCoordinates")[-1]`` diff --git a/doc/fr/examples.rst b/doc/fr/examples.rst index 2cf3320..a5fdd8e 100644 --- a/doc/fr/examples.rst +++ b/doc/fr/examples.rst @@ -64,7 +64,8 @@ Utilisations d'algorithmes de vérification Utilisations d'algorithmes orientés tâches ou études dédiées ------------------------------------------------------------ -#. :ref:`Exemples de vérification avec "MeasurementsOptimalPositioningTask"` +#. :ref:`Exemples d'étude avec "InterpolationByReducedModelTask"` +#. :ref:`Exemples d'étude avec "MeasurementsOptimalPositioningTask"` Utilisations avancées --------------------- diff --git a/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst b/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst index f19be04..18a8b12 100644 --- a/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst +++ b/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst @@ -35,11 +35,6 @@ Algorithme de tâche "*EnsembleOfSimulationGenerationTask*" .. ------------------------------------ .. .. include:: snippets/Header2Algo00.rst -.. warning:: - - Cet algorithme n'est utilisable qu'en interface textuelle (TUI) et pas en - interface graphique (GUI). - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst diff --git a/doc/fr/ref_algorithm_InputValuesTest.rst b/doc/fr/ref_algorithm_InputValuesTest.rst index f83c8e0..33f79f7 100644 --- a/doc/fr/ref_algorithm_InputValuesTest.rst +++ b/doc/fr/ref_algorithm_InputValuesTest.rst @@ -27,9 +27,6 @@ Algorithme de vérification "*InputValuesTest*" ---------------------------------------------- -.. ------------------------------------ .. -.. include:: snippets/Header2Algo00.rst - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst diff --git a/doc/fr/ref_algorithm_InterpolationByReducedModelTask.rst b/doc/fr/ref_algorithm_InterpolationByReducedModelTask.rst index 8dc334b..0e188b1 100644 --- a/doc/fr/ref_algorithm_InterpolationByReducedModelTask.rst +++ b/doc/fr/ref_algorithm_InterpolationByReducedModelTask.rst @@ -23,19 +23,20 @@ .. index:: single: InterpolationByReducedModelTask .. index:: single: Interpolation de mesures +.. index:: single: Reconstruction de champ .. index:: single: Snapshots (Ensemble) +.. index:: single: Reduced Order Model +.. index:: single: ROM .. _section_ref_algorithm_InterpolationByReducedModelTask: Algorithme de tâche "*InterpolationByReducedModelTask*" ------------------------------------------------------- .. ------------------------------------ .. -.. include:: snippets/Header2Algo00.rst - -.. warning:: +.. include:: snippets/Header2Algo99.rst - Cet algorithme n'est utilisable qu'en interface textuelle (TUI) et pas en - interface graphique (GUI). +.. ------------------------------------ .. +.. include:: snippets/Header2Algo00.rst .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst @@ -43,11 +44,14 @@ Algorithme de tâche "*InterpolationByReducedModelTask*" Cet algorithme permet de réaliser une interpolation très efficace de mesures physiques à l'aide d'une représentation réduite du modèle pour cette physique. On obtient en sortie, pour chaque jeu de mesures fournies aux positions -requises, un champ complet :math:`\mathbf{y}` par interpolation. +requises, un champ complet :math:`\mathbf{y}` par interpolation. Dit autrement, +c'est une reconstruction de champ physique à l'aide de mesures et d'un modèle +numérique réduit. Pour interpoler ces mesures, on utilise une méthode de type Empirical -Interpolation Method (EIM [Barrault04]_), qui établit un modèle réduit, avec ou -sans contraintes de positionnement de mesures. +Interpolation Method (EIM [Barrault04]_), qui utilise un modèle réduit de type +Reduced Order Model (ROM), avec ou sans contraintes de positionnement de +mesures. Pour utiliser cet algorithme, il faut disposer des mesures optimalement positionnées et de la base réduite associée pour la représentation du modèle. @@ -92,6 +96,7 @@ StoreSupplementaryCalculations de cette documentation par algorithme spécifique, dans la sous-partie "*Informations et variables disponibles à la fin de l'algorithme*") : [ "Analysis", + "ReducedCoordinates", ]. Exemple : @@ -107,9 +112,24 @@ StoreSupplementaryCalculations .. include:: snippets/Analysis.rst +.. include:: snippets/ReducedCoordinates.rst + .. ------------------------------------ .. .. _section_ref_algorithm_InterpolationByReducedModelTask_examples: +.. include:: snippets/Header2Algo09.rst + +.. --------- .. +.. include:: scripts/simple_InterpolationByReducedModelTask1.rst + +.. literalinclude:: scripts/simple_InterpolationByReducedModelTask1.py + +.. include:: snippets/Header2Algo10.rst + +.. literalinclude:: scripts/simple_InterpolationByReducedModelTask1.res + :language: none + +.. ------------------------------------ .. .. include:: snippets/Header2Algo06.rst - :ref:`section_ref_algorithm_MeasurementsOptimalPositioningTask` diff --git a/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst b/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst index 6fe2723..629da6b 100644 --- a/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst +++ b/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst @@ -29,6 +29,8 @@ .. index:: single: Ensemble de snapshots .. index:: single: Simulations (Ensemble) .. index:: single: Snapshots (Ensemble) +.. index:: single: Reduced Order Model +.. index:: single: ROM .. _section_ref_algorithm_MeasurementsOptimalPositioningTask: Algorithme de tâche "*MeasurementsOptimalPositioningTask*" @@ -37,11 +39,6 @@ Algorithme de tâche "*MeasurementsOptimalPositioningTask*" .. ------------------------------------ .. .. include:: snippets/Header2Algo00.rst -.. warning:: - - Cet algorithme n'est utilisable qu'en interface textuelle (TUI) et pas en - interface graphique (GUI). - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst @@ -58,8 +55,9 @@ un jeu de paramètres donné :math:`\mathbf{x}`, ou d'une observation explicite du (ou des) champ(s) complet(s) :math:`\mathbf{y}`. Pour établir la position optimale de mesures, on utilise une méthode de type -Empirical Interpolation Method (EIM [Barrault04]_), avec contraintes (variant -"*lcEIM*") ou sans contraintes (variant "*EIM*") de positionnement. +Empirical Interpolation Method (EIM [Barrault04]_), qui établit un modèle +réduit de type Reduced Order Model (ROM), avec contraintes (variant "*lcEIM*") +ou sans contraintes (variant "*EIM*") de positionnement. Il y a deux manières d'utiliser cet algorithme: diff --git a/doc/fr/ref_algorithm_ParticleSwarmOptimization.rst b/doc/fr/ref_algorithm_ParticleSwarmOptimization.rst index c45ad74..1cf5541 100644 --- a/doc/fr/ref_algorithm_ParticleSwarmOptimization.rst +++ b/doc/fr/ref_algorithm_ParticleSwarmOptimization.rst @@ -28,9 +28,6 @@ Algorithme de calcul "*ParticleSwarmOptimization*" -------------------------------------------------- -.. ------------------------------------ .. -.. include:: snippets/Header2Algo00.rst - .. ------------------------------------ .. .. include:: snippets/Header2Algo01.rst diff --git a/doc/fr/ref_assimilation_keywords.rst b/doc/fr/ref_assimilation_keywords.rst index cc86a62..bb82be9 100644 --- a/doc/fr/ref_assimilation_keywords.rst +++ b/doc/fr/ref_assimilation_keywords.rst @@ -26,32 +26,25 @@ Liste des commandes et mots-clés pour un cas d'assimilation de données ou d'optimisation ---------------------------------------------------------------------------------------- -On résume ici l'ensemble des commandes disponibles pour décrire un cas de -calcul en évitant les particularités de chaque algorithme. C'est donc un -inventaire commun des commandes. +On résume ici l’ensemble des commandes et des mots-clés disponibles pour +décrire un cas de calcul en évitant les particularités de chaque algorithme. +C’est donc un inventaire commun des commandes. Le jeu de commandes pour un cas d'assimilation de données ou d'optimisation est lié à la description d'un cas de calcul, qui est une procédure en *Assimilation -de Données*, en *Méthodes avec Réduction* ou en méthodes *Optimisation*. +de Données* (désignée en interface graphique par la commande +"*ASSIMILATION_STUDY*"), en *Méthodes avec Réduction* (désignée en interface +graphique par la commande "*REDUCTION_STUDY*") ou en méthodes *Optimisation* +(désignée en interface graphique par la commande "*OPTIMIZATION_STUDY*"). -Le premier terme décrit le choix entre un calcul ou une vérification. Dans -l'interface graphique, chacun des trois types de calculs, individuellement -plutôt orientés soit *assimilation de données*, soit "méthodes d'optimisation*, -"soit *méthodes avec réduction* (sachant que certains sont simultanément dans -plusieurs catégories), est impérativement désigné par l'une ces commandes: - -.. include:: snippets/ASSIMILATION_STUDY.rst - -.. include:: snippets/OPTIMIZATION_STUDY.rst - -.. include:: snippets/REDUCTION_STUDY.rst - -Les termes imbriqués sont classés par ordre alphabétique. Ils ne sont pas -obligatoirement requis pour tous les algorithmes. Les différentes commandes -sont les suivantes: +Tous les termes possibles, imbriqués ou non, sont classés par ordre +alphabétique. Ils ne sont pas obligatoirement requis pour tous les algorithmes. +Les commandes ou mots-clés disponibles sont les suivants: .. include:: snippets/AlgorithmParameters.rst +.. include:: snippets/ASSIMILATION_STUDY.rst + .. include:: snippets/Background.rst .. include:: snippets/BackgroundError.rst @@ -76,8 +69,12 @@ sont les suivantes: .. include:: snippets/Observers.rst +.. include:: snippets/OPTIMIZATION_STUDY.rst + .. include:: snippets/OutputVariables.rst +.. include:: snippets/REDUCTION_STUDY.rst + .. include:: snippets/StudyName.rst .. include:: snippets/StudyRepertory.rst diff --git a/doc/fr/ref_checking_keywords.rst b/doc/fr/ref_checking_keywords.rst index f9fd8d8..f6a1bb6 100644 --- a/doc/fr/ref_checking_keywords.rst +++ b/doc/fr/ref_checking_keywords.rst @@ -26,24 +26,25 @@ Liste des commandes et mots-clés pour un cas de vérification ------------------------------------------------------------ -Ce jeu de commandes est lié à la description d'un cas de vérification, qui est -une procédure pour vérifier les propriétés d'une information requise, utilisée -ailleurs par un cas de calcul. +On résume ici l’ensemble des commandes et des mots-clés disponibles pour +décrire un cas de vérification en évitant les particularités de chaque +algorithme. C’est donc un inventaire commun des commandes. -Le premier terme décrit le choix entre un calcul ou une vérification. Dans -l'interface graphique, le choix est désigné obligatoirement par la commande: +Un terme particulier désigne le choix explicite d'une vérification. Dans +l'interface graphique, ce choix se fait par la commande obligatoire +"*CHECKING_STUDY*". -.. include:: snippets/CHECKING_STUDY.rst - -Les termes imbriqués sont classés par ordre alphabétique. Ils ne sont pas -obligatoirement requis pour tous les algorithmes. Les différentes commandes -sont les suivantes: +Tous les termes possibles, imbriqués ou non, sont classés par ordre +alphabétique. Ils ne sont pas obligatoirement requis pour tous les algorithmes. +Les commandes ou mots-clés disponibles sont les suivants: .. include:: snippets/AlgorithmParameters.rst +.. include:: snippets/BackgroundError.rst + .. include:: snippets/CheckingPoint.rst -.. include:: snippets/BackgroundError.rst +.. include:: snippets/CHECKING_STUDY.rst .. include:: snippets/Debug.rst diff --git a/doc/fr/ref_task_keywords.rst b/doc/fr/ref_task_keywords.rst index 9e065c3..93296a7 100644 --- a/doc/fr/ref_task_keywords.rst +++ b/doc/fr/ref_task_keywords.rst @@ -26,19 +26,24 @@ Liste des commandes et mots-clés pour un cas orienté tâche ou étude dédiée -------------------------------------------------------------------------- -Ce jeu de commandes est lié à la description d'un cas orienté tâche ou étude -dédiée, qui consiste en une procédure spécifique simple pour effectuer une -tâche de calcul dédiée à une application générale des méthodes d'assimilation -de données ou d'optimisation. +On résume ici l’ensemble des commandes et des mots-clés disponibles pour +décrire un cas orienté tâche ou étude dédiée en évitant les particularités de +chaque algorithme. C’est donc un inventaire commun des commandes. -Les termes imbriqués sont classés par ordre alphabétique. Ils ne sont pas -obligatoirement requis pour tous les algorithmes. Les différentes commandes -sont les suivantes: +Tous les termes possibles, imbriqués ou non, sont classés par ordre +alphabétique. Ils ne sont pas obligatoirement requis pour tous les algorithmes. +Les commandes ou mots-clés disponibles sont les suivants: .. include:: snippets/AlgorithmParameters.rst +.. include:: snippets/Background.rst + .. include:: snippets/Debug.rst +.. include:: snippets/Observation.rst + +.. include:: snippets/ObservationOperator.rst + .. include:: snippets/Observers.rst .. include:: snippets/StudyName.rst diff --git a/doc/fr/scripts/simple_InterpolationByReducedModelTask1.py b/doc/fr/scripts/simple_InterpolationByReducedModelTask1.py new file mode 100644 index 0000000..0b50cbd --- /dev/null +++ b/doc/fr/scripts/simple_InterpolationByReducedModelTask1.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +# +from numpy import array, arange, ravel, set_printoptions +set_printoptions(precision=3) +# +dimension = 7 +# +print("Définition d'un ensemble artificiel de champs physiques") +print("-------------------------------------------------------") +Ensemble = array( [i+arange(dimension) for i in range(7)] ).T +print("- Dimension de l'espace des champs physiques...........: %i"%dimension) +print("- Nombre de vecteurs de champs physiques...............: %i"%Ensemble.shape[1]) +print() +# +print("Recherche des positions optimales de mesure") +print("-------------------------------------------") +from adao import adaoBuilder +case = adaoBuilder.New() +case.setAlgorithmParameters( + Algorithm = 'MeasurementsOptimalPositioningTask', + Parameters = { + "EnsembleOfSnapshots":Ensemble, + "MaximumNumberOfLocations":3, + "ErrorNorm":"L2", + "StoreSupplementaryCalculations":[ + "ReducedBasis", + "Residus", + ], + } +) +case.execute() +print("- Calcul ADAO effectué") +print() +# +print("Affichage des positions optimales de mesure") +print("-------------------------------------------") +op = case.get("OptimalPoints")[-1] +print("- Nombre de positions optimales de mesure..............: %i"%op.size) +print("- Positions optimales de mesure, numérotées par défaut.: %s"%op) +print() +# +print("Reconstruction par interpolation d'états mesurés connus") +print("-------------------------------------------------------") +rb = case.get("ReducedBasis")[-1] +measures_at_op = Ensemble[op,1] +# +interpolation = adaoBuilder.New() +interpolation.setAlgorithmParameters( + Algorithm = 'InterpolationByReducedModelTask', + Parameters = { + "ReducedBasis":rb, + "OptimalLocations":op, + } + ) +interpolation.setObservation( Vector = measures_at_op ) +interpolation.execute() +field = interpolation.get("Analysis")[-1] +print("- État de référence 1 utilisé pour l'apprentissage.....:",ravel(Ensemble[:,1])) +print("- Positions optimales de mesure, numérotées par défaut.: %s"%op) +print("- Mesures extraites de l'état 1 pour la reconstruction.:",measures_at_op) +print("- État 1 reconstruit avec la précision de 1%...........:",field) +if max(abs(ravel(Ensemble[:,1])-field)) < 1.e-2: + print(" ===> Aucune différence n'existe entre les deux états, comme attendu") +else: + raise ValueError("Différence constatée sur l'état de référence 1") +print() +# +print("Reconstruction par interpolation d'états mesurés non connus") +print("-----------------------------------------------------------") +measures_at_op = array([4, 3]) +interpolation.setObservation( Vector = measures_at_op ) +interpolation.execute() +field = interpolation.get("Analysis")[-1] +print(" Illustration d'une interpolation sur mesures réelles non connues") +print("- Positions optimales de mesure, numérotées par défaut.: %s"%op) +print("- Mesures non présentes dans les états connus..........:",measures_at_op) +print("- État reconstruit avec la précision de 1%.............:",field) +print(" ===> Aux positions de mesure %s, le champ reconstruit est égal à la mesure"%op) +print() diff --git a/doc/fr/scripts/simple_InterpolationByReducedModelTask1.res b/doc/fr/scripts/simple_InterpolationByReducedModelTask1.res new file mode 100644 index 0000000..8941549 --- /dev/null +++ b/doc/fr/scripts/simple_InterpolationByReducedModelTask1.res @@ -0,0 +1,30 @@ +Définition d'un ensemble artificiel de champs physiques +------------------------------------------------------- +- Dimension de l'espace des champs physiques...........: 7 +- Nombre de vecteurs de champs physiques...............: 7 + +Recherche des positions optimales de mesure +------------------------------------------- +- Calcul ADAO effectué + +Affichage des positions optimales de mesure +------------------------------------------- +- Nombre de positions optimales de mesure..............: 2 +- Positions optimales de mesure, numérotées par défaut.: [6 0] + +Reconstruction par interpolation d'états mesurés connus +------------------------------------------------------- +- État de référence 1 utilisé pour l'apprentissage.....: [1 2 3 4 5 6 7] +- Positions optimales de mesure, numérotées par défaut.: [6 0] +- Mesures extraites de l'état 1 pour la reconstruction.: [7 1] +- État 1 reconstruit avec la précision de 1%...........: [1. 2. 3. 4. 5. 6. 7.] + ===> Aucune différence n'existe entre les deux états, comme attendu + +Reconstruction par interpolation d'états mesurés non connus +----------------------------------------------------------- + Illustration d'une interpolation sur mesures réelles non connues +- Positions optimales de mesure, numérotées par défaut.: [6 0] +- Mesures non présentes dans les états connus..........: [4 3] +- État reconstruit avec la précision de 1%.............: [3. 3.167 3.333 3.5 3.667 3.833 4. ] + ===> Aux positions de mesure [6 0], le champ reconstruit est égal à la mesure + diff --git a/doc/fr/scripts/simple_InterpolationByReducedModelTask1.rst b/doc/fr/scripts/simple_InterpolationByReducedModelTask1.rst new file mode 100644 index 0000000..a47fa08 --- /dev/null +++ b/doc/fr/scripts/simple_InterpolationByReducedModelTask1.rst @@ -0,0 +1,16 @@ +.. index:: single: InterpolationByReducedModelTask (example) + +Premier exemple +............... + +Cet exemple décrit la mise en oeuvre d'une reconstruction par interpolation, +faisant suite à l'établissement d'une représentation réduite par une tâche de +recherche de **positionnement optimal de mesures**. + +Pour l'illustration, on utilise la collection artificielle de champs physiques +très simple (engendré de manière à exister dans un espace vectoriel de +dimension 2) que pour les :ref:`exemples d'étude avec +"MeasurementsOptimalPositioningTask"`. +La recherche ADAO préalable permet d'obtenir 2 positions optimales pour les +mesures, qui servent ensuite à établir une interpolation de champ physique à +partir de mesures aux positions optimales. diff --git a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.py b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.py index 39c0771..919313d 100644 --- a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.py +++ b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.py @@ -29,8 +29,8 @@ case.execute() print("- Calcul ADAO effectué") print() # -print("Positions optimales de mesure") -print("-----------------------------") +print("Affichage des positions optimales de mesure") +print("-------------------------------------------") op = case.get("OptimalPoints")[-1] print("- Nombre de positions optimales de mesure..............: %i"%op.size) print("- Positions optimales de mesure, numérotées par défaut.: %s"%op) diff --git a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.res b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.res index ff9fbd2..30c662d 100644 --- a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.res +++ b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask1.res @@ -15,8 +15,8 @@ Recherche des positions optimales de mesure ------------------------------------------- - Calcul ADAO effectué -Positions optimales de mesure ------------------------------ +Affichage des positions optimales de mesure +------------------------------------------- - Nombre de positions optimales de mesure..............: 2 - Positions optimales de mesure, numérotées par défaut.: [6 0] diff --git a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.py b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.py index 8d2aaed..78bdd83 100644 --- a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.py +++ b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.py @@ -33,8 +33,8 @@ case.execute() print("- Calcul ADAO effectué") print() # -print("Positions optimales de mesure") -print("-----------------------------") +print("Affichage des positions optimales de mesure") +print("-------------------------------------------") op = case.get("OptimalPoints")[-1] print("- Nombre de positions optimales de mesure..............: %i"%op.size) print("- Positions optimales de mesure, numérotées par défaut.: %s"%op) @@ -50,8 +50,8 @@ rs = case.get("Residus")[-1] print("- Résidus ordonnés d'erreur de reconstruction\n ",rs) print() a0, a1 = 7, -2.5 -print("- Exemple élémentaire de reconstruction du second champ") -print(" comme combinaison linéaire des deux vecteurs de base,") -print(" avec les coefficients respectifs %.1f et %.1f :"%(a0,a1)) +print("- Exemple élémentaire de reconstruction du second champ comme une") +print(" combinaison linéaire des deux vecteurs de base, qui peuvent être") +print(" multipliés par les coefficients respectifs %.1f et %.1f :"%(a0,a1)) print( a0*rb[:,0] + a1*rb[:,1]) print() diff --git a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.res b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.res index 300a264..6f0d6c7 100644 --- a/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.res +++ b/doc/fr/scripts/simple_MeasurementsOptimalPositioningTask2.res @@ -15,8 +15,8 @@ Recherche des positions optimales de mesure ------------------------------------------- - Calcul ADAO effectué -Positions optimales de mesure ------------------------------ +Affichage des positions optimales de mesure +------------------------------------------- - Nombre de positions optimales de mesure..............: 2 - Positions optimales de mesure, numérotées par défaut.: [6 0] @@ -35,9 +35,9 @@ Représentation réduite et informations d'erreurs - Résidus ordonnés d'erreur de reconstruction [2.43926218e+01 4.76969601e+00 2.51214793e-15] -- Exemple élémentaire de reconstruction du second champ - comme combinaison linéaire des deux vecteurs de base, - avec les coefficients respectifs 7.0 et -2.5 : +- Exemple élémentaire de reconstruction du second champ comme une + combinaison linéaire des deux vecteurs de base, qui peuvent être + multipliés par les coefficients respectifs 7.0 et -2.5 : [[1.] [2.] [3.] diff --git a/doc/fr/snippets/Header2Algo00.rst b/doc/fr/snippets/Header2Algo00.rst index c90fcef..58516f3 100644 --- a/doc/fr/snippets/Header2Algo00.rst +++ b/doc/fr/snippets/Header2Algo00.rst @@ -1,5 +1,2 @@ -.. warning:: - - Dans la présente version, cet algorithme ou certaines de ses variantes sont - expérimentaux, et restent donc susceptibles de changements dans les - prochaines versions. +Cet algorithme est réservé à une utilisation en interface textuelle (TUI), et +donc pas en interface graphique (GUI). diff --git a/doc/fr/snippets/Header2Algo99.rst b/doc/fr/snippets/Header2Algo99.rst new file mode 100644 index 0000000..c90fcef --- /dev/null +++ b/doc/fr/snippets/Header2Algo99.rst @@ -0,0 +1,5 @@ +.. warning:: + + Dans la présente version, cet algorithme ou certaines de ses variantes sont + expérimentaux, et restent donc susceptibles de changements dans les + prochaines versions. diff --git a/doc/fr/snippets/ModuleCompatibility.rst b/doc/fr/snippets/ModuleCompatibility.rst index 9bfbe23..ff9fd39 100644 --- a/doc/fr/snippets/ModuleCompatibility.rst +++ b/doc/fr/snippets/ModuleCompatibility.rst @@ -17,7 +17,7 @@ l'étendue décrite ci-dessous. Python, 3.6.5, 3.11.5 Numpy, 1.14.3, 1.26.0 - Scipy, 0.19.1, 1.11.2 + Scipy, 0.19.1, 1.11.3 MatplotLib, 2.2.2, 3.8.0 GnuplotPy, 1.8, 1.8 NLopt, 2.4.2, 2.7.1 diff --git a/doc/fr/snippets/ReducedCoordinates.rst b/doc/fr/snippets/ReducedCoordinates.rst new file mode 100644 index 0000000..bbbb347 --- /dev/null +++ b/doc/fr/snippets/ReducedCoordinates.rst @@ -0,0 +1,9 @@ +.. index:: single: ReducedCoordinates + +ReducedCoordinates + *Liste de vecteurs*. Chaque élément de cette variable est constitué des + coordonnées d'un état physique complet :math:`\mathbf{y}` dans la base + réduite. + + Exemple : + ``rc = ADD.get("ReducedCoordinates")[-1]`` diff --git a/src/daComposant/daAlgorithms/Atoms/ecweim.py b/src/daComposant/daAlgorithms/Atoms/ecweim.py index 297e8bb..4236143 100644 --- a/src/daComposant/daAlgorithms/Atoms/ecweim.py +++ b/src/daComposant/daAlgorithms/Atoms/ecweim.py @@ -208,6 +208,8 @@ def EIM_online(selfA, QEIM, gJmu = None, mPoints = None, mu = None, PseudoInvers logging.debug("%s The full field of size %i has been correctly build"%(selfA._name,__gMmu.size)) if hasattr(selfA, "StoredVariables"): selfA.StoredVariables["Analysis"].store( __gMmu ) + if selfA._toStore("ReducedCoordinates"): + selfA.StoredVariables["ReducedCoordinates"].store( __gammaMu ) # return __gMmu diff --git a/src/daComposant/daAlgorithms/InterpolationByReducedModelTask.py b/src/daComposant/daAlgorithms/InterpolationByReducedModelTask.py index b055ccb..98fe7eb 100644 --- a/src/daComposant/daAlgorithms/InterpolationByReducedModelTask.py +++ b/src/daComposant/daAlgorithms/InterpolationByReducedModelTask.py @@ -57,6 +57,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): message = "Liste de calculs supplémentaires à stocker et/ou effectuer", listval = [ "Analysis", + "ReducedCoordinates", ] ) self.requireInputArguments( diff --git a/src/daComposant/daAlgorithms/InterpolationByReducedModelTest.py b/src/daComposant/daAlgorithms/InterpolationByReducedModelTest.py index ddf1acb..2b371a5 100644 --- a/src/daComposant/daAlgorithms/InterpolationByReducedModelTest.py +++ b/src/daComposant/daAlgorithms/InterpolationByReducedModelTest.py @@ -21,7 +21,9 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D import numpy, math -from daCore import BasicObjects +from daCore import BasicObjects, PlatformInfo +mpr = PlatformInfo.PlatformInfo().MachinePrecision() +mfp = PlatformInfo.PlatformInfo().MaximumPrecision() from daCore.PlatformInfo import vfloat from daAlgorithms.Atoms import ecweim, eosg @@ -29,7 +31,7 @@ from daAlgorithms.Atoms import ecweim, eosg class ElementaryAlgorithm(BasicObjects.Algorithm): def __init__(self): # - BasicObjects.Algorithm.__init__(self, "INTERPOLATIONBYREDUCEDMODEL") + BasicObjects.Algorithm.__init__(self, "INTERPOLATIONBYREDUCEDMODELTEST") self.defineRequiredParameter( name = "ReducedBasis", default = [], @@ -100,6 +102,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): #-------------------------- __s = self._parameters["ShowElementarySummary"] __p = self._parameters["NumberOfPrintedDigits"] + __r = __nsn # __marge = 5*u" " __flech = 3*"="+"> " @@ -141,6 +144,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): msgs += (__flech + "Interpolation error test for all given states:\n") msgs += (__marge + "----------------------------------------------\n") msgs += ("\n") + Es = [] for ns in range(__nsn): __rm = __eos[__ip,ns] __im = ecweim.EIM_online(self, __rb, __eos[__ip,ns], __ip) @@ -149,8 +153,29 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): __ecart = vfloat(numpy.linalg.norm( __eos[:,ns] - __im ) / numpy.linalg.norm( __eos[:,ns] )) else: __ecart = vfloat(numpy.linalg.norm( __eos[:,ns] - __im, ord=numpy.inf ) / numpy.linalg.norm( __eos[:,ns], ord=numpy.inf )) + Es.append( __ecart ) if __s: msgs += (__marge + "Normalized interpolation error (%s) for state number %0"+str(__ordre)+"i..: %."+str(__p)+"e\n")%(self._parameters["ErrorNorm"],ns,__ecart) + msgs += ("\n") + msgs += (__marge + "%s\n"%("-"*75,)) + # + if __r > 1: + msgs += ("\n") + msgs += (__flech + "Launching statistical summary calculation for %i states\n"%__r) + msgs += ("\n") + msgs += (__marge + "Statistical analysis of the errors Es obtained over the collection of states\n") + msgs += (__marge + "(Remark: numbers that are (about) under %.0e represent 0 to machine precision)\n"%mpr) + msgs += ("\n") + Yy = numpy.array( Es ) + msgs += (__marge + "Number of evaluations...........................: %i\n")%len( Es ) + msgs += ("\n") + msgs += (__marge + "Characteristics of the whole set of error outputs Es:\n") + msgs += (__marge + " Minimum value of the whole set of outputs.....: %."+str(__p)+"e\n")%numpy.min( Yy ) + msgs += (__marge + " Maximum value of the whole set of outputs.....: %."+str(__p)+"e\n")%numpy.max( Yy ) + msgs += (__marge + " Mean of vector of the whole set of outputs....: %."+str(__p)+"e\n")%numpy.mean( Yy, dtype=mfp ) + msgs += (__marge + " Standard error of the whole set of outputs....: %."+str(__p)+"e\n")%numpy.std( Yy, dtype=mfp ) + msgs += ("\n") + msgs += (__marge + "%s\n"%("-"*75,)) # msgs += ("\n") msgs += (__marge + "End of the \"%s\" verification\n\n"%self._name) diff --git a/src/daComposant/daCore/BasicObjects.py b/src/daComposant/daCore/BasicObjects.py index 1550b99..6904e18 100644 --- a/src/daComposant/daCore/BasicObjects.py +++ b/src/daComposant/daCore/BasicObjects.py @@ -726,6 +726,7 @@ class Algorithm(object): - MahalanobisConsistency : indicateur de consistance des covariances - OMA : Observation moins Analyse : Y - Xa - OMB : Observation moins Background : Y - Xb + - ReducedCoordinates : coordonnées dans la base réduite - Residu : dans le cas des algorithmes de vérification - SampledStateForQuantiles : échantillons d'états pour l'estimation des quantiles - SigmaBck2 : indicateur de correction optimale des erreurs d'ébauche @@ -798,6 +799,7 @@ class Algorithm(object): self.StoredVariables["OMB"] = Persistence.OneVector(name = "OMB") self.StoredVariables["OptimalPoints"] = Persistence.OneVector(name = "OptimalPoints") self.StoredVariables["ReducedBasis"] = Persistence.OneMatrix(name = "ReducedBasis") + self.StoredVariables["ReducedCoordinates"] = Persistence.OneVector(name = "ReducedCoordinates") self.StoredVariables["Residu"] = Persistence.OneScalar(name = "Residu") self.StoredVariables["Residus"] = Persistence.OneVector(name = "Residus") self.StoredVariables["SampledStateForQuantiles"] = Persistence.OneMatrix(name = "SampledStateForQuantiles") -- 2.39.2