13.5.2. Macro “sensitivityFiniteDifferencesFunctionFlowrate.C”
13.5.2.1. Objective
The objective of this macro is to compute the finite differences indexes on a function.
13.5.2.2. Macro Uranie
// Define the DataServer and add the attributes (stochastic variables here)
TDataServer *tds = new TDataServer("tdsflowrate", "DataBase flowrate");
// loading the flowrateModel function
gROOT->LoadMacro("UserFunctions.C");
tds->addAttribute( new TUniformDistribution("rw", 0.05, 0.15));
tds->addAttribute( new TUniformDistribution("r", 100.0, 50000.0));
tds->addAttribute( new TUniformDistribution("tu", 63070.0, 115600.0));
tds->addAttribute( new TUniformDistribution("tl", 63.1, 116.0));
tds->addAttribute( new TUniformDistribution("hu", 990.0, 1110.0));
tds->addAttribute( new TUniformDistribution("hl", 700.0, 820.0));
tds->addAttribute( new TUniformDistribution("l", 1120.0, 1680.0));
tds->addAttribute( new TUniformDistribution("kw", 9855.0, 12045.0));
tds->getAttribute("rw")->setDefaultValue(0.075);
tds->getAttribute("r")->setDefaultValue(25000.0);
tds->getAttribute("tu")->setDefaultValue(90000.0);
tds->getAttribute("tl")->setDefaultValue(90.0);
tds->getAttribute("hu")->setDefaultValue(1050.0);
tds->getAttribute("hl")->setDefaultValue(760.0);
tds->getAttribute("l")->setDefaultValue(1400.0);
tds->getAttribute("kw")->setDefaultValue(10500.0);
// Create a TFiniteDifferences object
TFiniteDifferences * tfindef = new TFiniteDifferences(tds,"flowrateModel", "rw:r:tu:tl:hu:hl:l:kw", "y", "steps=1%");
tfindef->setDrawProgressBar(kFALSE);
tfindef->computeIndexes();
TMatrixD matRes = tfindef->getSensitivityMatrix();
matRes.Print();
The function flowrateModel is loaded from the macro UserFunctions.C (the file can be found in
${URANIESYS}/share/uranie/macros)
gROOT->LoadMacro("UserFunctions.C");
Each parameter is related to the TDataServer as a TAttribute and obeys an uniform law on specific interval:
TDataServer *tds = new TDataServer("tdsflowrate", "DataBase flowrate");
tds->addAttribute( new TUniformDistribution("rw", 0.05, 0.15));
tds->addAttribute( new TUniformDistribution("r", 100.0, 50000.0));
tds->addAttribute( new TUniformDistribution("tu", 63070.0, 115600.0));
tds->addAttribute( new TUniformDistribution("tl", 63.1, 116.0));
tds->addAttribute( new TUniformDistribution("hu", 990.0, 1110.0));
tds->addAttribute( new TUniformDistribution("hl", 700.0, 820.0));
tds->addAttribute( new TUniformDistribution("l", 1120.0, 1680.0));
tds->addAttribute( new TUniformDistribution("kw", 9855.0, 12045.0));
Each parameter gets a default value:
tds->getAttribute("rw")->setDefaultValue(0.075);
tds->getAttribute("r")->setDefaultValue(25000.0);
tds->getAttribute("tu")->setDefaultValue(90000.0);
tds->getAttribute("tl")->setDefaultValue(90.0);
tds->getAttribute("hu")->setDefaultValue(1050.0);
tds->getAttribute("hl")->setDefaultValue(760.0);
tds->getAttribute("l")->setDefaultValue(1400.0);
tds->getAttribute("kw")->setDefaultValue(10500.0);
To instantiate the TFiniteDifferences object, one uses the TDataServer, the name of the function, the
name of the output of the function, the names of the input variables separated by “:” and the option
to specify the sampling:
TFiniteDifferences * tfindef = new TFiniteDifferences(tds,"flowrateModel", "rw:r:tu:tl:hu:hl:l:kw", "y", "steps=1%");
Computation of sensitivity indexes:
tfindef->computeIndexes();
13.5.2.3. Console
--- Uranie v4.11/0 --- Developed with ROOT (6.36.06)
Copyright (C) 2013-2026 CEA/DES
Contact: support-uranie@cea.fr
Date: Thu Feb 12, 2026
1x8 matrix is as follows
| 0 | 1 | 2 | 3 | 4 |
----------------------------------------------------------------------
0 | 1019 -3.586e-07 1.265e-09 0.001265 0.1321
| 5 | 6 | 7 |
----------------------------------------------------------------------
0 | -0.1321 -0.02729 0.003639