My Project
|
Solve mixed formulation of incompressible flow modelled by Darcy's law. More...
#include <IncompFlowSolverHybrid.hpp>
Public Types | |
typedef const FlowSolution & | SolutionType |
Type representing the solution to the problem defined by the parameters to. | |
Public Member Functions | |
template<class Point > | |
void | init (const GridInterface &g, const RockInterface &r, const Point &grav, const BCInterface &bc) |
All-in-one initialization routine. | |
void | clear () |
Clear all topologic, geometric and rock-dependent information currently held in internal data structures. | |
void | initSystemStructure (const GridInterface &g, const BCInterface &bc) |
Compute structure of coefficient matrix in final system of linear equations for this flow problem. | |
template<class Point > | |
void | computeInnerProducts (const RockInterface &r, const Point &grav) |
Compute static (i.e., independent of saturation) parts of the spatially varying inner products ![]() | |
template<class FluidInterface > | |
void | solve (const FluidInterface &r, const std::vector< double > &sat, const BCInterface &bc, const std::vector< double > &src, double residual_tolerance=1e-8, int linsolver_verbosity=1, int linsolver_type=1, bool same_matrix=false, int linsolver_maxit=0, double prolongate_factor=1.6, int smooth_steps=1) |
Construct and solve system of linear equations for the pressure values on each interface/contact between neighbouring grid cells. | |
double | postProcessFluxes () |
Postprocess the solution fluxes. | |
SolutionType | getSolution () |
Recover the solution to the problem defined by the parameters to method. | |
template<typename charT , class traits > | |
void | printStats (std::basic_ostream< charT, traits > &os) |
Print statistics about the connections in the current model. | |
void | printSystem (const std::string &prefix) |
Output current system of linear equations to permanent storage in files. | |
Solve mixed formulation of incompressible flow modelled by Darcy's law.
@f] The solver is based on a hybrid discretization scheme which yields a system of linear equations of the form
=
@f] where
Through a Schur complement analysis, the above system of linear equations is reduced to an equivalent system of the form
=
@f] where
The system
@f] Specifically, the matrix
class, the matrix
The matrix
The code is structured in a manner similar to traditional FEM software implementations. In particular, we assemble the coefficient matrix
where
A final quirk of the implementation is that we always solve for every interface pressure, even if a given pressure value is known through, e.g., a prescribed pressure boundary condition. This feature enables changing the type and value of a set of boundary conditions between pressure solves without having to reconstruct the sparsity structure of the coefficient matrix
The use of non-periodic boundary conditions after periodic connections have been introduced is fully supported. This mode introduces a performance caveat. Specifically, a few entries which would otherwise not have been entered into the matrix due to being automatically zero will become explicit zeros instead. Consequently, each iteration of an iterative solver for the system
The flow solver is initialized in a three-step process. The first step, represented by method
, releases any previously held data in the internal data structures and prepares the solver system for defining a new problem. The second step, represented by the
enumerates the primary degrees of freedom (i.e., the interface pressure values) and determines, and allocates, the coefficient matrix non-zero structure. The third and final step, represented by method
, computes the static (i.e., geology and geomtry-dependent) inner product matrices
is offered separately in order to support solve several different property models on the same underlying geometry (grid). Finally, method
is a convenience method which calls the other initialization methods in sequence.
Following solver intialization, a sequence of flow problems differing only by boundary condition type/value and/or differing fluid saturation values may be resolved by separate calls to the
method. At any time following a call to
may the solution, represented by the type
, to the most recently resolved flow problem be retrieved through the
method. We note that
is always a reference-to-const.
GridInterface | Type presenting an interface to a grid (typically a discretized geological model). The type is assumed to expose a forward iterator type, CellIter
cellbegin()
cellend()
FaceIter
facebegin()
faceend()
|
RockInterface | Type presenting an interface to reservoir properties such as permeability and porosity. The type is assumed to expose a method, permeability()
GridInterface::CellIter
|
BCInterface | Type presenting an interface to boundary conditions. The type is expected to provide a method, flowCond()
BCInterface::FlowBC
|
InnerProduct | Type presenting a specific inner product defining a discretization of the Darcy equation. |
typedef const FlowSolution& Opm::IncompFlowSolverHybrid< GridInterface, RockInterface, BCInterface, InnerProduct >::SolutionType |
Type representing the solution to the problem defined by the parameters to.
. Always a reference-to-const. The
exposes methods
and
from which the cell pressure in cell
and outward-pointing flux across interface
may be recovered.
|
inline |
Clear all topologic, geometric and rock-dependent information currently held in internal data structures.
Release all memory resources in preparation of constructing a solver for a new problem. Method
must be called prior to any other method of the class.
|
inline |
Compute static (i.e., independent of saturation) parts of the spatially varying inner products
This is often a fairly expensive process, so in order to increase the speed of the system assembly we do not wish to perform this computation for each time step unless we have to. Moreover, if the permeability field changes but the grid connections remain static, we do not have to build a new matrix structure but need only compute new values for these static inner products.
[in] | r | The reservoir properties of each grid cell. In method , we only inspect the permeability field of r
|
|
inline |
|
inline |
All-in-one initialization routine.
Enumerates all grid connections, allocates sufficient space, defines the structure of the global system of linear equations for the contact pressures, and computes the permeability dependent inner products for all of the grid's cells.
[in] | g | The grid. |
[in] | r | The reservoir properties of each grid cell. |
[in] | grav | Gravity vector. Its Euclidian two-norm value represents the strength of the gravity field (in units of m/s^2) while its direction is the direction of gravity in the current model. |
[in] | bc | The boundary conditions describing how the current flow problem interacts with the outside world. This is used only for the purpose of introducing additional couplings in the case of periodic boundary conditions. The specific values of the boundary conditions are not inspected in init()
|
|
inline |
Compute structure of coefficient matrix in final system of linear equations for this flow problem.
Allocates all storage needed by the flow solver itself.
[in] | g | The grid. |
[in] | bc | The boundary conditions describing how the current flow problem interacts with the outside world. This is used only for the purpose of introducing additional couplings in the case of periodic boundary conditions. The specific values of the boundary conditions are not inspected in init()
|
|
inline |
Postprocess the solution fluxes.
This method modifies the solution object so that out-fluxes of twin faces (that is, the two faces on a cell-cell intersection) will be made antisymmetric.
|
inline |
Print statistics about the connections in the current model.
This is mostly for debugging purposes and should only rarely be used in client code.
charT | Character type of output stream. |
traits | Character traits of charT
|
os | Output stream into which the statistics will be printed. |
|
inline |
Output current system of linear equations to permanent storage in files.
One file for the coefficient matrix and one file for the right hand side. This is mostly useful whilst debugging the solver and should rarely be used from client code.
The system is stored in a format which is suitable for importing into MATLAB or MATLAB-compatible software. In particular, using the MATLAB
and
functions makes it easy to reconstruct the system of linear equations from within MATLAB.
[in] | prefix | Prefix from which file names for the coefficient matrix and right hand side data are derived. Specifically, the matrix data is output to the file prefix +
"-mat.dat"
prefix + "-rhs.dat"
|
|
inline |
Construct and solve system of linear equations for the pressure values on each interface/contact between neighbouring grid cells.
Recover cell pressure and interface fluxes. Following a call to
method.
FluidInterface | Type presenting an interface to fluid properties such as density, mobility &c. The type is expected to provide methods phaseMobilities()
phaseDensities()
|
[in] | r | The fluid properties of each grid cell. In method solve()
r.phaseMobilities()
phaseDensities() @encode) of each phase.
@param [in] sat
Saturation of primary phase. One scalar value for each
grid cell. This parameter currently limits @code
Solve mixed formulation of incompressible flow modelled by Darcy's law. Definition IncompFlowSolverHybrid.hpp:365 |
[in] | bc | The boundary conditions describing how the current flow problem interacts with the outside world. Method solve()
|
Specifically, the
method is expected to yield a valid
object for which the methods
,
, and
yield valid responses depending on the type of the object.
[in] | src | Explicit source terms. One scalar value for each grid cell representing the rate (in units of m^3/s) of fluid being injected into (>0) or extracted from (<0) a given grid cell. |
[in] | residual_tolerance | Control parameter for iterative linear solver software. The iteration process is terminated when the norm of the linear system residual is less than residual_tolerance
|
[in] | linsolver_verbosity | Control parameter for iterative linear solver software. Verbosity level 0 prints nothing, level 1 prints summary information, level 2 prints data for each iteration. |
[in] | linsolver_type | Control parameter for iterative linear solver software. Type 0 selects a ILU0/CG solver, type 1 selects AMG/CG, type 2 selects KAMG/CG, type 3 selects AMG/CG with fast Gauss-Seidel smoothing |
[in] | linsolver_maxit | maximum iterations allowed |
[in] | prolongate_factor | Factor to scale the prolongated coarse coarse grid correction |
[in] | smooth_steps | Number of smoothing steps to be used for pre and post smoothing in AMG |
[in] | same_matrix | Whether the matrix is the same as in the previous solve. |