https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
TruncatedGaussian Class Reference

A class used to generate a truncated Gaussian likelihood of observing model predictions. More...

#include <TruncatedGaussian.h>

Inheritance diagram for TruncatedGaussian:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 TruncatedGaussian (const InputParameters &parameters)
 
virtual Real function (const std::vector< Real > &x) const override
 Return the probability density or mass function at vector x.
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
bool isKokkosObject () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (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 &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) 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
 

Static Public Member Functions

static InputParameters validParams ()
 
static Real function (const std::vector< Real > &exp, const std::vector< Real > &model, const Real &noise, const Real &lower_bound, const Real &upper_bound, const bool &log_likelihood)
 Return the probability density function.
 
static Real function (const std::vector< Real > &exp, const std::vector< Real > &model, const Real &noise, const bool &log_likelihood)
 Return the probability density function.
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 

Protected Member Functions

void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
const ReporterContextBasegetReporterContextBaseByName (const ReporterName &reporter_name) const
 
const ReporterNamegetReporterName (const std::string &param_name) const
 
virtual void addReporterDependencyHelper (const ReporterName &)
 
const TgetReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 

Protected Attributes

const bool _log_likelihood
 return log-likelihood or likelihood
 
const Real & _noise
 Noise value.
 
std::vector< Real > _exp_values
 Experimental data values.
 
const bool & _enabled
 
MooseApp_app
 
Factory_factory
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
const Parallel::Communicator & _communicator
 

Private Member Functions

bool reportersAdded () const
 
void possiblyCheckHasReporter (const ReporterName &reporter_name, const std::string &param_name="") const
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 

Private Attributes

const Real _lower_bound
 Lower bound.
 
const Real _upper_bound
 Upper bound.
 
const ParallelParamObject_parent
 
const MooseBase_si_moose_base
 
const FEProblemBase_si_problem
 
const InputParameters_ri_params
 
FEProblemBase_ri_fe_problem_base
 
const ReporterData_ri_reporter_data
 
const MooseObject_ri_moose_object
 

Detailed Description

A class used to generate a truncated Gaussian likelihood of observing model predictions.

Definition at line 17 of file TruncatedGaussian.h.

Constructor & Destructor Documentation

◆ TruncatedGaussian()

TruncatedGaussian::TruncatedGaussian ( const InputParameters parameters)

Definition at line 26 of file TruncatedGaussian.C.

28 _lower_bound(getParam<Real>("lower_bound")),
29 _upper_bound(getParam<Real>("upper_bound"))
30{
32 mooseError("The specified lower bound should be less than the upper bound.");
33}
A class used to generate a Gaussian likelihood of observing model predictions.
Definition Gaussian.h:19
const InputParameters & parameters() const
void mooseError(Args &&... args) const
const Real _upper_bound
Upper bound.
const Real _lower_bound
Lower bound.

Member Function Documentation

◆ function() [1/3]

Real Gaussian::function ( const std::vector< Real > &  exp,
const std::vector< Real > &  model,
const Real &  noise,
const bool &  log_likelihood 
)
staticinherited

Return the probability density function.

Parameters
expThe experimental measurement
modelThe model prediction
noiseThe standard deviation
log_likelihoodBool to return the log likelihood value

Definition at line 58 of file Gaussian.C.

62{
63 Real result = 0.0;
64 Real val1;
65 for (unsigned i = 0; i < exp.size(); ++i)
66 {
67 val1 = Normal::pdf(exp[i], model[i], noise);
68 val1 = std::log(val1);
69 result += val1;
70 }
71 if (!log_likelihood)
72 result = std::exp(result);
73 return result;
74}
const PertinentGeochemicalSystem model(database, {"H2O", "H+", "HCO3-", "O2(aq)", "Ca++", ">(s)FeOH", "radius_neg1", "radius_neg1.5"}, {"Calcite"}, {}, {"Calcite_asdf"}, {"CH4(aq)"}, {">(s)FeOCa+"}, "O2(aq)", "e-")
virtual Real pdf(const Real &x) const override
Definition Normal.C:68
auto exp(const T &)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ function() [2/3]

Real TruncatedGaussian::function ( const std::vector< Real > &  exp,
const std::vector< Real > &  model,
const Real &  noise,
const Real &  lower_bound,
const Real &  upper_bound,
const bool &  log_likelihood 
)
static

Return the probability density function.

Parameters
expThe experimental measurement
modelThe model prediction
noiseThe standard deviation
lower_boundThe lower bound
upper_boundThe upper bound
log_likelihoodBool to return the log likelihood value

Definition at line 36 of file TruncatedGaussian.C.

42{
43 Real result = 0.0;
44 for (unsigned i = 0; i < exp.size(); ++i)
45 result += std::log(TruncatedNormal::pdf(exp[i], model[i], noise, lower_bound, upper_bound));
46 if (!log_likelihood)
47 result = std::exp(result);
48 return result;
49}
virtual Real pdf(const Real &x) const override

◆ function() [3/3]

Real TruncatedGaussian::function ( const std::vector< Real > &  x) const
overridevirtual

Return the probability density or mass function at vector x.

Parameters
xThe input vector x

Reimplemented from Gaussian.

Definition at line 52 of file TruncatedGaussian.C.

53{
55}
const std::vector< double > x
const Real & _noise
Noise value.
Definition Gaussian.h:44
std::vector< Real > _exp_values
Experimental data values.
Definition Gaussian.h:47
const bool _log_likelihood
return log-likelihood or likelihood
Definition Gaussian.h:41
virtual Real function(const std::vector< Real > &x) const override
Return the probability density or mass function at vector x.

Referenced by function().

◆ validParams()

InputParameters TruncatedGaussian::validParams ( )
static

Definition at line 16 of file TruncatedGaussian.C.

17{
20 "TruncatedGaussian likelihood function evaluating the model goodness against experiments.");
21 params.addRequiredParam<Real>("lower_bound", "Lower bound for the quantity of interest.");
22 params.addRequiredParam<Real>("upper_bound", "Upper bound for the quantity of interest.");
23 return params;
24}
static InputParameters validParams()
Definition Gaussian.C:17
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _exp_values

std::vector<Real> Gaussian::_exp_values
protectedinherited

Experimental data values.

Definition at line 47 of file Gaussian.h.

Referenced by ExtremeValue::function(), Gaussian::function(), LinearSum::function(), function(), and Gaussian::Gaussian().

◆ _log_likelihood

const bool Gaussian::_log_likelihood
protectedinherited

return log-likelihood or likelihood

Definition at line 41 of file Gaussian.h.

Referenced by ExtremeValue::function(), Gaussian::function(), and function().

◆ _lower_bound

const Real TruncatedGaussian::_lower_bound
private

Lower bound.

Definition at line 44 of file TruncatedGaussian.h.

Referenced by function(), and TruncatedGaussian().

◆ _noise

const Real& Gaussian::_noise
protectedinherited

Noise value.

Definition at line 44 of file Gaussian.h.

Referenced by ExtremeValue::function(), Gaussian::function(), LinearSum::function(), and function().

◆ _upper_bound

const Real TruncatedGaussian::_upper_bound
private

Upper bound.

Definition at line 47 of file TruncatedGaussian.h.

Referenced by function(), and TruncatedGaussian().


The documentation for this class was generated from the following files: