Routines and data structures to manage local contributions to a global system of simultaneous linear equations arising from a Schur complement reduction of an original block system. More...
Go to the source code of this file.
Classes | |
struct | hybsys |
Elemental contributions (from cells) to block system of simultaneous linear equations. More... | |
struct | hybsys_well |
Elemental contributions (from wells) to block system of simultaneous linear equations. More... | |
Functions | |
struct hybsys * | hybsys_allocate_symm (int max_nconn, int nc, int nconn_tot) |
Allocate a hybrid system management structure suitable for discretising a symmetric (i.e., incompressible) flow problem on a grid model of given size. More... | |
struct hybsys * | hybsys_allocate_unsymm (int max_nconn, int nc, int nconn_tot) |
Allocate a hybrid system management structure suitable for discretising an unsymmetric (i.e., compressible) flow problem on a grid model of given size. More... | |
struct hybsys_well * | hybsys_well_allocate_symm (int max_nconn, int nc, int *cwpos) |
Allocate a hybrid system management structure suitable for discretising an incompressible (i.e., symmetric) well flow problem on a grid model of given size. More... | |
struct hybsys_well * | hybsys_well_allocate_unsymm (int max_nconn, int nc, int *cwpos) |
Allocate a hybrid system management structure suitable for discretising a compressible (i.e., unsymmetric) well flow problem on a grid model of given size. More... | |
void | hybsys_free (struct hybsys *sys) |
Dispose of memory resources previously obtained through one of the allocation functions, hybsys_allocate_symm() or hybsys_allocate_unsymm(). More... | |
void | hybsys_well_free (struct hybsys_well *wsys) |
Dispose of memory resources previously obtained through one of the allocation functions, hybsys_well_allocate_symm() or hybsys_well_allocate_unsymm(). More... | |
void | hybsys_init (int max_nconn, struct hybsys *sys) |
Perform post-construction dynamic initialisation of system structure obtained from function hybsys_allocate_symm() or hybsys_allocate_unsymm(). More... | |
void | hybsys_schur_comp_symm (int nc, const int *pconn, const double *Binv, struct hybsys *sys) |
Compute elemental (per-cell) contributions to symmetric Schur system of simultaneous linear equations. More... | |
void | hybsys_schur_comp_unsymm (int nc, const int *pconn, const double *Binv, const double *BIV, const double *P, struct hybsys *sys) |
Compute elemental (per-cell) contributions to unsymmetric Schur system of simultaneous linear equations. More... | |
void | hybsys_schur_comp_gen (int nc, const int *pconn, const double *Binv, const double *C2, const double *P, struct hybsys *sys) |
Compute elemental (per-cell) contributions to unsymmetric Schur system of simultaneous linear equations. More... | |
void | hybsys_well_schur_comp_symm (int nc, const int *cwpos, double *WI, struct hybsys *sys, struct hybsys_well *wsys) |
Compute elemental contributions to global, symmetric system of simultaneous linear equations from cell<->well connections. More... | |
void | hybsys_cellcontrib_symm (int c, int nconn, int p1, int p2, const double *gpress, const double *src, const double *Binv, struct hybsys *sys) |
Compute final (symmetric) Schur complement contributions to global system of simultaneous linear equations. More... | |
void | hybsys_cellcontrib_unsymm (int c, int nconn, int p1, int p2, const double *gpress, const double *src, const double *Binv, struct hybsys *sys) |
Compute final (non-symmetric) Schur complement contributions to global system of simultaneous linear equations. More... | |
void | hybsys_well_cellcontrib_symm (int c, int ngconn, int p1, const int *cwpos, const double *WI, const double *wdp, struct hybsys *sys, struct hybsys_well *wsys) |
Form elemental direct contributions to global system of simultaneous linear equations from cell<->well interactions. More... | |
void | hybsys_compute_press_flux (int nc, const int *pconn, const int *conn, const double *gpress, const double *Binv, const struct hybsys *sys, const double *pi, double *press, double *flux, double *work) |
Recover cell pressures and outward fluxes (with respect to cells–i.e., the ``half-face fluxes'') through back substitution after solving a symmetric (i.e., incompressible) Schur complement system of simultaneous linear equations. More... | |
void | hybsys_compute_press_flux_well (int nc, const int *pgconn, int nf, int nw, const int *pwconn, const int *wconn, const double *Binv, const double *WI, const double *wdp, const struct hybsys *sys, const struct hybsys_well *wsys, const double *pi, double *cpress, double *cflux, double *wpress, double *wflux, double *work) |
Recover well pressures (i.e., bottom-hole pressure values) and well connection (perforation) fluxes. More... | |
Routines and data structures to manage local contributions to a global system of simultaneous linear equations arising from a Schur complement reduction of an original block system.
Specifically, these data structures and related routines compute and store the elemental (cell-based) contributions of the Schur complement reduction of the block system of simultaneous linear equations
in which accounts for effects of gravity. The traditional Schurcomplement reduction (block Gaussian elimination) then produces the equivalent system of simultaneous linear equations
Here, the matrix and the right hand side vector
are given by
and the component matrices ,
, and
are given by
In the case of incompressible flow, the matrix is the same as
and
whence the coefficient matrix
of the Schur complement system
is symmetric.
A great deal of simplification arises from the simple characterisation of the and
matrices. Specifically,
and
When viewed in the context of a single cell, then the matrix is, effectively, the identity with the
array simply affecting a finite-element style redistribution (assembly) of the local contributions. This module leverages that property extensively.
struct hybsys* hybsys_allocate_symm | ( | int | max_nconn, |
int | nc, | ||
int | nconn_tot | ||
) |
Allocate a hybrid system management structure suitable for discretising a symmetric (i.e., incompressible) flow problem on a grid model of given size.
[in] | max_nconn | Maximum number of single cell faces. |
[in] | nc | Total number of grid cells. |
[in] | nconn_tot | Aggregate number of cell faces for all cells. |
NULL
in case of allocation failure. struct hybsys* hybsys_allocate_unsymm | ( | int | max_nconn, |
int | nc, | ||
int | nconn_tot | ||
) |
Allocate a hybrid system management structure suitable for discretising an unsymmetric (i.e., compressible) flow problem on a grid model of given size.
[in] | max_nconn | Maximum number of single cell faces. |
[in] | nc | Total number of grid cells. |
[in] | nconn_tot | Aggregate number of cell faces for all cells. |
NULL
in case of allocation failure. void hybsys_cellcontrib_symm | ( | int | c, |
int | nconn, | ||
int | p1, | ||
int | p2, | ||
const double * | gpress, | ||
const double * | src, | ||
const double * | Binv, | ||
struct hybsys * | sys | ||
) |
Compute final (symmetric) Schur complement contributions to global system of simultaneous linear equations.
This function forms the coefficient matrix
and similar right-hand side elemental contributions. These values must be subsequently assembled into the global system using function hybsys_global_assemble_cell() after imposing any applicable boundary conditions.
This function overwrites the fields S
and r
of the hybrid system structure.
[in] | c | Cell for which to compute local contributions. |
[in] | nconn | Number of connections (faces) of cell c . |
[in] | p1 | Start address (into gpress ) of the gravity contributions of cell c . |
[in] | p2 | Start address (into Binv ) of the inverse inner product of cell c . |
[in] | gpress | Gravity contributions of all cells. Must include effects of multiple phases if applicable. |
[in] | src | Explicit source terms for all cells. |
[in] | Binv | Inverse inner products for all cells. Must include effects of multiple phases if applicable. |
[in,out] | sys | Hybrid system management structure allocated using hybsys_allocate_symm() and initialised using hybsys_init() and/or filled using function hybsys_schur_comp_symm() and hybsys_well_schur_comp_symm() if applicable. |
void hybsys_cellcontrib_unsymm | ( | int | c, |
int | nconn, | ||
int | p1, | ||
int | p2, | ||
const double * | gpress, | ||
const double * | src, | ||
const double * | Binv, | ||
struct hybsys * | sys | ||
) |
Compute final (non-symmetric) Schur complement contributions to global system of simultaneous linear equations.
This function forms the coefficient matrix
and similar right-hand side elemental contributions. These values must be subsequently assembled into the global system using function hybsys_global_assemble_cell() after imposing any applicable boundary conditions.
This function overwrites the fields S
and r
of the hybrid system structure.
[in] | c | Cell for which to compute local contributions. |
[in] | nconn | Number of connections (faces) of cell c . |
[in] | p1 | Start address (into gpress ) of the gravity contributions of cell c . |
[in] | p2 | Start address (into Binv ) of the inverse inner product of cell c . |
[in] | gpress | Gravity contributions of all cells. Must include effects of multiple phases if applicable. |
[in] | src | Explicit source terms for all cells. |
[in] | Binv | Inverse inner products for all cells. Must include effects of multiple phases if applicable. |
[in,out] | sys | Hybrid system management structure allocated using hybsys_allocate_symm() and initialised using hybsys_init() and/or filled using functions hybsys_schur_comp_unsymm() or hybsys_schur_comp_gen(). |
void hybsys_compute_press_flux | ( | int | nc, |
const int * | pconn, | ||
const int * | conn, | ||
const double * | gpress, | ||
const double * | Binv, | ||
const struct hybsys * | sys, | ||
const double * | pi, | ||
double * | press, | ||
double * | flux, | ||
double * | work | ||
) |
Recover cell pressures and outward fluxes (with respect to cells–i.e., the ``half-face fluxes'') through back substitution after solving a symmetric (i.e., incompressible) Schur complement system of simultaneous linear equations.
Specifically, given the solution to the global system of simultaneous linear equations,
, that arises as a result of the Schur complement analysis, this function recovers the cell pressures
and outward fluxes
defined by
[in] | nc | Total number of grid cells. |
[in] | pconn | Cell-to-face start pointers. |
[in] | conn | Cell-to-face mapping. |
[in] | gpress | Gravity contributions of all cells. Must coincide with equally named parameter in calls to cell contribution functions such as hybsys_cellcontrib_symm(). |
[in] | Binv | Inverse inner products for all cells. Must coincide with equally named parameter in calls to contribution functions such as hybsys_cellcontrib_symm(). |
[in] | sys | Hybrid system management structure coinciding with equally named parameter in contribution functions such as hybsys_cellcontrib_symm() or hybsys_cellcontrib_unsymm(). |
[in] | pi | Solution (interface/contact pressure) obtained from solving the global system ![]() |
[out] | press | Cell pressures, ![]() nc . |
[out] | flux | Outward interface fluxes, ![]() pconn[nc] . |
[in,out] | work | Scratch array for temporary results. Array of size at least ![]() |
void hybsys_compute_press_flux_well | ( | int | nc, |
const int * | pgconn, | ||
int | nf, | ||
int | nw, | ||
const int * | pwconn, | ||
const int * | wconn, | ||
const double * | Binv, | ||
const double * | WI, | ||
const double * | wdp, | ||
const struct hybsys * | sys, | ||
const struct hybsys_well * | wsys, | ||
const double * | pi, | ||
double * | cpress, | ||
double * | cflux, | ||
double * | wpress, | ||
double * | wflux, | ||
double * | work | ||
) |
Recover well pressures (i.e., bottom-hole pressure values) and well connection (perforation) fluxes.
Specifically, this function performs the same role (i.e., back-substitution) for wells as function hybsys_compute_press_flux() does for grid cells and grid contacts (interfaces).
[in] | nc | Total number of grid cells. |
[in] | pgconn | Cell-to-face start pointers. |
[in] | nf | Total number of grid faces. |
[in] | nw | Total number of wells. |
[in] | pwconn | Cell-to-well start pointers. If nw > 0 , then this parameter must coincide with the cwpos array used in call to hybsys_well_schur_comp_symm(). |
[in] | wconn | Cell-to-well mapping. |
[in] | Binv | Inverse inner products for all cells. Must coincide with equally named parameter in calls to contribution functions such as hybsys_well_cellcontrib_symm(). |
[in] | WI | Peaceman well connection indices. Array of size pwconn[nc] . Must coincide with equally named parameter of contribution function hybsys_well_cellcontrib_symm(). |
[in] | wdp | Well connection gravity pressure adjustments. |
[in] | sys | Hybrid system management structure coinciding with equally named parameter in contribution functions such as hybsys_cellcontrib_symm() and hybsys_well_cellcontrib_symm(). |
[in] | wsys | Hybrid well-system management structure. Must coincide with equally named paramter of contribution function hybsys_well_cellcontrib_symm(). |
[in] | pi | Solution (interface/contact pressure and well BHPs) obtained from solving the global system ![]() |
[in] | cpress | Cell pressures, ![]() |
[in] | cflux | Outward fluxes, ![]() |
[out] | wpress | Well (i.e., bottom-hole) pressures. Array of size nw . |
[out] | wflux | Well connection (perforation) fluxes. Array of size pwconn[nw] . |
[in,out] | work | Scratch array for storing intermediate results. Array of size at least ![]() |
void hybsys_free | ( | struct hybsys * | sys | ) |
Dispose of memory resources previously obtained through one of the allocation functions, hybsys_allocate_symm() or hybsys_allocate_unsymm().
Following a call to hybsys_free(), the input pointer is no longer valid. hybsys_free(NULL)
does nothing.
[in,out] | sys | Previously allocated hybrid system management structure (or NULL ). |
void hybsys_init | ( | int | max_nconn, |
struct hybsys * | sys | ||
) |
Perform post-construction dynamic initialisation of system structure obtained from function hybsys_allocate_symm() or hybsys_allocate_unsymm().
[in] | max_nconn | Maximum number of single cell faces. Must coincide with the equally named parameter of functions hybsys_allocate_symm() or hybsys_allocate_unsymm(). |
[in,out] | sys | Previously allocated hybrid system management structure. |
void hybsys_schur_comp_gen | ( | int | nc, |
const int * | pconn, | ||
const double * | Binv, | ||
const double * | C2, | ||
const double * | P, | ||
struct hybsys * | sys | ||
) |
Compute elemental (per-cell) contributions to unsymmetric Schur system of simultaneous linear equations.
This function assumes that the coefficient matrix of the hybrid system of linear equations is that of the introduction with no additional provisions. In other words, this function assumes that the coefficient matrix is of the form
This function fills the F1
, F2
and L
fields of the management structure.
[in] | nc | Total number of grid cells. |
[in] | pconn | Cell-to-face start pointers. |
[in] | Binv | Inverse inner product results, usually computed using mim_ip_simple_all() and mim_ip_mobility_update(). |
[in] | C2 | Explicit representation of the ![]() ![]() |
[in] | P | Per cell compressible accumulation term. One scalar per cell. |
[in,out] | sys | Hybrid system management structure allocated using hybsys_allocate_symm() and initialised using hybsys_init(). |
void hybsys_schur_comp_symm | ( | int | nc, |
const int * | pconn, | ||
const double * | Binv, | ||
struct hybsys * | sys | ||
) |
Compute elemental (per-cell) contributions to symmetric Schur system of simultaneous linear equations.
This function assumes that the coefficient matrix of the hybrid system of linear equations is that of the introduction with the additional provision that and that
. In other words, this function assumes that the coefficient matrix is of the form
This function fills the F1
and L
fields of the management structure.
[in] | nc | Total number of grid cells. |
[in] | pconn | Cell-to-face start pointers. |
[in] | Binv | Inverse inner product results, usually computed using mim_ip_simple_all() and mim_ip_mobility_update(). |
[in,out] | sys | Hybrid system management structure allocated using hybsys_allocate_symm() and initialised using hybsys_init(). |
void hybsys_schur_comp_unsymm | ( | int | nc, |
const int * | pconn, | ||
const double * | Binv, | ||
const double * | BIV, | ||
const double * | P, | ||
struct hybsys * | sys | ||
) |
Compute elemental (per-cell) contributions to unsymmetric Schur system of simultaneous linear equations.
This function assumes that the coefficient matrix of the hybrid system of linear equations is that of the introduction with the additional provision that . In other words, this function assumes that the coefficient matrix is of the form
This matrix arises in the `` '' phase compressibility formulation of the compressible black-oil model. This function fills the
F1
, F2
and L
fields of the management structure.
[in] | nc | Total number of grid cells. |
[in] | pconn | Cell-to-face start pointers. |
[in] | Binv | Inverse inner product results, usually computed using mim_ip_simple_all() and mim_ip_mobility_update(). |
[in] | BIV | ![]() ![]() |
[in] | P | Per cell compressible accumulation term. One scalar per cell. |
[in,out] | sys | Hybrid system management structure allocated using hybsys_allocate_symm() and initialised using hybsys_init(). |
struct hybsys_well* hybsys_well_allocate_symm | ( | int | max_nconn, |
int | nc, | ||
int * | cwpos | ||
) |
Allocate a hybrid system management structure suitable for discretising an incompressible (i.e., symmetric) well flow problem on a grid model of given size.
[in] | max_nconn | Maximum number of single cell faces. |
[in] | nc | Total number of grid cells. |
[in] | cwpos | Indirection array that defines each cell's connecting wells. Values typically computed using function derive_cell_wells(). |
NULL
in case of allocation failure. struct hybsys_well* hybsys_well_allocate_unsymm | ( | int | max_nconn, |
int | nc, | ||
int * | cwpos | ||
) |
Allocate a hybrid system management structure suitable for discretising a compressible (i.e., unsymmetric) well flow problem on a grid model of given size.
[in] | max_nconn | Maximum number of single cell faces. |
[in] | nc | Total number of grid cells. |
[in] | cwpos | Indirection array that defines each cell's connecting wells. Values typically computed using function derive_cell_wells(). |
NULL
in case of allocation failure. void hybsys_well_cellcontrib_symm | ( | int | c, |
int | ngconn, | ||
int | p1, | ||
const int * | cwpos, | ||
const double * | WI, | ||
const double * | wdp, | ||
struct hybsys * | sys, | ||
struct hybsys_well * | wsys | ||
) |
Form elemental direct contributions to global system of simultaneous linear equations from cell<->well interactions.
Plays a role similar to function hybsys_cellcontrib_symm(), but for wells.
[in] | c | Cell for which to compute cell<->well Schur complement |
[in] | ngconn | Number of inter-cell connections (faces) of cell c . |
[in] | p1 | Start index (into sys->F1 ) of cell c . |
[in] | cwpos | Indirection array that defines each cell's connecting wells. Must coincide with equally named parameter of function hybsys_well_schur_comp_symm(). |
[in] | WI | Peaceman well connection indices. Array of size pwconn[nc] . Must coincide with equally named parameter of contribution function hybsys_well_schur_comp_symm(). |
[in] | wdp | Well connection gravity pressure adjustments. One scalar for each well connection in an array of size pwconn[nc] . |
[in,out] | sys | Hybrid system management structure filled using functions hybsys_schur_comp_unsymm() or hybsys_schur_comp_gen(). |
[in,out] | wsys | Hybrid well-system management structure filled using function hybsys_well_schur_comp_symm(). |
void hybsys_well_free | ( | struct hybsys_well * | wsys | ) |
Dispose of memory resources previously obtained through one of the allocation functions, hybsys_well_allocate_symm() or hybsys_well_allocate_unsymm().
Following a call to hybsys_well_free(), the input pointer is no longer valid. hybsys_well_free(NULL)
does nothing.
[in,out] | wsys | Previously allocated hybrid system management structure (or NULL ). |
void hybsys_well_schur_comp_symm | ( | int | nc, |
const int * | cwpos, | ||
double * | WI, | ||
struct hybsys * | sys, | ||
struct hybsys_well * | wsys | ||
) |
Compute elemental contributions to global, symmetric system of simultaneous linear equations from cell<->well connections.
Specifically, for a well w
intersecting a cell c
, this function computes the elemental contributions
and
and incorporates the contributions into the global system quantities as appropriate.
This function modifies sys->L
and wsys->F1
.
[in] | nc | Total number of grid cells. |
[in] | cwpos | Indirection array that defines each cell's connecting wells. Values typically computed using function derive_cell_wells(). |
[in] | WI | Peaceman well connection indices. Array of size cwpos[nc] . Must incorporate effects of multiple phases (i.e., total mobility) if applicable. |
[in,out] | sys | Hybrid system management structure allocated using hybsys_allocate_symm() and initialised using hybsys_init() and/or filled using function hybsys_schur_comp_symm(). |
[in,out] | wsys | Hybrid well-system management structure obtained from function hybsys_well_allocate_symm(). |