--- myst: substitutions: macro: python: 1-5,13-36,40-85,88-96,101-154,159-165 cpp: 6-38,42-80,83-90,96-152,157-162,171 bloc1: python: 51,53-60 cpp: 43,50-57 bloc2: python: 69-70 cpp: 66-67 bloc3: python: "73" cpp: "70" bloc4: python: 77-78,81 cpp: 74,77 bloc5: python: "90" cpp: "85" bloc6: python: 141-146,149 cpp: 140-145,149 console: python: 2-14,16- cpp: 6-49 dedent: python: "" cpp: "4" --- # Macro "**sensitivityBrutForceMethodFlowrate.{{extension}}**" ## Objective The objective of this macro is to perform a sensitivity analysis with brute force method on a set of eight parameters used in the *flowrate* model described in [](#launcher_introduction_simple_case_problem). Sensitivity indexes are computed dividing conditional variance by the standard deviation of the output variable. ```{warning} This macro is purely illustrative. It is not meant to be used for proper results with a real code / function as it needs a large number of computation to only get the first order index. Its main appeal is to be nicely illustrative: it shows plainly the definition of the conditional expectation and also its variance used to defined the first order sobol indices. ``` ## Macro {{uranie}} {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityBrutForceMethodFlowrate." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[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 + "/sensitivityBrutForceMethodFlowrate." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} A {{doe}} is built with a "Halton" method ($n_S$ = 4000): {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityBrutForceMethodFlowrate." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[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 + "/sensitivityBrutForceMethodFlowrate." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc3[language] + "\n" + "```" }} The `flowrateModel` model is applied on previous variables: {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityBrutForceMethodFlowrate." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc4[language] + "\n" + "```" }} Characteristic values for the output attribute are computed: {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityBrutForceMethodFlowrate." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc5[language] + "\n" + "```" }} Sensitivity indexes are computed in the for loop. Average value of output variable is computed on nbins+2=12 points for each input variable: ````{only} cpp ```cpp c->cd(1); ... Int_t nnbins = hprofs->GetNbinsX(); for(Int_t i=1; i <= nnbins; i++) ntd->Fill(i-1, hprofs->GetBinCenter(i), hprofs->GetBinContent(i)); ``` ```` ````{only} py ```python c.cd(1) ... nnbins = hprofs.GetNbinsX() for i in range(1,nnbins+1): ntd.Fill(i-1, hprofs.GetBinCenter(i), hprofs.GetBinContent(i)) ``` ```` The RMS value is obtained from the graphic of ymod versus the considered output variable and the sensitivity index is computed dividing the conditional variance value by the standard deviation of the output variable **ymod**. {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityBrutForceMethodFlowrate." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc6[language] + "\n" + ":dedent: " + dedent[language] + "\n" + "```" }} ## Graph {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/sensitivity/use_cases/" + language + "/brute_force/sensitivityBrutForceMethodFlowrate.png\n" + ":align: center\n" + ":name: use_cases_sensitivityBrutForceMethodFlowrate\n" + figure_scale + "\n" + "\n" + "Graph of the macro **\"sensitivityBrutForceMethodFlowrate." + extension + "\"**" + "\n" + "```" }} ## Console {{ "```{" "literalinclude" "} " + parent_dir + "/roottest/build/uranie/doc/sensitivity/use_cases/" + language + "/sensitivityBrutForceMethodFlowrate_clean.log" + "\n" + ":language: none\n" + ":lines: " + console[language] + "\n" + "```" }}