Feel++  0.92.0
Protected Attributes
Feel::CRBModel< ModelType > Class Template Reference

Certified Reduced Basis Model class. More...

#include <crbmodel.hpp>

List of all members.

Public Types

Typedefs
typedef ModelType model_type
 model type
typedef boost::shared_ptr
< ModelType > 
model_ptrtype
typedef model_type::value_type value_type
 value_type
typedef ModelType::mesh_type mesh_type
 mesh type
typedef ModelType::mesh_ptrtype mesh_ptrtype
 mesh shared_ptr
typedef ModelType::space_type space_type
 space_type
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::vector_type vector_type
typedef
model_type::eigen_matrix_type 
eigen_matrix_type
typedef
model_type::parameterspace_type 
parameterspace_type
typedef
model_type::parameterspace_ptrtype 
parameterspace_ptrtype
typedef model_type::parameter_type parameter_type
typedef
model_type::parameter_ptrtype 
parameter_ptrtype
typedef model_type::sampling_type sampling_type
typedef
model_type::sampling_ptrtype 
sampling_ptrtype
typedef Eigen::VectorXd theta_vector_type
typedef boost::tuple
< sparse_matrix_ptrtype,
sparse_matrix_ptrtype,
std::vector< vector_ptrtype > > 
offline_merge_type
typedef boost::tuple
< std::vector
< sparse_matrix_ptrtype >
, std::vector
< sparse_matrix_ptrtype >
, std::vector< std::vector
< vector_ptrtype > > > 
affine_decomposition_type
typedef boost::tuple
< theta_vector_type,
theta_vector_type, std::vector
< theta_vector_type > > 
thetaq_type

Public Member Functions

Constructors, destructor
 CRBModel ()
 CRBModel (po::variables_map const &vm, CRBModelMode mode=CRBModelMode::PFEM)
 CRBModel (model_ptrtype &model)
 CRBModel (CRBModel const &o)
virtual ~CRBModel ()
 destructor
FEELPP_DONT_INLINE void init ()
 initialize the model (mesh, function space, operators, matrices, ...)
Operator overloads
CRBModeloperator= (CRBModel const &o)
 copy operator
Accessors
po::variables_map vm () const
virtual sparse_matrix_ptrtype newMatrix () const
sparse_matrix_ptrtype const & innerProduct () const
 Returns the matrix associated with the $H_1$ inner product.
sparse_matrix_ptrtype const & h1 () const
 Returns the matrix associated with the $H_1$ inner product.
functionspace_ptrtype functionSpace () const
 Returns the function space.
size_type Qa () const
 return the number of $\mu$ independent terms for the bilinear form
size_type Qm () const
 return the number of $\mu$ independent terms for the bilinear form ( time dependent )
size_type Qm (mpl::bool_< true >) const
size_type Qm (mpl::bool_< false >) const
size_type Nl () const
 return the number of outputs
size_type Ql (int l) const
 return the number of $\mu$ independent terms for the right hand side
parameterspace_ptrtype parameterSpace () const
 return the parameter space
Mutators
void setMeshSize (double s)
Methods
thetaq_type computeThetaq (parameter_type const &mu, double time=0)
 compute the thetaq given mu
thetaq_type computeThetaq (parameter_type const &mu, mpl::bool_< true >, double time=0)
thetaq_type computeThetaq (parameter_type const &mu, mpl::bool_< false >, double time=0)
offline_merge_type update (parameter_type const &mu, double time=0)
 update the model wrt mu
affine_decomposition_type computeAffineDecomposition ()
 Compute the affine decomposition of the various forms.
affine_decomposition_type computeAffineDecomposition (mpl::bool_< true >)
affine_decomposition_type computeAffineDecomposition (mpl::bool_< false >)
value_type h1 (element_type const &xi_i, element_type const &xi_j)
 the inner product $h1(\xi_i, \xi_j) = \xi_j^T H_1 \xi_i$
value_type h1 (element_type const &xi_i)
 the inner product $h1(\xi_i, \xi_j) = \xi_j^T H_1 \xi_i$
sparse_matrix_ptrtype Aq (uint16_type q, bool transpose=false) const
 Returns the matrix Aq[q] of the affine decomposition of the bilinear form.
sparse_matrix_ptrtype Mq (uint16_type q, bool transpose=false) const
 Returns the matrix Mq[q] of the affine decomposition of the bilinear form (time dependent)
value_type Aq (uint16_type q, element_type const &xi_i, element_type const &xi_j, bool transpose=false)
 the inner product $a_q(\xi_i, \xi_j) = \xi_j^T A_q \xi_i$
value_type Mq (uint16_type q, element_type const &xi_i, element_type const &xi_j, bool transpose=false)
 the inner product $m_q(\xi_i, \xi_j) = \xi_j^T M_q \xi_i$
theta_vector_type const & thetaAq () const
 Returns the vector coefficients.
theta_vector_type const & thetaMq () const
 Returns the vector coefficients.
theta_vector_type const & thetaMq (mpl::bool_< true >) const
theta_vector_type const & thetaMq (mpl::bool_< false >) const
value_type thetaAq (int q) const
 Returns the value of the $A_q$ coefficient at $\mu$.
value_type thetaMq (int q) const
 Returns the value of the $M_q$ coefficient at $\mu$.
value_type thetaMq (int q, mpl::bool_< true >) const
value_type thetaMq (int q, mpl::bool_< false >) const
std::vector< theta_vector_type >
const & 
thetaL () const
 Returns the vector coefficients.
value_type thetaL (int l, int q) const
 Returns the value of the $L_q$ coefficient at $\mu$.
vector_ptrtype Fq (uint16_type l, uint16_type q) const
 the vector Fq[q] of the affine decomposition of the right hand side
value_type Fq (uint16_type l, uint16_type q, element_type const &xi)
 the inner product $f_q(\xi) = \xi^T F_q $
value_type Fq (uint16_type l, uint16_type q, element_ptrtype const &xi)
 the inner product $f_q(\xi) = \xi^T F_q $
double scalarProduct (vector_type const &X, vector_type const &Y)
double scalarProduct (vector_ptrtype const &X, vector_ptrtype const &Y)
double scalarProductForPod (vector_type const &X, vector_type const &Y)
double scalarProductForPod (vector_type const &X, vector_type const &Y, mpl::bool_< true >)
double scalarProductForPod (vector_type const &X, vector_type const &Y, mpl::bool_< false >)
double scalarProductForPod (vector_ptrtype const &X, vector_ptrtype const &Y)
double scalarProductForPod (vector_ptrtype const &X, vector_ptrtype const &Y, mpl::bool_< true >)
double scalarProductForPod (vector_ptrtype const &X, vector_ptrtype const &Y, mpl::bool_< false >)
void solve (parameter_type const &mu)
void solve (parameter_type const &mu, element_ptrtype &u)
void solve (parameter_type const &mu, element_ptrtype &u, vector_ptrtype const &L, bool transpose=false)
void l2solve (vector_ptrtype &u, vector_ptrtype const &f)
boost::tuple< int, value_typesolve (sparse_matrix_ptrtype const &A, vector_ptrtype &x, vector_ptrtype const &f, bool tranpose=false)
 solve $A x = f$
void run (const double *X, unsigned long N, double *Y, unsigned long P)
 export a vector of elements
std::map< double, boost::tuple
< double, double, double, int,
double, double > > 
run ()
std::map< double, boost::tuple
< double, double, double, int,
double, double > > 
run (mpl::bool_< true >)
std::map< double, boost::tuple
< double, double, double, int,
double, double > > 
run (mpl::bool_< false >)
std::map< double, boost::tuple
< double, double, double, int,
double, double > > 
runq ()
value_type output (int output_index, parameter_type const &mu)
int computeNumberOfSnapshots ()
int computeNumberOfSnapshots (mpl::bool_< true >)
int computeNumberOfSnapshots (mpl::bool_< false >)
double timeStep ()
double timeStep (mpl::bool_< true >)
double timeStep (mpl::bool_< false >)
double timeInitial ()
double timeInitial (mpl::bool_< true >)
double timeInitial (mpl::bool_< false >)
double timeFinal ()
double timeFinal (mpl::bool_< true >)
double timeFinal (mpl::bool_< false >)
int timeOrder ()
int timeOrder (mpl::bool_< true >)
int timeOrder (mpl::bool_< false >)
bool isSteady ()
bool isSteady (mpl::bool_< true >)
bool isSteady (mpl::bool_< false >)
void initializationField (element_ptrtype &initial_field, parameter_type const &mu)
void initializationField (element_ptrtype &initial_field, parameter_type const &mu, mpl::bool_< true >)
void initializationField (element_ptrtype &initial_field, parameter_type const &mu, mpl::bool_< false >)

Static Public Attributes

Constants
static const uint16_type ParameterSpaceDimension = ModelType::ParameterSpaceDimension
static const bool is_time_dependent = ModelType::is_time_dependent

Protected Attributes

std::vector
< sparse_matrix_ptrtype > 
M_Aq
 affine decomposition terms for the left hand side
std::vector
< sparse_matrix_ptrtype > 
M_Mq
 affine decomposition terms ( time dependent )
std::vector< std::vector
< vector_ptrtype > > 
M_Fq
 affine decomposition terms for the right hand side

Detailed Description

template<typename ModelType>
class Feel::CRBModel< ModelType >

Certified Reduced Basis Model class.

This class implements the requirements over a model to be usable by the certified reduced basis method.

Template Parameters:
ModelTypethe type of the finite element method model

The FEM model type should derive from this class and fill the vector of matrices M_Aq and vector of vectors M_Fq

Author:
Christophe Prud'homme
See also:
crb

Constructor & Destructor Documentation

template<typename ModelType>
Feel::CRBModel< ModelType >::CRBModel ( model_ptrtype &  model) [inline]
Parameters:
modelthe model to be used

References Feel::CRBModel< ModelType >::init().

template<typename ModelType>
Feel::CRBModel< ModelType >::CRBModel ( CRBModel< ModelType > const &  o) [inline]

copy constructor

References Feel::CRBModel< ModelType >::init().


Member Function Documentation

template<typename ModelType>
sparse_matrix_ptrtype Feel::CRBModel< ModelType >::Aq ( uint16_type  q,
bool  transpose = false 
) const [inline]

Returns the matrix Aq[q] of the affine decomposition of the bilinear form.

Parameters:
qthe index of the component in the affine decomposition
transposetranspose A_q
Returns:
the matrix Aq[q] of the affine decomposition of the bilinear form

References Feel::CRBModel< ModelType >::M_Aq.

template<typename ModelType>
value_type Feel::CRBModel< ModelType >::Aq ( uint16_type  q,
element_type const &  xi_i,
element_type const &  xi_j,
bool  transpose = false 
) [inline]

the inner product $a_q(\xi_i, \xi_j) = \xi_j^T A_q \xi_i$

Parameters:
qthe index of the component in the affine decomposition
xi_ian element of the function space
xi_jan element of the function space
transposetranspose A_q
Returns:
the inner product $a_q(\xi_i, \xi_j) = \xi_j^T A_q \xi_i$

References Feel::CRBModel< ModelType >::M_Aq.

template<typename ModelType>
affine_decomposition_type Feel::CRBModel< ModelType >::computeAffineDecomposition ( ) [inline]

Compute the affine decomposition of the various forms.

This function defined in the M_model assembles the parameter independant part of the affine decomposition of the bilinear and linear forms.

template<typename ModelType>
vector_ptrtype Feel::CRBModel< ModelType >::Fq ( uint16_type  l,
uint16_type  q 
) const [inline]

the vector Fq[q] of the affine decomposition of the right hand side

Returns:
the vector associated with $F_q$

References Feel::CRBModel< ModelType >::M_Fq.

template<typename ModelType>
value_type Feel::CRBModel< ModelType >::Fq ( uint16_type  l,
uint16_type  q,
element_type const &  xi 
) [inline]

the inner product $f_q(\xi) = \xi^T F_q $

Denote $F_q$ the algebraic representation of the linear form associated with the right hand side.

Parameters:
qthe index of the component in the affine decomposition
xian element of the function space
Returns:
the inner product $f_q(\xi) = \xi^T F_q $

References Feel::inner_product(), and Feel::CRBModel< ModelType >::M_Fq.

template<typename ModelType>
value_type Feel::CRBModel< ModelType >::Fq ( uint16_type  l,
uint16_type  q,
element_ptrtype const &  xi 
) [inline]

the inner product $f_q(\xi) = \xi^T F_q $

Denote $F_q$ the algebraic representation of the linear form associated with the right hand side.

Parameters:
qthe index of the component in the affine decomposition
xian element of the function space
Returns:
the inner product $f_q(\xi) = \xi^T F_q $

References Feel::inner_product(), and Feel::CRBModel< ModelType >::M_Fq.

template<typename ModelType>
value_type Feel::CRBModel< ModelType >::h1 ( element_type const &  xi_i,
element_type const &  xi_j 
) [inline]

the inner product $h1(\xi_i, \xi_j) = \xi_j^T H_1 \xi_i$

Parameters:
xi_ian element of the function space
xi_jan element of the function space
transposetranspose A_q
Returns:
the inner product $h1(\xi_i, \xi_j) = \xi_j^T H_1 \xi_i$
template<typename ModelType>
value_type Feel::CRBModel< ModelType >::h1 ( element_type const &  xi_i) [inline]

the inner product $h1(\xi_i, \xi_j) = \xi_j^T H_1 \xi_i$

Parameters:
xi_ian element of the function space
xi_jan element of the function space
transposetranspose A_q
Returns:
the inner product $h1(\xi_i, \xi_j) = \xi_j^T H_1 \xi_i$
template<typename ModelType>
void Feel::CRBModel< ModelType >::l2solve ( vector_ptrtype &  u,
vector_ptrtype const &  f 
) [inline]

solve $M u = f$ where $ M $ is the matrix associated to the $ L_2 $ norm

template<typename ModelType>
sparse_matrix_ptrtype Feel::CRBModel< ModelType >::Mq ( uint16_type  q,
bool  transpose = false 
) const [inline]

Returns the matrix Mq[q] of the affine decomposition of the bilinear form (time dependent)

Parameters:
qthe index of the component in the affine decomposition
transposetranspose M_q
Returns:
the matrix Mq[q] of the affine decomposition of the bilinear form (ime dependent)

References Feel::CRBModel< ModelType >::M_Mq.

template<typename ModelType>
value_type Feel::CRBModel< ModelType >::Mq ( uint16_type  q,
element_type const &  xi_i,
element_type const &  xi_j,
bool  transpose = false 
) [inline]

the inner product $m_q(\xi_i, \xi_j) = \xi_j^T M_q \xi_i$

Parameters:
qthe index of the component in the affine decomposition
xi_ian element of the function space
xi_jan element of the function space
transposetranspose M_q
Returns:
the inner product $m_q(\xi_i, \xi_j) = \xi_j^T M_q \xi_i$

References Feel::CRBModel< ModelType >::M_Mq.

template<typename ModelType>
virtual sparse_matrix_ptrtype Feel::CRBModel< ModelType >::newMatrix ( ) const [inline, virtual]

create a new matrix

Returns:
the newly created matrix
template<typename ModelType>
value_type Feel::CRBModel< ModelType >::output ( int  output_index,
parameter_type const &  mu 
) [inline]

Given the output index output_index and the parameter mu, return the value of the corresponding FEM output

template<typename TruthModelType >
void Feel::CRBModel< TruthModelType >::run ( const double *  X,
unsigned long  N,
double *  Y,
unsigned long  P 
)

export a vector of elements

Parameters:
va vector of shared_ptr<> elements of the functions space run the model

References Feel::CRBModel< ModelType >::run().

Referenced by Feel::CRBModel< ModelType >::run().

template<typename ModelType>
double Feel::CRBModel< ModelType >::scalarProduct ( vector_type const &  X,
vector_type const &  Y 
) [inline]

returns the scalar product of the vector x and vector y

template<typename ModelType>
double Feel::CRBModel< ModelType >::scalarProduct ( vector_ptrtype const &  X,
vector_ptrtype const &  Y 
) [inline]

returns the scalar product of the vector x and vector y

template<typename ModelType>
double Feel::CRBModel< ModelType >::scalarProductForPod ( vector_type const &  X,
vector_type const &  Y 
) [inline]

returns the scalar product used to assemble POD matrix of the vector x and vector y

Referenced by Feel::CRBModel< ModelType >::scalarProductForPod().

template<typename ModelType>
double Feel::CRBModel< ModelType >::scalarProductForPod ( vector_ptrtype const &  X,
vector_ptrtype const &  Y 
) [inline]

returns the scalar product used to assemble POD matrix of the vector x and vector y

References Feel::CRBModel< ModelType >::scalarProductForPod().

template<typename ModelType>
void Feel::CRBModel< ModelType >::setMeshSize ( double  s) [inline]

set the mesh characteristic length to s

template<typename ModelType>
void Feel::CRBModel< ModelType >::solve ( parameter_type const &  mu) [inline]

solve the model for a given parameter mu

template<typename ModelType>
void Feel::CRBModel< ModelType >::solve ( parameter_type const &  mu,
element_ptrtype &  u 
) [inline]

solve the model for a given parameter mu

template<typename ModelType>
void Feel::CRBModel< ModelType >::solve ( parameter_type const &  mu,
element_ptrtype &  u,
vector_ptrtype const &  L,
bool  transpose = false 
) [inline]

solve the model for a given parameter mu and L as right hand side

Parameters:
transposeif true solve the transposed(dual) problem
template<typename ModelType>
boost::tuple<int, value_type> Feel::CRBModel< ModelType >::solve ( sparse_matrix_ptrtype const &  A,
vector_ptrtype &  x,
vector_ptrtype const &  f,
bool  tranpose = false 
) [inline]

solve $A x = f$

Note:
if tranpose is true then solve for $A^T x = f$.
Parameters:
Amatrix
xsolution vector
fright hand side vector
transposeif is true solve for $A^T x = f$, otherwise solve $A x = f$.
Returns:
a tuple with the number of iterations used and the residual
template<typename ModelType>
po::variables_map Feel::CRBModel< ModelType >::vm ( ) const [inline]
Returns:
the variables_map