Merge remote-tracking branch 'hnil/hnil_class' into combined.

Conflicts:
	CMakeLists.txt
	examples/sim_wateroil.cpp
	opm/core/grid/cpgpreprocess/geometry.c
	opm/core/transport/reorder/ReorderSolverInterface.hpp
	opm/core/transport/reorder/TofDiscGalReorder.cpp
	opm/core/transport/reorder/TofDiscGalReorder.hpp
	opm/core/transport/reorder/TofReorder.cpp
	opm/core/transport/reorder/TofReorder.hpp
	opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.cpp
	opm/core/transport/reorder/TransportSolverTwophaseReorder.cpp
This commit is contained in:
Atgeirr Flø Rasmussen 2013-03-14 16:18:39 +01:00
commit e99e023980
15 changed files with 185 additions and 90 deletions

View File

@ -24,9 +24,12 @@ namespace Opm
{ {
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck, BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
const UnstructuredGrid& grid) const UnstructuredGrid& grid,
bool init_rock)
{ {
rock_.init(deck, grid); if (init_rock){
rock_.init(deck, grid);
}
pvt_.init(deck, 200); pvt_.init(deck, 200);
SaturationPropsFromDeck<SatFuncSimpleUniform>* ptr SaturationPropsFromDeck<SatFuncSimpleUniform>* ptr
= new SaturationPropsFromDeck<SatFuncSimpleUniform>(); = new SaturationPropsFromDeck<SatFuncSimpleUniform>();
@ -41,9 +44,13 @@ namespace Opm
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck, BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
const UnstructuredGrid& grid, const UnstructuredGrid& grid,
const parameter::ParameterGroup& param) const parameter::ParameterGroup& param,
bool init_rock)
{ {
rock_.init(deck, grid); if(init_rock){
rock_.init(deck, grid);
}
const int pvt_samples = param.getDefault("pvt_tab_size", 200); const int pvt_samples = param.getDefault("pvt_tab_size", 200);
pvt_.init(deck, pvt_samples); pvt_.init(deck, pvt_samples);

View File

@ -45,7 +45,7 @@ namespace Opm
/// mapping from cell indices (typically from a processed grid) /// mapping from cell indices (typically from a processed grid)
/// to logical cartesian indices consistent with the deck. /// to logical cartesian indices consistent with the deck.
BlackoilPropertiesFromDeck(const EclipseGridParser& deck, BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
const UnstructuredGrid& grid); const UnstructuredGrid& grid, bool init_rock=true );
/// Initialize from deck, grid and parameters. /// Initialize from deck, grid and parameters.
/// \param[in] deck Deck input parser /// \param[in] deck Deck input parser
@ -60,7 +60,8 @@ namespace Opm
/// be done, and the input fluid data used directly for linear interpolation. /// be done, and the input fluid data used directly for linear interpolation.
BlackoilPropertiesFromDeck(const EclipseGridParser& deck, BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
const UnstructuredGrid& grid, const UnstructuredGrid& grid,
const parameter::ParameterGroup& param); const parameter::ParameterGroup& param,
bool init_rock=true);
/// Destructor. /// Destructor.
virtual ~BlackoilPropertiesFromDeck(); virtual ~BlackoilPropertiesFromDeck();

View File

@ -0,0 +1,32 @@
/*===========================================================================
//
// File: TwoPhaseTransportSolver.cpp
//
// Author: hnil <hnil@sintef.no>
//
// Created: 9 Nov 2012
//==========================================================================*/
/*
Copyright 2011 SINTEF ICT, Applied Mathematics.
Copyright 2011 Statoil ASA.
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 "TwoPhaseTransportSolver.hpp"

View File

@ -0,0 +1,60 @@
/*===========================================================================
//
// File: TwoPhaseTransportSolver.hpp
//
// Author: hnil <hnil@sintef.no>
//
// Created: 9 Nov 2012
//==========================================================================*/
/*
Copyright 2011 SINTEF ICT, Applied Mathematics.
Copyright 2011 Statoil ASA.
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 TWOPHASETRANSPORTSOLVER_HPP
#define TWOPHASETRANSPORTSOLVER_HPP
#include <opm/core/simulator/TwophaseState.hpp>
#include <opm/core/simulator/WellState.hpp>
namespace Opm
{
/// Base class for tranport solvers
class TwoPhaseTransportSolver
{
public:
/// Virtual destructor to enable inheritance.
virtual ~TwoPhaseTransportSolver() {}
/// Solve for saturation at next timestep.
/// \param[in] darcyflux Array of signed face fluxes.
/// \param[in] porevolume Array of pore volumes.
/// \param[in] source Transport source term.
/// \param[in] dt Time step.
/// \param[in, out] saturation Phase saturations.
virtual void solve(const double* porevolume,
const double* source,
const double dt,
TwophaseState& state,
WellState& wstate) = 0;
};
}
#endif // TWOPHASETRANSPORTSOLVER_HPP

View File

@ -17,7 +17,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/core/transport/reorder/TransportModelInterface.hpp> #include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
#include <opm/core/transport/reorder/reordersequence.h> #include <opm/core/transport/reorder/reordersequence.h>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/utility/StopWatch.hpp> #include <opm/core/utility/StopWatch.hpp>
@ -26,7 +26,7 @@
#include <cassert> #include <cassert>
void Opm::TransportModelInterface::reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux) void Opm::ReorderSolverInterface::reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux)
{ {
// Compute reordered sequence of single-cell problems // Compute reordered sequence of single-cell problems
sequence_.resize(grid.number_of_cells); sequence_.resize(grid.number_of_cells);

View File

@ -17,8 +17,8 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef OPM_TRANSPORTMODELINTERFACE_HEADER_INCLUDED #ifndef OPM_REORDERSOLVERINTERFACE_HEADER_INCLUDED
#define OPM_TRANSPORTMODELINTERFACE_HEADER_INCLUDED #define OPM_REORDERSOLVERINTERFACE_HEADER_INCLUDED
#include <vector> #include <vector>
@ -35,10 +35,10 @@ namespace Opm
/// class.) The reorderAndTransport() method is provided as an aid /// class.) The reorderAndTransport() method is provided as an aid
/// to implementing solve() in subclasses, together with the /// to implementing solve() in subclasses, together with the
/// sequence() and components() methods for accessing the ordering. /// sequence() and components() methods for accessing the ordering.
class TransportModelInterface class ReorderSolverInterface
{ {
public: public:
virtual ~TransportModelInterface() {} virtual ~ReorderSolverInterface() {}
private: private:
virtual void solveSingleCell(const int cell) = 0; virtual void solveSingleCell(const int cell) = 0;
virtual void solveMultiCell(const int num_cells, const int* cells) = 0; virtual void solveMultiCell(const int num_cells, const int* cells) = 0;

View File

@ -19,7 +19,7 @@
#include <opm/core/grid/CellQuadrature.hpp> #include <opm/core/grid/CellQuadrature.hpp>
#include <opm/core/grid/FaceQuadrature.hpp> #include <opm/core/grid/FaceQuadrature.hpp>
#include <opm/core/transport/reorder/TransportModelTracerTofDiscGal.hpp> #include <opm/core/transport/reorder/TofDiscGalReorder.hpp>
#include <opm/core/transport/reorder/DGBasis.hpp> #include <opm/core/transport/reorder/DGBasis.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/utility/ErrorMacros.hpp> #include <opm/core/utility/ErrorMacros.hpp>
@ -34,10 +34,6 @@ namespace Opm
{ {
// --------------- Methods of TransportModelTracerTofDiscGal ---------------
/// Construct solver. /// Construct solver.
/// \param[in] grid A 2d or 3d grid. /// \param[in] grid A 2d or 3d grid.
/// \param[in] param Parameters for the solver. /// \param[in] param Parameters for the solver.
@ -55,8 +51,8 @@ namespace Opm
/// computing (unlimited) solution. /// computing (unlimited) solution.
/// AsSimultaneousPostProcess Apply to each cell independently, using un- /// AsSimultaneousPostProcess Apply to each cell independently, using un-
/// limited solution in neighbouring cells. /// limited solution in neighbouring cells.
TransportModelTracerTofDiscGal::TransportModelTracerTofDiscGal(const UnstructuredGrid& grid, TofDiscGalReorder::TofDiscGalReorder(const UnstructuredGrid& grid,
const parameter::ParameterGroup& param) const parameter::ParameterGroup& param)
: grid_(grid), : grid_(grid),
use_cvi_(false), use_cvi_(false),
use_limiter_(false), use_limiter_(false),
@ -127,7 +123,7 @@ namespace Opm
/// cell comes before the K coefficients corresponding /// cell comes before the K coefficients corresponding
/// to the second cell etc. /// to the second cell etc.
/// K depends on degree and grid dimension. /// K depends on degree and grid dimension.
void TransportModelTracerTofDiscGal::solveTof(const double* darcyflux, void TofDiscGalReorder::solveTof(const double* darcyflux,
const double* porevolume, const double* porevolume,
const double* source, const double* source,
std::vector<double>& tof_coeff) std::vector<double>& tof_coeff)
@ -173,7 +169,7 @@ namespace Opm
void TransportModelTracerTofDiscGal::solveSingleCell(const int cell) void TofDiscGalReorder::solveSingleCell(const int cell)
{ {
// Residual: // Residual:
// For each cell K, basis function b_j (spanning V_h), // For each cell K, basis function b_j (spanning V_h),
@ -396,7 +392,7 @@ namespace Opm
void TransportModelTracerTofDiscGal::solveMultiCell(const int num_cells, const int* cells) void TofDiscGalReorder::solveMultiCell(const int num_cells, const int* cells)
{ {
std::cout << "Pretending to solve multi-cell dependent equation with " << num_cells << " cells." << std::endl; std::cout << "Pretending to solve multi-cell dependent equation with " << num_cells << " cells." << std::endl;
for (int i = 0; i < num_cells; ++i) { for (int i = 0; i < num_cells; ++i) {

View File

@ -17,10 +17,10 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef OPM_TRANSPORTMODELTRACERTOFDISCGAL_HEADER_INCLUDED #ifndef OPM_TOFDISCGALREORDER_HEADER_INCLUDED
#define OPM_TRANSPORTMODELTRACERTOFDISCGAL_HEADER_INCLUDED #define OPM_TOFDISCGALREORDER_HEADER_INCLUDED
#include <opm/core/transport/reorder/TransportModelInterface.hpp> #include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <vector> #include <vector>
#include <map> #include <map>
@ -45,7 +45,7 @@ namespace Opm
/// \tau is specified to be zero on all inflow boundaries. /// \tau is specified to be zero on all inflow boundaries.
/// The user may specify the polynomial degree of the basis function space /// The user may specify the polynomial degree of the basis function space
/// used, but only degrees 0 and 1 are supported so far. /// used, but only degrees 0 and 1 are supported so far.
class TransportModelTracerTofDiscGal : public TransportModelInterface class TofDiscGalReorder : public ReorderSolverInterface
{ {
public: public:
/// Construct solver. /// Construct solver.
@ -68,8 +68,8 @@ namespace Opm
/// computing (unlimited) solution. /// computing (unlimited) solution.
/// AsSimultaneousPostProcess Apply to each cell independently, using un- /// AsSimultaneousPostProcess Apply to each cell independently, using un-
/// limited solution in neighbouring cells. /// limited solution in neighbouring cells.
TransportModelTracerTofDiscGal(const UnstructuredGrid& grid, TofDiscGalReorder(const UnstructuredGrid& grid,
const parameter::ParameterGroup& param); const parameter::ParameterGroup& param);
/// Solve for time-of-flight. /// Solve for time-of-flight.
@ -95,8 +95,8 @@ namespace Opm
private: private:
// Disable copying and assignment. // Disable copying and assignment.
TransportModelTracerTofDiscGal(const TransportModelTracerTofDiscGal&); TofDiscGalReorder(const TofDiscGalReorder&);
TransportModelTracerTofDiscGal& operator=(const TransportModelTracerTofDiscGal&); TofDiscGalReorder& operator=(const TofDiscGalReorder&);
// Data members // Data members
const UnstructuredGrid& grid_; const UnstructuredGrid& grid_;

View File

@ -17,7 +17,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/core/transport/reorder/TransportModelTracerTof.hpp> #include <opm/core/transport/reorder/TofReorder.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/utility/ErrorMacros.hpp> #include <opm/core/utility/ErrorMacros.hpp>
#include <algorithm> #include <algorithm>
@ -30,8 +30,8 @@ namespace Opm
/// Construct solver. /// Construct solver.
/// \param[in] grid A 2d or 3d grid. /// \param[in] grid A 2d or 3d grid.
TransportModelTracerTof::TransportModelTracerTof(const UnstructuredGrid& grid, TofReorder::TofReorder(const UnstructuredGrid& grid,
const bool use_multidim_upwind) const bool use_multidim_upwind)
: grid_(grid), : grid_(grid),
darcyflux_(0), darcyflux_(0),
porevolume_(0), porevolume_(0),
@ -53,7 +53,7 @@ namespace Opm
/// (+) inflow flux, /// (+) inflow flux,
/// (-) outflow flux. /// (-) outflow flux.
/// \param[out] tof Array of time-of-flight values. /// \param[out] tof Array of time-of-flight values.
void TransportModelTracerTof::solveTof(const double* darcyflux, void TofReorder::solveTof(const double* darcyflux,
const double* porevolume, const double* porevolume,
const double* source, const double* source,
std::vector<double>& tof) std::vector<double>& tof)
@ -137,7 +137,7 @@ namespace Opm
void TransportModelTracerTof::solveSingleCell(const int cell) void TofReorder::solveSingleCell(const int cell)
{ {
if (use_multidim_upwind_) { if (use_multidim_upwind_) {
solveSingleCellMultidimUpwind(cell); solveSingleCellMultidimUpwind(cell);
@ -243,7 +243,7 @@ namespace Opm
void TransportModelTracerTof::solveMultiCell(const int num_cells, const int* cells) void TofReorder::solveMultiCell(const int num_cells, const int* cells)
{ {
std::cout << "Pretending to solve multi-cell dependent equation with " << num_cells << " cells." << std::endl; std::cout << "Pretending to solve multi-cell dependent equation with " << num_cells << " cells." << std::endl;
for (int i = 0; i < num_cells; ++i) { for (int i = 0; i < num_cells; ++i) {

View File

@ -17,10 +17,10 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef OPM_TRANSPORTMODELTRACERTOF_HEADER_INCLUDED #ifndef OPM_TOFREORDER_HEADER_INCLUDED
#define OPM_TRANSPORTMODELTRACERTOF_HEADER_INCLUDED #define OPM_TOFREORDER_HEADER_INCLUDED
#include <opm/core/transport/reorder/TransportModelInterface.hpp> #include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
#include <vector> #include <vector>
#include <map> #include <map>
#include <ostream> #include <ostream>
@ -38,14 +38,14 @@ namespace Opm
/// where v is the fluid velocity, \tau is time-of-flight and /// where v is the fluid velocity, \tau is time-of-flight and
/// \phi is the porosity. This is a boundary value problem, where /// \phi is the porosity. This is a boundary value problem, where
/// \tau is specified to be zero on all inflow boundaries. /// \tau is specified to be zero on all inflow boundaries.
class TransportModelTracerTof : public TransportModelInterface class TofReorder : public ReorderSolverInterface
{ {
public: public:
/// Construct solver. /// Construct solver.
/// \param[in] grid A 2d or 3d grid. /// \param[in] grid A 2d or 3d grid.
/// \param[in] use_multidim_upwind If true, use multidimensional tof upwinding. /// \param[in] use_multidim_upwind If true, use multidimensional tof upwinding.
TransportModelTracerTof(const UnstructuredGrid& grid, TofReorder(const UnstructuredGrid& grid,
const bool use_multidim_upwind = false); const bool use_multidim_upwind = false);
/// Solve for time-of-flight. /// Solve for time-of-flight.
/// \param[in] darcyflux Array of signed face fluxes. /// \param[in] darcyflux Array of signed face fluxes.

View File

@ -18,7 +18,7 @@
*/ */
#include <opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp> #include <opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.hpp>
#include <opm/core/props/BlackoilPropertiesInterface.hpp> #include <opm/core/props/BlackoilPropertiesInterface.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/transport/reorder/reordersequence.h> #include <opm/core/transport/reorder/reordersequence.h>
@ -39,7 +39,7 @@ namespace Opm
typedef RegulaFalsi<WarnAndContinueOnError> RootFinder; typedef RegulaFalsi<WarnAndContinueOnError> RootFinder;
TransportModelCompressibleTwophase::TransportModelCompressibleTwophase( TransportSolverCompressibleTwophaseReorder::TransportSolverCompressibleTwophaseReorder(
const UnstructuredGrid& grid, const UnstructuredGrid& grid,
const Opm::BlackoilPropertiesInterface& props, const Opm::BlackoilPropertiesInterface& props,
const double tol, const double tol,
@ -76,7 +76,7 @@ namespace Opm
props.satRange(props.numCells(), &allcells_[0], &smin_[0], &smax_[0]); props.satRange(props.numCells(), &allcells_[0], &smin_[0], &smax_[0]);
} }
void TransportModelCompressibleTwophase::solve(const double* darcyflux, void TransportSolverCompressibleTwophaseReorder::solve(const double* darcyflux,
const double* pressure, const double* pressure,
const double* porevolume0, const double* porevolume0,
const double* porevolume, const double* porevolume,
@ -132,7 +132,7 @@ namespace Opm
// We need the formula influx = B_i sum_{j->i} b_j v_{ij} - B_i q_w. // We need the formula influx = B_i sum_{j->i} b_j v_{ij} - B_i q_w.
// outflux = B_i sum_{i->j} b_i v_{ij} - B_i q = sum_{i->j} v_{ij} - B_i q // outflux = B_i sum_{i->j} b_i v_{ij} - B_i q = sum_{i->j} v_{ij} - B_i q
// Influxes are negative, outfluxes positive. // Influxes are negative, outfluxes positive.
struct TransportModelCompressibleTwophase::Residual struct TransportSolverCompressibleTwophaseReorder::Residual
{ {
int cell; int cell;
double B_cell; double B_cell;
@ -142,8 +142,8 @@ namespace Opm
// @@@ TODO: figure out change to rock-comp. terms with fluid compr. // @@@ TODO: figure out change to rock-comp. terms with fluid compr.
double comp_term; // Now: used to be: q - sum_j v_ij double comp_term; // Now: used to be: q - sum_j v_ij
double dtpv; // dt/pv(i) double dtpv; // dt/pv(i)
const TransportModelCompressibleTwophase& tm; const TransportSolverCompressibleTwophaseReorder& tm;
explicit Residual(const TransportModelCompressibleTwophase& tmodel, int cell_index) explicit Residual(const TransportSolverCompressibleTwophaseReorder& tmodel, int cell_index)
: tm(tmodel) : tm(tmodel)
{ {
cell = cell_index; cell = cell_index;
@ -187,7 +187,7 @@ namespace Opm
}; };
void TransportModelCompressibleTwophase::solveSingleCell(const int cell) void TransportSolverCompressibleTwophaseReorder::solveSingleCell(const int cell)
{ {
Residual res(*this, cell); Residual res(*this, cell);
int iters_used; int iters_used;
@ -196,7 +196,7 @@ namespace Opm
} }
void TransportModelCompressibleTwophase::solveMultiCell(const int num_cells, const int* cells) void TransportSolverCompressibleTwophaseReorder::solveMultiCell(const int num_cells, const int* cells)
{ {
// Experiment: when a cell changes more than the tolerance, // Experiment: when a cell changes more than the tolerance,
// mark all downwind cells as needing updates. After // mark all downwind cells as needing updates. After
@ -302,7 +302,7 @@ namespace Opm
} }
double TransportModelCompressibleTwophase::fracFlow(double s, int cell) const double TransportSolverCompressibleTwophaseReorder::fracFlow(double s, int cell) const
{ {
double sat[2] = { s, 1.0 - s }; double sat[2] = { s, 1.0 - s };
double mob[2]; double mob[2];
@ -321,15 +321,15 @@ namespace Opm
// [[ incompressible was: r(s) = s - s0 + dt/pv*sum_{j adj i}( gravmod_ij * gf_ij ) ]] // [[ incompressible was: r(s) = s - s0 + dt/pv*sum_{j adj i}( gravmod_ij * gf_ij ) ]]
// //
// r(s) = s - B*z0 + dt/pv*( influx + outflux*f(s) ) // r(s) = s - B*z0 + dt/pv*( influx + outflux*f(s) )
struct TransportModelCompressibleTwophase::GravityResidual struct TransportSolverCompressibleTwophaseReorder::GravityResidual
{ {
int cell; int cell;
int nbcell[2]; int nbcell[2];
double s0; double s0;
double dtpv; // dt/pv(i) double dtpv; // dt/pv(i)
double gf[2]; double gf[2];
const TransportModelCompressibleTwophase& tm; const TransportSolverCompressibleTwophaseReorder& tm;
explicit GravityResidual(const TransportModelCompressibleTwophase& tmodel, explicit GravityResidual(const TransportSolverCompressibleTwophaseReorder& tmodel,
const std::vector<int>& cells, const std::vector<int>& cells,
const int pos, const int pos,
const double* gravflux) // Always oriented towards next in column. Size = colsize - 1. const double* gravflux) // Always oriented towards next in column. Size = colsize - 1.
@ -376,7 +376,7 @@ namespace Opm
} }
}; };
void TransportModelCompressibleTwophase::mobility(double s, int cell, double* mob) const void TransportSolverCompressibleTwophaseReorder::mobility(double s, int cell, double* mob) const
{ {
double sat[2] = { s, 1.0 - s }; double sat[2] = { s, 1.0 - s };
props_.relperm(1, sat, &cell, mob, 0); props_.relperm(1, sat, &cell, mob, 0);
@ -386,7 +386,7 @@ namespace Opm
void TransportModelCompressibleTwophase::initGravity(const double* grav) void TransportSolverCompressibleTwophaseReorder::initGravity(const double* grav)
{ {
// Set up transmissibilities. // Set up transmissibilities.
std::vector<double> htrans(grid_.cell_facepos[grid_.number_of_cells]); std::vector<double> htrans(grid_.cell_facepos[grid_.number_of_cells]);
@ -403,7 +403,7 @@ namespace Opm
void TransportModelCompressibleTwophase::initGravityDynamic() void TransportSolverCompressibleTwophaseReorder::initGravityDynamic()
{ {
// Set up gravflux_ = T_ij g [ (b_w,i rho_w,S - b_o,i rho_o,S) (z_i - z_f) // Set up gravflux_ = T_ij g [ (b_w,i rho_w,S - b_o,i rho_o,S) (z_i - z_f)
// + (b_w,j rho_w,S - b_o,j rho_o,S) (z_f - z_j) ] // + (b_w,j rho_w,S - b_o,j rho_o,S) (z_f - z_j) ]
@ -436,7 +436,7 @@ namespace Opm
void TransportModelCompressibleTwophase::solveSingleCellGravity(const std::vector<int>& cells, void TransportSolverCompressibleTwophaseReorder::solveSingleCellGravity(const std::vector<int>& cells,
const int pos, const int pos,
const double* gravflux) const double* gravflux)
{ {
@ -451,7 +451,7 @@ namespace Opm
int TransportModelCompressibleTwophase::solveGravityColumn(const std::vector<int>& cells) int TransportSolverCompressibleTwophaseReorder::solveGravityColumn(const std::vector<int>& cells)
{ {
// Set up column gravflux. // Set up column gravflux.
const int nc = cells.size(); const int nc = cells.size();
@ -504,7 +504,7 @@ namespace Opm
void TransportModelCompressibleTwophase::solveGravity(const std::vector<std::vector<int> >& columns, void TransportSolverCompressibleTwophaseReorder::solveGravity(const std::vector<std::vector<int> >& columns,
const double dt, const double dt,
std::vector<double>& saturation, std::vector<double>& saturation,
std::vector<double>& surfacevol) std::vector<double>& surfacevol)

View File

@ -17,10 +17,10 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef OPM_TRANSPORTMODELCOMPRESSIBLETWOPHASE_HEADER_INCLUDED #ifndef OPM_TRANSPORTSOLVERCOMPRESSIBLETWOPHASEREORDER_HEADER_INCLUDED
#define OPM_TRANSPORTMODELCOMPRESSIBLETWOPHASE_HEADER_INCLUDED #define OPM_TRANSPORTSOLVERCOMPRESSIBLETWOPHASEREORDER_HEADER_INCLUDED
#include <opm/core/transport/reorder/TransportModelInterface.hpp> #include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
#include <vector> #include <vector>
struct UnstructuredGrid; struct UnstructuredGrid;
@ -32,7 +32,7 @@ namespace Opm
/// Implements a reordering transport solver for compressible, /// Implements a reordering transport solver for compressible,
/// non-miscible two-phase flow. /// non-miscible two-phase flow.
class TransportModelCompressibleTwophase : public TransportModelInterface class TransportSolverCompressibleTwophaseReorder : public ReorderSolverInterface
{ {
public: public:
/// Construct solver. /// Construct solver.
@ -40,7 +40,7 @@ namespace Opm
/// \param[in] props Rock and fluid properties. /// \param[in] props Rock and fluid properties.
/// \param[in] tol Tolerance used in the solver. /// \param[in] tol Tolerance used in the solver.
/// \param[in] maxit Maximum number of non-linear iterations used. /// \param[in] maxit Maximum number of non-linear iterations used.
TransportModelCompressibleTwophase(const UnstructuredGrid& grid, TransportSolverCompressibleTwophaseReorder(const UnstructuredGrid& grid,
const Opm::BlackoilPropertiesInterface& props, const Opm::BlackoilPropertiesInterface& props,
const double tol, const double tol,
const int maxit); const int maxit);

View File

@ -17,7 +17,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/core/transport/reorder/TransportModelTwophase.hpp> #include <opm/core/transport/reorder/TransportSolverTwophaseReorder.hpp>
#include <opm/core/props/IncompPropertiesInterface.hpp> #include <opm/core/props/IncompPropertiesInterface.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/transport/reorder/reordersequence.h> #include <opm/core/transport/reorder/reordersequence.h>
@ -40,7 +40,7 @@ namespace Opm
typedef RegulaFalsi<WarnAndContinueOnError> RootFinder; typedef RegulaFalsi<WarnAndContinueOnError> RootFinder;
TransportModelTwophase::TransportModelTwophase(const UnstructuredGrid& grid, TransportSolverTwophaseReorder::TransportSolverTwophaseReorder(const UnstructuredGrid& grid,
const Opm::IncompPropertiesInterface& props, const Opm::IncompPropertiesInterface& props,
const double tol, const double tol,
const int maxit) const int maxit)
@ -76,7 +76,7 @@ namespace Opm
props.satRange(props.numCells(), &cells[0], &smin_[0], &smax_[0]); props.satRange(props.numCells(), &cells[0], &smin_[0], &smax_[0]);
} }
void TransportModelTwophase::solve(const double* darcyflux, void TransportSolverTwophaseReorder::solve(const double* darcyflux,
const double* porevolume, const double* porevolume,
const double* source, const double* source,
const double dt, const double dt,
@ -108,7 +108,7 @@ namespace Opm
} }
const std::vector<int>& TransportModelTwophase::getReorderIterations() const const std::vector<int>& TransportSolverTwophaseReorder::getReorderIterations() const
{ {
return reorder_iterations_; return reorder_iterations_;
} }
@ -120,7 +120,7 @@ namespace Opm
// //
// where influx is water influx, outflux is total outflux. // where influx is water influx, outflux is total outflux.
// Influxes are negative, outfluxes positive. // Influxes are negative, outfluxes positive.
struct TransportModelTwophase::Residual struct TransportSolverTwophaseReorder::Residual
{ {
int cell; int cell;
double s0; double s0;
@ -128,8 +128,8 @@ namespace Opm
double outflux; // sum_j max(v_ij, 0) - q double outflux; // sum_j max(v_ij, 0) - q
double comp_term; // q - sum_j v_ij double comp_term; // q - sum_j v_ij
double dtpv; // dt/pv(i) double dtpv; // dt/pv(i)
const TransportModelTwophase& tm; const TransportSolverTwophaseReorder& tm;
explicit Residual(const TransportModelTwophase& tmodel, int cell_index) explicit Residual(const TransportSolverTwophaseReorder& tmodel, int cell_index)
: tm(tmodel) : tm(tmodel)
{ {
cell = cell_index; cell = cell_index;
@ -171,7 +171,7 @@ namespace Opm
}; };
void TransportModelTwophase::solveSingleCell(const int cell) void TransportSolverTwophaseReorder::solveSingleCell(const int cell)
{ {
Residual res(*this, cell); Residual res(*this, cell);
// const double r0 = res(saturation_[cell]); // const double r0 = res(saturation_[cell]);
@ -225,7 +225,7 @@ namespace Opm
// } // anon namespace // } // anon namespace
void TransportModelTwophase::solveMultiCell(const int num_cells, const int* cells) void TransportSolverTwophaseReorder::solveMultiCell(const int num_cells, const int* cells)
{ {
// std::ofstream os("dump"); // std::ofstream os("dump");
// std::copy(cells, cells + num_cells, std::ostream_iterator<double>(os, "\n")); // std::copy(cells, cells + num_cells, std::ostream_iterator<double>(os, "\n"));
@ -440,7 +440,7 @@ namespace Opm
#endif // EXPERIMENT_GAUSS_SEIDEL #endif // EXPERIMENT_GAUSS_SEIDEL
} }
double TransportModelTwophase::fracFlow(double s, int cell) const double TransportSolverTwophaseReorder::fracFlow(double s, int cell) const
{ {
double sat[2] = { s, 1.0 - s }; double sat[2] = { s, 1.0 - s };
double mob[2]; double mob[2];
@ -458,15 +458,15 @@ namespace Opm
// //
// r(s) = s - s0 + dt/pv*sum_{j adj i}( gravmod_ij * gf_ij ). // r(s) = s - s0 + dt/pv*sum_{j adj i}( gravmod_ij * gf_ij ).
// //
struct TransportModelTwophase::GravityResidual struct TransportSolverTwophaseReorder::GravityResidual
{ {
int cell; int cell;
int nbcell[2]; int nbcell[2];
double s0; double s0;
double dtpv; // dt/pv(i) double dtpv; // dt/pv(i)
double gf[2]; double gf[2];
const TransportModelTwophase& tm; const TransportSolverTwophaseReorder& tm;
explicit GravityResidual(const TransportModelTwophase& tmodel, explicit GravityResidual(const TransportSolverTwophaseReorder& tmodel,
const std::vector<int>& cells, const std::vector<int>& cells,
const int pos, const int pos,
const double* gravflux) // Always oriented towards next in column. Size = colsize - 1. const double* gravflux) // Always oriented towards next in column. Size = colsize - 1.
@ -513,7 +513,7 @@ namespace Opm
} }
}; };
void TransportModelTwophase::mobility(double s, int cell, double* mob) const void TransportSolverTwophaseReorder::mobility(double s, int cell, double* mob) const
{ {
double sat[2] = { s, 1.0 - s }; double sat[2] = { s, 1.0 - s };
props_.relperm(1, sat, &cell, mob, 0); props_.relperm(1, sat, &cell, mob, 0);
@ -523,7 +523,7 @@ namespace Opm
void TransportModelTwophase::initGravity(const double* grav) void TransportSolverTwophaseReorder::initGravity(const double* grav)
{ {
// Set up gravflux_ = T_ij g (rho_w - rho_o) (z_i - z_j) // Set up gravflux_ = T_ij g (rho_w - rho_o) (z_i - z_j)
std::vector<double> htrans(grid_.cell_facepos[grid_.number_of_cells]); std::vector<double> htrans(grid_.cell_facepos[grid_.number_of_cells]);
@ -547,7 +547,7 @@ namespace Opm
void TransportModelTwophase::solveSingleCellGravity(const std::vector<int>& cells, void TransportSolverTwophaseReorder::solveSingleCellGravity(const std::vector<int>& cells,
const int pos, const int pos,
const double* gravflux) const double* gravflux)
{ {
@ -564,7 +564,7 @@ namespace Opm
int TransportModelTwophase::solveGravityColumn(const std::vector<int>& cells) int TransportSolverTwophaseReorder::solveGravityColumn(const std::vector<int>& cells)
{ {
// Set up column gravflux. // Set up column gravflux.
const int nc = cells.size(); const int nc = cells.size();
@ -617,7 +617,7 @@ namespace Opm
void TransportModelTwophase::solveGravity(const std::vector<std::vector<int> >& columns, void TransportSolverTwophaseReorder::solveGravity(const std::vector<std::vector<int> >& columns,
const double* porevolume, const double* porevolume,
const double dt, const double dt,
std::vector<double>& saturation) std::vector<double>& saturation)

View File

@ -17,10 +17,10 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef OPM_TRANSPORTMODELTWOPHASE_HEADER_INCLUDED #ifndef OPM_TRANSPORTSOLVERTWOPHASEREORDER_HEADER_INCLUDED
#define OPM_TRANSPORTMODELTWOPHASE_HEADER_INCLUDED #define OPM_TRANSPORTSOLVERTWOPHASEREORDER_HEADER_INCLUDED
#include <opm/core/transport/reorder/TransportModelInterface.hpp> #include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
#include <vector> #include <vector>
#include <map> #include <map>
#include <ostream> #include <ostream>
@ -32,7 +32,7 @@ namespace Opm
class IncompPropertiesInterface; class IncompPropertiesInterface;
/// Implements a reordering transport solver for incompressible two-phase flow. /// Implements a reordering transport solver for incompressible two-phase flow.
class TransportModelTwophase : public TransportModelInterface class TransportSolverTwophaseReorder : public ReorderSolverInterface
{ {
public: public:
/// Construct solver. /// Construct solver.
@ -40,7 +40,7 @@ namespace Opm
/// \param[in] props Rock and fluid properties. /// \param[in] props Rock and fluid properties.
/// \param[in] tol Tolerance used in the solver. /// \param[in] tol Tolerance used in the solver.
/// \param[in] maxit Maximum number of non-linear iterations used. /// \param[in] maxit Maximum number of non-linear iterations used.
TransportModelTwophase(const UnstructuredGrid& grid, TransportSolverTwophaseReorder(const UnstructuredGrid& grid,
const Opm::IncompPropertiesInterface& props, const Opm::IncompPropertiesInterface& props,
const double tol, const double tol,
const int maxit); const int maxit);

View File

@ -223,8 +223,7 @@ namespace Opm
: w_(0) : w_(0)
{ {
} }
/// Construct from existing wells object. /// Construct from existing wells object.
WellsManager::WellsManager(struct Wells* W) WellsManager::WellsManager(struct Wells* W)