hybsys.h
Go to the documentation of this file.
1 /*
2  Copyright 2010 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_HYBSYS_HEADER_INCLUDED
21 #define OPM_HYBSYS_HEADER_INCLUDED
22 
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105 
112 struct hybsys {
113  double *L;
114  double *q;
115  double *F1;
116  double *F2;
117  double *r;
118  double *S;
119  double *one;
120 };
121 
122 
129 struct hybsys_well {
130  double *F1;
131  double *F2;
132  double *r;
134  double *w2r;
135  double *r2w;
136  double *w2w;
138  double *data;
139 };
140 
141 
153 struct hybsys *
154 hybsys_allocate_symm(int max_nconn, int nc, int nconn_tot);
155 
156 
168 struct hybsys *
169 hybsys_allocate_unsymm(int max_nconn, int nc, int nconn_tot);
170 
171 
185 struct hybsys_well *
186 hybsys_well_allocate_symm(int max_nconn, int nc, int *cwpos);
187 
188 
202 struct hybsys_well *
203 hybsys_well_allocate_unsymm(int max_nconn, int nc, int *cwpos);
204 
205 
217 void
218 hybsys_free(struct hybsys *sys);
219 
231 void
232 hybsys_well_free(struct hybsys_well *wsys);
233 
234 
247 void
248 hybsys_init(int max_nconn, struct hybsys *sys);
249 
278 void
279 hybsys_schur_comp_symm(int nc, const int *pconn,
280  const double *Binv, struct hybsys *sys);
281 
282 
316 void
317 hybsys_schur_comp_unsymm(int nc, const int *pconn,
318  const double *Binv, const double *BIV,
319  const double *P, struct hybsys *sys);
320 
321 
356 void
357 hybsys_schur_comp_gen(int nc, const int *pconn,
358  const double *Binv, const double *C2,
359  const double *P, struct hybsys *sys);
360 
394 void
395 hybsys_well_schur_comp_symm(int nc, const int *cwpos,
396  double *WI,
397  struct hybsys *sys,
398  struct hybsys_well *wsys);
399 
433 void
434 hybsys_cellcontrib_symm(int c, int nconn, int p1, int p2,
435  const double *gpress, const double *src,
436  const double *Binv, struct hybsys *sys);
437 
438 
471 void
472 hybsys_cellcontrib_unsymm(int c, int nconn, int p1, int p2,
473  const double *gpress, const double *src,
474  const double *Binv, struct hybsys *sys);
475 
476 
502 void
503 hybsys_well_cellcontrib_symm(int c, int ngconn, int p1,
504  const int *cwpos,
505  const double *WI, const double *wdp,
506  struct hybsys *sys, struct hybsys_well *wsys);
507 
508 
548 void
549 hybsys_compute_press_flux(int nc, const int *pconn, const int *conn,
550  const double *gpress,
551  const double *Binv, const struct hybsys *sys,
552  const double *pi, double *press, double *flux,
553  double *work);
554 
555 
601 void
602 hybsys_compute_press_flux_well(int nc, const int *pgconn, int nf,
603  int nw, const int *pwconn, const int *wconn,
604  const double *Binv,
605  const double *WI,
606  const double *wdp,
607  const struct hybsys *sys,
608  const struct hybsys_well *wsys,
609  const double *pi,
610  double *cpress, double *cflux,
611  double *wpress, double *wflux,
612  double *work);
613 
614 
615 #ifdef __cplusplus
616 }
617 #endif
618 
619 #endif /* OPM_HYBSYS_HEADER_INCLUDED */
double * w2w
Aggregate well-to-well connection strength.
Definition: hybsys.h:136
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 equatio...
Definition: hybsys.c:327
double * r
Data buffer for system right-hand side, single cell.
Definition: hybsys.h:117
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...
Definition: hybsys.c:247
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<->wel...
Definition: hybsys.c:516
double * r2w
Reservoir-to-well connection strength, single cell.
Definition: hybsys.h:135
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’&#39;) t...
Definition: hybsys.c:581
double * L
, all cells
Definition: hybsys.h:113
double * F2
, all cells
Definition: hybsys.h:116
double * data
Linear storage array.
Definition: hybsys.h:138
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 equa...
Definition: hybsys.c:479
double * w2r
Well-to-reservoir connection strength, single cell.
Definition: hybsys.h:134
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...
Definition: hybsys.c:157
double * S
Data buffer system matrix, single cell.
Definition: hybsys.h:118
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 cel...
Definition: hybsys.c:372
double * F2
, all connections.
Definition: hybsys.h:131
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().
Definition: hybsys.c:201
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...
Definition: hybsys.c:632
double * q
, all cells
Definition: hybsys.h:114
void hybsys_init(int max_nconn, struct hybsys *sys)
Perform post-construction dynamic initialisation of system structure obtained from function hybsys_al...
Definition: hybsys.c:234
Elemental contributions (from wells) to block system of simultaneous linear equations.
Definition: hybsys.h:129
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...
Definition: hybsys.c:39
double * one
, single cell
Definition: hybsys.h:119
double * F1
, all cells
Definition: hybsys.h:115
double * r
Data buffer for system right-hand side, single cell.
Definition: hybsys.h:132
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().
Definition: hybsys.c:221
double * F1
, all connections.
Definition: hybsys.h:130
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 equatio...
Definition: hybsys.c:281
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...
Definition: hybsys.c:113
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...
Definition: hybsys.c:69
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 ...
Definition: hybsys.c:496
Elemental contributions (from cells) to block system of simultaneous linear equations.
Definition: hybsys.h:112