Take initial steps towards including wells in assembly.

Specifically, accept (and currently ignore), a WellCompletions
structure into the constructor, and aggregate all driving forces
(source terms, boundary conditions and all well-related structures)
into an assembler-specific "force" structure.  Accept a pointer to
such a structure into the assemble() function.  Currently ignored
except for source terms.
This commit is contained in:
Bård Skaflestad 2011-11-23 13:20:37 +01:00
parent 9a9b47a49a
commit a1df963169
2 changed files with 37 additions and 13 deletions

View File

@ -125,7 +125,10 @@ impl_deallocate(struct cfs_tpfa_res_impl *pimpl)
/* ---------------------------------------------------------------------- */
static struct cfs_tpfa_res_impl *
impl_allocate(grid_t *G, size_t max_conn, int np)
impl_allocate(grid_t *G ,
struct WellCompletions *wconn ,
size_t max_conn,
int np )
/* ---------------------------------------------------------------------- */
{
size_t nnu, ngconn, nwperf;
@ -137,6 +140,11 @@ impl_allocate(grid_t *G, size_t max_conn, int np)
ngconn = G->cell_facepos[ G->number_of_cells ];
nwperf = 0;
if (wconn != NULL) {
nnu += wconn->number_of_wells;
nwperf = wconn->well_connpos[ wconn->number_of_wells ];
}
/* Linear system */
ddata_sz = nnu; /* b */
@ -708,7 +716,9 @@ cfs_tpfa_res_destroy(struct cfs_tpfa_res_data *h)
/* ---------------------------------------------------------------------- */
struct cfs_tpfa_res_data *
cfs_tpfa_res_construct(grid_t *G, int nphases)
cfs_tpfa_res_construct(grid_t *G ,
struct WellCompletions *wconn ,
int nphases)
/* ---------------------------------------------------------------------- */
{
size_t nc, nf, ngconn;
@ -717,7 +727,7 @@ cfs_tpfa_res_construct(grid_t *G, int nphases)
h = malloc(1 * sizeof *h);
if (h != NULL) {
h->pimpl = impl_allocate(G, maxconn(G), nphases);
h->pimpl = impl_allocate(G, wconn, maxconn(G), nphases);
h->J = construct_matrix(G);
if ((h->pimpl == NULL) || (h->J == NULL)) {
@ -753,8 +763,7 @@ cfs_tpfa_res_construct(grid_t *G, int nphases)
void
cfs_tpfa_res_assemble(grid_t *G,
double dt,
flowbc_t *bc,
struct compr_src *src,
struct cfs_tpfa_res_forces *forces,
const double *zc,
struct compr_quantities_gen *cq,
const double *trans,
@ -785,9 +794,9 @@ cfs_tpfa_res_assemble(grid_t *G,
assemble_cell_contrib(G, c, h);
}
if (src != NULL) {
assert (src->nphases == cq->nphases);
assemble_sources(dt, src, h);
if ((forces != NULL) && (forces->src != NULL)) {
assert (forces->src->nphases == cq->nphases);
assemble_sources(dt, forces->src, h);
}
res_is_neumann = 1;

View File

@ -21,8 +21,6 @@
#define OPM_CFS_TPFA_HEADER_INCLUDED
#include "grid.h"
#include "flow_bc.h"
#include "well.h"
#ifdef __cplusplus
extern "C" {
@ -32,6 +30,22 @@ struct cfs_tpfa_res_impl;
struct CSRMatrix;
struct compr_quantities_gen;
struct compr_src;
struct compr_bc;
struct WellCompletions;
struct WellControls;
struct completion_data;
struct cfs_tpfa_res_wells {
struct WellCompletions *conn;
struct WellControls *ctrl;
struct completion_data *data;
};
struct cfs_tpfa_res_forces {
struct cfs_tpfa_res_wells *W ;
struct compr_bc *bc ;
struct compr_src *src;
};
struct cfs_tpfa_res_data {
struct CSRMatrix *J;
@ -42,7 +56,9 @@ struct cfs_tpfa_res_data {
struct cfs_tpfa_res_data *
cfs_tpfa_res_construct(grid_t *G, int nphases);
cfs_tpfa_res_construct(grid_t *G ,
struct WellCompletions *wconn ,
int nphases);
void
cfs_tpfa_res_destroy(struct cfs_tpfa_res_data *h);
@ -50,8 +66,7 @@ cfs_tpfa_res_destroy(struct cfs_tpfa_res_data *h);
void
cfs_tpfa_res_assemble(grid_t *G,
double dt,
flowbc_t *bc,
struct compr_src *src,
struct cfs_tpfa_res_forces *forces,
const double *zc,
struct compr_quantities_gen *cq,
const double *trans,