LifeV
|
FESpace - Short description here please! More...
#include <FESpace.hpp>
Protected Types | |
enum | spaceData { P0 = 1, P1 = 10, P1_HIGH = 15, P1Bubble = 16, P2 = 20, P2_HIGH = 25, P2Bubble = 26 } |
Set space Map (useful for switch syntax with strings) More... | |
Protected Attributes | |
std::map< std::string, spaceData > | M_spaceMap |
meshPtr_Type | M_mesh |
reference to the mesh More... | |
const ReferenceFE * | M_refFE |
Reference FE for the velocity. More... | |
const QuadratureRule * | M_Qr |
Quadrature rule for volumic elementary computations. More... | |
const QuadratureRule * | M_bdQr |
Quadrature rule for surface elementary computations. More... | |
UInt | M_fieldDim |
dimension of the field variable ( scalar/vector field) More... | |
std::shared_ptr< DOF > | M_dof |
A shared pointer to the DOF object. More... | |
UInt | M_dim |
The number of total dofs. More... | |
std::shared_ptr< CurrentFE > | M_fe |
Current FE. More... | |
std::shared_ptr< CurrentFEManifold > | M_feBd |
mapPtr_Type | M_map |
Map. More... | |
Public Types | |
typedef std::function< Real(Real const &, Real const &, Real const &, Real const &, ID const &) > | function_Type |
typedef MeshType | mesh_Type |
typedef std::shared_ptr< mesh_Type > | meshPtr_Type |
typedef MapType | map_Type |
typedef std::shared_ptr< map_Type > | mapPtr_Type |
typedef map_Type::commPtr_Type | commPtr_Type |
Constructor & Destructor | |
LIFEV_DEPRECATED (FESpace(MeshPartitioner< MeshType > &mesh, const ReferenceFE &refFE, const QuadratureRule &Qr, const QuadratureRule &bdQr, const Int fDim, const commPtr_Type &commptr)) | |
LIFEV_DEPRECATED (FESpace(MeshPartitioner< MeshType > &mesh, const std::string &space, const Int fDim, const commPtr_Type &commptr)) | |
FESpace (meshPtr_Type mesh, const ReferenceFE &refFE, const QuadratureRule &Qr, const QuadratureRule &bdQr, const Int fDim, const commPtr_Type &commptr) | |
FESpace (meshPtr_Type mesh, const std::string &space, const Int fDim, const commPtr_Type &commptr) | |
virtual | ~FESpace () |
Do nothing destructor. More... | |
Methods | |
template<typename vector_type > | |
void | interpolate (const function_Type &fct, vector_type &vect, const Real time=0.) |
Interpolate a given function nodally onto a vector. More... | |
template<typename vector_type > | |
void | interpolateBC (BCHandler &BCh, vector_type &vect, const Real time) |
template<typename ReturnType , typename vector_type > | |
void | interpolate (const FEFunction< MeshType, MapType, ReturnType > *fEFunction, vector_type &vector, const Real time=0.) |
Interpolation method for FEFunctions. More... | |
template<typename vector_type > | |
void | l2ScalarProduct (const function_Type &fct, vector_type &vec, const Real t) |
calculate L2 velocity error for given exact velocity function More... | |
template<typename vector_type > | |
Real | l20Error (const function_Type &fexact, const vector_type &vec, const Real time, Real *relError=0) |
template<typename vector_type > | |
Real | l2Error (const function_Type &fexact, const vector_type &vec, const Real time, Real *relError=0) |
template<typename function , typename vector_type > | |
Real | h1Error (const function &fexact, const vector_type &vec, const Real time, Real *relError=0) |
template<typename vector_type > | |
Real | l2Norm (const vector_type &vec) |
template<typename function > | |
Real | l2NormFunction (const function &f, const Real time=0) |
template<typename vector_type > | |
Real | h1Norm (const vector_type &vec) |
template<typename vector_type > | |
Real | l2ErrorWeighted (const function_Type &exactSolution, const vector_type &solution, const function_Type &weight, const Real time) |
Method to computes the L2 error when using a weight function. More... | |
template<typename point_type , typename vector_type > | |
Real | feInterpolateValue (const ID &elementID, const vector_type &solutionVector, const point_type &pt, const UInt &component=0) const |
This method computes the interpolate value of a given FE function in a given point. More... | |
template<typename point_type , typename vector_type > | |
Real | feInterpolateValueLocal (const ID &elementID, const vector_type &solutionVector, const point_type &pt) const |
This method computes the interpolate value of a given FE function in a given point. More... | |
template<typename point_type , typename vector_type > | |
Real | feInterpolateGradient (const ID &elementID, const vector_type &solutionVector, const point_type &pt, const UInt &gradientElement, const UInt &component=0) const |
This method computes the interpolated gradient of a given FE function in a given point. More... | |
template<typename point_type , typename vector_type > | |
Real | feInterpolateGradientLocal (const ID &elementID, const vector_type &solutionVector, const point_type &pt, const UInt &gradientElement) const |
This method computes the interpolated gradient of a given FE function in a given point. More... | |
template<typename vector_type > | |
vector_type | feToFEInterpolate (const FESpace< mesh_Type, map_Type > &originalSpace, const vector_type &originalVector, const MapEpetraType &outputMapType=Unique) const |
This method enables to pass a solution from one FESpace to the present one. More... | |
template<typename vector_type > | |
vector_type | gradientRecovery (const vector_type &solution, const UInt &component) const |
This method reconstruct a gradient of a solution in the present FE space. More... | |
template<typename vector_type > | |
vector_type | recoveryFunction (const vector_type &solution) const |
This method reconstruct a gradient of a solution in the present FE space. More... | |
template<typename vector_type > | |
vector_type | laplacianRecovery (const vector_type &solution) const |
Reconstruction of the laplacian using gradientRecovery procedures. More... | |
UInt | polynomialDegree () const |
Return the polynomial degree of the finite element used. More... | |
Set Methods | |
void | setQuadRule (const QuadratureRule &Qr) |
Method to set replace the quadrule. More... | |
void | setBdQuadRule (const QuadratureRule &bdQr) |
Get Methods | |
const meshPtr_Type & | mesh () const |
meshPtr_Type & | mesh () |
const map_Type & | map () const |
Returns map. More... | |
map_Type & | map () |
const mapPtr_Type & | mapPtr () const |
const DOF & | dof () const |
Returns the velocity dof. More... | |
DOF & | dof () |
const std::shared_ptr< DOF > & | dofPtr () const |
const CurrentFE & | fe () const |
Returns the current FE. More... | |
CurrentFE & | fe () |
CurrentFEManifold & | feBd () |
Returns the current boundary FE. More... | |
const ReferenceFE & | refFE () const |
Returns the res FE. More... | |
const QuadratureRule & | qr () const |
Returns the volumic quadratic rule. More... | |
const QuadratureRule & | bdQr () const |
Returns the surfasic quadratic rule. More... | |
const UInt & | dim () const |
Returns FE space dimension. More... | |
const UInt & | fieldDim () const |
Private Methods | |
FESpace (const FESpace &fespace) | |
copy constructor More... | |
void | createMap (const commPtr_Type &commptr) |
Creates the map for interprocessor communication. More... | |
void | resetBoundaryFE () |
Resets boundary data if necessary. More... | |
void | setSpace (const std::string &space, UInt dimension) |
Set space. More... | |
template<typename vector_type > | |
vector_type | interpolateGeneric (const FESpace< mesh_Type, map_Type > &OriginalSpace, const vector_type &OriginalVector) const |
This is a generic function called by feToFEInterpolate method. More... | |
template<typename vector_type > | |
vector_type | linearInterpolate (const FESpace< mesh_Type, map_Type > &originalSpace, const vector_type &originalVector) const |
This is a specialized function called by feToFEInterpolate method. More... | |
template<typename vector_type > | |
vector_type | P2Interpolate (const FESpace< mesh_Type, map_Type > &original_space, const vector_type &original_vector) const |
This is a specialized function called by feToFEInterpolate method. More... | |
template<typename vector_type > | |
vector_type | RT0ToP0Interpolate (const FESpace< mesh_Type, map_Type > &original_space, const vector_type &original_vector) const |
This is a specialized function called by FESpace::feToFEInterpolate method for RT0 to P0 interpolation. More... | |
FESpace - Short description here please!
Class representing the FE space, i.e. the reference FE and the geometric mapping.
Definition at line 78 of file FESpace.hpp.
typedef std::function< Real ( Real const&, Real const&, Real const&, Real const&, ID const& ) > function_Type |
Definition at line 87 of file FESpace.hpp.
Definition at line 88 of file FESpace.hpp.
typedef std::shared_ptr<mesh_Type> meshPtr_Type |
Definition at line 89 of file FESpace.hpp.
typedef MapType map_Type |
Definition at line 90 of file FESpace.hpp.
typedef std::shared_ptr<map_Type> mapPtr_Type |
Definition at line 91 of file FESpace.hpp.
typedef map_Type::commPtr_Type commPtr_Type |
Definition at line 92 of file FESpace.hpp.
|
protected |
Set space Map (useful for switch syntax with strings)
Enumerator | |
---|---|
P0 | |
P1 | |
P1_HIGH | |
P1Bubble | |
P2 | |
P2_HIGH | |
P2Bubble |
Definition at line 559 of file FESpace.hpp.
FESpace | ( | meshPtr_Type | mesh, |
const ReferenceFE & | refFE, | ||
const QuadratureRule & | Qr, | ||
const QuadratureRule & | bdQr, | ||
const Int | fDim, | ||
const commPtr_Type & | commptr | ||
) |
Definition at line 656 of file FESpace.hpp.
FESpace | ( | meshPtr_Type | mesh, |
const std::string & | space, | ||
const Int | fDim, | ||
const commPtr_Type & | commptr | ||
) |
Definition at line 680 of file FESpace.hpp.
|
inlinevirtual |
Do nothing destructor.
Definition at line 141 of file FESpace.hpp.
LIFEV_DEPRECATED | ( | FESpace< MeshType, MapType >(MeshPartitioner< MeshType > &mesh, const ReferenceFE &refFE, const QuadratureRule &Qr, const QuadratureRule &bdQr, const Int fDim, const commPtr_Type &commptr) | ) |
data_file | GetPot data file |
refFE_u | reference FE for the velocity |
refFE_p | reference FE for the pressure |
Qr_u | element quadrature rule for the velocity |
bdQr_u | surface quadrature rule for the velocity |
Qr_p | element quadrature rule for the pressure |
bdQr_p | surface quadrature rule for the pressure |
BCh_fluid | boundary conditions for the fluid |
ord_bdf | order of the bdf time advancing scheme and incremental pressure approach (default: Backward Euler) |
LIFEV_DEPRECATED | ( | FESpace< MeshType, MapType >(MeshPartitioner< MeshType > &mesh, const std::string &space, const Int fDim, const commPtr_Type &commptr) | ) |
void interpolate | ( | const function_Type & | fct, |
vector_type & | vect, | ||
const Real | time = 0. |
||
) |
Interpolate a given function nodally onto a vector.
Definition at line 720 of file FESpace.hpp.
void interpolateBC | ( | BCHandler & | BCh, |
vector_type & | vect, | ||
const Real | time | ||
) |
Definition at line 838 of file FESpace.hpp.
void interpolate | ( | const FEFunction< MeshType, MapType, ReturnType > * | fEFunction, |
vector_type & | vector, | ||
const Real | time = 0. |
||
) |
Interpolation method for FEFunctions.
fEFunction | Pointer to an FEFunction |
vector | Interpolated function |
time | Time in the interpolation |
Definition at line 777 of file FESpace.hpp.
void l2ScalarProduct | ( | const function_Type & | fct, |
vector_type & | vec, | ||
const Real | t | ||
) |
calculate L2 velocity error for given exact velocity function
pexact | the exact velocity as a function |
time | the time |
relError | Real* to store the relative error in |
Definition at line 891 of file FESpace.hpp.
Real l20Error | ( | const function_Type & | fexact, |
const vector_type & | vec, | ||
const Real | time, | ||
Real * | relError = 0 |
||
) |
Definition at line 932 of file FESpace.hpp.
Real l2Error | ( | const function_Type & | fexact, |
const vector_type & | vec, | ||
const Real | time, | ||
Real * | relError = 0 |
||
) |
Definition at line 986 of file FESpace.hpp.
Real h1Error | ( | const function & | fexact, |
const vector_type & | vec, | ||
const Real | time, | ||
Real * | relError = 0 |
||
) |
Definition at line 1130 of file FESpace.hpp.
Real l2Norm | ( | const vector_type & | vec | ) |
Definition at line 1185 of file FESpace.hpp.
Definition at line 1039 of file FESpace.hpp.
Real h1Norm | ( | const vector_type & | vec | ) |
Definition at line 1215 of file FESpace.hpp.
Real l2ErrorWeighted | ( | const function_Type & | exactSolution, |
const vector_type & | solution, | ||
const function_Type & | weight, | ||
const Real | time | ||
) |
Method to computes the L2 error when using a weight function.
The scope of this method is to compute . The usual L2 error norm can be retrieved by using
Definition at line 1067 of file FESpace.hpp.
Real feInterpolateValue | ( | const ID & | elementID, |
const vector_type & | solutionVector, | ||
const point_type & | pt, | ||
const UInt & | component = 0 |
||
) | const |
This method computes the interpolate value of a given FE function in a given point.
The user of this function has to provide the element and the vector of the DOF values. Given these informations and a point P, the function compute the value: value = sum_{dof i} v(i) phi_i(P)
Note that the point P can be outside of the element considered (this is NOT checked).
Warning: this method has been only checked in 3D.
elementID | The ID of the element considered. The ID is the local ID (not the global one, see in the MeshEntity class). |
solutionVector | The vector containing the values in all nodes (not only of the considered element). |
pt | The point where to perform the interpolation. Note that pt must allow for STL-type accessor [] and must have the size() method (typically a std::vector<Real>). |
component | The component for which the interpolation has to be performed (usefull only for the vectorial FE, set to 0 if the FE is scalar). |
Definition at line 1248 of file FESpace.hpp.
Real feInterpolateValueLocal | ( | const ID & | elementID, |
const vector_type & | solutionVector, | ||
const point_type & | pt | ||
) | const |
This method computes the interpolate value of a given FE function in a given point.
This method is the same as feInterpolateValue, but for the definition of the solution vector. Here, the solution is given only for the degrees of freedom of the given element. The parameter solutionVector is typically a std::vector<Real> containing the values in the dofs.
It is not possible to specify the component, the user has to provide directly the values for the wanted component in the solutionVector.
Definition at line 1311 of file FESpace.hpp.
Real feInterpolateGradient | ( | const ID & | elementID, |
const vector_type & | solutionVector, | ||
const point_type & | pt, | ||
const UInt & | gradientElement, | ||
const UInt & | component = 0 |
||
) | const |
This method computes the interpolated gradient of a given FE function in a given point.
This method is the same as feInterpolateValue, but it computes the gradient insted of the value. Therefor, the desired element of the gradient has to be expressed using the parameter gradientElement.
For example, if gradientElement=i and component=j, then the results corresponds to the value of partial u_j / partial x_i.
Warning: This method has not been tested deeply, buggy behaviour is possible.
Definition at line 1361 of file FESpace.hpp.
Real feInterpolateGradientLocal | ( | const ID & | elementID, |
const vector_type & | solutionVector, | ||
const point_type & | pt, | ||
const UInt & | gradientElement | ||
) | const |
This method computes the interpolated gradient of a given FE function in a given point.
This method is the same as feInterpolateGradient, but it works with local values only, just as feInterpolateValueLocal.
Warning: This method has not been tested deeply, buggy behaviour is possible.
Definition at line 1431 of file FESpace.hpp.
vector_type feToFEInterpolate | ( | const FESpace< mesh_Type, map_Type > & | originalSpace, |
const vector_type & | originalVector, | ||
const MapEpetraType & | outputMapType = Unique |
||
) | const |
This method enables to pass a solution from one FESpace to the present one.
This method interpolates the values of a FE solution (given by the vector and the FESpace) in the dofs of the present FESpace: we note the component of the vector given in argument and the basis functions of the FESpace given in argument. This defines a function on the domain given by: .
We search then the function belonging to the present FESpace such that for all dofs of the present FESpace. This function returns the vector such that where are the basis functions of the present space.
Warning: It is NOT true in general that (it is for lagrangian FEs). For example, if we want to pass the solution from the P_1 to the P_1 with bubbles, then the value associated to the bubble function will be always 0 even if the value of f is not 0 at the location of the dof of the bubble!
originalSpace | The space where the solution is defined originally. |
originalVector | The vector of the solution in the original space. |
outputMapType | The map type (default: Unique) of the the returned vector. |
Definition at line 1485 of file FESpace.hpp.
vector_type gradientRecovery | ( | const vector_type & | solution, |
const UInt & | component | ||
) | const |
This method reconstruct a gradient of a solution in the present FE space.
The goal of this method is to build an approximation of the gradient of a given FE function in this FESpace. Typically, when one use P1 elements for approximating the solution of a given problem, the gradient is only piecewise constant. However, one could need continuous gradient. The solutions to this problem is either to use specific finite elements (like Hermite FE) or rely on a recovery procedure for the gradient.
This method implements a recovery procedure that performs a local average with weights corresponding to the areas of the elements:
See Zienkiewicz and Zhu (1987) for more details.
Results might be very wrong if you are not using lagrangian FE for tetrahedra
Definition at line 1572 of file FESpace.hpp.
vector_type recoveryFunction | ( | const vector_type & | solution | ) | const |
This method reconstruct a gradient of a solution in the present FE space.
The goal of this method is to build an approximation of the gradient of a given FE function in this FESpace. Typically, when one use P1 elements for approximating the solution of a given problem, the gradient is only piecewise constant. However, one could need continuous gradient. The solutions to this problem is either to use specific finite elements (like Hermite FE) or rely on a recovery procedure for the gradient.
This method implements a recovery procedure that performs a local average with weights corresponding to the areas of the elements:
See Zienkiewicz and Zhu (1987) for more details.
Results might be very wrong if you are not using lagrangian FE for tetrahedra
vector_type laplacianRecovery | ( | const vector_type & | solution | ) | const |
Reconstruction of the laplacian using gradientRecovery procedures.
This method simply uses the FESpace::gradientRecovery method several times so that one can get a continuous approximation of the laplacian of the given solution.
Results might be very wrong if you are not using lagrangian FE for tetrahedra
Definition at line 1639 of file FESpace.hpp.
UInt polynomialDegree | ( | ) | const |
Return the polynomial degree of the finite element used.
Definition at line 2166 of file FESpace.hpp.
void setQuadRule | ( | const QuadratureRule & | Qr | ) |
Method to set replace the quadrule.
Qr | The new quadrule to be used in the FESpace |
Definition at line 1814 of file FESpace.hpp.
void setBdQuadRule | ( | const QuadratureRule & | bdQr | ) |
Definition at line 1824 of file FESpace.hpp.
|
inline |
Definition at line 401 of file FESpace.hpp.
|
inline |
Definition at line 405 of file FESpace.hpp.
|
inline |
Returns map.
Definition at line 411 of file FESpace.hpp.
|
inline |
Definition at line 415 of file FESpace.hpp.
|
inline |
Definition at line 420 of file FESpace.hpp.
|
inline |
Returns the velocity dof.
Definition at line 426 of file FESpace.hpp.
|
inline |
Definition at line 430 of file FESpace.hpp.
|
inline |
Definition at line 434 of file FESpace.hpp.
|
inline |
Returns the current FE.
Definition at line 440 of file FESpace.hpp.
|
inline |
Definition at line 444 of file FESpace.hpp.
|
inline |
Returns the current boundary FE.
Definition at line 450 of file FESpace.hpp.
|
inline |
Returns the res FE.
Definition at line 456 of file FESpace.hpp.
|
inline |
Returns the volumic quadratic rule.
Definition at line 462 of file FESpace.hpp.
|
inline |
Returns the surfasic quadratic rule.
Definition at line 468 of file FESpace.hpp.
|
inline |
Returns FE space dimension.
Definition at line 474 of file FESpace.hpp.
|
inline |
Definition at line 478 of file FESpace.hpp.
|
protected |
Creates the map for interprocessor communication.
Definition at line 1851 of file FESpace.hpp.
|
protected |
Resets boundary data if necessary.
Definition at line 1873 of file FESpace.hpp.
|
inlineprotected |
Set space.
Definition at line 1665 of file FESpace.hpp.
|
protected |
This is a generic function called by feToFEInterpolate method.
It allows to interpolate vectors between any two continuous and scalar FE spaces. It is used when other specialized functions are not provided
originalSpace | The space where the solution is defined originally. |
originalVector | The vector of the solution in the original space (must be a Repeated vector). |
Definition at line 1886 of file FESpace.hpp.
|
protected |
This is a specialized function called by feToFEInterpolate method.
It allows to interpolate P1bubble, P2 vectors into P1 vectors, P1 into P1bubble vectors and Q2 vectors into Q1 vectors.
originalSpace | The space where the solution is defined originally. |
originalVector | The vector of the solution in the original space. |
Definition at line 1961 of file FESpace.hpp.
|
protected |
This is a specialized function called by feToFEInterpolate method.
It allows to interpolate P1, P1bubble vectors into P2 vectors, and Q1 vectors into Q2 vectors.
originalSpace | The space where the solution is defined originally. |
originalVector | The vector of the solution in the original space (must be a Repeated vector). |
Definition at line 2000 of file FESpace.hpp.
|
protected |
This is a specialized function called by FESpace::feToFEInterpolate method for RT0 to P0 interpolation.
Definition at line 2068 of file FESpace.hpp.
|
protected |
Definition at line 560 of file FESpace.hpp.
|
protected |
reference to the mesh
Definition at line 563 of file FESpace.hpp.
|
protected |
Reference FE for the velocity.
Definition at line 566 of file FESpace.hpp.
|
protected |
Quadrature rule for volumic elementary computations.
Definition at line 569 of file FESpace.hpp.
|
protected |
Quadrature rule for surface elementary computations.
Definition at line 572 of file FESpace.hpp.
|
protected |
dimension of the field variable ( scalar/vector field)
Definition at line 575 of file FESpace.hpp.
|
protected |
A shared pointer to the DOF object.
Definition at line 578 of file FESpace.hpp.
|
protected |
The number of total dofs.
Definition at line 581 of file FESpace.hpp.
|
protected |
Current FE.
Definition at line 584 of file FESpace.hpp.
|
protected |
Definition at line 585 of file FESpace.hpp.
|
protected |
Map.
Definition at line 588 of file FESpace.hpp.