Go to the source code of this file.
|
struct cfs_tpfa_res_data * | cfs_tpfa_res_construct (struct UnstructuredGrid *G, struct cfs_tpfa_res_wells *wells, int nphases) |
|
void | cfs_tpfa_res_destroy (struct cfs_tpfa_res_data *h) |
|
int | cfs_tpfa_res_assemble (struct UnstructuredGrid *G, double dt, struct cfs_tpfa_res_forces *forces, const double *zc, struct compr_quantities_gen *cq, const double *trans, const double *gravcap_f, const double *cpress, const double *wpress, const double *porevol, struct cfs_tpfa_res_data *h) |
|
int | cfs_tpfa_res_comprock_assemble (struct UnstructuredGrid *G, double dt, struct cfs_tpfa_res_forces *forces, const double *zc, struct compr_quantities_gen *cq, const double *trans, const double *gravcap_f, const double *cpress, const double *wpress, const double *porevol, const double *porevol0, const double *rock_comp, struct cfs_tpfa_res_data *h) |
|
void | cfs_tpfa_res_flux (struct UnstructuredGrid *G, struct cfs_tpfa_res_forces *forces, int np, const double *trans, const double *pmobc, const double *pmobf, const double *gravcap_f, const double *cpress, const double *wpress, double *fflux, double *wflux) |
|
void | cfs_tpfa_res_fpress (struct UnstructuredGrid *G, int np, const double *htrans, const double *pmobf, const double *gravcap_f, struct cfs_tpfa_res_data *h, const double *cpress, const double *fflux, double *fpress) |
|
◆ cfs_tpfa_res_assemble()
int cfs_tpfa_res_assemble |
( |
struct UnstructuredGrid * |
G, |
|
|
double |
dt, |
|
|
struct cfs_tpfa_res_forces * |
forces, |
|
|
const double * |
zc, |
|
|
struct compr_quantities_gen * |
cq, |
|
|
const double * |
trans, |
|
|
const double * |
gravcap_f, |
|
|
const double * |
cpress, |
|
|
const double * |
wpress, |
|
|
const double * |
porevol, |
|
|
struct cfs_tpfa_res_data * |
h |
|
) |
| |
Assemble system of linear equations by linearising the residual around the current pressure point. Assume incompressible rock (i.e., that the pore-volume is independent of pressure).
The fully assembled system is presented in h->J and h->F and must be solved separately using external software.
- Parameters
-
[in] | G | Grid. |
[in] | dt | Time step size . |
[in] | forces | Driving forces. |
[in] | zc | Component volumes, per pore-volume, at surface conditions for all components in all cells stored consecutively per cell. Array of size G->number_of_cells * cq->nphases . |
[in] | cq | Compressible quantities describing the current fluid state. Fields Ac , dAc , Af , and phasemobf must be valid. |
[in] | trans | Background transmissibilities as defined by function tpfa_trans_compute(). |
[in] | gravcap_f | Discrete gravity and capillary forces. |
[in] | cpress | Cell pressures. One scalar value per grid cell. |
[in] | wpress | Well (bottom-hole) pressures. One scalar value per well. NULL in case of no wells. |
[in] | porevol | Pore-volumes. One (positive) scalar value for each grid cell. |
[in,out] | h | On input-a valid (non-NULL ) assembler obtained from a previous call to constructor function cfs_tpfa_res_construct(). On output-valid assembler that includes the new system of linear equations in its J and F fields. |
- Returns
- 1 if the assembled matrix was adjusted to remove a singularity. This happens if all fluids are incompressible and there are no pressure conditions on wells or boundaries. Otherwise return 0.
◆ cfs_tpfa_res_comprock_assemble()
int cfs_tpfa_res_comprock_assemble |
( |
struct UnstructuredGrid * |
G, |
|
|
double |
dt, |
|
|
struct cfs_tpfa_res_forces * |
forces, |
|
|
const double * |
zc, |
|
|
struct compr_quantities_gen * |
cq, |
|
|
const double * |
trans, |
|
|
const double * |
gravcap_f, |
|
|
const double * |
cpress, |
|
|
const double * |
wpress, |
|
|
const double * |
porevol, |
|
|
const double * |
porevol0, |
|
|
const double * |
rock_comp, |
|
|
struct cfs_tpfa_res_data * |
h |
|
) |
| |
Assemble system of linear equations by linearising the residual around the current pressure point. Assume compressible rock (i.e., that the pore-volume depends on pressure).
The fully assembled system is presented in h->J and h->F and must be solved separately using external software.
- Parameters
-
[in] | G | Grid. |
[in] | dt | Time step size . |
[in] | forces | Driving forces. |
[in] | zc | Component volumes, per pore-volume, at surface conditions for all components in all cells stored consecutively per cell. Array of size G->number_of_cells * cq->nphases . |
[in] | cq | Compressible quantities describing the current fluid state. Fields Ac , dAc , Af , and phasemobf must be valid. |
[in] | trans | Background transmissibilities as defined by function tpfa_trans_compute(). |
[in] | gravcap_f | Discrete gravity and capillary forces. |
[in] | cpress | Cell pressures. One scalar value per grid cell. |
[in] | wpress | Well (bottom-hole) pressures. One scalar value per well. NULL in case of no wells. |
[in] | porevol | Pore-volumes. One (positive) scalar value for each grid cell. |
[in] | porevol0 | Pore-volumes at start of time step (i.e., at time level ). One (positive) scalar value for each grid cell. |
[in] | rock_comp | Rock compressibility. One non-negative scalar for each grid cell. |
[in,out] | h | On input-a valid (non-NULL ) assembler obtained from a previous call to constructor function cfs_tpfa_res_construct(). On output-valid assembler that includes the new system of linear equations in its J and F fields. |
- Returns
- 1 if the assembled matrix was adjusted to remove a singularity. This happens if all fluids are incompressible, the rock is incompressible, and there are no pressure conditions on wells or boundaries. Otherwise return 0.
◆ cfs_tpfa_res_construct()
Construct assembler for system of linear equations.
- Parameters
-
[in] | G | Grid |
[in] | wells | Well description. NULL in case of no wells. For backwards compatibility, the constructor also interprets (wells != NULL) && (wells->W == NULL) as "no wells present", but new code should use wells == NULL to signify "no wells". |
[in] | nphases | Number of active fluid phases in this simulation run. Needed to correctly size various internal work arrays. |
- Returns
- Fully formed assembler structure suitable for forming systems of linear equations using, e.g., function cfs_tpfa_res_assemble().
NULL in case of allocation failure. Must be destroyed using function cfs_tpfa_res_destroy().
◆ cfs_tpfa_res_destroy()
Destroy assembler for system of linear equations.
Disposes of all resources acquired in a previous call to construction function cfs_tpfa_res_construct(). Note that the statement cfs_tpfa_res_destroy(NULL) is supported and benign (i.e., behaves like free(NULL) ).
- Parameters
-
[in,out] | h | On input - assembler obtained through a previous call to construction function cfs_tpfa_res_construct(). On output - invalid pointer. |
◆ cfs_tpfa_res_flux()
void cfs_tpfa_res_flux |
( |
struct UnstructuredGrid * |
G, |
|
|
struct cfs_tpfa_res_forces * |
forces, |
|
|
int |
np, |
|
|
const double * |
trans, |
|
|
const double * |
pmobc, |
|
|
const double * |
pmobf, |
|
|
const double * |
gravcap_f, |
|
|
const double * |
cpress, |
|
|
const double * |
wpress, |
|
|
double * |
fflux, |
|
|
double * |
wflux |
|
) |
| |
Derive interface (total) Darcy fluxes from (converged) pressure solution.
- Parameters
-
[in] | G | Grid |
[in] | forces | Driving forces. Must correspond to those used when forming the system of linear equations, e.g., in the call to function cfs_tpfa_res_assemble(). |
[in] | np | Number of fluid phases (and components). |
[in] | trans | Background transmissibilities as defined by function tpfa_trans_compute(). Must correspond to equally named parameter of the assembly functions. |
[in] | pmobc | Phase mobilities stored consecutively per cell with phase index cycling the most rapidly. Array of size G->number_of_cells * np . |
[in] | pmobf | Phase mobilities stored consecutively per interface with phase index cycling the most rapidly. Array of size G->number_of_faces * np . |
[in] | gravcap_f | Discrete gravity and capillary forces. |
[in] | cpress | Cell pressure values. One (positive) scalar for each grid cell. |
[in] | wpress | Well (bottom-hole) pressure values. One (positive) scalar value for each well. NULL in case of no wells. |
[out] | fflux | Total Darcy interface fluxes. One scalar value for each interface (inter-cell connection). Array of size G->number_of_faces . |
[out] | wflux | Total Darcy well connection fluxes. One scalar value for each well connection (perforation). Array of size forces->wells->W->well_connpos [forces->wells->W->number_of_wells] . |
◆ cfs_tpfa_res_fpress()
void cfs_tpfa_res_fpress |
( |
struct UnstructuredGrid * |
G, |
|
|
int |
np, |
|
|
const double * |
htrans, |
|
|
const double * |
pmobf, |
|
|
const double * |
gravcap_f, |
|
|
struct cfs_tpfa_res_data * |
h, |
|
|
const double * |
cpress, |
|
|
const double * |
fflux, |
|
|
double * |
fpress |
|
) |
| |
Derive interface pressures from (converged) pressure solution.
- Parameters
-
[in] | G | Grid |
[in] | np | Number of fluid phases (and components). |
[in] | htrans | Background one-sided ("half") transmissibilities as defined by function tpfa_htrans_compute(). |
[in] | pmobf | Phase mobilities stored consecutively per interface with phase index cycling the most rapidly. Array of size G->number_of_faces * np . |
[in] | gravcap_f | Discrete gravity and capillary forces. |
[in] | h | System assembler. Must correspond to the assembler state used to form the final system of linear equations from which the converged pressure solution was derived. |
[in] | cpress | Cell pressure values. One (positive) scalar for each grid cell. |
[in] | fflux | Total Darcy interface fluxes. One scalar value for each interface (inter-cell connection). Array of size G->number_of_faces . Typically computed using function cfs_tpfa_res_flux(). |
[out] | fpress | Interface pressure values. One (positive) scalar for each interface. Array of size G->number_of_faces . |
|