2012-08-24 09:08:26 -05:00
|
|
|
/*
|
|
|
|
Copyright 2012 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/>.
|
|
|
|
*/
|
|
|
|
|
2013-04-10 05:56:14 -05:00
|
|
|
#include "config.h"
|
2013-03-18 06:38:04 -05:00
|
|
|
#include <opm/core/tof/TofReorder.hpp>
|
2012-08-24 09:08:26 -05:00
|
|
|
#include <opm/core/grid.h>
|
|
|
|
#include <opm/core/utility/ErrorMacros.hpp>
|
2013-04-22 07:02:45 -05:00
|
|
|
#include <opm/core/utility/SparseTable.hpp>
|
2012-08-24 09:08:26 -05:00
|
|
|
#include <algorithm>
|
2012-09-25 07:00:17 -05:00
|
|
|
#include <numeric>
|
|
|
|
#include <cmath>
|
2012-08-24 09:08:26 -05:00
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/// Construct solver.
|
2013-04-22 04:29:59 -05:00
|
|
|
/// \param[in] grid A 2d or 3d grid.
|
2013-03-21 08:51:49 -05:00
|
|
|
/// \param[in] use_multidim_upwind If true, use multidimensional tof upwinding.
|
2013-03-14 10:18:39 -05:00
|
|
|
TofReorder::TofReorder(const UnstructuredGrid& grid,
|
|
|
|
const bool use_multidim_upwind)
|
2013-01-03 07:07:51 -06:00
|
|
|
: grid_(grid),
|
|
|
|
darcyflux_(0),
|
|
|
|
porevolume_(0),
|
|
|
|
source_(0),
|
|
|
|
tof_(0),
|
|
|
|
tracer_(0),
|
|
|
|
num_tracers_(0),
|
2013-04-22 04:22:23 -05:00
|
|
|
gauss_seidel_tol_(1e-3),
|
2013-01-03 07:07:51 -06:00
|
|
|
use_multidim_upwind_(use_multidim_upwind)
|
2012-08-24 09:08:26 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-09 02:54:54 -05:00
|
|
|
/// Solve for time-of-flight.
|
2012-09-25 07:00:17 -05:00
|
|
|
/// \param[in] darcyflux Array of signed face fluxes.
|
|
|
|
/// \param[in] porevolume Array of pore volumes.
|
2012-10-09 02:54:54 -05:00
|
|
|
/// \param[in] source Source term. Sign convention is:
|
|
|
|
/// (+) inflow flux,
|
|
|
|
/// (-) outflow flux.
|
2012-09-25 07:00:17 -05:00
|
|
|
/// \param[out] tof Array of time-of-flight values.
|
2012-11-16 09:06:01 -06:00
|
|
|
void TofReorder::solveTof(const double* darcyflux,
|
2013-04-22 07:02:45 -05:00
|
|
|
const double* porevolume,
|
|
|
|
const double* source,
|
|
|
|
std::vector<double>& tof)
|
2012-08-24 09:08:26 -05:00
|
|
|
{
|
|
|
|
darcyflux_ = darcyflux;
|
|
|
|
porevolume_ = porevolume;
|
2012-09-25 07:00:17 -05:00
|
|
|
source_ = source;
|
|
|
|
#ifndef NDEBUG
|
|
|
|
// Sanity check for sources.
|
|
|
|
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
|
|
|
if (std::fabs(cum_src) > *std::max_element(source, source + grid_.number_of_cells)*1e-2) {
|
|
|
|
THROW("Sources do not sum to zero: " << cum_src);
|
|
|
|
}
|
|
|
|
#endif
|
2012-08-24 09:08:26 -05:00
|
|
|
tof.resize(grid_.number_of_cells);
|
|
|
|
std::fill(tof.begin(), tof.end(), 0.0);
|
|
|
|
tof_ = &tof[0];
|
2012-10-30 07:10:50 -05:00
|
|
|
if (use_multidim_upwind_) {
|
|
|
|
face_tof_.resize(grid_.number_of_faces);
|
|
|
|
std::fill(face_tof_.begin(), face_tof_.end(), 0.0);
|
|
|
|
}
|
2013-01-03 07:07:51 -06:00
|
|
|
num_tracers_ = 0;
|
2013-04-17 06:18:22 -05:00
|
|
|
num_multicell_ = 0;
|
|
|
|
max_size_multicell_ = 0;
|
2013-04-22 04:22:23 -05:00
|
|
|
max_iter_multicell_ = 0;
|
2013-01-03 07:07:51 -06:00
|
|
|
reorderAndTransport(grid_, darcyflux);
|
2013-04-22 04:22:23 -05:00
|
|
|
if (num_multicell_ > 0) {
|
|
|
|
std::cout << num_multicell_ << " multicell blocks with max size "
|
|
|
|
<< max_size_multicell_ << " cells in upto "
|
|
|
|
<< max_iter_multicell_ << " iterations." << std::endl;
|
|
|
|
}
|
2013-01-03 07:07:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Solve for time-of-flight and a number of tracers.
|
|
|
|
/// One tracer will be used for each inflow flux specified in
|
|
|
|
/// the source parameter.
|
|
|
|
/// \param[in] darcyflux Array of signed face fluxes.
|
|
|
|
/// \param[in] porevolume Array of pore volumes.
|
|
|
|
/// \param[in] source Source term. Sign convention is:
|
|
|
|
/// (+) inflow flux,
|
|
|
|
/// (-) outflow flux.
|
2013-04-22 07:02:45 -05:00
|
|
|
/// \param[in] tracerheads Table containing one row per tracer, and each
|
|
|
|
/// row contains the source cells for that tracer.
|
2013-01-03 07:07:51 -06:00
|
|
|
/// \param[out] tof Array of time-of-flight values (1 per cell).
|
|
|
|
/// \param[out] tracer Array of tracer values (N per cell, where N is
|
|
|
|
/// the number of cells c for which source[c] > 0.0).
|
2013-03-14 15:43:21 -05:00
|
|
|
void TofReorder::solveTofTracer(const double* darcyflux,
|
|
|
|
const double* porevolume,
|
|
|
|
const double* source,
|
2013-04-22 07:02:45 -05:00
|
|
|
const SparseTable<int>& tracerheads,
|
2013-03-14 15:43:21 -05:00
|
|
|
std::vector<double>& tof,
|
|
|
|
std::vector<double>& tracer)
|
2013-01-03 07:07:51 -06:00
|
|
|
{
|
|
|
|
darcyflux_ = darcyflux;
|
|
|
|
porevolume_ = porevolume;
|
|
|
|
source_ = source;
|
|
|
|
#ifndef NDEBUG
|
|
|
|
// Sanity check for sources.
|
|
|
|
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
|
|
|
if (std::fabs(cum_src) > *std::max_element(source, source + grid_.number_of_cells)*1e-2) {
|
|
|
|
THROW("Sources do not sum to zero: " << cum_src);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
tof.resize(grid_.number_of_cells);
|
|
|
|
std::fill(tof.begin(), tof.end(), 0.0);
|
|
|
|
tof_ = &tof[0];
|
2013-04-22 07:02:45 -05:00
|
|
|
|
2013-01-03 07:07:51 -06:00
|
|
|
// Find the tracer heads (injectors).
|
|
|
|
num_tracers_ = tracerheads.size();
|
|
|
|
tracer.resize(grid_.number_of_cells*num_tracers_);
|
|
|
|
std::fill(tracer.begin(), tracer.end(), 0.0);
|
2013-04-23 08:35:47 -05:00
|
|
|
tracerhead_by_cell_.clear();
|
|
|
|
tracerhead_by_cell_.resize(grid_.number_of_cells, NoTracerHead);
|
2013-01-03 07:07:51 -06:00
|
|
|
for (int tr = 0; tr < num_tracers_; ++tr) {
|
2013-04-22 07:02:45 -05:00
|
|
|
for (int i = 0; i < tracerheads[tr].size(); ++i) {
|
|
|
|
const int cell = tracerheads[tr][i];
|
|
|
|
tracer[cell*num_tracers_ + tr] = 1.0;
|
2013-04-23 08:35:47 -05:00
|
|
|
tracerhead_by_cell_[cell] = tr;
|
2013-04-22 07:02:45 -05:00
|
|
|
}
|
2013-01-03 07:07:51 -06:00
|
|
|
}
|
2013-04-22 07:02:45 -05:00
|
|
|
|
2013-01-03 07:07:51 -06:00
|
|
|
tracer_ = &tracer[0];
|
|
|
|
if (use_multidim_upwind_) {
|
|
|
|
face_tof_.resize(grid_.number_of_faces);
|
|
|
|
std::fill(face_tof_.begin(), face_tof_.end(), 0.0);
|
|
|
|
THROW("Multidimensional upwind not yet implemented for tracer.");
|
|
|
|
}
|
2013-04-22 07:02:45 -05:00
|
|
|
num_multicell_ = 0;
|
|
|
|
max_size_multicell_ = 0;
|
|
|
|
max_iter_multicell_ = 0;
|
2012-08-24 09:08:26 -05:00
|
|
|
reorderAndTransport(grid_, darcyflux);
|
2013-04-22 07:02:45 -05:00
|
|
|
if (num_multicell_ > 0) {
|
|
|
|
std::cout << num_multicell_ << " multicell blocks with max size "
|
|
|
|
<< max_size_multicell_ << " cells in upto "
|
|
|
|
<< max_iter_multicell_ << " iterations." << std::endl;
|
|
|
|
}
|
2012-08-24 09:08:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-16 09:06:01 -06:00
|
|
|
void TofReorder::solveSingleCell(const int cell)
|
2012-08-24 09:08:26 -05:00
|
|
|
{
|
2012-11-05 07:26:00 -06:00
|
|
|
if (use_multidim_upwind_) {
|
|
|
|
solveSingleCellMultidimUpwind(cell);
|
|
|
|
return;
|
|
|
|
}
|
2012-08-24 09:08:26 -05:00
|
|
|
// Compute flux terms.
|
2012-09-25 07:00:17 -05:00
|
|
|
// Sources have zero tof, and therefore do not contribute
|
|
|
|
// to upwind_term. Sinks on the other hand, must be added
|
|
|
|
// to the downwind_flux (note sign change resulting from
|
|
|
|
// different sign conventions: pos. source is injection,
|
|
|
|
// pos. flux is outflow).
|
2013-04-23 08:35:47 -05:00
|
|
|
if (num_tracers_ && tracerhead_by_cell_[cell] == NoTracerHead) {
|
|
|
|
for (int tr = 0; tr < num_tracers_; ++tr) {
|
|
|
|
tracer_[num_tracers_*cell + tr] = 0.0;
|
|
|
|
}
|
|
|
|
}
|
2012-08-24 09:08:26 -05:00
|
|
|
double upwind_term = 0.0;
|
2012-09-25 07:00:17 -05:00
|
|
|
double downwind_flux = std::max(-source_[cell], 0.0);
|
2012-08-24 09:08:26 -05:00
|
|
|
for (int i = grid_.cell_facepos[cell]; i < grid_.cell_facepos[cell+1]; ++i) {
|
|
|
|
int f = grid_.cell_faces[i];
|
|
|
|
double flux;
|
|
|
|
int other;
|
|
|
|
// Compute cell flux
|
|
|
|
if (cell == grid_.face_cells[2*f]) {
|
|
|
|
flux = darcyflux_[f];
|
|
|
|
other = grid_.face_cells[2*f+1];
|
|
|
|
} else {
|
|
|
|
flux =-darcyflux_[f];
|
|
|
|
other = grid_.face_cells[2*f];
|
|
|
|
}
|
2012-12-05 03:39:00 -06:00
|
|
|
// Add flux to upwind_term or downwind_flux
|
|
|
|
if (flux < 0.0) {
|
|
|
|
// Using tof == 0 on inflow, so we only add a
|
|
|
|
// nonzero contribution if we are on an internal
|
|
|
|
// face.
|
|
|
|
if (other != -1) {
|
2012-11-05 07:26:00 -06:00
|
|
|
upwind_term += flux*tof_[other];
|
2013-04-23 08:35:47 -05:00
|
|
|
if (num_tracers_ && tracerhead_by_cell_[cell] == NoTracerHead) {
|
|
|
|
for (int tr = 0; tr < num_tracers_; ++tr) {
|
|
|
|
tracer_[num_tracers_*cell + tr] += flux*tracer_[num_tracers_*other + tr];
|
|
|
|
}
|
2013-01-03 07:07:51 -06:00
|
|
|
}
|
2012-08-24 09:08:26 -05:00
|
|
|
}
|
2012-12-05 03:39:00 -06:00
|
|
|
} else {
|
|
|
|
downwind_flux += flux;
|
2012-08-24 09:08:26 -05:00
|
|
|
}
|
|
|
|
}
|
2013-04-22 04:29:59 -05:00
|
|
|
|
2012-08-24 09:08:26 -05:00
|
|
|
// Compute tof.
|
|
|
|
tof_[cell] = (porevolume_[cell] - upwind_term)/downwind_flux;
|
2013-01-03 07:07:51 -06:00
|
|
|
|
|
|
|
// Compute tracers (if any).
|
|
|
|
// Do not change tracer solution in source cells.
|
2013-04-23 08:35:47 -05:00
|
|
|
if (num_tracers_ && tracerhead_by_cell_[cell] == NoTracerHead) {
|
2013-01-03 07:07:51 -06:00
|
|
|
for (int tr = 0; tr < num_tracers_; ++tr) {
|
|
|
|
tracer_[num_tracers_*cell + tr] *= -1.0/downwind_flux;
|
|
|
|
}
|
|
|
|
}
|
2013-04-17 05:58:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-22 04:29:59 -05:00
|
|
|
|
2013-03-14 15:43:21 -05:00
|
|
|
void TofReorder::solveSingleCellMultidimUpwind(const int cell)
|
2012-11-05 07:26:00 -06:00
|
|
|
{
|
|
|
|
// Compute flux terms.
|
|
|
|
// Sources have zero tof, and therefore do not contribute
|
|
|
|
// to upwind_term. Sinks on the other hand, must be added
|
|
|
|
// to the downwind terms (note sign change resulting from
|
|
|
|
// different sign conventions: pos. source is injection,
|
|
|
|
// pos. flux is outflow).
|
|
|
|
double upwind_term = 0.0;
|
|
|
|
double downwind_term_cell_factor = std::max(-source_[cell], 0.0);
|
|
|
|
double downwind_term_face = 0.0;
|
|
|
|
for (int i = grid_.cell_facepos[cell]; i < grid_.cell_facepos[cell+1]; ++i) {
|
|
|
|
int f = grid_.cell_faces[i];
|
|
|
|
double flux;
|
|
|
|
// Compute cell flux
|
|
|
|
if (cell == grid_.face_cells[2*f]) {
|
|
|
|
flux = darcyflux_[f];
|
|
|
|
} else {
|
|
|
|
flux =-darcyflux_[f];
|
|
|
|
}
|
2012-12-05 03:39:00 -06:00
|
|
|
// Add flux to upwind_term or downwind_term_[face|cell_factor].
|
|
|
|
if (flux < 0.0) {
|
|
|
|
upwind_term += flux*face_tof_[f];
|
2013-04-17 03:38:08 -05:00
|
|
|
} else if (flux > 0.0) {
|
2012-12-05 03:39:00 -06:00
|
|
|
double fterm, cterm_factor;
|
|
|
|
multidimUpwindTerms(f, cell, fterm, cterm_factor);
|
|
|
|
downwind_term_face += fterm*flux;
|
|
|
|
downwind_term_cell_factor += cterm_factor*flux;
|
2012-11-05 07:26:00 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Compute tof for cell.
|
2013-04-22 04:22:23 -05:00
|
|
|
tof_[cell] = (porevolume_[cell] - upwind_term - downwind_term_face)/downwind_term_cell_factor;
|
2012-11-05 07:26:00 -06:00
|
|
|
|
|
|
|
// Compute tof for downwind faces.
|
|
|
|
for (int i = grid_.cell_facepos[cell]; i < grid_.cell_facepos[cell+1]; ++i) {
|
|
|
|
int f = grid_.cell_faces[i];
|
|
|
|
const double outflux_f = (grid_.face_cells[2*f] == cell) ? darcyflux_[f] : -darcyflux_[f];
|
|
|
|
if (outflux_f > 0.0) {
|
|
|
|
double fterm, cterm_factor;
|
|
|
|
multidimUpwindTerms(f, cell, fterm, cterm_factor);
|
|
|
|
face_tof_[f] = fterm + cterm_factor*tof_[cell];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-16 09:06:01 -06:00
|
|
|
void TofReorder::solveMultiCell(const int num_cells, const int* cells)
|
2012-08-24 09:08:26 -05:00
|
|
|
{
|
2013-04-22 04:11:55 -05:00
|
|
|
++num_multicell_;
|
|
|
|
max_size_multicell_ = std::max(max_size_multicell_, num_cells);
|
|
|
|
// std::cout << "Multiblock solve with " << num_cells << " cells." << std::endl;
|
2013-04-22 04:22:23 -05:00
|
|
|
|
|
|
|
// Using a Gauss-Seidel approach.
|
2013-04-22 04:11:55 -05:00
|
|
|
double max_delta = 1e100;
|
2013-04-22 04:22:23 -05:00
|
|
|
int num_iter = 0;
|
|
|
|
while (max_delta > gauss_seidel_tol_) {
|
2013-04-22 04:11:55 -05:00
|
|
|
max_delta = 0.0;
|
2013-04-22 04:22:23 -05:00
|
|
|
++num_iter;
|
2013-04-22 04:11:55 -05:00
|
|
|
for (int ci = 0; ci < num_cells; ++ci) {
|
|
|
|
const int cell = cells[ci];
|
|
|
|
const double tof_before = tof_[cell];
|
|
|
|
solveSingleCell(cell);
|
|
|
|
max_delta = std::max(max_delta, std::fabs(tof_[cell] - tof_before));
|
|
|
|
}
|
|
|
|
// std::cout << "Max delta = " << max_delta << std::endl;
|
|
|
|
}
|
2013-04-22 04:22:23 -05:00
|
|
|
max_iter_multicell_ = std::max(max_iter_multicell_, num_iter);
|
2012-08-24 09:08:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-05 07:26:00 -06:00
|
|
|
|
|
|
|
|
|
|
|
// Assumes that face_tof_[f] is known for all upstream faces f of upwind_cell.
|
|
|
|
// Assumes that darcyflux_[face] is != 0.0.
|
|
|
|
// This function returns factors to compute the tof for 'face':
|
|
|
|
// tof(face) = face_term + cell_term_factor*tof(upwind_cell).
|
|
|
|
// It is not computed here, since these factors are needed to
|
|
|
|
// compute the tof(upwind_cell) itself.
|
2013-03-14 15:43:21 -05:00
|
|
|
void TofReorder::multidimUpwindTerms(const int face,
|
|
|
|
const int upwind_cell,
|
|
|
|
double& face_term,
|
|
|
|
double& cell_term_factor) const
|
2012-10-29 11:23:17 -05:00
|
|
|
{
|
2012-10-30 07:10:50 -05:00
|
|
|
// Implements multidim upwind according to
|
|
|
|
// "Multidimensional upstream weighting for multiphase transport on general grids"
|
|
|
|
// by Keilegavlen, Kozdon, Mallison.
|
|
|
|
// However, that article does not give a 3d extension other than noting that using
|
|
|
|
// multidimensional upwinding in the XY-plane and not in the Z-direction may be
|
|
|
|
// a good idea. We have here attempted some generalization, by looking at all
|
|
|
|
// face-neighbours across edges as upwind candidates, and giving them all uniform weight.
|
|
|
|
// This will over-weight the immediate upstream cell value in an extruded 2d grid with
|
|
|
|
// one layer (top and bottom no-flow faces will enter the computation) compared to the
|
|
|
|
// original 2d case. Improvements are welcome.
|
2013-04-22 04:07:41 -05:00
|
|
|
// Note: Modified algorithm to consider faces that share even a single vertex with
|
|
|
|
// the input face. This reduces the problem of non-edge-conformal grids, but does not
|
|
|
|
// eliminate it entirely.
|
2012-10-30 07:10:50 -05:00
|
|
|
|
|
|
|
// Identify the adjacent faces of the upwind cell.
|
|
|
|
const int* face_nodes_beg = grid_.face_nodes + grid_.face_nodepos[face];
|
|
|
|
const int* face_nodes_end = grid_.face_nodes + grid_.face_nodepos[face + 1];
|
|
|
|
ASSERT(face_nodes_end - face_nodes_beg == 2 || grid_.dimensions != 2);
|
|
|
|
adj_faces_.clear();
|
|
|
|
for (int hf = grid_.cell_facepos[upwind_cell]; hf < grid_.cell_facepos[upwind_cell + 1]; ++hf) {
|
|
|
|
const int f = grid_.cell_faces[hf];
|
|
|
|
if (f != face) {
|
|
|
|
const int* f_nodes_beg = grid_.face_nodes + grid_.face_nodepos[f];
|
|
|
|
const int* f_nodes_end = grid_.face_nodes + grid_.face_nodepos[f + 1];
|
|
|
|
// Find out how many vertices they have in common.
|
|
|
|
// Using simple linear searches since sets are small.
|
|
|
|
int num_common = 0;
|
|
|
|
for (const int* f_iter = f_nodes_beg; f_iter < f_nodes_end; ++f_iter) {
|
|
|
|
num_common += std::count(face_nodes_beg, face_nodes_end, *f_iter);
|
|
|
|
}
|
2013-04-22 04:07:41 -05:00
|
|
|
// Before: neighbours over an edge (3d) or vertex (2d).
|
|
|
|
// Now: neighbours across a vertex.
|
|
|
|
// if (num_common == grid_.dimensions - 1) {
|
|
|
|
if (num_common > 0) {
|
2012-10-30 07:10:50 -05:00
|
|
|
adj_faces_.push_back(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Indentify adjacent faces with inflows, compute omega_star, omega,
|
|
|
|
// add up contributions.
|
|
|
|
const int num_adj = adj_faces_.size();
|
2013-04-22 04:07:41 -05:00
|
|
|
// The assertion below only holds if the grid is edge-conformal.
|
|
|
|
// No longer testing, since method no longer requires it.
|
|
|
|
// ASSERT(num_adj == face_nodes_end - face_nodes_beg);
|
2012-10-30 07:10:50 -05:00
|
|
|
const double flux_face = std::fabs(darcyflux_[face]);
|
2012-11-05 07:26:00 -06:00
|
|
|
face_term = 0.0;
|
|
|
|
cell_term_factor = 0.0;
|
2012-10-30 07:10:50 -05:00
|
|
|
for (int ii = 0; ii < num_adj; ++ii) {
|
|
|
|
const int f = adj_faces_[ii];
|
|
|
|
const double influx_f = (grid_.face_cells[2*f] == upwind_cell) ? -darcyflux_[f] : darcyflux_[f];
|
|
|
|
const double omega_star = influx_f/flux_face;
|
|
|
|
// SPU
|
|
|
|
// const double omega = 0.0;
|
|
|
|
// TMU
|
|
|
|
// const double omega = omega_star > 0.0 ? std::min(omega_star, 1.0) : 0.0;
|
|
|
|
// SMU
|
|
|
|
const double omega = omega_star > 0.0 ? omega_star/(1.0 + omega_star) : 0.0;
|
2012-11-05 07:26:00 -06:00
|
|
|
face_term += omega*face_tof_[f];
|
|
|
|
cell_term_factor += (1.0 - omega);
|
2012-10-30 07:10:50 -05:00
|
|
|
}
|
2012-11-05 07:26:00 -06:00
|
|
|
face_term /= double(num_adj);
|
|
|
|
cell_term_factor /= double(num_adj);
|
2012-10-29 11:23:17 -05:00
|
|
|
}
|
2012-08-24 09:08:26 -05:00
|
|
|
|
2012-11-05 07:26:00 -06:00
|
|
|
|
|
|
|
|
2012-08-24 09:08:26 -05:00
|
|
|
} // namespace Opm
|