#include <PolynomialChaos.h>
Public Types | |
typedef DataFileName | DataFileParameterType |
Public Member Functions | |
PolynomialChaos (const InputParameters ¶meters) | |
virtual Real | evaluate (const std::vector< Real > &x) const override |
Evaluate surrogate model given a row of parameters. More... | |
std::size_t | getNumberOfParameters () const |
Access number of dimensions/parameters. More... | |
std::size_t | getNumberofCoefficients () const |
Number of terms in expansion. More... | |
const std::vector< Real > & | getCoefficients () const |
Access computed expansion coefficients. More... | |
virtual Real | computeMean () const |
Evaluate mean: = E[u]. More... | |
virtual Real | computeStandardDeviation () const |
Evaluate standard deviation: = sqrt(E[(u-)^2]) More... | |
Real | powerExpectation (const unsigned int n) const |
Compute expectation of a certain power of the QoI: E[(u-)^n]. More... | |
Real | computeDerivative (const unsigned int dim, const std::vector< Real > &x) const |
Evaluates partial derivative of expansion: du(x)/dx_dim. More... | |
Real | computePartialDerivative (const std::vector< unsigned int > &dim, const std::vector< Real > &x) const |
Evaluates sum of partial derivative of expansion. More... | |
Real | computeSobolIndex (const std::set< unsigned int > &ind) const |
Computes Sobol sensitivities S_{i_1,i_2,...,i_s}, where ind = i_1,i_2,...,i_s. More... | |
Real | computeSobolTotal (const unsigned int dim) const |
void | store (nlohmann::json &json) const |
virtual Real | evaluate (const std::vector< Real > &x) const |
Evaluate surrogate model given a row of parameters. More... | |
virtual void | evaluate (const std::vector< Real > &x, std::vector< Real > &y) const |
Various evaluate methods that can be overriden. More... | |
virtual Real | evaluate (const std::vector< Real > &x, Real &std) const |
Evaluate methods that also return predicted standard deviation (see GaussianProcess.h) More... | |
virtual void | evaluate (const std::vector< Real > &x, std::vector< Real > &y, std::vector< Real > &) const |
virtual bool | enabled () const |
std::shared_ptr< MooseObject > | getSharedPtr () |
std::shared_ptr< const MooseObject > | getSharedPtr () const |
MooseApp & | getMooseApp () const |
const std::string & | type () const |
virtual const std::string & | name () const |
std::string | typeAndName () const |
std::string | errorPrefix (const std::string &error_type) const |
void | callMooseError (std::string msg, const bool with_prefix) const |
MooseObjectParameterName | uniqueParameterName (const std::string ¶meter_name) const |
const InputParameters & | parameters () const |
MooseObjectName | uniqueName () const |
const T & | getParam (const std::string &name) const |
std::vector< std::pair< T1, T2 > > | getParam (const std::string ¶m1, const std::string ¶m2) const |
const T * | queryParam (const std::string &name) const |
const T & | getRenamedParam (const std::string &old_name, const std::string &new_name) const |
T | getCheckedPointerParam (const std::string &name, const std::string &error_string="") const |
bool | isParamValid (const std::string &name) const |
bool | isParamSetByUser (const std::string &nm) const |
void | paramError (const std::string ¶m, Args... args) const |
void | paramWarning (const std::string ¶m, Args... args) const |
void | paramInfo (const std::string ¶m, Args... args) const |
void | connectControllableParams (const std::string ¶meter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const |
void | mooseError (Args &&... args) const |
void | mooseErrorNonPrefixed (Args &&... args) const |
void | mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const |
void | mooseWarning (Args &&... args) const |
void | mooseWarningNonPrefixed (Args &&... args) const |
void | mooseDeprecated (Args &&... args) const |
void | mooseInfo (Args &&... args) const |
std::string | getDataFileName (const std::string ¶m) const |
std::string | getDataFileNameByName (const std::string &relative_path) const |
std::string | getDataFilePath (const std::string &relative_path) const |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
T & | getSampler (const std::string &name) |
Sampler & | getSampler (const std::string &name) |
T & | getSamplerByName (const SamplerName &name) |
Sampler & | getSamplerByName (const SamplerName &name) |
template<> | |
SurrogateModel & | getSurrogateModel (const std::string &name) const |
template<> | |
SurrogateTrainerBase & | getSurrogateTrainer (const std::string &name) const |
template<> | |
SurrogateModel & | getSurrogateModelByName (const UserObjectName &name) const |
template<> | |
SurrogateTrainerBase & | getSurrogateTrainerByName (const UserObjectName &name) const |
const std::string & | modelMetaDataName () const |
Accessor for the name of the model meta data. More... | |
const FileName & | getModelDataFileName () const |
Get the associated filename. More... | |
bool | hasModelData () const |
Check if we need to load model data (if the filename parameter is used) More... | |
const std::vector< std::vector< unsigned int > > & | getPolynomialOrders () const |
Access polynomial orders from tuple /. More... | |
unsigned int | getPolynomialOrder (const unsigned int dim, const unsigned int i) const |
virtual void | evaluate (const std::vector< Real > &x, std::vector< Real > &y) const |
Various evaluate methods that can be overriden. More... | |
virtual Real | evaluate (const std::vector< Real > &x, Real &std) const |
Evaluate methods that also return predicted standard deviation (see GaussianProcess.h) More... | |
virtual void | evaluate (const std::vector< Real > &x, std::vector< Real > &y, std::vector< Real > &) const |
template<typename T = SurrogateModel> | |
T & | getSurrogateModel (const std::string &name) const |
Get a SurrogateModel/Trainer with a given name. More... | |
template<typename T = SurrogateTrainerBase> | |
T & | getSurrogateTrainer (const std::string &name) const |
template<typename T = SurrogateModel> | |
T & | getSurrogateModelByName (const UserObjectName &name) const |
Get a sampler with a given name. More... | |
template<typename T = SurrogateTrainerBase> | |
T & | getSurrogateTrainerByName (const UserObjectName &name) const |
template<typename T , typename... Args> | |
T & | declareModelData (const std::string &data_name, Args &&... args) |
Declare model data for loading from file as well as restart. More... | |
template<typename T , typename... Args> | |
const T & | getModelData (const std::string &data_name, Args &&... args) const |
Retrieve model data from the interface. More... | |
Static Public Member Functions | |
static InputParameters | validParams () |
static MooseEnum | defaultPredictorTypes () |
static MooseEnum | defaultResponseTypes () |
Public Attributes | |
const ConsoleStream | _console |
Protected Attributes | |
const bool & | _enabled |
MooseApp & | _app |
const std::string | _type |
const std::string | _name |
const InputParameters & | _pars |
Factory & | _factory |
ActionFactory & | _action_factory |
const Parallel::Communicator & | _communicator |
Private Attributes | |
const unsigned int & | _order |
Maximum polynomial order. The sum of 1D polynomial orders does not go above this value. More... | |
const unsigned int & | _ndim |
Total number of parameters/dimensions. More... | |
const std::size_t & | _ncoeff |
Total number of coefficient (defined by size of _tuple) More... | |
const std::vector< std::vector< unsigned int > > & | _tuple |
A _ndim-by-_ncoeff matrix containing the appropriate one-dimensional polynomial order. More... | |
const std::vector< Real > & | _coeff |
These are the coefficients we are after in the PC expansion. More... | |
const std::vector< std::unique_ptr< const PolynomialQuadrature::Polynomial > > & | _poly |
The distributions used for sampling. More... | |
Friends | |
void | to_json (nlohmann::json &json, const PolynomialChaos *const &pc) |
dof_id_type | _n_local_coeff = std::numeric_limits<dof_id_type>::max() |
Variables calculation and for looping over the computed coefficients in parallel. More... | |
dof_id_type | _local_coeff_begin = 0 |
dof_id_type | _local_coeff_end = 0 |
void | linearPartitionCoefficients () const |
Definition at line 19 of file PolynomialChaos.h.
PolynomialChaos::PolynomialChaos | ( | const InputParameters & | parameters | ) |
Definition at line 24 of file PolynomialChaos.C.
Real PolynomialChaos::computeDerivative | ( | const unsigned int | dim, |
const std::vector< Real > & | x | ||
) | const |
Evaluates partial derivative of expansion: du(x)/dx_dim.
Definition at line 139 of file PolynomialChaos.C.
Referenced by PolynomialChaosReporter::computeLocalSensitivity().
|
virtual |
Evaluate mean: = E[u].
Definition at line 79 of file PolynomialChaos.C.
Referenced by computeSobolIndex().
Real PolynomialChaos::computePartialDerivative | ( | const std::vector< unsigned int > & | dim, |
const std::vector< Real > & | x | ||
) | const |
Evaluates sum of partial derivative of expansion.
Example: computeGradient({0, 2, 3}, x) = du(x)/dx_0dx_2dx_3
Definition at line 145 of file PolynomialChaos.C.
Referenced by computeDerivative().
Computes Sobol sensitivities S_{i_1,i_2,...,i_s}, where ind = i_1,i_2,...,i_s.
Definition at line 177 of file PolynomialChaos.C.
Definition at line 213 of file PolynomialChaos.C.
|
virtual |
Evaluate standard deviation: = sqrt(E[(u-)^2])
Definition at line 86 of file PolynomialChaos.C.
|
inherited |
Declare model data for loading from file as well as restart.
Definition at line 78 of file RestartableModelInterface.h.
|
inlinestaticinherited |
Definition at line 27 of file SurrogateModel.h.
|
inlinestaticinherited |
Definition at line 28 of file SurrogateModel.h.
Referenced by EvaluateSurrogate::validParams().
|
inline |
Evaluate surrogate model given a row of parameters.
Definition at line 33 of file SurrogateModel.h.
|
inline |
Various evaluate methods that can be overriden.
Definition at line 43 of file SurrogateModel.h.
|
inline |
Evaluate methods that also return predicted standard deviation (see GaussianProcess.h)
Definition at line 53 of file SurrogateModel.h.
|
inline |
Definition at line 59 of file SurrogateModel.h.
Evaluate surrogate model given a row of parameters.
Reimplemented from SurrogateModel.
Definition at line 37 of file PolynomialChaos.C.
Referenced by PolynomialChaosReporter::computeLocalSensitivity().
|
inlinevirtualinherited |
Various evaluate methods that can be overriden.
Reimplemented in GaussianProcessSurrogate, PolynomialRegressionSurrogate, and NearestPointSurrogate.
Definition at line 43 of file SurrogateModel.h.
|
inlinevirtualinherited |
Evaluate methods that also return predicted standard deviation (see GaussianProcess.h)
Reimplemented in GaussianProcessSurrogate.
Definition at line 53 of file SurrogateModel.h.
|
inlinevirtualinherited |
Reimplemented in GaussianProcessSurrogate.
Definition at line 59 of file SurrogateModel.h.
const std::vector< Real > & PolynomialChaos::getCoefficients | ( | ) | const |
Access computed expansion coefficients.
Definition at line 73 of file PolynomialChaos.C.
Referenced by store().
|
inherited |
Retrieve model data from the interface.
Definition at line 85 of file RestartableModelInterface.h.
|
inherited |
Get the associated filename.
Definition at line 33 of file RestartableModelInterface.C.
|
inline |
Number of terms in expansion.
Definition at line 31 of file PolynomialChaos.h.
Referenced by store().
|
inline |
Access number of dimensions/parameters.
Definition at line 28 of file PolynomialChaos.h.
Referenced by store().
Definition at line 67 of file PolynomialChaos.C.
const std::vector< std::vector< unsigned int > > & PolynomialChaos::getPolynomialOrders | ( | ) | const |
Access polynomial orders from tuple /.
Definition at line 61 of file PolynomialChaos.C.
Referenced by store().
|
inherited |
Definition at line 46 of file SurrogateModelInterface.C.
|
inherited |
Get a SurrogateModel/Trainer with a given name.
name | The name of the parameter key of the sampler to retrieve |
Definition at line 81 of file SurrogateModelInterface.h.
Referenced by SurrogateTrainer::initialize().
|
inherited |
Definition at line 31 of file SurrogateModelInterface.C.
|
inherited |
Get a sampler with a given name.
name | The name of the sampler to retrieve |
Definition at line 88 of file SurrogateModelInterface.h.
Referenced by CrossValidationScores::CrossValidationScores(), EvaluateSurrogate::EvaluateSurrogate(), and InverseMapping::initialSetup().
|
inherited |
Definition at line 104 of file SurrogateModelInterface.h.
|
inherited |
Definition at line 60 of file SurrogateModelInterface.C.
|
inherited |
Definition at line 53 of file SurrogateModelInterface.C.
|
inherited |
Definition at line 111 of file SurrogateModelInterface.h.
Referenced by SurrogateTrainerOutput::output().
|
inherited |
Check if we need to load model data (if the filename parameter is used)
Definition at line 39 of file RestartableModelInterface.C.
|
private |
Definition at line 229 of file PolynomialChaos.C.
Referenced by computeSobolIndex(), and computeSobolTotal().
|
inlineinherited |
Accessor for the name of the model meta data.
Definition at line 47 of file RestartableModelInterface.h.
Referenced by SurrogateTrainerOutput::output(), and MappingOutput::output().
Compute expectation of a certain power of the QoI: E[(u-)^n].
Definition at line 101 of file PolynomialChaos.C.
void PolynomialChaos::store | ( | nlohmann::json & | json | ) | const |
Definition at line 241 of file PolynomialChaos.C.
Referenced by to_json().
|
static |
Definition at line 17 of file PolynomialChaos.C.
|
friend |
Definition at line 150 of file PolynomialChaosReporter.C.
|
private |
These are the coefficients we are after in the PC expansion.
Definition at line 97 of file PolynomialChaos.h.
Referenced by computeMean(), computePartialDerivative(), computeSobolIndex(), computeSobolTotal(), computeStandardDeviation(), evaluate(), getCoefficients(), and powerExpectation().
|
mutableprivate |
Definition at line 77 of file PolynomialChaos.h.
Referenced by computeSobolIndex(), computeSobolTotal(), and linearPartitionCoefficients().
|
mutableprivate |
Definition at line 78 of file PolynomialChaos.h.
Referenced by computeSobolIndex(), computeSobolTotal(), and linearPartitionCoefficients().
|
mutableprivate |
Variables calculation and for looping over the computed coefficients in parallel.
The various utility methods in this class require the coefficients be partitioned in parallel, but the data being partitioned is loaded from the trainer so it might not be available. Thus, the partitioning is done on demand, if needed.
The methods are marked const because they do not modify the loaded data, to keep this interface the partitioning uses mutable variables.
Definition at line 76 of file PolynomialChaos.h.
Referenced by linearPartitionCoefficients().
|
private |
Total number of coefficient (defined by size of _tuple)
Definition at line 91 of file PolynomialChaos.h.
Referenced by computePartialDerivative(), computeStandardDeviation(), evaluate(), linearPartitionCoefficients(), and powerExpectation().
|
private |
Total number of parameters/dimensions.
Definition at line 88 of file PolynomialChaos.h.
Referenced by computePartialDerivative(), computeSobolIndex(), computeSobolTotal(), computeStandardDeviation(), evaluate(), and powerExpectation().
|
private |
Maximum polynomial order. The sum of 1D polynomial orders does not go above this value.
Definition at line 85 of file PolynomialChaos.h.
Referenced by computePartialDerivative(), evaluate(), and store().
|
private |
The distributions used for sampling.
Definition at line 100 of file PolynomialChaos.h.
Referenced by computePartialDerivative(), computeSobolIndex(), computeSobolTotal(), computeStandardDeviation(), evaluate(), getNumberOfParameters(), powerExpectation(), and store().
|
private |
A _ndim-by-_ncoeff matrix containing the appropriate one-dimensional polynomial order.
Definition at line 94 of file PolynomialChaos.h.
Referenced by computePartialDerivative(), computeSobolIndex(), computeSobolTotal(), computeStandardDeviation(), evaluate(), getNumberofCoefficients(), getPolynomialOrder(), getPolynomialOrders(), and powerExpectation().