coarse_sys.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_COARSE_SYS_HEADER_INCLUDED
21 #define OPM_COARSE_SYS_HEADER_INCLUDED
22 
23 #include <opm/core/grid.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /* ---------------------------------------------------------------------- */
30 
31 struct coarse_sys {
32  int *dof2conn; /* Map dof->connection (coarse interface) */
33  int *blkdof_pos; /* Start pointers to each block's dofs */
34  int *basis_pos; /* Start pointers to each block's bf's */
35  int *cell_ip_pos; /* Start pointers to each block's IP */
36 
37  int *blkdof; /* Each block's dofs */
38  double *basis; /* All basis functions */
39  double *cell_ip; /* Fine-scale IP contributions */
40  double *Binv; /* Coarse-scale inverse IP per block */
41 };
42 
43 
44 /* ---------------------------------------------------------------------- */
45 
46 struct coarse_topology;
47 struct CSRMatrix;
48 
49 typedef void (*LocalSolver)(struct CSRMatrix *A,
50  double *b,
51  double *x);
52 
53 struct coarse_sys *
54 coarse_sys_construct(struct UnstructuredGrid *g, const int *p,
55  struct coarse_topology *ct,
56  const double *perm,
57  const double *src,
58  const double *totmob,
59  LocalSolver linsolve);
60 
61 void
62 coarse_sys_destroy(struct coarse_sys *sys);
63 
64 void
66  int max_nconn,
67  int nb,
68  const int *pconn,
69  const double *Binv,
70  const int *b2c_pos,
71  const int *b2c,
72  struct coarse_sys *sys);
73 
74 void
76  int max_bcells,
77  const double *totmob,
78  const int *b2c_pos,
79  const int *b2c,
80  struct coarse_sys *sys,
81  double *work);
82 
83 void
85  struct coarse_topology *ct,
86  struct coarse_sys *sys,
87  const int *b2c_pos,
88  const int *b2c,
89  const double *v_c,
90  double *flux,
91  double *work);
92 
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* OPM_COARSE_SYS_HEADER_INCLUDED */
void coarse_sys_compute_cell_ip(int nc, int max_nconn, int nb, const int *pconn, const double *Binv, const int *b2c_pos, const int *b2c, struct coarse_sys *sys)
Definition: sparse_sys.h:38
Definition: grid.h:98
int * blkdof_pos
Definition: coarse_sys.h:33
int * dof2conn
Definition: coarse_sys.h:32
struct coarse_sys * coarse_sys_construct(struct UnstructuredGrid *g, const int *p, struct coarse_topology *ct, const double *perm, const double *src, const double *totmob, LocalSolver linsolve)
double * basis
Definition: coarse_sys.h:38
int * blkdof
Definition: coarse_sys.h:37
void(* LocalSolver)(struct CSRMatrix *A, double *b, double *x)
Definition: coarse_sys.h:49
int * cell_ip_pos
Definition: coarse_sys.h:35
void coarse_sys_compute_Binv(int nb, int max_bcells, const double *totmob, const int *b2c_pos, const int *b2c, struct coarse_sys *sys, double *work)
double * cell_ip
Definition: coarse_sys.h:39
double * Binv
Definition: coarse_sys.h:40
int * basis_pos
Definition: coarse_sys.h:34
Definition: coarse_sys.h:31
void coarse_sys_compute_fs_flux(struct UnstructuredGrid *g, struct coarse_topology *ct, struct coarse_sys *sys, const int *b2c_pos, const int *b2c, const double *v_c, double *flux, double *work)
const double flux
Definition: Units.hpp:150
void coarse_sys_destroy(struct coarse_sys *sys)
Definition: coarse_conn.h:27