Add utilities for computing derived fluid quantities.

These are (currently) entirely geared towards pressure solvers.
This commit is contained in:
Bård Skaflestad 2010-10-20 19:14:07 +02:00
parent a886165290
commit b193e461ca
3 changed files with 144 additions and 15 deletions

View File

@ -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

81
compr_quant.c Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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];
}
}

46
compr_quant.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_COMPR_QUANT_HEADER_INCLUDED
#define OPM_COMPR_QUANT_HEADER_INCLUDED
#include <stddef.h>
#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 */