Make TransportSolverTwophaseReorder inherit TransportSolverTwophaseInterface.

This changes the solve() interface, which requires clients to change.
This commit is contained in:
Atgeirr Flø Rasmussen 2013-03-15 11:31:31 +01:00
parent 7f1a06cfb3
commit e2afd671f0
6 changed files with 36 additions and 31 deletions

View File

@ -628,8 +628,7 @@ main(int argc, char** argv)
}
for (int tr_substep = 0; tr_substep < num_transport_substeps; ++tr_substep) {
if (use_reorder) {
reorder_model.solve(&state.faceflux()[0], &porevol[0], &reorder_src[0],
stepsize, state.saturation());
reorder_model.solve(&porevol[0], &reorder_src[0], stepsize, state);
Opm::computeInjectedProduced(*props, state.saturation(), reorder_src, stepsize, injected, produced);
if (use_segregation_split) {
if (use_column_solver) {

View File

@ -523,8 +523,7 @@ namespace Opm
double injected[2] = { 0.0 };
double produced[2] = { 0.0 };
for (int tr_substep = 0; tr_substep < num_transport_substeps_; ++tr_substep) {
tsolver_.solve(&state.faceflux()[0], &initial_porevol[0], &transport_src[0],
stepsize, state.saturation());
tsolver_.solve(&initial_porevol[0], &transport_src[0], stepsize, state);
double substep_injected[2] = { 0.0 };
double substep_produced[2] = { 0.0 };
Opm::computeInjectedProduced(props_, state.saturation(), transport_src, stepsize,

View File

@ -41,9 +41,9 @@ namespace Opm
TransportSolverTwophaseReorder::TransportSolverTwophaseReorder(const UnstructuredGrid& grid,
const Opm::IncompPropertiesInterface& props,
const double tol,
const int maxit)
const Opm::IncompPropertiesInterface& props,
const double tol,
const int maxit)
: grid_(grid),
props_(props),
tol_(tol),
@ -76,17 +76,22 @@ namespace Opm
props.satRange(props.numCells(), &cells[0], &smin_[0], &smax_[0]);
}
void TransportSolverTwophaseReorder::solve(const double* darcyflux,
const double* porevolume,
const double* source,
const double dt,
std::vector<double>& saturation)
TransportSolverTwophaseReorder::~TransportSolverTwophaseReorder()
{
darcyflux_ = darcyflux;
}
void TransportSolverTwophaseReorder::solve(const double* porevolume,
const double* source,
const double dt,
TwophaseState& state)
{
darcyflux_ = &state.faceflux()[0];
porevolume_ = porevolume;
source_ = source;
dt_ = dt;
toWaterSat(saturation, saturation_);
toWaterSat(state.saturation(), saturation_);
#ifdef EXPERIMENT_GAUSS_SEIDEL
std::vector<int> seq(grid_.number_of_cells);
@ -97,14 +102,14 @@ namespace Opm
&ia_upw_[0], &ja_upw_[0]);
const int nf = grid_.number_of_faces;
std::vector<double> neg_darcyflux(nf);
std::transform(darcyflux, darcyflux + nf, neg_darcyflux.begin(), std::negate<double>());
std::transform(darcyflux_, darcyflux_ + nf, neg_darcyflux.begin(), std::negate<double>());
compute_sequence_graph(&grid_, &neg_darcyflux[0],
&seq[0], &comp[0], &ncomp,
&ia_downw_[0], &ja_downw_[0]);
#endif
std::fill(reorder_iterations_.begin(),reorder_iterations_.end(),0);
reorderAndTransport(grid_, darcyflux);
toBothSat(saturation_, saturation);
reorderAndTransport(grid_, darcyflux_);
toBothSat(saturation_, state.saturation());
}

View File

@ -21,6 +21,7 @@
#define OPM_TRANSPORTSOLVERTWOPHASEREORDER_HEADER_INCLUDED
#include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
#include <opm/core/transport/TransportSolverTwophaseInterface.hpp>
#include <vector>
#include <map>
#include <ostream>
@ -32,7 +33,7 @@ namespace Opm
class IncompPropertiesInterface;
/// Implements a reordering transport solver for incompressible two-phase flow.
class TransportSolverTwophaseReorder : public ReorderSolverInterface
class TransportSolverTwophaseReorder : public TransportSolverTwophaseInterface, ReorderSolverInterface
{
public:
/// Construct solver.
@ -45,17 +46,19 @@ namespace Opm
const double tol,
const int maxit);
// Virtual destructor.
virtual ~TransportSolverTwophaseReorder();
/// 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.
void solve(const double* darcyflux,
const double* porevolume,
const double* source,
const double dt,
std::vector<double>& saturation);
/// \param[in] porevolume Array of pore volumes.
/// \param[in] source Transport source term. For interpretation see Opm::computeTransportSource().
/// \param[in] dt Time step.
/// \param[in, out] state Reservoir state. Calling solve() will read state.faceflux() and
/// read and write state.saturation().
virtual void solve(const double* porevolume,
const double* source,
const double dt,
TwophaseState& state);
/// Initialise quantities needed by gravity solver.
/// \param[in] grav gravity vector

View File

@ -301,8 +301,7 @@ int main ()
/// \details Solve the transport equation.
/// \snippet tutorial3.cpp transport solve
/// \internal [transport solve]
transport_solver.solve(&state.faceflux()[0], &porevol[0], &src[0],
dt, state.saturation());
transport_solver.solve(&porevol[0], &src[0], dt, state);
/// \internal [transport solve]
/// \endinternal

View File

@ -420,7 +420,7 @@ int main ()
/// \TODO We must call computeTransportSource() here, since we have wells.
/// \snippet tutorial4.cpp tranport solver
/// \internal[tranport solver]
transport_solver.solve(&state.faceflux()[0], &porevol[0], &src[0], dt, state.saturation());
transport_solver.solve(&porevol[0], &src[0], dt, state);
/// \internal[tranport solver]
/// \endinternal