--- myst: substitutions: macro: python: 1-5,17-31,34-39 cpp: 4-6,13-23,26-31 bloc1: python: 24-25 cpp: "18" console: python: 2-15 cpp: 6-19 sentence: python: "`sensitivtySobolFunctionFlowrate.py`" cpp: "`sensitivtySobolFunctionFlowrate.C`" --- (use_cases_macro_sensitivity_sobol_data)= # Macro "**sensitivitySobolWithData.{{extension}}**" ## Objective The objective of this macro is to perform a Sobol analysis using the some already made computations in order to be able to save ressources. The idea (discussed in the second item in the tip box in [](#sensitivity_sobol_computation_indices) is indeed to use the provided points as the $2 \times n_S$ first estimations corresponding to both the $M$ and $N$ matrices content. The class will still have to create all the cross configurations (the $N_i$ matrices) and launch their corresponding estimations. In order to do that there are few things to keep in mind: - The input file (here `_onlyMandN_sobol_launching_.dat`) should contains input and output variables only, the user being in charge of having a decent {{doe}} for the sobol estimation. ```{warning} The `_onlyMandN_sobol_launching_.dat` file used as input is not provided in the usual sub-directory *"/share/uranie/macros"* of the installation folder of {{uranie}} (*$URANIESYS*) but can be generated by the user by running the macro discussed in [](#use_cases_macro_sensitivity_sobol). ``` ## Macro {{uranie}} {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivitySobolWithData." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[language] + "\n" + "```" }} As for [](#use_cases_macro_sensitivity_sobol), the `UserFunctions.C` file is loaded and the input file `_onlyMandN_sobol_launching_.dat` (which should have been generated by the use of {{sentence[language]}}), is loaded into the dataserver. The `TSobol` object is constructed from the usual function constructor with a noticing difference: the option field is filled with *WithData* to specify that data are already there and the code has to use these data and split them into both the $M$ and $N$ matrices. {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivitySobolWithData." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} Once done, the `computeIndexes()` method is called and few lines are shown to display the results in the classical plot form, leading to the figure below (it is provided to illustrate how to represent results). The numerical results are shown in the console below and are identical to the ones shown in [](#use_cases_macro_sensitivity_sobol_console) from where the original set of points is coming from. ## Graph The results of the previous macro is shown in {numref}`use_cases_sensitivitySobolWithData`, where the evolution of the sobol coefficient is shown for all inputs with the uncertainty band, for the first order coefficient and the total one, respectively on the top and bottom panel. {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/sensitivity/use_cases/" + language + "/sobol_data/sensitivitySobolWithData.png\n" + ":align: center\n" + ":name: use_cases_sensitivitySobolWithData\n" + figure_scale + "\n" + "\n" + "Graph of the macro **\"sensitivitySobolWithData." + extension + "\"**" + "\n" + "```" }} ## Console {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/build/uranie/doc/sensitivity/use_cases/" + language + "/sensitivitySobolWithData_clean.log" + "\n" + ":language: none\n" + ":lines: " + console[language] + "\n" + "```" }}