Feel++
0.92.0
|
Certifed Reduced Basis class. More...
#include <crb.hpp>
Public Types | |
Typedefs | |
typedef TruthModelType | truth_model_type |
typedef truth_model_type | model_type |
typedef boost::shared_ptr < truth_model_type > | truth_model_ptrtype |
typedef double | value_type |
typedef boost::tuple< double, double > | bounds_type |
typedef ParameterSpace < TruthModelType::ParameterSpaceDimension > | parameterspace_type |
typedef boost::shared_ptr < parameterspace_type > | parameterspace_ptrtype |
typedef parameterspace_type::element_type | parameter_type |
typedef parameterspace_type::element_ptrtype | parameter_ptrtype |
typedef parameterspace_type::sampling_type | sampling_type |
typedef parameterspace_type::sampling_ptrtype | sampling_ptrtype |
typedef boost::tuple< double, parameter_type, size_type, double, double > | relative_error_type |
typedef relative_error_type | max_error_type |
typedef boost::tuple< double, std::vector< std::vector < double > >, std::vector < std::vector< double > >, double, double > | error_estimation_type |
typedef boost::tuple< double, std::vector< double > > | residual_error_type |
typedef boost::bimap< int, boost::tuple< double, double, double > > | convergence_type |
typedef convergence_type::value_type | convergence |
typedef CRBSCM< truth_model_type > | scm_type |
scm | |
typedef boost::shared_ptr < scm_type > | scm_ptrtype |
typedef POD< truth_model_type > | pod_type |
POD. | |
typedef boost::shared_ptr < pod_type > | pod_ptrtype |
typedef model_type::functionspace_type | functionspace_type |
function space type | |
typedef model_type::functionspace_ptrtype | functionspace_ptrtype |
typedef model_type::element_type | element_type |
element of the functionspace type | |
typedef model_type::element_ptrtype | element_ptrtype |
typedef model_type::backend_type | backend_type |
typedef boost::shared_ptr < backend_type > | backend_ptrtype |
typedef model_type::sparse_matrix_ptrtype | sparse_matrix_ptrtype |
typedef model_type::vector_ptrtype | vector_ptrtype |
typedef model_type::theta_vector_type | theta_vector_type |
typedef Eigen::VectorXd | y_type |
typedef std::vector< y_type > | y_set_type |
typedef std::vector < boost::tuple< double, double > > | y_bounds_type |
typedef std::vector< element_type > | wn_type |
typedef boost::tuple < std::vector< wn_type > , std::vector< std::string > > | export_vector_wn_type |
typedef std::vector< double > | vector_double_type |
typedef boost::shared_ptr < vector_double_type > | vector_double_ptrtype |
typedef Eigen::VectorXd | vectorN_type |
typedef Eigen::MatrixXd | matrixN_type |
typedef std::vector< element_type > | mode_set_type |
typedef boost::shared_ptr < mode_set_type > | mode_set_ptrtype |
typedef boost::multi_array < value_type, 2 > | array_2_type |
typedef boost::multi_array < vectorN_type, 2 > | array_3_type |
typedef boost::multi_array < matrixN_type, 2 > | array_4_type |
typedef model_type::mesh_type | mesh_type |
mesh type | |
typedef boost::shared_ptr < mesh_type > | mesh_ptrtype |
typedef model_type::space_type | space_type |
space type | |
typedef Bdf< space_type > | bdf_type |
time discretization | |
typedef boost::shared_ptr < bdf_type > | bdf_ptrtype |
typedef Exporter< mesh_type > | export_type |
typedef boost::shared_ptr < export_type > | export_ptrtype |
Public Member Functions | |
Constructors, destructor | |
CRB () | |
default constructor | |
CRB (std::string name, po::variables_map const &vm) | |
constructor from command line options | |
CRB (CRB const &o) | |
copy constructor | |
~CRB () | |
destructor | |
Operator overloads | |
CRB & | operator= (CRB const &o) |
copy operator | |
Accessors | |
int | factor () const |
return factor | |
int | maxIter () const |
parameterspace_ptrtype | Dmu () const |
int | outputIndex () const |
int | dimension () const |
sampling_ptrtype | trainSampling () const |
CRBErrorType | errorType () const |
scm_ptrtype | scm () const |
Mutators | |
void | setOutputIndex (uint16_type oindex) |
set the output index | |
void | setCRBErrorType (CRBErrorType error) |
set the crb error type | |
void | setTolerance (double tolerance) |
set offline tolerance | |
void | setTruthModel (truth_model_ptrtype const &model) |
set the truth offline model | |
void | setMaxIter (int K) |
set max iteration number | |
void | setFactor (int Factor) |
set factor | |
Methods | |
void | orthonormalize (size_type N, wn_type &wn, int Nm=1) |
void | checkResidual (parameter_type const &mu, std::vector< std::vector< double > > const &primal_residual_coeffs, std::vector< std::vector< double > > const &dual_residual_coeffs) const |
void | compareResidualsForTransientProblems (parameter_type const &mu, std::vector< element_ptrtype > const &Un, std::vector< element_ptrtype > const &Unold, std::vector< element_ptrtype > const &Undu, std::vector< element_ptrtype > const &Unduold, std::vector< std::vector< double > > const &primal_residual_coeffs, std::vector< std::vector< double > > const &dual_residual_coeffs) const |
void | buildFunctionFromRbCoefficients (std::vector< vectorN_type > const &RBcoeff, wn_type const &WN, std::vector< element_ptrtype > &FEMsolutions) |
void | checkOrthonormality (int N, const wn_type &wn) const |
void | check (size_type N) const |
void | computeErrorEstimationEfficiencyIndicator (parameterspace_ptrtype const &Dmu, double &max_ei, double &min_ei, int N=4) |
void | exportBasisFunctions (const export_vector_wn_type &wn) const |
boost::tuple< double, double > | lb (size_type N, parameter_type const &mu, std::vector< vectorN_type > &uN, std::vector< vectorN_type > &uNdu, std::vector< vectorN_type > &uNold, std::vector< vectorN_type > &uNduold, int K=0) const |
boost::tuple< double, double > | lb (parameter_ptrtype const &mu, size_type N, std::vector< vectorN_type > &uN, std::vector< vectorN_type > &uNdu) const |
value_type | ub (size_type N, parameter_type const &mu, std::vector< vectorN_type > &uN, std::vector< vectorN_type > &uNdu) const |
value_type | delta (size_type N, parameter_ptrtype const &mu, std::vector< vectorN_type > const &uN, std::vector< vectorN_type > const &uNdu, std::vector< vectorN_type > const &uNold, std::vector< vectorN_type > const &uNduold, int k=0) const |
error_estimation_type | delta (size_type N, parameter_type const &mu, std::vector< vectorN_type > const &uN, std::vector< vectorN_type > const &uNdu, std::vector< vectorN_type > const &uNold, std::vector< vectorN_type > const &uNduold, int k=0) const |
value_type | ub (size_type K, parameter_ptrtype const &mu, std::vector< vectorN_type > &uN, std::vector< vectorN_type > &uNdu) const |
convergence_type | offline () |
max_error_type | maxErrorBounds (size_type N) const |
Retuns maximum value of the relative error. | |
residual_error_type | transientPrimalResidual (int Ncur, parameter_type const &mu, vectorN_type const &Un, vectorN_type const &Unold=vectorN_type(), double time_step=1, double time=1e30) const |
residual_error_type | steadyPrimalResidual (int Ncur, parameter_type const &mu, vectorN_type const &Un, double time=0) const |
residual_error_type | transientDualResidual (int Ncur, parameter_type const &mu, vectorN_type const &Un, vectorN_type const &Unold=vectorN_type(), double time_step=1, double time=1e30) const |
residual_error_type | steadyDualResidual (int Ncur, parameter_type const &mu, vectorN_type const &Un, double time=0) const |
value_type | initialDualResidual (int Ncur, parameter_type const &mu, vectorN_type const &Uduini, double time_step) const |
void | offlineResidual (int Ncur, int number_of_added_elements=1) |
void | offlineResidual (int Ncur, mpl::bool_< true >, int number_of_added_elements=1) |
void | offlineResidual (int Ncur, mpl::bool_< false >, int number_of_added_elements=1) |
value_type | empiricalErrorEstimation (int Ncur, parameter_type const &mu, int k) const |
boost::tuple< double, double, double, double > | run (parameter_type const &mu, double eps=1e-6) |
void | run (const double *X, unsigned long N, double *Y, unsigned long P) |
void | run (const double *X, unsigned long N, double *Y, unsigned long P, mpl::bool_< true >) |
void | run (const double *X, unsigned long N, double *Y, unsigned long P, mpl::bool_< false >) |
sampling_type | randomSampling (int N) |
sampling_type | equidistributedSampling (int N) |
void | saveDB () |
bool | loadDB () |
void | projectionOnPodSpace (const element_ptrtype &u, element_ptrtype &projection, const std::string &name_of_space="primal") |
bool | rebuildDB () |
bool | showMuSelection () |
bool | printErrorDuringOfflineStep () |
void | printMuSelection (void) |
void | printErrorsDuringRbConstruction (void) |
double | correctionTerms (parameter_type const &mu, std::vector< vectorN_type > const &uN, std::vector< vectorN_type > const &uNdu, std::vector< vectorN_type > const &uNold, int const K=0) const |
void | buildVarianceMatrixPhi (int const N) |
Friends | |
class | boost::serialization::access |
Certifed Reduced Basis class.
Implements the certified reduced basis method
check the reduced basis space invariant properties
N | dimension of ![]() |
References Feel::CRB< TruthModelType >::delta(), Feel::CRB< TruthModelType >::lb(), and Feel::CRBDB::vm().
Referenced by Feel::CRB< TruthModelType >::offline().
void Feel::CRB< TruthModelType >::computeErrorEstimationEfficiencyIndicator | ( | parameterspace_ptrtype const & | Dmu, |
double & | max_ei, | ||
double & | min_ei, | ||
int | N = 4 |
||
) |
compute effectivity indicator of the error estimation overall a given parameter space
max_ei | : maximum efficiency indicator (output) |
min_ei | : minimum efficiency indicator (output) |
Dmu | (input) parameter space |
N | : sampling size (optional input with default value) |
References Feel::CRB< TruthModelType >::delta(), and Feel::CRB< TruthModelType >::lb().
value_type Feel::CRB< TruthModelType >::delta | ( | size_type | N, |
parameter_ptrtype const & | mu, | ||
std::vector< vectorN_type > const & | uN, | ||
std::vector< vectorN_type > const & | uNdu, | ||
std::vector< vectorN_type > const & | uNold, | ||
std::vector< vectorN_type > const & | uNduold, | ||
int | k = 0 |
||
) | const [inline] |
Returns the error bound on the output
mu | ![]() |
N | the size of the reduced basis space to use |
uN | primal solution |
uNdu | dual solution |
Referenced by Feel::CRB< TruthModelType >::check(), Feel::CRB< TruthModelType >::computeErrorEstimationEfficiencyIndicator(), Feel::CRB< TruthModelType >::maxErrorBounds(), Feel::CRB< TruthModelType >::run(), and Feel::CRB< TruthModelType >::ub().
CRB< TruthModelType >::error_estimation_type Feel::CRB< TruthModelType >::delta | ( | size_type | N, |
parameter_type const & | mu, | ||
std::vector< vectorN_type > const & | uN, | ||
std::vector< vectorN_type > const & | uNdu, | ||
std::vector< vectorN_type > const & | uNold, | ||
std::vector< vectorN_type > const & | uNduold, | ||
int | k = 0 |
||
) | const |
Returns the error bound on the output associed to
mu | ![]() |
N | the dimension of ![]() |
uN | primal solution |
uNdu | dual solution |
References Feel::CRB< TruthModelType >::transientPrimalResidual().
parameterspace_ptrtype Feel::CRB< TruthModelType >::Dmu | ( | ) | const [inline] |
sampling_type Feel::CRB< TruthModelType >::equidistributedSampling | ( | int | N | ) | [inline] |
CRBErrorType Feel::CRB< TruthModelType >::errorType | ( | ) | const [inline] |
void Feel::CRB< TruthModelType >::exportBasisFunctions | ( | const export_vector_wn_type & | wn | ) | const |
export basis functions to visualize it
wn | : tuple composed of a vector of wn_type and a vector of string (used to name basis) |
References Feel::CRBDB::name().
Referenced by Feel::CRB< TruthModelType >::offline().
boost::tuple< double, double > Feel::CRB< TruthModelType >::lb | ( | size_type | N, |
parameter_type const & | mu, | ||
std::vector< vectorN_type > & | uN, | ||
std::vector< vectorN_type > & | uNdu, | ||
std::vector< vectorN_type > & | uNold, | ||
std::vector< vectorN_type > & | uNduold, | ||
int | K = 0 |
||
) | const |
Returns the lower bound of the output
mu | ![]() |
N | the size of the reduced basis space to use |
uN | primal solution |
uNdu | dual solution |
K | : index of time ( time = K*dt) at which we want to evaluate the output Note : K as a default value for non time-dependent problems |
References Feel::CRBDB::name(), and Feel::CRBDB::vm().
Referenced by Feel::CRB< TruthModelType >::check(), Feel::CRB< TruthModelType >::computeErrorEstimationEfficiencyIndicator(), Feel::CRB< TruthModelType >::lb(), Feel::CRB< TruthModelType >::maxErrorBounds(), Feel::CRB< TruthModelType >::run(), and Feel::CRB< TruthModelType >::ub().
boost::tuple<double,double> Feel::CRB< TruthModelType >::lb | ( | parameter_ptrtype const & | mu, |
size_type | N, | ||
std::vector< vectorN_type > & | uN, | ||
std::vector< vectorN_type > & | uNdu | ||
) | const [inline] |
Returns the lower bound of the output
mu | ![]() |
N | the size of the reduced basis space to use |
uN | primal solution |
uNdu | dual solution |
References Feel::CRB< TruthModelType >::lb().
load the CRB database
Reimplemented from Feel::CRBDB.
References Feel::CRBDB::lookForDB(), and Feel::CRB< TruthModelType >::rebuildDB().
Referenced by Feel::CRB< TruthModelType >::CRB(), Feel::CRB< TruthModelType >::setOutputIndex(), and Feel::CRB< TruthModelType >::setTruthModel().
CRB< TruthModelType >::max_error_type Feel::CRB< TruthModelType >::maxErrorBounds | ( | size_type | N | ) | const |
Retuns maximum value of the relative error.
N | number of elements in the reduced basis <=> M_N |
References Feel::CRB< TruthModelType >::delta(), Feel::CRB< TruthModelType >::lb(), and Feel::CRBDB::vm().
Referenced by Feel::CRB< TruthModelType >::offline().
CRB< TruthModelType >::convergence_type Feel::CRB< TruthModelType >::offline | ( | ) |
Offline computation
References Feel::Backend< T >::build(), Feel::CRB< TruthModelType >::check(), Feel::CRB< TruthModelType >::exportBasisFunctions(), Feel::inner_product(), Feel::CRB< TruthModelType >::maxErrorBounds(), Feel::CRBDB::name(), Feel::CRB< TruthModelType >::offlineResidual(), Feel::CRB< TruthModelType >::orthonormalize(), Feel::CRB< TruthModelType >::projectionOnPodSpace(), Feel::CRB< TruthModelType >::saveDB(), and Feel::CRBDB::vm().
void Feel::CRB< TruthModelType >::offlineResidual | ( | int | Ncur, |
int | number_of_added_elements = 1 |
||
) |
generate offline the residual
Referenced by Feel::CRB< TruthModelType >::offline().
void Feel::CRB< TruthModelType >::orthonormalize | ( | size_type | N, |
wn_type & | wn, | ||
int | Nm = 1 |
||
) |
orthonormalize the basis
References Feel::CRBDB::vm().
Referenced by Feel::CRB< TruthModelType >::offline().
int Feel::CRB< TruthModelType >::outputIndex | ( | ) | const [inline] |
bool Feel::CRB< TruthModelType >::printErrorDuringOfflineStep | ( | ) |
if true, print the max error (absolute) during the offline stage
References Feel::CRBDB::vm().
void Feel::CRB< TruthModelType >::printErrorsDuringRbConstruction | ( | void | ) |
print max errors (total error and also primal and dual contributions) during offline stage
void Feel::CRB< TruthModelType >::printMuSelection | ( | void | ) |
print parameters set mu selected during the offline stage
void Feel::CRB< TruthModelType >::projectionOnPodSpace | ( | const element_ptrtype & | u, |
element_ptrtype & | projection, | ||
const std::string & | name_of_space = "primal" |
||
) |
do the projection on the POD space of u (for transient problems)
u | : the solution to project (input parameter) |
projection | : the projection (output parameter) |
name_of_space | : primal or dual |
Referenced by Feel::CRB< TruthModelType >::offline().
sampling_type Feel::CRB< TruthModelType >::randomSampling | ( | int | N | ) | [inline] |
if true, rebuild the database (if already exist)
References Feel::CRBDB::vm().
Referenced by Feel::CRB< TruthModelType >::loadDB().
boost::tuple< double, double, double, double > Feel::CRB< TruthModelType >::run | ( | parameter_type const & | mu, |
double | eps = 1e-6 |
||
) |
run the certified reduced basis with P parameters and returns 1 output
References Feel::CRB< TruthModelType >::delta(), Feel::CRB< TruthModelType >::lb(), and Feel::CRBDB::vm().
Referenced by Feel::CRB< TruthModelType >::run().
void Feel::CRB< TruthModelType >::run | ( | const double * | X, |
unsigned long | N, | ||
double * | Y, | ||
unsigned long | P | ||
) |
run the certified reduced basis with P parameters and returns 1 output
References Feel::CRB< TruthModelType >::run().
save the CRB database
Reimplemented from Feel::CRBDB.
References Feel::CRBDB::dbFilename(), and Feel::CRBDB::dbLocalPath().
Referenced by Feel::CRB< TruthModelType >::offline().
bool Feel::CRB< TruthModelType >::showMuSelection | ( | ) |
if true, show the mu selected during the offline stage
References Feel::CRBDB::vm().
sampling_ptrtype Feel::CRB< TruthModelType >::trainSampling | ( | ) | const [inline] |
CRB< TruthModelType >::residual_error_type Feel::CRB< TruthModelType >::transientPrimalResidual | ( | int | Ncur, |
parameter_type const & | mu, | ||
vectorN_type const & | Un, | ||
vectorN_type const & | Unold = vectorN_type() , |
||
double | time_step = 1 , |
||
double | time = 1e30 |
||
) | const |
evaluate online the residual
Referenced by Feel::CRB< TruthModelType >::delta().
value_type Feel::CRB< TruthModelType >::ub | ( | size_type | N, |
parameter_type const & | mu, | ||
std::vector< vectorN_type > & | uN, | ||
std::vector< vectorN_type > & | uNdu | ||
) | const [inline] |
Returns the upper bound of the output associed to
mu | ![]() |
N | the dimension of ![]() |
uN | primal solution |
uNdu | dual solution |
References Feel::CRB< TruthModelType >::delta(), and Feel::CRB< TruthModelType >::lb().
Referenced by Feel::CRB< TruthModelType >::ub().
value_type Feel::CRB< TruthModelType >::ub | ( | size_type | K, |
parameter_ptrtype const & | mu, | ||
std::vector< vectorN_type > & | uN, | ||
std::vector< vectorN_type > & | uNdu | ||
) | const [inline] |
Returns the upper bound of the output associed to
mu | ![]() |
N | the dimension of ![]() |
References Feel::CRB< TruthModelType >::ub().