diff --git a/Makefile.am b/Makefile.am index 00ad0ae8..8655e018 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ libopmpressure_HEADERS = \ blas_lapack.h \ coarse_conn.h \ coarse_sys.h \ +compr_quant.h \ dfs.h \ flow_bc.h \ fsh.h \ @@ -30,21 +31,22 @@ GridAdapter.hpp \ HybridPressureSolver.hpp -libopmpressure_la_SOURCES = \ -coarse_conn.c \ -coarse_sys.c \ -dfs.c \ -flow_bc.c \ -fsh.c \ -fsh_common.c \ -hash_set.c \ -hybsys.c \ -hybsys_global.c \ -ifsh.c \ -ifsh_ms.c \ -mimetic.c \ -partition.c \ -sparse_sys.c \ +libopmpressure_la_SOURCES = \ +coarse_conn.c \ +coarse_sys.c \ +compr_quant.c \ +dfs.c \ +flow_bc.c \ +fsh.c \ +fsh_common.c \ +hash_set.c \ +hybsys.c \ +hybsys_global.c \ +ifsh.c \ +ifsh_ms.c \ +mimetic.c \ +partition.c \ +sparse_sys.c \ well.c diff --git a/compr_quant.c b/compr_quant.c new file mode 100644 index 00000000..296168c7 --- /dev/null +++ b/compr_quant.c @@ -0,0 +1,81 @@ +/* + Copyright 2010 SINTEF ICT, Applied Mathematics. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#include "compr_quant.h" + + +/* ---------------------------------------------------------------------- */ +/* Compute B \ (V') == zeta(cellNo) .* faceFlux2CellFlux(fflux) */ +/* ---------------------------------------------------------------------- */ +void +compr_flux_term(grid_t *G, + const double *fflux, + const double *zeta, + double *Biv) +/* ---------------------------------------------------------------------- */ +{ + int c, i, f; + double s; + + for (c = i = 0; c < G->number_of_cells; c++) { + for (; i < G->cell_facepos[c + 1]; i++) { + f = G->cell_faces[i]; + s = 2.0*(c == G->face_cells[2*f + 0]) - 1.0; + + Biv[i] = zeta[c] * s * fflux[f]; + } + } +} + + +/* ---------------------------------------------------------------------- */ +/* Compute P == ct .* pv ./ dt */ +/* ---------------------------------------------------------------------- */ +void +compr_accum_term(size_t nc, + double dt, + const double *porevol, + const double *totcompr, + double *P) +/* ---------------------------------------------------------------------- */ +{ + size_t c; + + for (c = 0; c < nc; c++) { + P[c] = totcompr[c] * porevol[c] / dt; + } +} + + +/* ---------------------------------------------------------------------- */ +/* Add pressure accumulation term (P*p_0) to cell sources */ +/* ---------------------------------------------------------------------- */ +void +compr_src_add_press_accum(size_t nc, + const double *p0, + const double *P, + double *src) +/* ---------------------------------------------------------------------- */ +{ + size_t c; + + for (c = 0; c < nc; c++) { + src[c] += P[c] * p0[c]; + } +} diff --git a/compr_quant.h b/compr_quant.h new file mode 100644 index 00000000..fe269efd --- /dev/null +++ b/compr_quant.h @@ -0,0 +1,46 @@ +/* + Copyright 2010 SINTEF ICT, Applied Mathematics. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#ifndef OPM_COMPR_QUANT_HEADER_INCLUDED +#define OPM_COMPR_QUANT_HEADER_INCLUDED + +#include + +#include "grid.h" + +void +compr_flux_term(grid_t *G, + const double *fflux, + const double *zeta, + double *Biv); + +void +compr_accum_term(size_t nc, + double dt, + const double *porevol, + const double *totcompr, + double *P); + +void +compr_src_add_press_accum(size_t nc, + const double *p0, + const double *P, + double *src); + +#endif /* OPM_COMPR_QUANT_HEADER_INCLUDED */