--- myst: substitutions: macro: python: 1-5,18-63,66-82,85-89 cpp: 5-7,11-48,51-64,67-71,80-81 bloc1: python: "19" cpp: "11" bloc2: python: 21-29 cpp: 13-21 bloc3: python: 31-47 cpp: 23-32 bloc4: python: "63" cpp: "48" bloc5: python: "67" cpp: "52" bloc6: python: "69" cpp: "54" bloc7: python: "70" cpp: "55" console: python: 7-18 cpp: 11-22 sentence: python: | . On the contrary to the C++ script, python cannot use methods such as `setInputs` or `setOutputs` and the inputs and outputs have to be included ony-by-one. cpp: ":" dedent: python: "" cpp: "4" --- # Macro "**sensitivityMorrisFunctionFlowrateRunner.{{extension}}**" ## Objective The objective of this macro is to perform a Morris sensitivity analysis on a set of eight parameters used in the `flowrateModel` model described in [](#launcher_introduction_simple_case_problem), but this time using the {{Relaun}} architecture. ## Macro {{uranie}} {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[language] + "\n" + "```" }} The function `flowrateModel` is loaded from the macro `UserFunctions.C` (the file can be found in `${URANIESYS}/share/uranie/macros`) {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} Each parameter is related to the {{tds}} as a `TAttribute` and obeys an uniform law on specific interval: {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} The interface to the function is then defined, using the {{Relaun}} interface, through a `TCIntEval` object and a sequential runner{{sentence[language]}} {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc3[language] + "\n" + "```" }} The dataserver object is defined only on the master to avoid useless replication if one wants to run the estimation of the function in parallel (by changing the `TSequentialRun` by either a `TThreadedRun` or a `TMpiRun`). To instantiate the `TMorris` object, one uses the {{tds}}, a pointer to the chosen runner, the number of replicas (here nreplique=3), the level parameter (here nlevel=10) {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc4[language] + "\n" + ":dedent: " + dedent[language] + "\n" + "```" }} Creation of the sampling: {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc5[language] + "\n" + ":dedent: " + dedent[language] + "\n" + "```" }} Data are exported in an ASCII file: {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc6[language] + "\n" + ":dedent: " + dedent[language] + "\n" + "```" }} Computation of sensitivity indexes: {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc7[language] + "\n" + ":dedent: " + dedent[language] + "\n" + "```" }} The rest of the code is providing command to get a final plot. ## Graph {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/sensitivity/use_cases/" + language + "/morris_runner/sensitivityMorrisFunctionFlowrateRunner.png\n" + ":align: center\n" + ":name: use_cases_sensitivityMorrisFunctionFlowrateRunner\n" + figure_scale + "\n" + "\n" + "Graph of the macro **\"sensitivityMorrisFunctionFlowrateRunner." + extension + "\"**" + "\n" + "```" }} ## Console {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/build/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityMorrisFunctionFlowrateRunner.log" + "\n" + ":language: none\n" + ":lines: " + console[language] + "\n" + "```" }}