Routines to assist in the formation and assembly of a global system of simultaneous linear equations derived from a Schur complement reduction of an original hybrid block system. More...
#include <opm/core/grid.h>
#include <opm/core/pressure/legacy_well.h>
#include <opm/core/linalg/sparse_sys.h>
Go to the source code of this file.
Functions | |
struct CSRMatrix * | hybsys_define_globconn (struct UnstructuredGrid *G, well_t *W) |
Construct sparse matrix capable of managing a (reduced) hybrid system of simultaneous linear equations with one degree of freedom for each grid interface and each well. More... | |
void | hybsys_global_assemble_cell (int nconn, int *l2g, const double *S, const double *r, struct CSRMatrix *A, double *b) |
Assemble local contributions into global system of simultaneous linear equations. More... | |
void | hybsys_global_assemble_well_sym (int ngconn_tot, int ngconn, const int *gconn, int nwconn, const int *wconn, const double *r2w, const double *w2w, const double *r, struct CSRMatrix *A, double *b) |
Assemble local contributions from single cell's well connections (perforations) into global system of simultaneous linear equations. More... | |
Routines to assist in the formation and assembly of a global system of simultaneous linear equations derived from a Schur complement reduction of an original hybrid block system.
We assume that the original block system of linear equations is given by
in which the block matrices and
are assumed to have a particularly simple structure and the matrix
is block diagonal.
The Schur complement reduction process (a block Gaussian elimination) then produces the following block system of simultaneous linear equations
in which
The component matrices and
are given by
The primary degrees of freedom, , may then be recovered by solving the Schur complement system
from which the derived quantities and
may be computed through a back-substitution process.
The functions in this module assist in the creation of the sparsity pattern of matrix and in the global assembling of values into the matrix
and the right-hand side vector
. Specifically, function hybsys_define_globconn() builds the sparsity pattern of
while functions hybsys_global_assemble_cell() and hybsys_global_assemble_well_sym() perform the task of adding matrix and right-hand side values from local contributions.
Construct sparse matrix capable of managing a (reduced) hybrid system of simultaneous linear equations with one degree of freedom for each grid interface and each well.
The return value is suitable for use in pressure solvers based on Schur-complement reductions such as the mimetic finite-difference or multiscale mixed finite-element classes of discretisations. In typical applications, the matrix will be cleared using function csrmatrix_zero() and then filled using an assembly process similar to the traditional finite-element algorithm.
Functions hybsys_global_assemble_cell() and hybsys_global_assemble_well_sys() may be used to assist such an assembly process.
[in] | G | Grid. |
[in] | W | Well topology. NULL in a model without wells. |
G->number_of_faces
) plus the number of wells (W->number_of_wells
). void hybsys_global_assemble_cell | ( | int | nconn, |
int * | l2g, | ||
const double * | S, | ||
const double * | r, | ||
struct CSRMatrix * | A, | ||
double * | b | ||
) |
Assemble local contributions into global system of simultaneous linear equations.
The contributions will typically have been computed using function hybsys_schur_comp_symm() and function hybsys_cellcontrib_symm() or some of the related functions.
[in] | nconn | Number of cell faces. |
[in] | l2g | Local-to-global mapping of cell's primary degrees of freedom (i.e., the faces). |
[in] | S | Single cell local contribution to global coefficient matrix. An ![]() |
[in] | r | Single cell local contribution to global system right-hand side. An ![]() |
[in,out] | A | Global coefficient matrix (of Schur complement system). |
[in,out] | b | Global system right-hand side (of Schur complement system). |
void hybsys_global_assemble_well_sym | ( | int | ngconn_tot, |
int | ngconn, | ||
const int * | gconn, | ||
int | nwconn, | ||
const int * | wconn, | ||
const double * | r2w, | ||
const double * | w2w, | ||
const double * | r, | ||
struct CSRMatrix * | A, | ||
double * | b | ||
) |
Assemble local contributions from single cell's well connections (perforations) into global system of simultaneous linear equations.
This function assumes that the connection strength from cell to well equals the connection strength from well to cell. In other words, that the numerical values of the well contributions are symmetric.
The contributions are typically computed using functions hybsys_well_schur_comp_symm() and hybsys_well_cellcontrib_symm().
[in] | ngconn_tot | Total number of grid connections. Expected to equal G->number_of_faces when G is the grid used to form the original matrix in hybsys_define_globconn(). |
[in] | ngconn | Number of grid connections referenced by given cell. |
[in] | gconn | Actual grid connections (DOFs) referenced by given cell. Pointer to ngconn consecutive DOF indices. |
[in] | nwconn | Number of well connections intersecting given cell. Typically ![]() |
[in] | wconn | Actual well connections (DOFs) intersecting given cell. Pointer to nwconn consecutive DOF indices. |
[in] | r2w | Reservoir-to-well connection strengths. |
[in] | w2w | Well-to-well-connection strenghts. |
[in] | r | Single cell local contribution to global system right-hand side. An ![]() |
[in,out] | A | Global coefficient matrix (of Schur complement system). |
[in,out] | b | Global system right-hand side (of Schur complement system). |