1) Move extra fields found in struct CornerpointGrid into struct UnstructuredGrid.

2) Remove typedef grid_t
3) Remove struct CornerpointGrid.
4) handle fallout.
This commit is contained in:
Jostein R. Natvig 2012-02-01 14:56:38 +01:00
parent e577b74a48
commit fb99d7bdaf
32 changed files with 254 additions and 260 deletions

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2010 SINTEF ICT, Applied Mathematics. Copyright 2010, 2011, 2012 SINTEF ICT, Applied Mathematics.
This file is part of the Open Porous Media project (OPM). This file is part of the Open Porous Media project (OPM).
@ -48,11 +48,14 @@ struct UnstructuredGrid {
double *cell_centroids; double *cell_centroids;
double *cell_volumes; double *cell_volumes;
int *global_cell;
int cartdims[3];
int *cell_facetag;
}; };
typedef struct UnstructuredGrid grid_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -82,7 +82,7 @@ cfsh_assemble_grid(flowbc_t *bc,
* the well connections represented by 'W'. */ * the well connections represented by 'W'. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct fsh_data * struct fsh_data *
cfsh_construct(grid_t *G, well_t *W) cfsh_construct(struct UnstructuredGrid *G, well_t *W)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int nc, ngconn_tot; int nc, ngconn_tot;

View File

@ -38,7 +38,7 @@
* substitution process, projected half-contact fluxes. */ * substitution process, projected half-contact fluxes. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
fsh_press_flux(grid_t *G, fsh_press_flux(struct UnstructuredGrid *G,
const double *Binv, const double *gpress, const double *Binv, const double *gpress,
struct fsh_data *h, struct fsh_data *h,
double *cpress, double *fflux, double *cpress, double *fflux,

View File

@ -72,7 +72,7 @@ fsh_destroy(struct fsh_data *h);
* given grid and well pattern. * given grid and well pattern.
*/ */
struct fsh_data * struct fsh_data *
cfsh_construct(grid_t *G, well_t *W); cfsh_construct(struct UnstructuredGrid *G, well_t *W);
@ -102,7 +102,7 @@ cfsh_assemble(flowbc_t *bc,
* @param W The wells * @param W The wells
*/ */
struct fsh_data * struct fsh_data *
ifsh_construct(grid_t *G, well_t *W); ifsh_construct(struct UnstructuredGrid *G, well_t *W);
@ -161,7 +161,7 @@ ifsh_assemble(flowbc_t *bc,
* @param wflux[out] \TODO * @param wflux[out] \TODO
*/ */
void void
fsh_press_flux(grid_t *G, fsh_press_flux(struct UnstructuredGrid *G,
const double *Binv, const double *gpress, const double *Binv, const double *gpress,
struct fsh_data *h, struct fsh_data *h,
double *cpress, double *fflux, double *cpress, double *fflux,

View File

@ -136,7 +136,7 @@ fsh_impl_allocate_basic(size_t idata_sz, size_t ddata_sz)
/* Determine nnz (=sum(diff(facePos)^2)) and max(diff(facePos) for grid */ /* Determine nnz (=sum(diff(facePos)^2)) and max(diff(facePos) for grid */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
fsh_count_grid_dof(grid_t *G, int *max_ngdof, size_t *sum_ngdof2) fsh_count_grid_dof(struct UnstructuredGrid *G, int *max_ngdof, size_t *sum_ngdof2)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int c, n; int c, n;
@ -243,7 +243,7 @@ fsh_define_linsys_arrays(struct fsh_data *h)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
fsh_compute_table_sz(grid_t *G, well_t *W, int max_ngconn, fsh_compute_table_sz(struct UnstructuredGrid *G, well_t *W, int max_ngconn,
size_t *nnu, size_t *idata_sz, size_t *ddata_sz) size_t *nnu, size_t *idata_sz, size_t *ddata_sz)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {

View File

@ -54,7 +54,7 @@ struct fsh_impl *
fsh_impl_allocate_basic(size_t idata_sz, size_t ddata_sz); fsh_impl_allocate_basic(size_t idata_sz, size_t ddata_sz);
void void
fsh_count_grid_dof(grid_t *G, int *max_ngdof, size_t *sum_ngdof2); fsh_count_grid_dof(struct UnstructuredGrid *G, int *max_ngdof, size_t *sum_ngdof2);
int int
fsh_impose_bc(int ndof, fsh_impose_bc(int ndof,
@ -77,7 +77,7 @@ void
fsh_define_linsys_arrays(struct fsh_data *h); fsh_define_linsys_arrays(struct fsh_data *h);
void void
fsh_compute_table_sz(grid_t *G, well_t *W, int max_ngconn, fsh_compute_table_sz(struct UnstructuredGrid *G, well_t *W, int max_ngconn,
size_t *nnu, size_t *idata_sz, size_t *ddata_sz); size_t *nnu, size_t *idata_sz, size_t *ddata_sz);
#endif /* OPM_FSH_COMMON_IMPL_HEADER_INCLUDED */ #endif /* OPM_FSH_COMMON_IMPL_HEADER_INCLUDED */

View File

@ -247,7 +247,7 @@ ifsh_assemble_well(flowbc_t *bc,
* the well connections represented by 'W'. */ * the well connections represented by 'W'. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct fsh_data * struct fsh_data *
ifsh_construct(grid_t *G, well_t *W) ifsh_construct(struct UnstructuredGrid *G, well_t *W)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int nc, ngconn_tot; int nc, ngconn_tot;

View File

@ -59,7 +59,7 @@ deallocate_well_dofset(size_t nw, struct hash_set **wia)
* successful and NULL otherwise. */ * successful and NULL otherwise. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct hash_set ** static struct hash_set **
allocate_well_dofset(grid_t *G, well_t *W) allocate_well_dofset(struct UnstructuredGrid *G, well_t *W)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int w, i, c, ok; int w, i, c, ok;
@ -100,7 +100,7 @@ allocate_well_dofset(grid_t *G, well_t *W)
* if applicable. */ * if applicable. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
count_conn_per_row_grid(grid_t *G, struct CSRMatrix *A) count_conn_per_row_grid(struct UnstructuredGrid *G, struct CSRMatrix *A)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int c, nc, *ia, *ja; int c, nc, *ia, *ja;
@ -132,7 +132,7 @@ count_conn_per_row_grid(grid_t *G, struct CSRMatrix *A)
* Returns 1 if successful, and zero otherwise. */ * Returns 1 if successful, and zero otherwise. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int static int
count_conn_per_row_well(grid_t *G, well_t *W, count_conn_per_row_well(struct UnstructuredGrid *G, well_t *W,
int *cwpos, int *cwpos,
int *cwells, int *cwells,
struct hash_set **wia, struct hash_set **wia,
@ -201,7 +201,7 @@ fill_self_connections(struct CSRMatrix *A)
/* Fill self-to-other DOF connections (i.e., define 'ja') for grid. */ /* Fill self-to-other DOF connections (i.e., define 'ja') for grid. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
fill_grid_connections(grid_t *G, struct CSRMatrix *A) fill_grid_connections(struct UnstructuredGrid *G, struct CSRMatrix *A)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int c, i, j, n; int c, i, j, n;
@ -269,7 +269,7 @@ fill_well_connections(int nf, int nw,
* otherwise. */ * otherwise. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct CSRMatrix * struct CSRMatrix *
hybsys_define_globconn(grid_t *G, well_t *W) hybsys_define_globconn(struct UnstructuredGrid *G, well_t *W)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int nw, ok; int nw, ok;

View File

@ -29,7 +29,7 @@ extern "C" {
#include <opm/core/linalg/sparse_sys.h> #include <opm/core/linalg/sparse_sys.h>
struct CSRMatrix * struct CSRMatrix *
hybsys_define_globconn(grid_t *G, well_t *W); hybsys_define_globconn(struct UnstructuredGrid *G, well_t *W);
void void

View File

@ -196,7 +196,7 @@ bf_asm_data_deallocate(struct bf_asm_data *data)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct bf_asm_data * static struct bf_asm_data *
bf_asm_data_allocate(grid_t *g, bf_asm_data_allocate(struct UnstructuredGrid *g,
struct coarse_sys_meta *m) struct coarse_sys_meta *m)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
@ -463,7 +463,7 @@ coarse_sys_meta_fill(int nc, const int *pgconn,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct coarse_sys_meta * static struct coarse_sys_meta *
coarse_sys_meta_construct(grid_t *g, const int *p, coarse_sys_meta_construct(struct UnstructuredGrid *g, const int *p,
struct coarse_topology *ct) struct coarse_topology *ct)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
@ -489,7 +489,7 @@ coarse_sys_meta_construct(grid_t *g, const int *p,
#if USE_MIM_IP_SIMPLE #if USE_MIM_IP_SIMPLE
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static double * static double *
compute_fs_ip(grid_t *g, const double *perm, compute_fs_ip(struct UnstructuredGrid *g, const double *perm,
const struct coarse_sys_meta *m) const struct coarse_sys_meta *m)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
@ -511,7 +511,7 @@ compute_fs_ip(grid_t *g, const double *perm,
#include <opm/core/pressure/tpfa/trans_tpfa.h> #include <opm/core/pressure/tpfa/trans_tpfa.h>
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static double * static double *
compute_fs_ip(grid_t *g, const double *perm, compute_fs_ip(struct UnstructuredGrid *g, const double *perm,
const struct coarse_sys_meta *m) const struct coarse_sys_meta *m)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
@ -674,7 +674,7 @@ normalize_weighting(size_t nc, size_t nb, const int *p, double *w)
* Returns valid ponter if successful and NULL if not. */ * Returns valid ponter if successful and NULL if not. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static double * static double *
coarse_weight(grid_t *g, size_t nb, coarse_weight(struct UnstructuredGrid *g, size_t nb,
const int *p, const int *p,
struct coarse_sys_meta *m, struct coarse_sys_meta *m,
const double *perm, const double *src) const double *perm, const double *src)
@ -926,7 +926,7 @@ set_csys_block_pointers(struct coarse_topology *ct,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int static int
enumerate_local_dofs(size_t cf, enumerate_local_dofs(size_t cf,
grid_t *g , struct UnstructuredGrid *g ,
struct coarse_topology *ct, struct coarse_topology *ct,
struct coarse_sys_meta *m) struct coarse_sys_meta *m)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -970,7 +970,7 @@ enumerate_local_dofs(size_t cf,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
unenumerate_local_dofs(size_t cf, unenumerate_local_dofs(size_t cf,
grid_t *g , struct UnstructuredGrid *g ,
struct coarse_topology *ct, struct coarse_topology *ct,
struct coarse_sys_meta *m) struct coarse_sys_meta *m)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -1004,7 +1004,7 @@ unenumerate_local_dofs(size_t cf,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
linearise_local_dof(size_t cf, linearise_local_dof(size_t cf,
grid_t *g , struct UnstructuredGrid *g ,
struct coarse_topology *ct, struct coarse_topology *ct,
struct coarse_sys_meta *m , struct coarse_sys_meta *m ,
struct bf_asm_data *bf_asm) struct bf_asm_data *bf_asm)
@ -1123,7 +1123,7 @@ define_csr_sparsity(size_t nc, size_t m, struct bf_asm_data *bf_asm)
static void static void
assemble_local_system(size_t cf , assemble_local_system(size_t cf ,
size_t nlocf, size_t nlocf,
grid_t *g , struct UnstructuredGrid *g ,
const double *Binv , const double *Binv ,
double *w , double *w ,
struct coarse_topology *ct , struct coarse_topology *ct ,
@ -1212,7 +1212,7 @@ Binv_scale_mobility(int nc, struct coarse_sys_meta *m,
* field. */ * field. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
symmetrise_flux(size_t cf, grid_t *g, struct coarse_topology *ct, symmetrise_flux(size_t cf, struct UnstructuredGrid *g, struct coarse_topology *ct,
struct coarse_sys_meta *m, struct bf_asm_data *bf_asm) struct coarse_sys_meta *m, struct bf_asm_data *bf_asm)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
@ -1303,7 +1303,7 @@ symmetrise_flux(size_t cf, grid_t *g, struct coarse_topology *ct,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
solve_local_system(size_t cf , solve_local_system(size_t cf ,
grid_t *g , struct UnstructuredGrid *g ,
const double *Binv , const double *Binv ,
struct coarse_topology *ct , struct coarse_topology *ct ,
struct coarse_sys_meta *m , struct coarse_sys_meta *m ,
@ -1420,7 +1420,7 @@ store_basis_function(size_t cf ,
* NULL if not. */ * NULL if not. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct coarse_sys * struct coarse_sys *
coarse_sys_construct(grid_t *g, const int *p, coarse_sys_construct(struct UnstructuredGrid *g, const int *p,
struct coarse_topology *ct, struct coarse_topology *ct,
const double *perm, const double *perm,
const double *src, const double *src,
@ -1798,7 +1798,7 @@ coarse_sys_compute_Binv(int nb,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
coarse_sys_compute_fs_flux(grid_t *G, coarse_sys_compute_fs_flux(struct UnstructuredGrid *G,
struct coarse_topology *ct, struct coarse_topology *ct,
struct coarse_sys *sys, struct coarse_sys *sys,
const int *b2c_pos, const int *b2c_pos,

View File

@ -51,7 +51,7 @@ typedef void (*LocalSolver)(struct CSRMatrix *A,
double *x); double *x);
struct coarse_sys * struct coarse_sys *
coarse_sys_construct(grid_t *g, const int *p, coarse_sys_construct(struct UnstructuredGrid *g, const int *p,
struct coarse_topology *ct, struct coarse_topology *ct,
const double *perm, const double *perm,
const double *src, const double *src,
@ -81,7 +81,7 @@ coarse_sys_compute_Binv(int nb,
double *work); double *work);
void void
coarse_sys_compute_fs_flux(grid_t *g, coarse_sys_compute_fs_flux(struct UnstructuredGrid *g,
struct coarse_topology *ct, struct coarse_topology *ct,
struct coarse_sys *sys, struct coarse_sys *sys,
const int *b2c_pos, const int *b2c_pos,

View File

@ -145,7 +145,7 @@ count_blkdof(struct ifsh_ms_impl *pimpl)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int static int
ifsh_ms_vectors_construct(grid_t *G, struct ifsh_ms_impl *pimpl) ifsh_ms_vectors_construct(struct UnstructuredGrid *G, struct ifsh_ms_impl *pimpl)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
size_t nb, n_fs_gconn; size_t nb, n_fs_gconn;
@ -186,7 +186,7 @@ ifsh_ms_vectors_construct(grid_t *G, struct ifsh_ms_impl *pimpl)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
set_impl_pointers(grid_t *G, struct ifsh_ms_data *h) set_impl_pointers(struct UnstructuredGrid *G, struct ifsh_ms_data *h)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
size_t nb, n_fs_gconn; size_t nb, n_fs_gconn;
@ -289,7 +289,7 @@ ifsh_ms_matrix_construct(size_t m, size_t nnz, size_t nb,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct ifsh_ms_impl * static struct ifsh_ms_impl *
ifsh_ms_impl_construct(grid_t *G , ifsh_ms_impl_construct(struct UnstructuredGrid *G ,
const int *p , const int *p ,
const double *perm , const double *perm ,
const double *src , const double *src ,
@ -373,7 +373,7 @@ average_flux(size_t nf, const int *N, double *flux) /* Poor name */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct ifsh_ms_data * struct ifsh_ms_data *
ifsh_ms_construct(grid_t *G , ifsh_ms_construct(struct UnstructuredGrid *G ,
const int *p , const int *p ,
const double *perm , const double *perm ,
const double *src , const double *src ,
@ -494,7 +494,7 @@ ifsh_ms_assemble(const double *src ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
ifsh_ms_press_flux(grid_t *G, struct ifsh_ms_data *h, ifsh_ms_press_flux(struct UnstructuredGrid *G, struct ifsh_ms_data *h,
double *cpress, double *fflux) double *cpress, double *fflux)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {

View File

@ -44,7 +44,7 @@ struct ifsh_ms_data {
struct ifsh_ms_data * struct ifsh_ms_data *
ifsh_ms_construct(grid_t *G, ifsh_ms_construct(struct UnstructuredGrid *G,
const int *p, const int *p,
const double *perm, const double *perm,
const double *src, const double *src,
@ -60,7 +60,7 @@ ifsh_ms_assemble(const double *src,
struct ifsh_ms_data *h); struct ifsh_ms_data *h);
void void
ifsh_ms_press_flux(grid_t *G, struct ifsh_ms_data *h, ifsh_ms_press_flux(struct UnstructuredGrid *G, struct ifsh_ms_data *h,
double *cpress, double *fflux); double *cpress, double *fflux);

View File

@ -78,7 +78,7 @@ deallocate_densrat(struct densrat_util *ratio)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct densrat_util * static struct densrat_util *
allocate_densrat(grid_t *g, well_t *w, int np) allocate_densrat(struct UnstructuredGrid *g, well_t *w, int np)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int ntotperf; int ntotperf;
@ -137,7 +137,7 @@ impl_deallocate(struct cfs_tpfa_impl *pimpl)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct cfs_tpfa_impl * static struct cfs_tpfa_impl *
impl_allocate(grid_t *G, well_t *W, int np) impl_allocate(struct UnstructuredGrid *G, well_t *W, int np)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
size_t nnu, ngconn, nwperf; size_t nnu, ngconn, nwperf;
@ -189,7 +189,7 @@ impl_allocate(grid_t *G, well_t *W, int np)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct CSRMatrix * static struct CSRMatrix *
construct_matrix(grid_t *G, well_t *W) construct_matrix(struct UnstructuredGrid *G, well_t *W)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int f, c1, c2, w, i, nc, nnu; int f, c1, c2, w, i, nc, nnu;
@ -281,7 +281,7 @@ construct_matrix(grid_t *G, well_t *W)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
solve_cellsys_core(grid_t *G , solve_cellsys_core(struct UnstructuredGrid *G ,
size_t sz , size_t sz ,
const double *Ac , const double *Ac ,
const double *bf , const double *bf ,
@ -359,7 +359,7 @@ small_matvec(size_t n,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
solve_cellsys(grid_t *G , solve_cellsys(struct UnstructuredGrid *G ,
size_t sz, size_t sz,
const double *Ac, const double *Ac,
const double *bf, const double *bf,
@ -373,7 +373,7 @@ solve_cellsys(grid_t *G ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
set_dynamic_trans(grid_t *G , set_dynamic_trans(struct UnstructuredGrid *G ,
const double *trans, const double *trans,
struct compr_quantities *cq , struct compr_quantities *cq ,
struct densrat_util *ratio) struct densrat_util *ratio)
@ -391,7 +391,7 @@ set_dynamic_trans(grid_t *G ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
set_dynamic_grav(grid_t *G , set_dynamic_grav(struct UnstructuredGrid *G ,
flowbc_t *bc , flowbc_t *bc ,
const double *trans , const double *trans ,
const double *gravcap_f, const double *gravcap_f,
@ -460,7 +460,7 @@ set_dynamic_grav_well(well_t *W,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
sum_phase_contrib(grid_t *G , sum_phase_contrib(struct UnstructuredGrid *G ,
size_t sz , size_t sz ,
const double *xcf, const double *xcf,
double *sum) double *sum)
@ -485,7 +485,7 @@ sum_phase_contrib(grid_t *G ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
compute_densrat_update(grid_t *G , compute_densrat_update(struct UnstructuredGrid *G ,
struct compr_quantities *cq , struct compr_quantities *cq ,
struct densrat_util *ratio, struct densrat_util *ratio,
double *q) double *q)
@ -558,7 +558,7 @@ compute_densrat_update_well(well_t *W ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
compute_psys_contrib(grid_t *G, compute_psys_contrib(struct UnstructuredGrid *G,
well_t *W, well_t *W,
struct completion_data *wdata, struct completion_data *wdata,
flowbc_t *bc, flowbc_t *bc,
@ -627,7 +627,7 @@ compute_psys_contrib(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int static int
assemble_cell_contrib(grid_t *G, assemble_cell_contrib(struct UnstructuredGrid *G,
flowbc_t *bc, flowbc_t *bc,
const double *src, const double *src,
struct cfs_tpfa_data *h) struct cfs_tpfa_data *h)
@ -734,7 +734,7 @@ assemble_well_contrib(size_t nc,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
compute_fpress(grid_t *G, compute_fpress(struct UnstructuredGrid *G,
flowbc_t *bc, flowbc_t *bc,
int np, int np,
const double *htrans, const double *htrans,
@ -790,7 +790,7 @@ compute_fpress(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
compute_flux(grid_t *G, compute_flux(struct UnstructuredGrid *G,
flowbc_t *bc, flowbc_t *bc,
int np, int np,
const double *trans, const double *trans,
@ -896,7 +896,7 @@ is_incompr(int nc, struct compr_quantities *cq)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct cfs_tpfa_data * struct cfs_tpfa_data *
cfs_tpfa_construct(grid_t *G, well_t *W, int nphases) cfs_tpfa_construct(struct UnstructuredGrid *G, well_t *W, int nphases)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
size_t nc, nf, ngconn, nwconn; size_t nc, nf, ngconn, nwconn;
@ -950,7 +950,7 @@ cfs_tpfa_construct(grid_t *G, well_t *W, int nphases)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_assemble(grid_t *G, cfs_tpfa_assemble(struct UnstructuredGrid *G,
double dt, double dt,
well_t *W, well_t *W,
flowbc_t *bc, flowbc_t *bc,
@ -992,7 +992,7 @@ cfs_tpfa_assemble(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_press_flux(grid_t *G, cfs_tpfa_press_flux(struct UnstructuredGrid *G,
flowbc_t *bc, flowbc_t *bc,
well_t *W, well_t *W,
int np, int np,
@ -1027,7 +1027,7 @@ cfs_tpfa_press_flux(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_fpress(grid_t *G, cfs_tpfa_fpress(struct UnstructuredGrid *G,
flowbc_t *bc, flowbc_t *bc,
int np, int np,
const double *htrans, const double *htrans,
@ -1046,7 +1046,7 @@ cfs_tpfa_fpress(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_retrieve_masstrans(grid_t *G, cfs_tpfa_retrieve_masstrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_data *h, struct cfs_tpfa_data *h,
double *masstrans_f) double *masstrans_f)
@ -1059,7 +1059,7 @@ cfs_tpfa_retrieve_masstrans(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_retrieve_gravtrans(grid_t *G, cfs_tpfa_retrieve_gravtrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_data *h, struct cfs_tpfa_data *h,
double *gravtrans_f) double *gravtrans_f)
@ -1073,7 +1073,7 @@ cfs_tpfa_retrieve_gravtrans(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static double static double
cfs_tpfa_impes_maxtime_cell(int c, cfs_tpfa_impes_maxtime_cell(int c,
grid_t *G, struct UnstructuredGrid *G,
struct compr_quantities *cq, struct compr_quantities *cq,
const double *trans, const double *trans,
const double *porevol, const double *porevol,
@ -1189,7 +1189,7 @@ cfs_tpfa_impes_maxtime_cell(int c,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double double
cfs_tpfa_impes_maxtime(grid_t *G, cfs_tpfa_impes_maxtime(struct UnstructuredGrid *G,
struct compr_quantities *cq, struct compr_quantities *cq,
const double *trans, const double *trans,
const double *porevol, const double *porevol,
@ -1216,7 +1216,7 @@ cfs_tpfa_impes_maxtime(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_expl_mass_transport(grid_t *G, cfs_tpfa_expl_mass_transport(struct UnstructuredGrid *G,
well_t *W, well_t *W,
struct completion_data *wdata, struct completion_data *wdata,
int np, int np,

View File

@ -42,10 +42,10 @@ struct cfs_tpfa_data {
struct cfs_tpfa_data * struct cfs_tpfa_data *
cfs_tpfa_construct(grid_t *G, well_t *W, int nphases); cfs_tpfa_construct(struct UnstructuredGrid *G, well_t *W, int nphases);
void void
cfs_tpfa_assemble(grid_t *G, cfs_tpfa_assemble(struct UnstructuredGrid *G,
double dt, double dt,
well_t *W, well_t *W,
flowbc_t *bc, flowbc_t *bc,
@ -60,7 +60,7 @@ cfs_tpfa_assemble(grid_t *G,
struct cfs_tpfa_data *h); struct cfs_tpfa_data *h);
void void
cfs_tpfa_press_flux(grid_t *G, cfs_tpfa_press_flux(struct UnstructuredGrid *G,
flowbc_t *bc, flowbc_t *bc,
well_t *W, well_t *W,
int np, int np,
@ -75,7 +75,7 @@ cfs_tpfa_press_flux(grid_t *G,
double *wflux); double *wflux);
void void
cfs_tpfa_fpress(grid_t *G, cfs_tpfa_fpress(struct UnstructuredGrid *G,
flowbc_t *bc, flowbc_t *bc,
int np, int np,
const double *htrans, const double *htrans,
@ -87,19 +87,19 @@ cfs_tpfa_fpress(grid_t *G,
double *fpress); double *fpress);
void void
cfs_tpfa_retrieve_masstrans(grid_t *G, cfs_tpfa_retrieve_masstrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_data *h, struct cfs_tpfa_data *h,
double *masstrans_f); double *masstrans_f);
void void
cfs_tpfa_retrieve_gravtrans(grid_t *G, cfs_tpfa_retrieve_gravtrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_data *h, struct cfs_tpfa_data *h,
double *gravtrans_f); double *gravtrans_f);
double double
cfs_tpfa_impes_maxtime(grid_t *G, cfs_tpfa_impes_maxtime(struct UnstructuredGrid *G,
struct compr_quantities *cq, struct compr_quantities *cq,
const double *trans, const double *trans,
const double *porevol, const double *porevol,
@ -109,7 +109,7 @@ cfs_tpfa_impes_maxtime(grid_t *G,
const double *gravity); const double *gravity);
void void
cfs_tpfa_expl_mass_transport(grid_t *G, cfs_tpfa_expl_mass_transport(struct UnstructuredGrid *G,
well_t *W, well_t *W,
struct completion_data *wdata, struct completion_data *wdata,
int np, int np,

View File

@ -128,7 +128,7 @@ impl_deallocate(struct cfs_tpfa_res_impl *pimpl)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct cfs_tpfa_res_impl * static struct cfs_tpfa_res_impl *
impl_allocate(grid_t *G , impl_allocate(struct UnstructuredGrid *G ,
struct WellCompletions *wconn , struct WellCompletions *wconn ,
size_t max_conn, size_t max_conn,
int np ) int np )
@ -181,7 +181,7 @@ impl_allocate(grid_t *G ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct CSRMatrix * static struct CSRMatrix *
construct_matrix(grid_t *G, struct WellCompletions *wconn) construct_matrix(struct UnstructuredGrid *G, struct WellCompletions *wconn)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int f, c1, c2, w, i, nc, nnu; int f, c1, c2, w, i, nc, nnu;
@ -362,7 +362,7 @@ compute_darcyflux_and_deriv(int np,
static void static void
compute_compflux_and_deriv(grid_t *G , compute_compflux_and_deriv(struct UnstructuredGrid *G ,
int np , int np ,
const double *cpress, const double *cpress,
const double *trans , const double *trans ,
@ -459,7 +459,7 @@ compute_well_compflux_and_deriv(struct cfs_tpfa_res_wells *W ,
static int static int
count_internal_conn(grid_t *G, int c) count_internal_conn(struct UnstructuredGrid *G, int c)
{ {
int c1, c2, f, i, nconn; int c1, c2, f, i, nconn;
@ -478,7 +478,7 @@ count_internal_conn(grid_t *G, int c)
static int static int
init_cell_contrib(grid_t *G , init_cell_contrib(struct UnstructuredGrid *G ,
int c , int c ,
int np , int np ,
double pvol , double pvol ,
@ -526,7 +526,7 @@ init_cell_contrib(grid_t *G ,
static void static void
compute_cell_contrib(grid_t *G , compute_cell_contrib(struct UnstructuredGrid *G ,
int c , int c ,
int np , int np ,
double pvol , double pvol ,
@ -621,7 +621,7 @@ assemble_sources(double dt ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int static int
assemble_cell_contrib(grid_t *G, assemble_cell_contrib(struct UnstructuredGrid *G,
int c, int c,
struct cfs_tpfa_res_data *h) struct cfs_tpfa_res_data *h)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -878,7 +878,7 @@ assemble_well_contrib(struct cfs_tpfa_res_wells *W ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
compute_fpress(grid_t *G, compute_fpress(struct UnstructuredGrid *G,
int np, int np,
const double *htrans, const double *htrans,
const double *pmobf, const double *pmobf,
@ -935,7 +935,7 @@ compute_fpress(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
compute_flux(grid_t *G, compute_flux(struct UnstructuredGrid *G,
int np, int np,
const double *trans, const double *trans,
const double *pmobf, const double *pmobf,
@ -1020,7 +1020,7 @@ compute_wflux(int np ,
static size_t static size_t
maxconn(grid_t *G) maxconn(struct UnstructuredGrid *G)
{ {
int c; int c;
size_t m, n; size_t m, n;
@ -1056,7 +1056,7 @@ cfs_tpfa_res_destroy(struct cfs_tpfa_res_data *h)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct cfs_tpfa_res_data * struct cfs_tpfa_res_data *
cfs_tpfa_res_construct(grid_t *G , cfs_tpfa_res_construct(struct UnstructuredGrid *G ,
struct WellCompletions *wconn , struct WellCompletions *wconn ,
int nphases) int nphases)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -1111,7 +1111,7 @@ cfs_tpfa_res_construct(grid_t *G ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_res_assemble(grid_t *G, cfs_tpfa_res_assemble(struct UnstructuredGrid *G,
double dt, double dt,
struct cfs_tpfa_res_forces *forces, struct cfs_tpfa_res_forces *forces,
const double *zc, const double *zc,
@ -1169,7 +1169,7 @@ cfs_tpfa_res_assemble(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_res_flux(grid_t *G , cfs_tpfa_res_flux(struct UnstructuredGrid *G ,
struct cfs_tpfa_res_forces *forces , struct cfs_tpfa_res_forces *forces ,
int np , int np ,
const double *trans , const double *trans ,
@ -1194,7 +1194,7 @@ cfs_tpfa_res_flux(grid_t *G ,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_res_fpress(grid_t *G, cfs_tpfa_res_fpress(struct UnstructuredGrid *G,
int np, int np,
const double *htrans, const double *htrans,
const double *pmobf, const double *pmobf,
@ -1213,7 +1213,7 @@ cfs_tpfa_res_fpress(grid_t *G,
#if 0 #if 0
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_res_retrieve_masstrans(grid_t *G, cfs_tpfa_res_retrieve_masstrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_res_data *h, struct cfs_tpfa_res_data *h,
double *masstrans_f) double *masstrans_f)
@ -1226,7 +1226,7 @@ cfs_tpfa_res_retrieve_masstrans(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_res_retrieve_gravtrans(grid_t *G, cfs_tpfa_res_retrieve_gravtrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_res_data *h, struct cfs_tpfa_res_data *h,
double *gravtrans_f) double *gravtrans_f)
@ -1240,7 +1240,7 @@ cfs_tpfa_res_retrieve_gravtrans(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static double static double
cfs_tpfa_res_impes_maxtime_cell(int c, cfs_tpfa_res_impes_maxtime_cell(int c,
grid_t *G, struct UnstructuredGrid *G,
struct compr_quantities *cq, struct compr_quantities *cq,
const double *trans, const double *trans,
const double *porevol, const double *porevol,
@ -1356,7 +1356,7 @@ cfs_tpfa_res_impes_maxtime_cell(int c,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double double
cfs_tpfa_res_impes_maxtime(grid_t *G, cfs_tpfa_res_impes_maxtime(struct UnstructuredGrid *G,
struct compr_quantities *cq, struct compr_quantities *cq,
const double *trans, const double *trans,
const double *porevol, const double *porevol,
@ -1383,7 +1383,7 @@ cfs_tpfa_res_impes_maxtime(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
cfs_tpfa_res_expl_mass_transport(grid_t *G, cfs_tpfa_res_expl_mass_transport(struct UnstructuredGrid *G,
well_t *W, well_t *W,
struct completion_data *wdata, struct completion_data *wdata,
int np, int np,

View File

@ -54,7 +54,7 @@ struct cfs_tpfa_res_data {
struct cfs_tpfa_res_data * struct cfs_tpfa_res_data *
cfs_tpfa_res_construct(grid_t *G , cfs_tpfa_res_construct(struct UnstructuredGrid *G ,
struct WellCompletions *wconn , struct WellCompletions *wconn ,
int nphases); int nphases);
@ -62,7 +62,7 @@ void
cfs_tpfa_res_destroy(struct cfs_tpfa_res_data *h); cfs_tpfa_res_destroy(struct cfs_tpfa_res_data *h);
void void
cfs_tpfa_res_assemble(grid_t *G, cfs_tpfa_res_assemble(struct UnstructuredGrid *G,
double dt, double dt,
struct cfs_tpfa_res_forces *forces, struct cfs_tpfa_res_forces *forces,
const double *zc, const double *zc,
@ -75,7 +75,7 @@ cfs_tpfa_res_assemble(grid_t *G,
struct cfs_tpfa_res_data *h); struct cfs_tpfa_res_data *h);
void void
cfs_tpfa_res_flux(grid_t *G , cfs_tpfa_res_flux(struct UnstructuredGrid *G ,
struct cfs_tpfa_res_forces *forces , struct cfs_tpfa_res_forces *forces ,
int np , int np ,
const double *trans , const double *trans ,
@ -88,7 +88,7 @@ cfs_tpfa_res_flux(grid_t *G ,
double *wflux ); double *wflux );
void void
cfs_tpfa_res_fpress(grid_t *G, cfs_tpfa_res_fpress(struct UnstructuredGrid *G,
int np, int np,
const double *htrans, const double *htrans,
const double *pmobf, const double *pmobf,
@ -100,19 +100,19 @@ cfs_tpfa_res_fpress(grid_t *G,
#if 0 #if 0
void void
cfs_tpfa_retrieve_masstrans(grid_t *G, cfs_tpfa_retrieve_masstrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_data *h, struct cfs_tpfa_data *h,
double *masstrans_f); double *masstrans_f);
void void
cfs_tpfa_retrieve_gravtrans(grid_t *G, cfs_tpfa_retrieve_gravtrans(struct UnstructuredGrid *G,
int np, int np,
struct cfs_tpfa_data *h, struct cfs_tpfa_data *h,
double *gravtrans_f); double *gravtrans_f);
double double
cfs_tpfa_impes_maxtime(grid_t *G, cfs_tpfa_impes_maxtime(struct UnstructuredGrid *G,
struct compr_quantities *cq, struct compr_quantities *cq,
const double *trans, const double *trans,
const double *porevol, const double *porevol,
@ -122,7 +122,7 @@ cfs_tpfa_impes_maxtime(grid_t *G,
const double *gravity); const double *gravity);
void void
cfs_tpfa_expl_mass_transport(grid_t *G, cfs_tpfa_expl_mass_transport(struct UnstructuredGrid *G,
well_t *W, well_t *W,
struct completion_data *wdata, struct completion_data *wdata,
int np, int np,

View File

@ -24,7 +24,7 @@
/* Compute B \ (V') == zeta(cellNo) .* faceFlux2CellFlux(fflux) */ /* Compute B \ (V') == zeta(cellNo) .* faceFlux2CellFlux(fflux) */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
compr_flux_term(grid_t *G, compr_flux_term(struct UnstructuredGrid *G,
const double *fflux, const double *fflux,
const double *zeta, const double *zeta,
double *Biv) double *Biv)

View File

@ -39,7 +39,7 @@ struct compr_quantities {
}; };
void void
compr_flux_term(grid_t *G, compr_flux_term(struct UnstructuredGrid *G,
const double *fflux, const double *fflux,
const double *zeta, const double *zeta,
double *Biv); double *Biv);

View File

@ -30,7 +30,7 @@ impl_deallocate(struct ifs_tpfa_impl *pimpl)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct ifs_tpfa_impl * static struct ifs_tpfa_impl *
impl_allocate(grid_t *G) impl_allocate(struct UnstructuredGrid *G)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
struct ifs_tpfa_impl *new; struct ifs_tpfa_impl *new;
@ -57,7 +57,7 @@ impl_allocate(grid_t *G)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static struct CSRMatrix * static struct CSRMatrix *
ifs_tpfa_construct_matrix(grid_t *G) ifs_tpfa_construct_matrix(struct UnstructuredGrid *G)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int f, c1, c2; int f, c1, c2;
@ -122,7 +122,7 @@ ifs_tpfa_construct_matrix(grid_t *G)
/* fgrav = accumarray(cf(j), grav(j).*sgn(j), [nf, 1]) */ /* fgrav = accumarray(cf(j), grav(j).*sgn(j), [nf, 1]) */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void static void
compute_grav_term(grid_t *G, const double *gpress, compute_grav_term(struct UnstructuredGrid *G, const double *gpress,
double *fgrav) double *fgrav)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
@ -155,7 +155,7 @@ compute_grav_term(grid_t *G, const double *gpress,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct ifs_tpfa_data * struct ifs_tpfa_data *
ifs_tpfa_construct(grid_t *G) ifs_tpfa_construct(struct UnstructuredGrid *G)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
struct ifs_tpfa_data *new; struct ifs_tpfa_data *new;
@ -185,7 +185,7 @@ ifs_tpfa_construct(grid_t *G)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
ifs_tpfa_assemble(grid_t *G, ifs_tpfa_assemble(struct UnstructuredGrid *G,
const double *trans, const double *trans,
const double *src, const double *src,
const double *gpress, const double *gpress,
@ -232,7 +232,7 @@ ifs_tpfa_assemble(grid_t *G,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
ifs_tpfa_press_flux(grid_t *G, ifs_tpfa_press_flux(struct UnstructuredGrid *G,
const double *trans, const double *trans,
struct ifs_tpfa_data *h, struct ifs_tpfa_data *h,
double *cpress, double *cpress,

View File

@ -39,17 +39,17 @@ struct ifs_tpfa_data {
struct ifs_tpfa_data * struct ifs_tpfa_data *
ifs_tpfa_construct(grid_t *G); ifs_tpfa_construct(struct UnstructuredGrid *G);
void void
ifs_tpfa_assemble(grid_t *G, ifs_tpfa_assemble(struct UnstructuredGrid *G,
const double *trans, const double *trans,
const double *src, const double *src,
const double *gpress, const double *gpress,
struct ifs_tpfa_data *h); struct ifs_tpfa_data *h);
void void
ifs_tpfa_press_flux(grid_t *G, ifs_tpfa_press_flux(struct UnstructuredGrid *G,
const double *trans, const double *trans,
struct ifs_tpfa_data *h, struct ifs_tpfa_data *h,
double *cpress, double *cpress,

View File

@ -10,7 +10,7 @@
/* htrans <- sum(C(:,i) .* K(cellNo,:) .* N(:,j), 2) ./ sum(C.*C, 2) */ /* htrans <- sum(C(:,i) .* K(cellNo,:) .* N(:,j), 2) ./ sum(C.*C, 2) */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
tpfa_htrans_compute(grid_t *G, const double *perm, double *htrans) tpfa_htrans_compute(struct UnstructuredGrid *G, const double *perm, double *htrans)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int c, d, f, i, j; int c, d, f, i, j;
@ -61,7 +61,7 @@ tpfa_htrans_compute(grid_t *G, const double *perm, double *htrans)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
tpfa_trans_compute(grid_t *G, const double *htrans, double *trans) tpfa_trans_compute(struct UnstructuredGrid *G, const double *htrans, double *trans)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int c, i, f; int c, i, f;
@ -86,7 +86,7 @@ tpfa_trans_compute(grid_t *G, const double *htrans, double *trans)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void void
tpfa_eff_trans_compute(grid_t *G, tpfa_eff_trans_compute(struct UnstructuredGrid *G,
const double *totmob, const double *totmob,
const double *htrans, const double *htrans,
double *trans) double *trans)

View File

@ -27,13 +27,13 @@ extern "C" {
#endif #endif
void void
tpfa_htrans_compute(grid_t *G, const double *perm, double *htrans); tpfa_htrans_compute(struct UnstructuredGrid *G, const double *perm, double *htrans);
void void
tpfa_trans_compute(grid_t *G, const double *htrans, double *trans); tpfa_trans_compute(struct UnstructuredGrid *G, const double *htrans, double *trans);
void void
tpfa_eff_trans_compute(grid_t *G, tpfa_eff_trans_compute(struct UnstructuredGrid *G,
const double *totmob, const double *totmob,
const double *htrans, const double *htrans,
double *trans); double *trans);

View File

@ -13,7 +13,7 @@
/* Twophase mobility-weighted upwind */ /* Twophase mobility-weighted upwind */
void void
spu_explicit(grid_t *g, double *s0, double *s, double *mob, spu_explicit(struct UnstructuredGrid *g, double *s0, double *s, double *mob,
double *dflux, double *gflux, double *src, double *dflux, double *gflux, double *src,
double dt) double dt)
{ {

View File

@ -6,7 +6,7 @@
#ifndef SPU_EXPLICIT_H_INCLUDED #ifndef SPU_EXPLICIT_H_INCLUDED
#define SPU_EXPLICIT_H_INCLUDED #define SPU_EXPLICIT_H_INCLUDED
void void
spu_explicit(grid_t *g, spu_explicit(struct UnstructuredGrid *g,
double *s0, double *s0,
double *s, double *s,
double *mob, double *mob,

View File

@ -132,7 +132,7 @@ compute_mobilities(int n, double *s, double *mob, double *dmob, int ntab, double
* *
*/ */
double double
spu_implicit(grid_t *g, double *s0, double *s, double h, double x0, int ntab, double *tab, spu_implicit(struct UnstructuredGrid *g, double *s0, double *s, double h, double x0, int ntab, double *tab,
double *dflux, double *gflux, double *src, double dt, double *dflux, double *gflux, double *src, double dt,
void (*linear_solver)(int, int*, int*, double *, double *, double *)) void (*linear_solver)(int, int*, int*, double *, double *, double *))
{ {
@ -277,7 +277,7 @@ phase_upwind_mobility(double darcyflux, double gravityflux, int i, int c,
} }
void void
spu_implicit_assemble(grid_t *g, double *s0, double *s, double *mob, double *dmob, spu_implicit_assemble(struct UnstructuredGrid *g, double *s0, double *s, double *mob, double *dmob,
double *dflux, double *gflux, double *src, double dt, sparse_t *S, double *dflux, double *gflux, double *src, double dt, sparse_t *S,
double *b, char *work) double *b, char *work)
{ {

View File

@ -17,12 +17,12 @@ typedef struct Sparse {
void void
spu_implicit_assemble(grid_t *g, double *s0, double *s, double *mob, double *dmob, spu_implicit_assemble(struct UnstructuredGrid *g, double *s0, double *s, double *mob, double *dmob,
double *dflux, double *gflux, double *src, double dt, sparse_t *S, double *dflux, double *gflux, double *src, double dt, sparse_t *S,
double *b, char *work); double *b, char *work);
double double
spu_implicit(grid_t *g, double *s0, double *s, double h, double x0, int ntab, double *tab, spu_implicit(struct UnstructuredGrid *g, double *s0, double *s, double h, double x0, int ntab, double *tab,
double *dflux, double *gflux, double *src, double dt, double *dflux, double *gflux, double *src, double dt,
void (*linear_solver)(int, int*, int*, double *, double *, double *)); void (*linear_solver)(int, int*, int*, double *, double *, double *));

View File

@ -14,21 +14,18 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "geometry.h" #include <opm/core/utility/cpgpreprocess/geometry.h>
#include "cgridinterface.h" #include <opm/core/utility/cpgpreprocess/preprocess.h>
#include <opm/core/grid.h>
static int static int
fill_cell_topology(struct processed_grid *pg, fill_cell_topology(struct processed_grid *pg,
struct CornerpointGrid *G ) struct UnstructuredGrid *g )
{ {
int f, c1, c2, tag; int f, c1, c2, tag;
size_t c, nc, nhf; size_t c, nc, nhf;
struct UnstructuredGrid *g;
g = (struct UnstructuredGrid *) G;
nc = g->number_of_cells; nc = g->number_of_cells;
g->cell_facepos = malloc((nc + 1) * sizeof *g->cell_facepos); g->cell_facepos = malloc((nc + 1) * sizeof *g->cell_facepos);
@ -54,11 +51,11 @@ fill_cell_topology(struct processed_grid *pg,
g->cell_faces = malloc(nhf * sizeof *g->cell_faces); g->cell_faces = malloc(nhf * sizeof *g->cell_faces);
/* struct CornerpointGrid member */ /* struct UnstructuredGrid member */
G->cface_tag = malloc(nhf * sizeof *G->cface_tag ); g->cell_facetag = malloc(nhf * sizeof *g->cell_facetag );
if ((g->cell_faces == NULL) || (G->cface_tag == NULL)) { if ((g->cell_faces == NULL) || (g->cell_facetag == NULL)) {
free(G->cface_tag); G->cface_tag = NULL; free(g->cell_facetag); g->cell_facetag = NULL;
free(g->cell_faces); g->cell_faces = NULL; free(g->cell_faces); g->cell_faces = NULL;
free(g->cell_facepos); g->cell_facepos = NULL; free(g->cell_facepos); g->cell_facepos = NULL;
} }
@ -71,19 +68,15 @@ fill_cell_topology(struct processed_grid *pg,
c2 = g->face_cells[2*f + 1]; c2 = g->face_cells[2*f + 1];
if (c1 >= 0) { if (c1 >= 0) {
g->cell_faces[ g->cell_facepos[c1 + 1] ] = f; g->cell_faces [ g->cell_facepos[c1 + 1] ] = f;
g->cell_facetag [ g->cell_facepos[c1 + 1] ] = tag + 1;
/* struct CornerpointGrid member (!) */
G->cface_tag [ g->cell_facepos[c1 + 1] ] = tag + 1;
g->cell_facepos[c1 + 1] += 1; g->cell_facepos[c1 + 1] += 1;
} }
if (c2 >= 0) { if (c2 >= 0) {
g->cell_faces[ g->cell_facepos[c2 + 1] ] = f; g->cell_faces [ g->cell_facepos[c2 + 1] ] = f;
g->cell_facetag [ g->cell_facepos[c2 + 1] ] = tag + 0;
/* struct CornerpointGrid member (!) */
G->cface_tag [ g->cell_facepos[c2 + 1] ] = tag + 0;
g->cell_facepos[c2 + 1] += 1; g->cell_facepos[c2 + 1] += 1;
} }
@ -93,6 +86,30 @@ fill_cell_topology(struct processed_grid *pg,
return g->cell_facepos != NULL; return g->cell_facepos != NULL;
} }
void free_cornerpoint_grid(struct UnstructuredGrid *g)
{
if (g!=NULL)
{
free(g->face_nodes);
free(g->face_nodepos);
free(g->face_cells);
free(g->cell_facepos);
free(g->cell_faces);
free(g->node_coordinates);
free(g->face_centroids);
free(g->face_areas);
free(g->face_normals);
free(g->cell_centroids);
free(g->cell_volumes);
free(g->global_cell);
free(g->cell_facetag);
}
free(g);
}
static int static int
allocate_geometry(struct UnstructuredGrid *g) allocate_geometry(struct UnstructuredGrid *g)
{ {
@ -122,100 +139,93 @@ allocate_geometry(struct UnstructuredGrid *g)
return ok == 5; return ok == 5;
} }
void preprocess (const struct grdecl *in,
double tol, void compute_geometry(struct UnstructuredGrid *g)
struct CornerpointGrid *G)
{ {
assert (g != NULL);
if (g!=NULL)
{
assert (g->dimensions == 3);
assert (g->face_centroids != NULL);
assert (g->face_normals != NULL);
assert (g->face_areas != NULL);
assert (g->cell_centroids != NULL);
assert (g->cell_volumes != NULL);
compute_face_geometry(g->dimensions , g->node_coordinates,
g->number_of_faces, g->face_nodepos,
g->face_nodes, g->face_normals,
g->face_centroids, g->face_areas);
compute_cell_geometry(g->dimensions, g->node_coordinates,
g->face_nodepos, g->face_nodes,
g->face_cells, g->face_normals,
g->face_centroids, g->number_of_cells,
g->cell_facepos, g->cell_faces,
g->cell_centroids, g->cell_volumes);
}
}
struct UnstructuredGrid *
preprocess (const struct grdecl *in, double tol)
{
struct UnstructuredGrid *g;
int ok; int ok;
struct processed_grid pg; struct processed_grid pg;
struct UnstructuredGrid *base;
g = malloc(1 * sizeof *g);
base = (struct UnstructuredGrid *) G; if (g == NULL)
{
return NULL;
}
process_grdecl(in, tol, &pg); process_grdecl(in, tol, &pg);
/* /*
* General grid interface * Convert "struct processed_grid" to "struct UnstructuredGrid".
*/ */
base->dimensions = 3; g->dimensions = 3;
base->number_of_nodes = pg.number_of_nodes; g->number_of_nodes = pg.number_of_nodes;
base->number_of_faces = pg.number_of_faces; g->number_of_faces = pg.number_of_faces;
base->number_of_cells = pg.number_of_cells; g->number_of_cells = pg.number_of_cells;
base->node_coordinates = pg.node_coordinates; g->node_coordinates = pg.node_coordinates;
base->face_nodes = pg.face_nodes; g->face_nodes = pg.face_nodes;
base->face_nodepos = pg.face_ptr; g->face_nodepos = pg.face_ptr;
base->face_cells = pg.face_neighbors; g->face_cells = pg.face_neighbors;
base->face_centroids = NULL; g->face_centroids = NULL;
base->face_normals = NULL; g->face_normals = NULL;
base->face_areas = NULL; g->face_areas = NULL;
fill_cell_topology(&pg, G); g->cell_centroids = NULL;
g->cell_volumes = NULL;
base->cell_centroids = NULL; /* allocate and fill g->cell_faces/g->cell_facepos and
base->cell_volumes = NULL; * g->cell_facetag */
fill_cell_topology(&pg, g);
ok = allocate_geometry(base); ok = allocate_geometry(g);
if (!ok)
{
free_cornerpoint_grid(g);
g = NULL;
}
else
{
compute_geometry(g);
g->cartdims[0] = pg.dimensions[0];
g->cartdims[1] = pg.dimensions[1];
g->cartdims[2] = pg.dimensions[2];
g->global_cell = pg.local_cell_index;
}
/* return g;
* Cornerpoint grid interface
*/
G->cartdims[0] = pg.dimensions[0];
G->cartdims[1] = pg.dimensions[1];
G->cartdims[2] = pg.dimensions[2];
free(pg.face_tag);
G->index_map = pg.local_cell_index;
}
void free_cornerpoint_grid(struct CornerpointGrid *G)
{
free(G->grid.face_nodes);
free(G->grid.face_nodepos);
free(G->grid.face_cells);
free(G->grid.cell_facepos);
free(G->grid.cell_faces);
free(G->grid.node_coordinates);
free(G->grid.face_centroids);
free(G->grid.face_areas);
free(G->grid.face_normals);
free(G->grid.cell_centroids);
free(G->grid.cell_volumes);
free(G->index_map);
free(G->cface_tag);
}
void compute_geometry(struct CornerpointGrid *G)
{
struct UnstructuredGrid *g;
assert (G != NULL);
g = (struct UnstructuredGrid *) G;
assert (g->dimensions == 3);
assert (g->face_centroids != NULL);
assert (g->face_normals != NULL);
assert (g->face_areas != NULL);
assert (g->cell_centroids != NULL);
assert (g->cell_volumes != NULL);
compute_face_geometry(g->dimensions , g->node_coordinates,
g->number_of_faces, g->face_nodepos,
g->face_nodes, g->face_normals,
g->face_centroids, g->face_areas);
compute_cell_geometry(g->dimensions, g->node_coordinates,
g->face_nodepos, g->face_nodes,
g->face_cells, g->face_normals,
g->face_centroids, g->number_of_cells,
g->cell_facepos, g->cell_faces,
g->cell_centroids, g->cell_volumes);
} }

View File

@ -26,25 +26,12 @@
extern "C" { extern "C" {
#endif #endif
struct CornerpointGrid { struct UnstructuredGrid *
struct UnstructuredGrid grid; preprocess (const struct grdecl *in, double tol);
/* void compute_geometry (struct UnstructuredGrid *g);
* Special cornerpoint definitions
*/ void free_cornerpoint_grid(struct UnstructuredGrid *g);
int cartdims[3];
int *index_map;
int *cface_tag;
};
void preprocess (const struct grdecl *in,
double tol,
struct CornerpointGrid *out);
void compute_geometry (struct CornerpointGrid *g);
void free_cornerpoint_grid(struct CornerpointGrid *g);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -13,8 +13,8 @@
//==========================================================================*/ //==========================================================================*/
/* /*
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics. Copyright 2009, 2010, 2011, 2012 SINTEF ICT, Applied Mathematics.
Copyright 2009, 2010 Statoil ASA. Copyright 2009, 2010, 2011, 2012 Statoil ASA.
This file is part of The Open Reservoir Simulator Project (OpenRS). This file is part of The Open Reservoir Simulator Project (OpenRS).

View File

@ -155,7 +155,7 @@ call_UMFPACK(struct CSRMatrix *A, double *b, double *x)
} }
static void static void
deallocate_cart_grid(grid_t *G) deallocate_cart_grid(struct UnstructuredGrid *G)
{ {
if (G != NULL) { if (G != NULL) {
free(G->node_coordinates); free(G->node_coordinates);
@ -176,7 +176,7 @@ deallocate_cart_grid(grid_t *G)
free(G); free(G);
} }
static grid_t * static struct UnstructuredGrid *
cart_grid(int nx, int ny, int nz) cart_grid(int nx, int ny, int nz)
{ {
/* The following applies to any grid derived from base_grid_t. */ /* The following applies to any grid derived from base_grid_t. */
@ -196,7 +196,7 @@ cart_grid(int nx, int ny, int nz)
int nyf = nx*Ny*nz; int nyf = nx*Ny*nz;
int nzf = nx*ny*Nz; int nzf = nx*ny*Nz;
grid_t *G = malloc(1 * sizeof *G); struct UnstructuredGrid *G = malloc(1 * sizeof *G);
G->dimensions = 3; G->dimensions = 3;
@ -489,7 +489,7 @@ destroy_wells(well_t *W)
static well_t * static well_t *
create_wells(grid_t *G) create_wells(struct UnstructuredGrid *G)
{ {
well_t *new = malloc(1 * sizeof *new); well_t *new = malloc(1 * sizeof *new);
@ -621,7 +621,7 @@ main(void)
double *gravcap_f, *porevol, *cpress0; double *gravcap_f, *porevol, *cpress0;
double *cpress, *fpress, *fflux, *wpress, *wflux; double *cpress, *fpress, *fflux, *wpress, *wflux;
grid_t *G; struct UnstructuredGrid *G;
well_t *W; well_t *W;
well_control_t *wctrl; well_control_t *wctrl;
struct completion_data *wdata; struct completion_data *wdata;

View File

@ -8,7 +8,7 @@
#include <opm/core/utility/cpgpreprocess/readvector.hpp> #include <opm/core/utility/cpgpreprocess/readvector.hpp>
static struct CornerpointGrid static struct UnstructuredGrid*
read_grid(const std::string& dir) read_grid(const std::string& dir)
{ {
std::string fn; std::string fn;
@ -38,13 +38,7 @@ read_grid(const std::string& dir)
grdecl.dims[1] = dimens[1]; grdecl.dims[1] = dimens[1];
grdecl.dims[2] = dimens[2]; grdecl.dims[2] = dimens[2];
struct CornerpointGrid G; struct UnstructuredGrid *g= preprocess(&grdecl, 0.0);
preprocess(&grdecl, 0.0, &G);
compute_geometry(&G);
struct UnstructuredGrid *g = &G.grid;
double vol = 0.0; double vol = 0.0;
for (int c = 0; c < g->number_of_cells; c++) { for (int c = 0; c < g->number_of_cells; c++) {
@ -54,20 +48,20 @@ read_grid(const std::string& dir)
for (int c = 0, i = 0; c < g->number_of_cells; c++) { for (int c = 0, i = 0; c < g->number_of_cells; c++) {
for (; i < g->cell_facepos[c + 1]; i++) { for (; i < g->cell_facepos[c + 1]; i++) {
std::cout << "(c,i) = (" << c << "," << G.cface_tag[i] << ")\n"; std::cout << "(c,i) = (" << c << "," << g->cell_facetag[i] << ")\n";
} }
} }
return G; return g;
} }
int main() int main()
{ {
struct CornerpointGrid G; struct UnstructuredGrid *g;
G = read_grid(std::string("example")); g = read_grid(std::string("example"));
free_cornerpoint_grid(&G); free_cornerpoint_grid(g);
return 0; return 0;
} }