LifeV
DarcySolverNonLinear< MeshType > Class Template Reference

implements a non-linear Darcy solver More...

#include <DarcySolverNonLinear.hpp>

+ Inheritance diagram for DarcySolverNonLinear< MeshType >:
+ Collaboration diagram for DarcySolverNonLinear< MeshType >:

Public Types

typedef MeshType mesh_Type
 Typedef for mesh template. More...
 
typedef DarcySolverNonLinear< mesh_TypedarcySolverNonLinear_Type
 Self typedef. More...
 
typedef DarcySolverLinear< mesh_TypedarcySolverLinear_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 RealfixedPointTolerance () const
 Returns fixed point tolerance. More...
 
RealfixedPointTolerance ()
 Returns fixed point tolerance. More...
 
const UIntfixedPointMaxIteration () const
 Returns maximum number of fixed point iterations allowed. More...
 
UIntfixedPointMaxIteration ()
 Returns maximum number of fixed point iterations allowed. More...
 
const scalarFieldPtr_TypeprimalPreviousIterationPtr () const
 Returns the pointer of the primal solution field at previous step. More...
 
scalarFieldPtr_TypeprimalPreviousIterationPtr ()
 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_Typeoperator= (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_TypedarcySolver_Type
 Self typedef. More...
 
typedef DarcyData< mesh_Typedata_Type
 Typedef for the data type. More...
 
typedef std::shared_ptr< data_TypedataPtr_Type
 Shared pointer for the data type. More...
 
typedef BCHandler bcHandler_Type
 Boundary condition handler. More...
 
typedef std::shared_ptr< bcHandler_TypebcHandlerPtr_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< DisplayerdisplayerPtr_Type
 Shared pointer to a displayer. More...
 
typedef FESpace< mesh_Type, map_TypefESpace_Type
 Finite element space. More...
 
typedef std::shared_ptr< fESpace_TypefESpacePtr_Type
 Shared pointer to a finite element space. More...
 
typedef FEScalarField< mesh_Type, map_TypescalarField_Type
 Scalar field. More...
 
typedef std::shared_ptr< scalarField_TypescalarFieldPtr_Type
 Shared pointer to a scalar field. More...
 
typedef FEVectorField< mesh_Type, map_TypevectorField_Type
 Vector field. More...
 
typedef std::shared_ptr< vectorField_TypevectorFieldPtr_Type
 Shared pointer to a scalar field. More...
 
typedef FEFunction< mesh_Type, map_Type, RealscalarFct_Type
 Scalar value function. More...
 
typedef std::shared_ptr< scalarFct_TypescalarFctPtr_Type
 Shared pointer to a scalar value function. More...
 
typedef FEFunction< mesh_Type, map_Type, VectorvectorFct_Type
 Vector value function. More...
 
typedef std::shared_ptr< vectorFct_TypevectorFctPtr_Type
 Shared pointer to a vector value function. More...
 
typedef FEFunction< mesh_Type, map_Type, MatrixmatrixFct_Type
 Matrix value funcion. More...
 
typedef std::shared_ptr< matrixFct_TypematrixFctPtr_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_TypehybridFieldPtr () const
 Returns pointer to the hybrid solution field. More...
 
scalarFieldPtr_TypehybridFieldPtr ()
 Returns pointer to the hybrid solution field. More...
 
const scalarFieldPtr_TypeprimalFieldPtr () const
 Returns pointer to the primal solution field. More...
 
scalarFieldPtr_TypeprimalFieldPtr ()
 Returns pointer to the primal solution field. More...
 
const scalarFieldPtr_TypedualFieldPtr () const
 Returns pointer to the dual solution field. More...
 
scalarFieldPtr_TypedualFieldPtr ()
 Returns pointer to the dual solution field. More...
 
const vectorPtr_TyperesidualPtr () const
 
vectorPtr_TyperesidualPtr ()
 
const bcHandlerPtr_TypeboundaryConditionHandlerPtr () const
 Returns boundary conditions handler. More...
 
bcHandlerPtr_TypeboundaryConditionHandlerPtr ()
 Returns boundary conditions handler. More...
 
const map_TypegetMap () const
 Returns Epetra local map. More...
 
const commPtr_TypegetCommPtr () const
 Returns Epetra communicator. More...
 
- Protected Member Functions inherited from DarcySolverLinear< MeshType >
 DarcySolverLinear (const darcySolver_Type &)
 Inhibited copy constructor. More...
 
darcySolver_Typeoperator= (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...
 

Detailed Description

template<typename MeshType>
class LifeV::DarcySolverNonLinear< MeshType >

implements a non-linear Darcy solver

Author
A. Fumagalli aless.nosp@m.io.f.nosp@m.umaga.nosp@m.lli@.nosp@m.mail..nosp@m.poli.nosp@m.mi.it

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 $ p \in C^1 (\Omega ) $, being the pressure or the primal unknown, and $ \sigma \in (C^1( \Omega ) )^n $, being the Darcy velocity or the flux or the dual unknown, such that

\[ \left\{ \begin{array}{l l l} \Lambda^{-1}(p) \sigma + \nabla p = f_v & \mathrm{in} & \Omega\,, \vspace{0.2cm} \\ \nabla \cdot \sigma + \pi p - f = 0 & \mathrm{in} & \Omega\,, \vspace{0.2cm} \\ p = g_D & \mathrm{on} & \Gamma_D\,,\vspace{0.2cm} \\ \sigma \cdot n + h p = g_R & \mathrm{on} & \Gamma_R\,. \end{array} \right. \]

The data in the system are:

  • $ \Lambda $ the permeability tensor that depends on $ p $;
  • $ f $ the scalar source term;
  • $ f_v $ the vector source term;
  • $ \pi $ the reaction coefficient;
  • $ \Gamma_D $ the subset of the boundary of $ \Omega $ with Dirichlet boundary conditions;
  • $ g_D $ Dirichlet boundary condition data;
  • $ \Gamma_R $ that is the part of the boundary of $ \Omega $ with Robin, or Neumann, boundary conditions;
  • $ h $ and $ g_R $ Robin boundary condition data;

We suppose that $ \partial \Omega = \Gamma_D \cup \Gamma_R $ and $ \Gamma_D \cap \Gamma_R = \emptyset $.
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 $ \mathcal{T}_h $, then we may write the weak formulation for the dual problem. The new variable is the hybrid unknown $ \lambda $, 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.

\[ \begin{array}{l} V = L^2 (\Omega ) \,,\vspace{0.2cm} \\ H(div, K) = \displaystyle \left\{ \tau \in ( L^2(K))^n : \nabla \cdot \tau \in L^2(K)\right\}\,, \vspace{0.2cm}\\ Z = \displaystyle \left\{ \tau \in L^2(\Omega) : \tau\vert_K \in H(div, K) \, \forall K \in \mathcal{T}_h \right\}\,, \vspace{0.2cm}\\ \Lambda = \displaystyle \left\{ \lambda \in \prod_{K \in \mathcal{T}_h} H^{1/2} (\partial K): \lambda_K = \lambda_{K'} \,\, \mathrm{on} \,\, e_{K-K'} \, \forall K \in \mathcal{T}_h,\, \lambda = g_D \,\, \mathrm{on} \,\, \Gamma_D \right\}\,. \end{array} \]

Introducing the following operator, bilinear forms and the functionals

\[ \begin{array}{l l} a(\sigma, \tau, p) = \sum_{K \in \mathcal{T}_h}\int_K \Lambda^{-1}(p) \sigma \cdot \tau \,, & b(p, \tau) = -\sum_{K \in \mathcal{T}_h} \int_K p \nabla \cdot \tau\,, \vspace{0.2cm}\\ c(\lambda, \tau) = \sum_{K \in \mathcal{T}_h} \int_{\partial K} \lambda \tau \cdot n\,,& d(p, q) = \displaystyle \sum_{K \in \mathcal{T}_h} \int_{\partial K} \pi p q \,,\vspace{0.2cm}\\ h(\lambda, \mu) = \sum_{K \in \mathcal{T}_h} \int_{\partial K \cap \Gamma_R} h \mu \lambda \,,& F(q) = \sum_{K \in \mathcal{T}_h} \int_K f q\,,\vspace{0.2cm}\\ F_v(\tau) = \displaystyle \sum_{K \in \mathcal{T}_h} \int_K f_v \tau \,, \vspace{0.2cm}\,,& G(\mu) =\sum_{K \in \mathcal{T}_h} \int_{\partial K \cap \Gamma_R} g \mu\,, \end{array} \]

we obtain the Darcy problem in the weak form: find $ (\sigma, \, p, \, \lambda) \in Z \times V \times \Lambda $ such that

\[ \left\{ \begin{array}{l l} a(\sigma, \tau, p) + b(p, \tau) + c(\lambda, \tau) = F_v(\tau)\,, & \forall \tau \in Z \,,\vspace{0.2cm}\\ b(q, \sigma) + d (p, q)= - F(q)\,, & \forall q \in V \,,\vspace{0.2cm}\\ c(\mu, \sigma) + h(\lambda, \mu) = G(\mu) \,, & \forall \mu \in \Lambda\,. \end{array} \right. \]

At discrete level we introduce the polynomial space, of degree $ r $, that approximate the finite dimensional spaces introduced above $ V_h \subset V $, $ Z_h \subset Z $ and $\Lambda_h \subset \Lambda $

\[ \begin{array}{l} V_h = \left\{ v_h \in V: v_h|_K \in P_r (K)\, \forall K \in \mathcal{T}_h \right\}\,, \vspace{0.2cm}\\ Z_h = \left\{ \tau_h \in Z: \tau_h|_K \in RT_r(K) \, \forall K \in \mathcal{T}_h \right\} \,, \vspace{0.2cm} \\ \Lambda_h = \left\{ \lambda_h \in \Lambda: \lambda_h|_{\partial K} \in R_r( \partial K ) \, \forall K \in \mathcal{T}_h\right\}\,, \end{array} \]

where $ P_r(K) $ is the space of polynomial of degree $ r $ in the element $ K $, $ RT_r(K) $ is the space of polynomial of Raviart-Thomas of degrees $ r $ in the element $ K $ and $ R_r(\partial K) $ is the space of polynomial of degree $ r $ definite on each of the boundary of the element $ K $ and discontinuous from one edge to the other.
The finite dimensional problem is: find $ (\sigma_h,\,, p_h, \, \lambda_h) \in Z_h \times V_h \times \Lambda_h $ such that

\[ \left\{ \begin{array}{l l} a(\sigma_h, \tau_h, p_h) + b(p_h, \tau_h) + c(\lambda_h, \tau_h) = F_v(\tau)\,, & \forall \tau_h \in Z_h \,,\vspace{0.2cm}\\ b(q_h, \sigma_h) - d(p_h, q_h) = - F(q_h)\,, & \forall q_h \in V_h \,,\vspace{0.2cm}\\ c(\mu_h, \sigma_h) + h(\lambda_h, \mu_h) = G(\mu_h) \,, & \forall \mu_h \in \Lambda_h\,. \end{array} \right. \]

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 $ p^0 $ and solve the linearized problem for $ n \geq 1 $: find $ (\sigma_h^n,\, p_h^n, \, \lambda_h^n) \in Z_h \times V_h \times \Lambda_h $ such that

\[ \left\{ \begin{array}{l l} a(\sigma_h^n, \tau_h; p_h^{n-1}) + b(p_h^n, \tau_h) + c(\lambda_h^n, \tau_h) = F_v(\tau) \,, & \forall \tau_h \in Z_h \,,\vspace{0.2cm}\\ b(q_h, \sigma_h^n) - d(p_h, q_h)= - F(q_h)\,, & \forall q_h \in V_h \,,\vspace{0.2cm}\\ c(\mu_h, \sigma_h^n) + h(\lambda_h^n, \mu_h) = G(\mu_h) \,, & \forall \mu_h \in \Lambda_h\,. \end{array} \right. \]

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 $ p_K^n $, $\sigma_K^n $ may be written in function of $ \lambda_K^n $ alone. We introduce the following local matrices

\[ \begin{array}{l l l} \left[ A \left( p_K^{n-1}\right) \right]_{ij} = \displaystyle \int_K \Lambda^{-1}\left( p^{n-1} \right) \psi_j \cdot \psi_i \,, & \left[ B \right]_{ij} = - \displaystyle \int_K \phi_j \nabla \cdot \psi_i \,, & \left[ C \right]_{ij} = \displaystyle \int_{\partial K} \xi_i \psi_j \cdot n \,, \vspace{0.2cm} \\ \left[ D \right]_{ij} = \displaystyle \int_K \pi \phi_j \phi_i\,, & \left[ H \right]_{ij} = \displaystyle \int_{\partial K \cap \Gamma_R} h \xi_i \xi_j\,, & \left[ F \right]_{j} = \displaystyle \int_K f \phi_j\,,\vspace{0.2cm} \\ \left[ F_v \right]_{j} = \displaystyle \int_K f_v \psi_j\,,& \left[ G \right]_{j} = \displaystyle \int_{\partial K \cap \Gamma_R } g \xi_j\,, \end{array} \]

where we avoid to write the dependence on the triangle $ K $ in all the matrices and vectors.
The local matrix formulation of the finite dimensional problem, at each iteration, is

\[ \left\{ \begin{array}{l} A \left( p_K^{n-1} \right) \sigma_K^n + B p_K^n + C \lambda_K^n = F_v\,, \vspace{0.2cm} \\ B^T \sigma_K^n - D p_K^n= -F \,, \vspace{0.2cm}\\ C^T \sigma_K^n + H \lambda_K^n = G\,. \end{array} \right. \]

Or alternatively

\[ \begin{array}{l l l} \left[ \begin{array}{c c c} A \left( p_K^{n-1} \right) & B & C \vspace{0.2cm} \\ B^T & -D & 0 \vspace{0.2cm} \\ C^T & 0 & H \end{array} \right] \, \cdot & \left[ \begin{array}{c} \sigma_K^n \vspace{0.2cm}\\ p_K^n \vspace{0.2cm}\\ \lambda_K^n \end{array} \right] \, & = \left[ \begin{array}{c} F_v \vspace{0.2cm}\\ -F \vspace{0.2cm}\\ G \end{array} \right]\,. \end{array} \]

Introducing the local hybrid matrix and local hybrid right hand side

\[ \begin{array}{l} L_K = -C^T A^{-1}\left( p_k^{n-1}\right) C + C^T A^{-1} \left( p_K^{n-1} \right) B \left[ B^T A^{-1}\left( p_K^{n-1}\right) B + D \right]^{-1} B^T A^{-1}\left( p_K^{n-1} \right) C + H \,, \vspace{0.2cm} \\ r_K = G + C^T A^{-1}\left( p_K^{n-1} \right) B \left[ B^T A^{-1}\left( p_K^{n-1} \right) B + D \right]^{-1} F + C^T A^{-1}\left( p_K^{n-1} \right) B \left[ B^T A^{-1}\left( p_K^{n-1} \right) B + D \right]^{-1} B^T A^{-1}\left( p_K^{n-1} \right) F_v - C^T A^{-1}\left( p_K^{n-1} \right) F_v\,, \end{array} \]

Imposing that at each edge or face the hybrid unknown is single value we obtain a linear system for the hybrid unknown

\[ L^n \lambda^n = r \,. \]

We recover the primal and dual variable as a post-process from the hybrid variable at element level, so we have

\[ \begin{array}{l} p_K^n = \left[ B^T A^{-1}\left( p_K^{n-1} \right) B + D\right]^{-1} \left[ F + B^T A^{-1}\left( p_K^{n-1}\right) F_v - B^T A^{-1}\left( p_K^{n-1}\right) C \lambda_K^n \right]\,, \vspace{0.2cm} \\ \sigma_K^n = -A^{-1}\left(p_K^{n-1} \right) \left( B p_K^n - F_v + C \lambda_K^n \right) \,. \end{array} \]

Note
In the code we do not use the matrix $ H $ and the vector $ G $, because all the boundary conditions are imposed via BCHandler class.
Example of usage can be found in darcy_nonlinear and darcy_linear. Coupled with an hyperbolic solver in impes.
Todo:

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.

Member Typedef Documentation

◆ mesh_Type

Typedef for mesh template.

Definition at line 257 of file DarcySolverNonLinear.hpp.

◆ darcySolverNonLinear_Type

Self typedef.

Definition at line 260 of file DarcySolverNonLinear.hpp.

◆ darcySolverLinear_Type

Darcy solver class.

Definition at line 263 of file DarcySolverNonLinear.hpp.

◆ data_Type

Typedef for the data type.

Definition at line 266 of file DarcySolverNonLinear.hpp.

◆ dataPtr_Type

Shared pointer for the data type.

Definition at line 269 of file DarcySolverNonLinear.hpp.

◆ scalarFctPtr_Type

Shared pointer to a scalar value function.

Definition at line 272 of file DarcySolverNonLinear.hpp.

◆ matrixFctPtr_Type

Shared pointer to a matrix value function.

Definition at line 275 of file DarcySolverNonLinear.hpp.

◆ scalarField_Type

◆ scalarFieldPtr_Type

Shared pointer to a scalar field.

Definition at line 281 of file DarcySolverNonLinear.hpp.

Constructor & Destructor Documentation

◆ DarcySolverNonLinear() [1/2]

Constructor for the class.

Definition at line 567 of file DarcySolverNonLinear.hpp.

+ Here is the caller graph for this function:

◆ ~DarcySolverNonLinear()

virtual ~DarcySolverNonLinear ( )
inlinevirtual

Virtual destructor.

Definition at line 292 of file DarcySolverNonLinear.hpp.

◆ DarcySolverNonLinear() [2/2]

Inhibited copy constructor.

Member Function Documentation

◆ setup()

void setup ( )
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.

◆ solve()

virtual void solve ( )
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.

◆ setPrimalZeroIteration()

void setPrimalZeroIteration ( const scalarFctPtr_Type primalZeroIteration)

Initial guess for fixed point iteration.

Set the function for the first iteration for the fixed point method.

Parameters
primalZeroIterationThe function for the first iteration.

Definition at line 681 of file DarcySolverNonLinear.hpp.

◆ setInversePermeability()

virtual void setInversePermeability ( const matrixFctPtr_Type invPerm)
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

// Inverse of permeability matrix
typedef RegionMesh < LinearTriangle > regionMesh_Type;
class inversePermeability : public FEFunction < regionMesh_Type, MapEpetra, Matrix >
{
public:
virtual Matrix eval ( const UInt& iElem, const Vector3D& P, const Real& time = 0. ) const;
};

Its implementation is

Matrix inversePermeability::eval ( const UInt& iElem, const Vector3D& P, const Real& time ) const
{
Matrix invK ( 2, 2 );
Real unkown_n = scalarField(0).eval( iElem, P, time );
// Fill in of the inversePermeabilityMatrix
invK ( 0, 0 ) = 1;
invK ( 0, 1 ) = 0;
invK ( 1, 0 ) = 0;
invK ( 1, 1 ) = 1. / ( unkown_n * unkown_n + 1. );
return invK;
}

obtaining a tensor with the non linearity in the position $ (1,1) $ the function $ \left[K^{-1}\right]_{1,1} = u^2 + 1 $.
In the previous example we have supposed that the permeability has not others scalar fields. If the user has set $ m $ scalar fields prior to calling setInversePermeability, then the code should be

const Real unkown_n = scalarField(m).eval( iElem, P, time );

to access the primal at previous step.

Note
For an example of the usage see darcy_nonlinear and twophase_impes
Parameters
invPermInverse of the permeability tensor for the problem.

Reimplemented from DarcySolverLinear< MeshType >.

Reimplemented in DarcySolverTransientNonLinear< MeshType >.

Definition at line 375 of file DarcySolverNonLinear.hpp.

◆ setFixedPointTolerance()

void setFixedPointTolerance ( const Real tol)
inline

Set fixed point tolerance

Parameters
tolrequested tolerance

Definition at line 392 of file DarcySolverNonLinear.hpp.

+ Here is the caller graph for this function:

◆ setFixedPointMaxIteration()

void setFixedPointMaxIteration ( const UInt maxit)
inline

Set maximum number of fixed point iterations permitted

Parameters
maxitrequested maximum

Definition at line 401 of file DarcySolverNonLinear.hpp.

+ Here is the caller graph for this function:

◆ fixedPointNumIteration()

UInt fixedPointNumIteration ( )
inline

Returns the number of iteration of the fixed point scheme.

Returns
Final number of iterations of the fixed point method as a constant UInt.

Definition at line 415 of file DarcySolverNonLinear.hpp.

◆ fixedPointResidual()

Real fixedPointResidual ( )
inline

Returns the residual between two iterations of the fixed point scheme.

Returns
Final residual of the fixed point method as a constant Real.

Definition at line 424 of file DarcySolverNonLinear.hpp.

◆ fixedPointTolerance() [1/2]

const Real& fixedPointTolerance ( ) const
inline

Returns fixed point tolerance.

Returns
M_fixedPointTolerance

Definition at line 433 of file DarcySolverNonLinear.hpp.

◆ fixedPointTolerance() [2/2]

Real& fixedPointTolerance ( )
inline

Returns fixed point tolerance.

Returns
M_fixedPointTolerance

Definition at line 442 of file DarcySolverNonLinear.hpp.

◆ fixedPointMaxIteration() [1/2]

const UInt& fixedPointMaxIteration ( ) const
inline

Returns maximum number of fixed point iterations allowed.

Returns
max possible number of fixed point iterations

Definition at line 451 of file DarcySolverNonLinear.hpp.

◆ fixedPointMaxIteration() [2/2]

UInt& fixedPointMaxIteration ( )
inline

Returns maximum number of fixed point iterations allowed.

Returns
max possible number of fixed point iterations

Definition at line 460 of file DarcySolverNonLinear.hpp.

◆ primalPreviousIterationPtr() [1/2]

const scalarFieldPtr_Type& primalPreviousIterationPtr ( ) const
inline

Returns the pointer of the primal solution field at previous step.

Returns
Constant scalarFieldPtr_Type reference of the primal solution field at previous step.

Definition at line 469 of file DarcySolverNonLinear.hpp.

◆ primalPreviousIterationPtr() [2/2]

scalarFieldPtr_Type& primalPreviousIterationPtr ( )
inline

Returns the pointer of the primal solution field at previous step.

Returns
Constant scalarFieldPtr_Type reference of the primal solution field at previous step.

Definition at line 478 of file DarcySolverNonLinear.hpp.

◆ resetVariables()

void resetVariables ( )
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.

◆ fixedPoint()

void fixedPoint ( )
protected

Perform the fixed point loop to solve the non-linear problem.

Definition at line 623 of file DarcySolverNonLinear.hpp.

+ Here is the caller graph for this function:

◆ setupNonLinear()

void setupNonLinear ( )
protected

Set up the data for the non-linear solver.

Definition at line 601 of file DarcySolverNonLinear.hpp.

+ Here is the caller graph for this function:

◆ operator=()

darcySolverNonLinear_Type& operator= ( const darcySolverNonLinear_Type )
private

Inhibited assign operator.

Field Documentation

◆ M_primalFieldPreviousIteration

scalarFieldPtr_Type M_primalFieldPreviousIteration
protected

Primal solution at previous iteration step.

Definition at line 511 of file DarcySolverNonLinear.hpp.

◆ M_fixedPointMaxIteration

UInt M_fixedPointMaxIteration
private

The maximum number of iterations for the fixed point method.

Definition at line 538 of file DarcySolverNonLinear.hpp.

◆ M_fixedPointNumIteration

UInt M_fixedPointNumIteration
private

The current iterations for the fixed point method.

Definition at line 541 of file DarcySolverNonLinear.hpp.

◆ M_fixedPointTolerance

Real M_fixedPointTolerance
private

Tollerance for the stopping criteria for the fixed point method.

Definition at line 544 of file DarcySolverNonLinear.hpp.

◆ M_fixedPointResidual

Real M_fixedPointResidual
private

The residual between two iteration of the fixed point scheme.

Definition at line 547 of file DarcySolverNonLinear.hpp.

◆ M_primalFieldZeroIterationFct

scalarFctPtr_Type M_primalFieldZeroIterationFct
private

Primal solution at zero time step.

Definition at line 550 of file DarcySolverNonLinear.hpp.


The documentation for this class was generated from the following file: