LifeV
|
ADRAssembler - This class add into given matrices terms corresponding to the space discretization of the ADR problem. More...
#include <ADRAssembler.hpp>
Private Types | |
typedef CurrentFE | currentFE_type |
typedef std::unique_ptr< currentFE_type > | currentFE_ptrType |
typedef MatrixElemental | localMatrix_type |
typedef std::unique_ptr< localMatrix_type > | localMatrix_ptrType |
typedef VectorElemental | localVector_type |
typedef std::unique_ptr< localVector_type > | localVector_ptrType |
Public Types | |
typedef MapEpetra | map_Type |
typedef FESpace< mesh_type, map_Type > | fespace_type |
typedef std::shared_ptr< fespace_type > | fespace_ptrType |
typedef std::shared_ptr< matrix_type > | matrix_ptrType |
typedef LifeChrono | chrono_type |
typedef std::function< Real(const Real &, const Real &, const Real &, const Real &, const ID &) > | function_type |
Constructor & Destructor | |
ADRAssembler () | |
Empty Constructor. More... | |
virtual | ~ADRAssembler () |
Destructor. More... | |
Methods | |
void | setup (const fespace_ptrType &fespace, const fespace_ptrType &betaFESpace) |
Setup for the class (fill the members) More... | |
void | addMass (matrix_ptrType matrix, const Real &coefficient=1.0) |
Assembling for the mass. More... | |
void | addMass (matrix_ptrType matrix, const Real &coefficient, const UInt &offsetLeft, const UInt &offsetUp) |
Assembling for the mass using offsets. More... | |
void | addAdvection (matrix_ptrType matrix, const vector_type &beta) |
Assembling for the advection. More... | |
void | addAdvection (matrix_ptrType matrix, const vector_type &beta, const UInt &offsetLeft, const UInt &offsetUp) |
Assembling for the advection using offsets. More... | |
void | addDiffusion (matrix_ptrType matrix, const Real &coefficient=1.0) |
Assembling for the diffusion. More... | |
void | addDiffusion (matrix_ptrType matrix, const Real &coefficient, const UInt &offsetLeft, const UInt &offsetUp) |
Assembling for the diffusion using offsets. More... | |
void | addStiffStrain (matrix_ptrType &matrix, const Real &coefficient=1.0) |
Add the stiff strain in the standard block. More... | |
void | addStiffStrain (matrix_ptrType &matrix, const Real &coefficient, const UInt &offsetLeft, const UInt &offsetUp) |
Add the stiff strain using the given offsets. More... | |
void | addMassRhs (vector_type &rhs, const vector_type &f) |
Assembly for the right hand side (mass) with f given in vectorial form. More... | |
void | addMassRhs (vector_type &rhs, const function_type &f, const Real &t) |
Assembly for the right hand side (mass) with f given in functional form. More... | |
Set Methods | |
void | setFespace (const fespace_ptrType &fespace) |
Setter for the finite element space used for the unknown (reset the quadratures as well!) More... | |
void | setBetaFespace (const fespace_ptrType &betaFESpace) |
Setter for the finite element space used for the advection field (reset the quadratures as well!) More... | |
void | setQuadRuleForMassMatrix (const QuadratureRule &qr) |
Setter for the quadrature used for the mass matrix. More... | |
void | setQuadRuleForDiffusionMatrix (const QuadratureRule &qr) |
Setter for the quadrature used for the diffusion matrix. More... | |
void | setQuadRuleForAdvectionMatrix (const QuadratureRule &qr) |
Setter for the quadrature used for the advection matrix. More... | |
void | setQuadRuleForMassRhs (const QuadratureRule &qr) |
Setter for the quadrature used for the right hand side. More... | |
Get Methods | |
chrono_type & | massAssemblyChrono () |
Getter for the chrono of the assembly of the mass term. More... | |
chrono_type & | advectionAssemblyChrono () |
Getter for the chrono of the assembly of the advection term. More... | |
chrono_type & | diffusionAssemblyChrono () |
Getter for the chrono of the assembly of the diffusion term. More... | |
chrono_type & | setupChrono () |
Getter for the chrono of the setup of the assembler. More... | |
chrono_type & | massRhsAssemblyChrono () |
Getter for the chrono of the assembly of the rhs (mass) More... | |
Private Methods | |
ADRAssembler (const ADRAssembler &) | |
ADRAssembler - This class add into given matrices terms corresponding to the space discretization of the ADR problem.
Scope
This class has been designed for assembling the terms arising from the space discretization with finite elements of the advection-diffusion-reaction problem, i.e. of the PDE
where and are constants, a vectorial field.
Time discretization of the parabolic version of this equation is not in the scope of this assembler (it is usually not a finite element discretization) and has to be treated outside of the class.
This class is also not supposed to provide any stabilization for the discretization.
Good Practice
Here is the way this class is intended to be used. First, one should define the assembler. Only the empty constructor is available, so there is no choice.
Then, one should setup the assembler by providing the finite element spaces required, namely the space for the unknown and the space where the advection field is defined
When this setup method is used, the quadrature rules are set as the one stored in the FESpace of the unknown. One should then change them if one wants to have a more precise or a faster assembly (usually, the default quadrature is too precise for diffusion and the advection terms, so one should consider this option to make the assembly faster without affecting the results).
Now that everything has been set up, one can assemble the terms:
These two last lines have added the required terms into the matrix. Here one should be aware that the matrix is NOT finalized after the assembly of any of the terms. Therefore, before passing the matrix to a linear solver (and before applying boundary conditions), one should close the matrix using
Remarks
Troubleshooting
Empty FE Space cannot setup the ADR assembler You are passing a nul pointer as FE Space in the setup method.
Empty beta FE Space cannot setup the ADR assembler You are passing a nul pointer as FE Space for the advection field in the setup method.
Setting the FE space for the unknown to 0 is not permitted You are passing a nul pointer as FE Space in the setFespace method.
No FE space for the unknown! Use setFespace before setBetaFespace! You are trying to use the method setBetaFespace before having set the FE space for the unknown.
No FE space for assembling the mass! You are trying to use the addMass method without having set a FE Space for the unknown. Use the setup or the setFespace methods before calling addMass.
No FE space for assembling the advection! You are trying to use the addAdvection method without having set a FE Space for the unknown. Use the setup or the setFespace methods before calling addAdvection.
No FE space for assembling the diffusion! You are trying to use the addDiffusion method without having set a FE Space for the unknown. Use the setup or the setFespace methods before calling addDiffusion.
No FE space (beta) for assembling the advection! You are trying to add advection without having set the FE space for the advection field. Use the setup of the setBetaFespace methods before calling addAdvection.
Definition at line 166 of file ADRAssembler.hpp.
Definition at line 173 of file ADRAssembler.hpp.
typedef FESpace<mesh_type, map_Type> fespace_type |
Definition at line 175 of file ADRAssembler.hpp.
typedef std::shared_ptr<fespace_type> fespace_ptrType |
Definition at line 176 of file ADRAssembler.hpp.
typedef std::shared_ptr<matrix_type> matrix_ptrType |
Definition at line 178 of file ADRAssembler.hpp.
typedef LifeChrono chrono_type |
Definition at line 180 of file ADRAssembler.hpp.
typedef std::function<Real (const Real&, const Real&, const Real&, const Real&, const ID&) > function_type |
Definition at line 183 of file ADRAssembler.hpp.
|
private |
Definition at line 404 of file ADRAssembler.hpp.
|
private |
Definition at line 405 of file ADRAssembler.hpp.
|
private |
Definition at line 407 of file ADRAssembler.hpp.
|
private |
Definition at line 408 of file ADRAssembler.hpp.
|
private |
Definition at line 410 of file ADRAssembler.hpp.
|
private |
Definition at line 411 of file ADRAssembler.hpp.
ADRAssembler | ( | ) |
Empty Constructor.
Definition at line 468 of file ADRAssembler.hpp.
|
inlinevirtual |
Destructor.
Definition at line 195 of file ADRAssembler.hpp.
|
private |
void setup | ( | const fespace_ptrType & | fespace, |
const fespace_ptrType & | betaFESpace | ||
) |
Setup for the class (fill the members)
This method can be called either when the class is empty or when is already (partially) setup. It changes the internal containers to fit with the FESpace given in argument. All the quadrature rules are overriden by the one given in fespace.
Definition at line 498 of file ADRAssembler.hpp.
|
inline |
Assembling for the mass.
This method adds the mass matrix times the coefficient (whose default value is 1.0) to the matrix passed in argument. The matrix is NOT finalized, you have to call globalAssemble outside this method when the matrix is finished.
Definition at line 223 of file ADRAssembler.hpp.
void addMass | ( | matrix_ptrType | matrix, |
const Real & | coefficient, | ||
const UInt & | offsetLeft, | ||
const UInt & | offsetUp | ||
) |
Assembling for the mass using offsets.
This method adds the mass in the given matrix. Additional arguements are provided so that one can chose where to add the mass in the matrix, i.e. somewhere else than in the upper left block.
Definition at line 518 of file ADRAssembler.hpp.
|
inline |
Assembling for the advection.
This method adds the advection (with respect to the given vector field) matrix to the matrix passed in argument. beta represents a finite element function with the beta FE space of this assembler. The matrix is NOT finalized, you have to call globalAssemble outside this method when the matrix is finished.
Definition at line 245 of file ADRAssembler.hpp.
void addAdvection | ( | matrix_ptrType | matrix, |
const vector_type & | beta, | ||
const UInt & | offsetLeft, | ||
const UInt & | offsetUp | ||
) |
Assembling for the advection using offsets.
This method adds the advection in the given matrix. Additional arguements are provided so that one can chose where to add the mass in the matrix, i.e. somewhere else than in the upper left block.
Definition at line 563 of file ADRAssembler.hpp.
|
inline |
Assembling for the diffusion.
This method adds the diffusion matrix times the coefficient (whose default value is 1.0) to the matrix passed in argument. The matrix is NOT finalized, you have to call globalAssemble outside this method when the matrix is finished.
Definition at line 265 of file ADRAssembler.hpp.
void addDiffusion | ( | matrix_ptrType | matrix, |
const Real & | coefficient, | ||
const UInt & | offsetLeft, | ||
const UInt & | offsetUp | ||
) |
Assembling for the diffusion using offsets.
This method adds the diffusion in the given matrix. Additional arguements are provided so that one can chose where to add the mass in the matrix, i.e. somewhere else than in the upper left block.
Definition at line 626 of file ADRAssembler.hpp.
|
inline |
Add the stiff strain in the standard block.
Definition at line 279 of file ADRAssembler.hpp.
void addStiffStrain | ( | matrix_ptrType & | matrix, |
const Real & | coefficient, | ||
const UInt & | offsetLeft, | ||
const UInt & | offsetUp | ||
) |
Add the stiff strain using the given offsets.
Definition at line 670 of file ADRAssembler.hpp.
void addMassRhs | ( | vector_type & | rhs, |
const vector_type & | f | ||
) |
Assembly for the right hand side (mass) with f given in vectorial form.
This method assembles the right hand side for the ADR problem where the forcing term is given in the FE space of the unknown.
Definition at line 718 of file ADRAssembler.hpp.
void addMassRhs | ( | vector_type & | rhs, |
const function_type & | f, | ||
const Real & | t | ||
) |
Assembly for the right hand side (mass) with f given in functional form.
This method assembles the right hand side for the ADR problem where f is given as a function of space and time (t,x,y,z,component)
Definition at line 806 of file ADRAssembler.hpp.
void setFespace | ( | const fespace_ptrType & | fespace | ) |
Setter for the finite element space used for the unknown (reset the quadratures as well!)
Definition at line 889 of file ADRAssembler.hpp.
void setBetaFespace | ( | const fespace_ptrType & | betaFESpace | ) |
Setter for the finite element space used for the advection field (reset the quadratures as well!)
Beware that a FE space for the unknown has to be set before calling this method.
Definition at line 917 of file ADRAssembler.hpp.
|
inline |
Setter for the quadrature used for the mass matrix.
Beware that calling this function might be quite heavy, so avoid using it when it is not necessary.
Definition at line 322 of file ADRAssembler.hpp.
|
inline |
Setter for the quadrature used for the diffusion matrix.
Beware that calling this function might be quite heavy, so avoid using it when it is not necessary.
Definition at line 333 of file ADRAssembler.hpp.
|
inline |
Setter for the quadrature used for the advection matrix.
Beware that calling this function might be quite heavy, so avoid using it when it is not necessary.
Definition at line 344 of file ADRAssembler.hpp.
|
inline |
Setter for the quadrature used for the right hand side.
Beware that calling this function might be quite heavy, so avoid using it when it is not necessary.
Definition at line 357 of file ADRAssembler.hpp.
|
inline |
Getter for the chrono of the assembly of the mass term.
Definition at line 370 of file ADRAssembler.hpp.
|
inline |
Getter for the chrono of the assembly of the advection term.
Definition at line 376 of file ADRAssembler.hpp.
|
inline |
Getter for the chrono of the assembly of the diffusion term.
Definition at line 382 of file ADRAssembler.hpp.
|
inline |
Getter for the chrono of the setup of the assembler.
Definition at line 388 of file ADRAssembler.hpp.
|
inline |
Getter for the chrono of the assembly of the rhs (mass)
Definition at line 394 of file ADRAssembler.hpp.
|
private |
Definition at line 422 of file ADRAssembler.hpp.
|
private |
Definition at line 425 of file ADRAssembler.hpp.
|
private |
Definition at line 428 of file ADRAssembler.hpp.
|
private |
Definition at line 431 of file ADRAssembler.hpp.
|
private |
Definition at line 434 of file ADRAssembler.hpp.
|
private |
Definition at line 437 of file ADRAssembler.hpp.
|
private |
Definition at line 440 of file ADRAssembler.hpp.
|
private |
Definition at line 444 of file ADRAssembler.hpp.
|
private |
Definition at line 447 of file ADRAssembler.hpp.
|
private |
Definition at line 450 of file ADRAssembler.hpp.
|
private |
Definition at line 453 of file ADRAssembler.hpp.
|
private |
Definition at line 456 of file ADRAssembler.hpp.
|
private |
Definition at line 457 of file ADRAssembler.hpp.
|
private |
Definition at line 458 of file ADRAssembler.hpp.
|
private |
Definition at line 459 of file ADRAssembler.hpp.
|
private |
Definition at line 460 of file ADRAssembler.hpp.