22 "The distribution names to be sampled, the number of distributions provided defines the "
23 "number of columns per matrix.");
27 "Number of unique trajectories to perform. The higher number of these usually means a more "
28 "accurate sensitivity evaluation, but it is proportional to the number of required model "
29 "evaluations: 'trajectoris' x (number of 'distributions' + 1).");
33 "levels % 2 = 0 & levels > 0",
34 "The number of levels in the sampling. This determines the discretization of the input "
35 "space, more levels means finer discretization and more possible model perturbations.");
41 _num_trajectories(getParam<dof_id_type>(
"trajectories")),
42 _num_levels(getParam<unsigned
int>(
"levels"))
45 for (
const auto &
name : getParam<std::vector<DistributionName>>(
"distributions"))
52 _b = RealEigenMatrix::Ones(nc + 1, nc).triangularView<Eigen::StrictlyLower>();
54 _j.setOnes(nc + 1, nc);
77 "Current trajectory index is greater than the prescribed number of trajectories.");
84 std::vector<dof_id_type> pchoice(nc);
85 std::iota(pchoice.begin(), pchoice.end(), 0);
86 for (dof_id_type
c = 0;
c < nc; ++
c)
88 const unsigned int ind = nc > 1 ?
getRandl(rn_ind++, 0, pchoice.size()) : 0;
90 pchoice.erase(pchoice.begin() + ind);
95 for (dof_id_type
c = 0;
c < nc; ++
c)
99 for (dof_id_type
c = 0;
c < nc; ++
c)
112 std::vector<LocalRankConfig> all_rc(
processor_id() + 1);
119 bool found_first =
false;
120 for (
auto it = all_rc.rbegin(); it != all_rc.rend(); ++it)
121 if (it->is_first_local_rank)
registerMooseObject("StochasticToolsApp", MorrisSampler)
LocalRankConfig rankConfig(processor_id_type rank, processor_id_type nprocs, dof_id_type napps, processor_id_type min_app_procs, processor_id_type max_app_procs, bool batch_mode=false)
void ErrorVector unsigned int
const Distribution & getDistributionByName(const DistributionName &name) const
const std::string & name() const
A class used to perform Monte Carlo sampling for performing Morris sensitivity analysis.
dof_id_type _curr_trajectory
The trajectory the current _bstar represents.
void updateBstar()
Function to calculate trajectories This is only called once per trajectory (_n_rows / (_n_cols + 1))
static InputParameters validParams()
std::vector< const Distribution * > _distributions
Distribution to determine parameter from perturbations.
const unsigned int & _num_levels
Number of levels used for input space discretization.
MorrisSampler(const InputParameters ¶meters)
const dof_id_type & _num_trajectories
Number of trajectories.
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override
virtual LocalRankConfig constructRankConfig(bool batch_mode) const override
Morris sampling should have a slightly different partitioning in order to keep the sample and resampl...
void setNumberOfCols(dof_id_type n_cols)
Real getRand(std::size_t n, unsigned int index=0) const
const dof_id_type _max_procs_per_row
unsigned int getRandl(std::size_t n, unsigned int lower, unsigned int upper, unsigned int index=0) const
static InputParameters validParams()
dof_id_type getNumberOfCols() const
void setNumberOfRows(dof_id_type n_rows)
const dof_id_type _min_procs_per_row
processor_id_type processor_id() const
processor_id_type n_processors() const
dof_id_type num_local_sims
dof_id_type first_local_sim_index
dof_id_type num_local_apps
dof_id_type first_local_app_index