LifeV
|
implements a non-linear Darcy solver More...
#include <DarcySolverNonLinear.hpp>
Public Types | |
typedef MeshType | mesh_Type |
Typedef for mesh template. More... | |
typedef DarcySolverNonLinear< mesh_Type > | darcySolverNonLinear_Type |
Self typedef. More... | |
typedef DarcySolverLinear< mesh_Type > | darcySolverLinear_Type |
Darcy solver class. More... | |
typedef darcySolverLinear_Type::data_Type | data_Type |
Typedef for the data type. More... | |
typedef darcySolverLinear_Type::dataPtr_Type | dataPtr_Type |
Shared pointer for the data type. More... | |
typedef darcySolverLinear_Type::scalarFctPtr_Type | scalarFctPtr_Type |
Shared pointer to a scalar value function. More... | |
typedef darcySolverLinear_Type::matrixFctPtr_Type | matrixFctPtr_Type |
Shared pointer to a matrix value function. More... | |
typedef darcySolverLinear_Type::scalarField_Type | scalarField_Type |
Scalar field. More... | |
typedef darcySolverLinear_Type::scalarFieldPtr_Type | scalarFieldPtr_Type |
Shared pointer to a scalar field. More... | |
Constructors & destructor | |
DarcySolverNonLinear () | |
Constructor for the class. More... | |
virtual | ~DarcySolverNonLinear () |
Virtual destructor. More... | |
Methods | |
virtual void | setup () |
Set up the linear solver and the preconditioner for the linear system. More... | |
virtual void | solve () |
Solve the problem performing the fixed point scheme. More... | |
Set methos | |
void | setPrimalZeroIteration (const scalarFctPtr_Type &primalZeroIteration) |
Initial guess for fixed point iteration. More... | |
virtual void | setInversePermeability (const matrixFctPtr_Type &invPerm) |
Set the inverse of diffusion tensor,. More... | |
void | setFixedPointTolerance (const Real &tol) |
void | setFixedPointMaxIteration (const UInt &maxit) |
Get methods | |
UInt | fixedPointNumIteration () |
Real | fixedPointResidual () |
Returns the residual between two iterations of the fixed point scheme. More... | |
const Real & | fixedPointTolerance () const |
Returns fixed point tolerance. More... | |
Real & | fixedPointTolerance () |
Returns fixed point tolerance. More... | |
const UInt & | fixedPointMaxIteration () const |
Returns maximum number of fixed point iterations allowed. More... | |
UInt & | fixedPointMaxIteration () |
Returns maximum number of fixed point iterations allowed. More... | |
const scalarFieldPtr_Type & | primalPreviousIterationPtr () const |
Returns the pointer of the primal solution field at previous step. More... | |
scalarFieldPtr_Type & | primalPreviousIterationPtr () |
Returns the pointer of the primal solution field at previous step. More... | |
Protected Methods | |
virtual void | resetVariables () |
Update all problem variables. More... | |
void | fixedPoint () |
Perform the fixed point loop to solve the non-linear problem. More... | |
void | setupNonLinear () |
Set up the data for the non-linear solver. More... | |
Protected Members | |
scalarFieldPtr_Type | M_primalFieldPreviousIteration |
Primal solution at previous iteration step. More... | |
Private Constructors | |
DarcySolverNonLinear (const darcySolverNonLinear_Type &) | |
Inhibited copy constructor. More... | |
Private Operators | |
darcySolverNonLinear_Type & | operator= (const darcySolverNonLinear_Type &) |
Inhibited assign operator. More... | |
Non-linear stuff | |
UInt | M_fixedPointMaxIteration |
The maximum number of iterations for the fixed point method. More... | |
UInt | M_fixedPointNumIteration |
The current iterations for the fixed point method. More... | |
Real | M_fixedPointTolerance |
Tollerance for the stopping criteria for the fixed point method. More... | |
Real | M_fixedPointResidual |
The residual between two iteration of the fixed point scheme. More... | |
scalarFctPtr_Type | M_primalFieldZeroIterationFct |
Primal solution at zero time step. More... | |
Additional Inherited Members | |
Public Types inherited from DarcySolverLinear< MeshType > | |
typedef MeshType | mesh_Type |
Typedef for mesh template. More... | |
typedef LinearSolver | solver_Type |
Typedef for solver template. More... | |
typedef DarcySolverLinear< mesh_Type > | darcySolver_Type |
Self typedef. More... | |
typedef DarcyData< mesh_Type > | data_Type |
Typedef for the data type. More... | |
typedef std::shared_ptr< data_Type > | dataPtr_Type |
Shared pointer for the data type. More... | |
typedef BCHandler | bcHandler_Type |
Boundary condition handler. More... | |
typedef std::shared_ptr< bcHandler_Type > | bcHandlerPtr_Type |
Shared pointer to a boundary condition handler. More... | |
typedef std::shared_ptr< Epetra_Comm > | commPtr_Type |
Shared pointer to a MPI communicator. More... | |
typedef MapEpetra | map_Type |
Map type. More... | |
typedef std::shared_ptr< Displayer > | displayerPtr_Type |
Shared pointer to a displayer. More... | |
typedef FESpace< mesh_Type, map_Type > | fESpace_Type |
Finite element space. More... | |
typedef std::shared_ptr< fESpace_Type > | fESpacePtr_Type |
Shared pointer to a finite element space. More... | |
typedef FEScalarField< mesh_Type, map_Type > | scalarField_Type |
Scalar field. More... | |
typedef std::shared_ptr< scalarField_Type > | scalarFieldPtr_Type |
Shared pointer to a scalar field. More... | |
typedef FEVectorField< mesh_Type, map_Type > | vectorField_Type |
Vector field. More... | |
typedef std::shared_ptr< vectorField_Type > | vectorFieldPtr_Type |
Shared pointer to a scalar field. More... | |
typedef FEFunction< mesh_Type, map_Type, Real > | scalarFct_Type |
Scalar value function. More... | |
typedef std::shared_ptr< scalarFct_Type > | scalarFctPtr_Type |
Shared pointer to a scalar value function. More... | |
typedef FEFunction< mesh_Type, map_Type, Vector > | vectorFct_Type |
Vector value function. More... | |
typedef std::shared_ptr< vectorFct_Type > | vectorFctPtr_Type |
Shared pointer to a vector value function. More... | |
typedef FEFunction< mesh_Type, map_Type, Matrix > | matrixFct_Type |
Matrix value funcion. More... | |
typedef std::shared_ptr< matrixFct_Type > | matrixFctPtr_Type |
Shared pointer to a matrix value function. More... | |
typedef solver_Type::matrix_Type | matrix_Type |
Sparse and distributed matrix. More... | |
typedef solver_Type::matrixPtr_Type | matrixPtr_Type |
Shared pointer to a sparse and distributed matrix. More... | |
typedef solver_Type::vector_Type | vector_Type |
Distributed vector. More... | |
typedef solver_Type::vectorPtr_Type | vectorPtr_Type |
Shared pointer to a distributed vector. More... | |
typedef solver_Type::preconditionerPtr_Type | preconditionerPtr_Type |
Shared pointer to the preconditioner. More... | |
Public Member Functions inherited from DarcySolverLinear< MeshType > | |
DarcySolverLinear () | |
Constructor for the class. More... | |
virtual | ~DarcySolverLinear () |
Virtual destructor. More... | |
void | buildSystem () |
Build the global hybrid system, the right hand and apply the boundary conditions. More... | |
void | solveLinearSystem () |
Solve the global hybrid system. More... | |
void | computePrimalAndDual () |
Compute primal and dual variables from the hybrid variable as a post process. More... | |
void | setData (dataPtr_Type &data) |
Set the data. More... | |
void | setBoundaryConditions (bcHandlerPtr_Type &bcHandler) |
Set the boundary conditions. More... | |
void | setScalarSource (const scalarFctPtr_Type &scalarSourceFct) |
Set scalar source term. More... | |
void | setVectorSource (const vectorFctPtr_Type &vectorSourceFct) |
Set vector source term. More... | |
void | setReactionTerm (const scalarFctPtr_Type &reactionTermFct) |
Set the coefficient for the reaction term. More... | |
void | setHybridField (const scalarFieldPtr_Type &hybridField) |
Set the hybrid field vector. More... | |
void | setPrimalField (const scalarFieldPtr_Type &primalField) |
Set the primal field vector. More... | |
void | setDualField (const scalarFieldPtr_Type &dualField) |
Set the dual field vector. More... | |
void | setFields (const scalarFieldPtr_Type &dualField, const scalarFieldPtr_Type &primalField, const scalarFieldPtr_Type &hybridField) |
Set the fields. More... | |
void | setDisplayer (const displayerPtr_Type &displayer) |
Set the displayer and, implicitly, the communicator. More... | |
void | setCommunicator (const commPtr_Type &comm) |
Set the communicator and, implicitly, the displayer. More... | |
const scalarFieldPtr_Type & | hybridFieldPtr () const |
Returns pointer to the hybrid solution field. More... | |
scalarFieldPtr_Type & | hybridFieldPtr () |
Returns pointer to the hybrid solution field. More... | |
const scalarFieldPtr_Type & | primalFieldPtr () const |
Returns pointer to the primal solution field. More... | |
scalarFieldPtr_Type & | primalFieldPtr () |
Returns pointer to the primal solution field. More... | |
const scalarFieldPtr_Type & | dualFieldPtr () const |
Returns pointer to the dual solution field. More... | |
scalarFieldPtr_Type & | dualFieldPtr () |
Returns pointer to the dual solution field. More... | |
const vectorPtr_Type & | residualPtr () const |
vectorPtr_Type & | residualPtr () |
const bcHandlerPtr_Type & | boundaryConditionHandlerPtr () const |
Returns boundary conditions handler. More... | |
bcHandlerPtr_Type & | boundaryConditionHandlerPtr () |
Returns boundary conditions handler. More... | |
const map_Type & | getMap () const |
Returns Epetra local map. More... | |
const commPtr_Type & | getCommPtr () const |
Returns Epetra communicator. More... | |
Protected Member Functions inherited from DarcySolverLinear< MeshType > | |
DarcySolverLinear (const darcySolver_Type &) | |
Inhibited copy constructor. More... | |
darcySolver_Type & | operator= (const darcySolver_Type &) |
Inhibited assign operator. More... | |
virtual void | preLoopElementsComputation () |
Perform all the operations before doing the loop on volume elements. More... | |
void | computeConstantMatrices (MatrixElemental &elmatMix) |
Pre-computes local (element independant) matrices. More... | |
virtual void | localMatrixComputation (const UInt &iElem, MatrixElemental &elmatMix, MatrixElemental &elmatReactionTerm) |
Computes local (element dependent) matrices. More... | |
virtual void | localVectorComputation (const UInt &iElem, VectorElemental &elvecMix) |
Computes local (element dependent) vectors. More... | |
void | staticCondensation (MatrixElemental &localMatrixHybrid, VectorElemental &localVectorHybrid, MatrixElemental &elmatMix, MatrixElemental &elmatReactionTerm, VectorElemental &elvecMix) |
Performs static condensation. More... | |
void | localComputePrimalAndDual (VectorElemental &localSolution, MatrixElemental &elmatMix, MatrixElemental &elmatReactionTerm, VectorElemental &elvecMix) |
Compute locally, as a post process, the primal and dual variable given the hybrid. More... | |
virtual void | postComputePrimalAndDual () |
Do some computation after the calculation of the primal and dual variable. More... | |
void | applyBoundaryConditions () |
Apply the boundary condition. More... | |
template<typename MatrixType > | |
void | symmetrizeMatrix (Int N, MatrixType &A) |
Make matrix symmetric. More... | |
Protected Attributes inherited from DarcySolverLinear< MeshType > | |
displayerPtr_Type | M_displayer |
Displayer for parallel cout. More... | |
dataPtr_Type | M_data |
Data for Darcy solvers. More... | |
scalarFctPtr_Type | M_scalarSourceFct |
Source function. More... | |
vectorFctPtr_Type | M_vectorSourceFct |
Vector source function. More... | |
scalarFctPtr_Type | M_reactionTermFct |
Reaction term function. More... | |
matrixFctPtr_Type | M_inversePermeabilityFct |
Inverse of the permeability tensor. More... | |
bcHandlerPtr_Type | M_boundaryConditionHandler |
Bondary conditions handler. More... | |
scalarFieldPtr_Type | M_primalField |
Primal solution. More... | |
scalarFieldPtr_Type | M_dualField |
Dual solution. More... | |
scalarFieldPtr_Type | M_hybridField |
Hybrid solution. More... | |
matrixPtr_Type | M_matrHybrid |
Hybrid matrix. More... | |
vectorPtr_Type | M_rhs |
Right hand side. More... | |
vectorPtr_Type | M_residual |
Residual. More... | |
solver_Type | M_linearSolver |
Linear solver. More... | |
preconditionerPtr_Type | M_prec |
Epetra preconditioner for the linear system. More... | |
implements a non-linear Darcy solver
This class implements a non-linear Darcy solver with fixed point scheme to handle the non-linearity.
The classical non-linear Darcy formulation is a couple of differential equations of first order with the unknowns , being the pressure or the primal unknown, and , being the Darcy velocity or the flux or the dual unknown, such that
The data in the system are:
We suppose that and .
Using the hybridization procedure, and introducing a new variable, we may split the problem from the entire domain to problems in each elements of the triangulation , then we may write the weak formulation for the dual problem. The new variable is the hybrid unknown , e.g. "the trace" of pressure of the primal unknown, it is the Lagrange multipliers forcing the continuity of the flux across each faces or edges in the triangulation. We introduce the following functional spaces, the first is the space of the primal variable, the third for the dual variable, the fourth for the hybrid variable.
Introducing the following operator, bilinear forms and the functionals
we obtain the Darcy problem in the weak form: find such that
At discrete level we introduce the polynomial space, of degree , that approximate the finite dimensional spaces introduced above , and
where is the space of polynomial of degree in the element , is the space of polynomial of Raviart-Thomas of degrees in the element and is the space of polynomial of degree definite on each of the boundary of the element and discontinuous from one edge to the other.
The finite dimensional problem is: find such that
To solve the non-linearity we use a fixed point scheme based on the relative difference between two consecutive iterations of the primal variable. We start from the, user defined, function and solve the linearized problem for : find such that
At each iteration, to solve the problem, we use the static condensation procedure, i.e. the unknowns in the discrete weak system are not independent and , may be written in function of alone. We introduce the following local matrices
where we avoid to write the dependence on the triangle in all the matrices and vectors.
The local matrix formulation of the finite dimensional problem, at each iteration, is
Or alternatively
Introducing the local hybrid matrix and local hybrid right hand side
Imposing that at each edge or face the hybrid unknown is single value we obtain a linear system for the hybrid unknown
We recover the primal and dual variable as a post-process from the hybrid variable at element level, so we have
Insert any scientific publications that use this solver.
Attention! We have the hypothesis that we use P0 elements for the primal unknown. Change this in a future!
Add criteria to ensure convergence of the fixed point method.
Definition at line 247 of file DarcySolverNonLinear.hpp.
Typedef for mesh template.
Definition at line 257 of file DarcySolverNonLinear.hpp.
Self typedef.
Definition at line 260 of file DarcySolverNonLinear.hpp.
typedef DarcySolverLinear< mesh_Type > darcySolverLinear_Type |
Darcy solver class.
Definition at line 263 of file DarcySolverNonLinear.hpp.
Typedef for the data type.
Definition at line 266 of file DarcySolverNonLinear.hpp.
Shared pointer for the data type.
Definition at line 269 of file DarcySolverNonLinear.hpp.
Shared pointer to a scalar value function.
Definition at line 272 of file DarcySolverNonLinear.hpp.
Shared pointer to a matrix value function.
Definition at line 275 of file DarcySolverNonLinear.hpp.
Scalar field.
Definition at line 278 of file DarcySolverNonLinear.hpp.
Shared pointer to a scalar field.
Definition at line 281 of file DarcySolverNonLinear.hpp.
Constructor for the class.
Definition at line 567 of file DarcySolverNonLinear.hpp.
|
inlinevirtual |
Virtual destructor.
Definition at line 292 of file DarcySolverNonLinear.hpp.
|
private |
Inhibited copy constructor.
|
virtual |
Set up the linear solver and the preconditioner for the linear system.
Reimplemented from DarcySolverLinear< MeshType >.
Reimplemented in DarcySolverTransientNonLinear< MeshType >.
Definition at line 586 of file DarcySolverNonLinear.hpp.
|
inlinevirtual |
Solve the problem performing the fixed point scheme.
Reimplemented from DarcySolverLinear< MeshType >.
Reimplemented in DarcySolverTransientNonLinear< MeshType >.
Definition at line 303 of file DarcySolverNonLinear.hpp.
void setPrimalZeroIteration | ( | const scalarFctPtr_Type & | primalZeroIteration | ) |
Initial guess for fixed point iteration.
Set the function for the first iteration for the fixed point method.
primalZeroIteration | The function for the first iteration. |
Definition at line 681 of file DarcySolverNonLinear.hpp.
|
inlinevirtual |
Set the inverse of diffusion tensor,.
The non linearity of the solver is in the diffusion or permeability tensor. To handle this type of non linearity we use an iterative scheme and we write the tensor depending on the solution at previuos step. The non linear tensor now has as an additional scalar field, the last one, the solution of the problem at previuos step. This scalar field is automatically updated each iteration of the non linear solver.
The user should take into account that the value of the primal variable is the last field set, by the user, plus one. So the inverse of permeability can access to the primal variable, for example, with
Its implementation is
obtaining a tensor with the non linearity in the position the function .
In the previous example we have supposed that the permeability has not others scalar fields. If the user has set scalar fields prior to calling setInversePermeability, then the code should be
to access the primal at previous step.
invPerm | Inverse of the permeability tensor for the problem. |
Reimplemented from DarcySolverLinear< MeshType >.
Reimplemented in DarcySolverTransientNonLinear< MeshType >.
Definition at line 375 of file DarcySolverNonLinear.hpp.
|
inline |
Set fixed point tolerance
tol | requested tolerance |
Definition at line 392 of file DarcySolverNonLinear.hpp.
|
inline |
Set maximum number of fixed point iterations permitted
maxit | requested maximum |
Definition at line 401 of file DarcySolverNonLinear.hpp.
|
inline |
Returns the number of iteration of the fixed point scheme.
Definition at line 415 of file DarcySolverNonLinear.hpp.
|
inline |
Returns the residual between two iterations of the fixed point scheme.
Definition at line 424 of file DarcySolverNonLinear.hpp.
|
inline |
Returns fixed point tolerance.
Definition at line 433 of file DarcySolverNonLinear.hpp.
|
inline |
Returns fixed point tolerance.
Definition at line 442 of file DarcySolverNonLinear.hpp.
|
inline |
Returns maximum number of fixed point iterations allowed.
Definition at line 451 of file DarcySolverNonLinear.hpp.
|
inline |
Returns maximum number of fixed point iterations allowed.
Definition at line 460 of file DarcySolverNonLinear.hpp.
|
inline |
Returns the pointer of the primal solution field at previous step.
Definition at line 469 of file DarcySolverNonLinear.hpp.
|
inline |
Returns the pointer of the primal solution field at previous step.
Definition at line 478 of file DarcySolverNonLinear.hpp.
|
protectedvirtual |
Update all problem variables.
Update all the variables of the problem before the construction of the global hybrid matrix, e.g. reset the global hybrid matrix. It is principally used for a time dependent derived class.
Reimplemented from DarcySolverLinear< MeshType >.
Reimplemented in DarcySolverTransientNonLinear< MeshType >.
Definition at line 700 of file DarcySolverNonLinear.hpp.
|
protected |
Perform the fixed point loop to solve the non-linear problem.
Definition at line 623 of file DarcySolverNonLinear.hpp.
|
protected |
Set up the data for the non-linear solver.
Definition at line 601 of file DarcySolverNonLinear.hpp.
|
private |
Inhibited assign operator.
|
protected |
Primal solution at previous iteration step.
Definition at line 511 of file DarcySolverNonLinear.hpp.
|
private |
The maximum number of iterations for the fixed point method.
Definition at line 538 of file DarcySolverNonLinear.hpp.
|
private |
The current iterations for the fixed point method.
Definition at line 541 of file DarcySolverNonLinear.hpp.
|
private |
Tollerance for the stopping criteria for the fixed point method.
Definition at line 544 of file DarcySolverNonLinear.hpp.
|
private |
The residual between two iteration of the fixed point scheme.
Definition at line 547 of file DarcySolverNonLinear.hpp.
|
private |
Primal solution at zero time step.
Definition at line 550 of file DarcySolverNonLinear.hpp.