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/>.
|
|
|
|
*/
|
|
|
|
|
2012-11-16 09:06:01 -06:00
|
|
|
#ifndef OPM_TOFREORDER_HEADER_INCLUDED
|
|
|
|
#define OPM_TOFREORDER_HEADER_INCLUDED
|
2012-08-24 09:08:26 -05:00
|
|
|
|
2012-11-16 09:24:54 -06:00
|
|
|
#include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
|
2012-08-24 09:08:26 -05:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <ostream>
|
|
|
|
struct UnstructuredGrid;
|
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
|
|
|
class IncompPropertiesInterface;
|
|
|
|
|
2012-10-09 02:54:54 -05:00
|
|
|
/// Implements a first-order finite volume solver for
|
|
|
|
/// (single-phase) time-of-flight using reordering.
|
|
|
|
/// The equation solved is:
|
2013-03-21 08:51:49 -05:00
|
|
|
/// \f[v \cdot \nabla\tau = \phi\f]
|
|
|
|
/// where \f$ v \f$ is the fluid velocity, \f$ \tau \f$ is time-of-flight and
|
|
|
|
/// \f$ \phi \f$ is the porosity. This is a boundary value problem, where
|
|
|
|
/// \f$ \tau \f$ is specified to be zero on all inflow boundaries.
|
2012-11-16 09:06:01 -06:00
|
|
|
class TofReorder : public ReorderSolverInterface
|
2012-08-24 09:08:26 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Construct solver.
|
|
|
|
/// \param[in] grid A 2d or 3d grid.
|
2012-10-29 11:23:17 -05:00
|
|
|
/// \param[in] use_multidim_upwind If true, use multidimensional tof upwinding.
|
2013-03-14 10:18:39 -05:00
|
|
|
TofReorder(const UnstructuredGrid& grid,
|
|
|
|
const bool use_multidim_upwind = false);
|
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-08-24 09:08:26 -05:00
|
|
|
void solveTof(const double* darcyflux,
|
|
|
|
const double* porevolume,
|
2012-09-25 07:00:17 -05:00
|
|
|
const double* source,
|
2012-08-24 09:08:26 -05:00
|
|
|
std::vector<double>& tof);
|
|
|
|
|
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.
|
|
|
|
/// \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).
|
|
|
|
void solveTofTracer(const double* darcyflux,
|
|
|
|
const double* porevolume,
|
|
|
|
const double* source,
|
|
|
|
std::vector<double>& tof,
|
|
|
|
std::vector<double>& tracer);
|
|
|
|
|
2012-08-24 09:08:26 -05:00
|
|
|
private:
|
|
|
|
virtual void solveSingleCell(const int cell);
|
2012-11-05 07:26:00 -06:00
|
|
|
void solveSingleCellMultidimUpwind(const int cell);
|
2012-08-24 09:08:26 -05:00
|
|
|
virtual void solveMultiCell(const int num_cells, const int* cells);
|
|
|
|
|
2012-11-05 07:26:00 -06:00
|
|
|
void 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-08-24 09:08:26 -05:00
|
|
|
private:
|
|
|
|
const UnstructuredGrid& grid_;
|
|
|
|
const double* darcyflux_; // one flux per grid face
|
|
|
|
const double* porevolume_; // one volume per cell
|
2012-09-25 07:00:17 -05:00
|
|
|
const double* source_; // one volumetric source term per cell
|
2012-08-24 09:08:26 -05:00
|
|
|
double* tof_;
|
2013-01-03 07:07:51 -06:00
|
|
|
double* tracer_;
|
|
|
|
int num_tracers_;
|
2012-10-29 11:23:17 -05:00
|
|
|
bool use_multidim_upwind_;
|
2012-10-30 07:10:50 -05:00
|
|
|
std::vector<double> face_tof_; // For multidim upwind face tofs.
|
|
|
|
mutable std::vector<int> adj_faces_; // For multidim upwind logic.
|
2012-08-24 09:08:26 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#endif // OPM_TRANSPORTMODELTRACERTOF_HEADER_INCLUDED
|