From 7019eb2c32cfeab4e0bc935889b5fbfdb67e6b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Fri, 15 Mar 2013 08:21:55 +0100 Subject: [PATCH] Modify solve() interface, fix source term bug in implicit solver. --- .../simulator/SimulatorIncompTwophase.cpp | 3 --- .../TransportSolverTwophaseImplicit.cpp | 25 ++++++++----------- .../TransportSolverTwophaseImplicit.hpp | 9 +++---- .../TransportSolverTwophaseInterface.hpp | 7 +++--- 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/opm/core/simulator/SimulatorIncompTwophase.cpp b/opm/core/simulator/SimulatorIncompTwophase.cpp index 6ebe49bc..b350c53e 100644 --- a/opm/core/simulator/SimulatorIncompTwophase.cpp +++ b/opm/core/simulator/SimulatorIncompTwophase.cpp @@ -550,12 +550,9 @@ 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(&transport_src[0], &porevol[0], stepsize, - well_state, state); double substep_injected[2] = { 0.0 }; diff --git a/opm/core/transport/TransportSolverTwophaseImplicit.cpp b/opm/core/transport/TransportSolverTwophaseImplicit.cpp index 703d17e4..92cbadf2 100644 --- a/opm/core/transport/TransportSolverTwophaseImplicit.cpp +++ b/opm/core/transport/TransportSolverTwophaseImplicit.cpp @@ -59,32 +59,27 @@ namespace Opm /// Solve for saturation at next timestep. /// \param[in] porevolume Array of pore volumes. - /// \param[in] source Transport source term. + /// \param[in] source Transport source term. For interpretation see Opm::computeTransportSource(). /// \param[in] dt Time step. - /// \param[in] wstate Well state. - /// \param[in, out] state Reservoir state. Saturation will be modified. + /// \param[in, out] state Reservoir state. Calling solve() will read state.faceflux() and + /// read and write state.saturation(). void TransportSolverTwophaseImplicit::solve(const double* porevolume, const double* source, const double dt, - const WellState& well_state, TwophaseState& state) { std::vector porevol; if (rock_comp_.isActive()) { computePorevolume(grid_, props_.porosity(), rock_comp_, state.pressure(), porevol); } - std::vector src(grid_.number_of_cells, 0.0); - Opm::computeTransportSource(grid_, src, state.faceflux(), 1.0, - wells_.c_wells(), well_state.perfRates(), src); - double ssrc[] = { 1.0, 0.0 }; - double ssink[] = { 0.0, 1.0 }; - double zdummy[] = { 0.0, 0.0 }; + double ssrc[] = { 1.0, 0.0 }; + double dummy[] = { 0.0, 0.0 }; + clear_transport_source(tsrc_); for (int cell = 0; cell < grid_.number_of_cells; ++cell) { - clear_transport_source(tsrc_); - if (src[cell] > 0.0) { - append_transport_source(cell, 2, 0, src[cell], ssrc, zdummy, tsrc_); - } else if (src[cell] < 0.0) { - append_transport_source(cell, 2, 0, src[cell], ssink, zdummy, tsrc_); + if (source[cell] > 0.0) { + append_transport_source(cell, 2, 0, source[cell], ssrc, dummy, tsrc_); + } else if (source[cell] < 0.0) { + append_transport_source(cell, 2, 0, source[cell], dummy, dummy, tsrc_); } } Opm::ImplicitTransportDetails::NRReport rpt; diff --git a/opm/core/transport/TransportSolverTwophaseImplicit.hpp b/opm/core/transport/TransportSolverTwophaseImplicit.hpp index f3d1e18e..76ae195d 100644 --- a/opm/core/transport/TransportSolverTwophaseImplicit.hpp +++ b/opm/core/transport/TransportSolverTwophaseImplicit.hpp @@ -72,15 +72,14 @@ namespace Opm /// Solve for saturation at next timestep. /// \param[in] porevolume Array of pore volumes. - /// \param[in] source Transport source term. + /// \param[in] source Transport source term. For interpretation see Opm::computeTransportSource(). /// \param[in] dt Time step. - /// \param[in] wstate Well state. - /// \param[in, out] state Reservoir state. Saturation will be modified. + /// \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, - const Opm::WellState& well_state, - Opm::TwophaseState& state); + TwophaseState& state); private: // Disallow copying and assignment. diff --git a/opm/core/transport/TransportSolverTwophaseInterface.hpp b/opm/core/transport/TransportSolverTwophaseInterface.hpp index 5e2b5f27..313647ea 100644 --- a/opm/core/transport/TransportSolverTwophaseInterface.hpp +++ b/opm/core/transport/TransportSolverTwophaseInterface.hpp @@ -35,14 +35,13 @@ namespace Opm /// Solve for saturation at next timestep. /// \param[in] porevolume Array of pore volumes. - /// \param[in] source Transport source term. + /// \param[in] source Transport source term. For interpretation see Opm::computeTransportSource(). /// \param[in] dt Time step. - /// \param[in] wstate Well state. - /// \param[in, out] state Reservoir state. Saturation will be modified. + /// \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, - const WellState& wstate, TwophaseState& state) = 0; };