Modified TransportSolverTwophaseInterface::solve(), general cleanup.
Move output arguments last in argument list.
This commit is contained in:
parent
e532250867
commit
86b51c80b8
@ -554,10 +554,10 @@ namespace Opm
|
|||||||
//tsolver_.solve(&state.faceflux()[0], &initial_porevol[0], &transport_src[0],
|
//tsolver_.solve(&state.faceflux()[0], &initial_porevol[0], &transport_src[0],
|
||||||
// stepsize, state.saturation());
|
// stepsize, state.saturation());
|
||||||
tsolver_->solve(&transport_src[0],
|
tsolver_->solve(&transport_src[0],
|
||||||
&porevol[0],
|
&porevol[0],
|
||||||
stepsize,
|
stepsize,
|
||||||
state,
|
well_state,
|
||||||
well_state);
|
state);
|
||||||
|
|
||||||
double substep_injected[2] = { 0.0 };
|
double substep_injected[2] = { 0.0 };
|
||||||
double substep_produced[2] = { 0.0 };
|
double substep_produced[2] = { 0.0 };
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
#include <opm/core/transport/TransportSolverTwophaseImplicit.hpp>
|
#include <opm/core/transport/TransportSolverTwophaseImplicit.hpp>
|
||||||
#include <opm/core/simulator/TwophaseState.hpp>
|
#include <opm/core/simulator/TwophaseState.hpp>
|
||||||
#include <opm/core/utility/miscUtilities.hpp>
|
#include <opm/core/utility/miscUtilities.hpp>
|
||||||
namespace Opm{
|
|
||||||
|
namespace Opm
|
||||||
|
{
|
||||||
|
|
||||||
TransportSolverTwophaseImplicit::TransportSolverTwophaseImplicit(
|
TransportSolverTwophaseImplicit::TransportSolverTwophaseImplicit(
|
||||||
const Opm::WellsManager& wells,
|
const Opm::WellsManager& wells,
|
||||||
@ -48,22 +50,30 @@ namespace Opm{
|
|||||||
wells_(wells)
|
wells_(wells)
|
||||||
{
|
{
|
||||||
tsrc_ = create_transport_source(2, 2);
|
tsrc_ = create_transport_source(2, 2);
|
||||||
//linsolver_(param),
|
|
||||||
//src_(num_cells, 0.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransportSolverTwophaseImplicit::~TransportSolverTwophaseImplicit()
|
||||||
|
{
|
||||||
|
destroy_transport_source(tsrc_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Solve for saturation at next timestep.
|
||||||
|
/// \param[in] porevolume Array of pore volumes.
|
||||||
|
/// \param[in] source Transport source term.
|
||||||
|
/// \param[in] dt Time step.
|
||||||
|
/// \param[in] wstate Well state.
|
||||||
|
/// \param[in, out] state Reservoir state. Saturation will be modified.
|
||||||
void TransportSolverTwophaseImplicit::solve(const double* porevolume,
|
void TransportSolverTwophaseImplicit::solve(const double* porevolume,
|
||||||
const double* source,
|
const double* source,
|
||||||
const double dt,
|
const double dt,
|
||||||
TwophaseState& state,
|
const WellState& well_state,
|
||||||
const WellState& well_state)
|
TwophaseState& state)
|
||||||
{
|
{
|
||||||
std::vector<double> porevol;
|
std::vector<double> porevol;
|
||||||
if (rock_comp_.isActive()) {
|
if (rock_comp_.isActive()) {
|
||||||
computePorevolume(grid_, props_.porosity(), rock_comp_, state.pressure(), porevol);
|
computePorevolume(grid_, props_.porosity(), rock_comp_, state.pressure(), porevol);
|
||||||
}
|
}
|
||||||
std::vector<double> src(grid_.number_of_cells, 0.0);
|
std::vector<double> src(grid_.number_of_cells, 0.0);
|
||||||
//Opm::wellsToSrc(*wells->c_wells(), num_cells, src);
|
|
||||||
Opm::computeTransportSource(grid_, src, state.faceflux(), 1.0,
|
Opm::computeTransportSource(grid_, src, state.faceflux(), 1.0,
|
||||||
wells_.c_wells(), well_state.perfRates(), src);
|
wells_.c_wells(), well_state.perfRates(), src);
|
||||||
double ssrc[] = { 1.0, 0.0 };
|
double ssrc[] = { 1.0, 0.0 };
|
||||||
@ -77,10 +87,9 @@ namespace Opm{
|
|||||||
append_transport_source(cell, 2, 0, src[cell], ssink, zdummy, tsrc_);
|
append_transport_source(cell, 2, 0, src[cell], ssink, zdummy, tsrc_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Boundary conditions.
|
|
||||||
Opm::ImplicitTransportDetails::NRReport rpt;
|
Opm::ImplicitTransportDetails::NRReport rpt;
|
||||||
tsolver_.solve(grid_, tsrc_, dt, ctrl_, state, linsolver_, rpt);
|
tsolver_.solve(grid_, tsrc_, dt, ctrl_, state, linsolver_, rpt);
|
||||||
std::cout << rpt;
|
std::cout << rpt;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // namespace Opm
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2011 SINTEF ICT, Applied Mathematics.
|
Copyright 2011 SINTEF ICT, Applied Mathematics.
|
||||||
Copyright 2011 Statoil ASA.
|
Copyright 2011 Statoil ASA.
|
||||||
|
|
||||||
This file is part of the Open Porous Media Project (OPM).
|
This file is part of the Open Porous Media Project (OPM).
|
||||||
|
|
||||||
OPM is free software: you can redistribute it and/or modify
|
OPM is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
OPM is distributed in the hope that it will be useful,
|
OPM is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPM_TRANSPORTSOLVERTWOPHASEIMPLICIT_HEADER_INCLUDED
|
#ifndef OPM_TRANSPORTSOLVERTWOPHASEIMPLICIT_HEADER_INCLUDED
|
||||||
#define OPM_TRANSPORTSOLVERTWOPHASEIMPLICIT_HEADER_INCLUDED
|
#define OPM_TRANSPORTSOLVERTWOPHASEIMPLICIT_HEADER_INCLUDED
|
||||||
#include <vector>
|
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <opm/core/transport/TransportSolverTwophaseInterface.hpp>
|
#include <opm/core/transport/TransportSolverTwophaseInterface.hpp>
|
||||||
#include <opm/core/props/IncompPropertiesInterface.hpp>
|
#include <opm/core/props/IncompPropertiesInterface.hpp>
|
||||||
@ -38,13 +38,20 @@
|
|||||||
#include <opm/core/transport/JacobianSystem.hpp>
|
#include <opm/core/transport/JacobianSystem.hpp>
|
||||||
#include <opm/core/transport/CSRMatrixBlockAssembler.hpp>
|
#include <opm/core/transport/CSRMatrixBlockAssembler.hpp>
|
||||||
#include <opm/core/transport/SinglePointUpwindTwoPhase.hpp>
|
#include <opm/core/transport/SinglePointUpwindTwoPhase.hpp>
|
||||||
#include <boost/scoped_ptr.hpp>
|
|
||||||
|
|
||||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||||
#include <opm/core/wells/WellsManager.hpp>
|
#include <opm/core/wells/WellsManager.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/core/simulator/WellState.hpp>
|
||||||
namespace Opm{
|
|
||||||
// implicite transprot solver
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Opm
|
||||||
|
{
|
||||||
|
|
||||||
|
// Implicit transport solver using Newton-Raphson.
|
||||||
class TransportSolverTwophaseImplicit : public TransportSolverTwophaseInterface
|
class TransportSolverTwophaseImplicit : public TransportSolverTwophaseInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -53,42 +60,38 @@ 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.
|
||||||
TransportSolverTwophaseImplicit(
|
TransportSolverTwophaseImplicit(const Opm::WellsManager& wells,
|
||||||
const Opm::WellsManager& wells,
|
const Opm::RockCompressibility& rock_comp,
|
||||||
const Opm::RockCompressibility& rock_comp,
|
const ImplicitTransportDetails::NRControl& ctrl,
|
||||||
const ImplicitTransportDetails::NRControl& ctrl,
|
SinglePointUpwindTwoPhase<Opm::SimpleFluid2pWrappingProps>& model,
|
||||||
SinglePointUpwindTwoPhase<Opm::SimpleFluid2pWrappingProps>& model,
|
const UnstructuredGrid& grid,
|
||||||
const UnstructuredGrid& grid,
|
const Opm::IncompPropertiesInterface& props,
|
||||||
const Opm::IncompPropertiesInterface& props,
|
const parameter::ParameterGroup& param);
|
||||||
const parameter::ParameterGroup& param);
|
|
||||||
|
|
||||||
~TransportSolverTwophaseImplicit(){
|
virtual ~TransportSolverTwophaseImplicit();
|
||||||
destroy_transport_source(tsrc_);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Solve for saturation at next timestep.
|
/// Solve for saturation at next timestep.
|
||||||
/// \param[in] darcyflux Array of signed face fluxes.
|
/// \param[in] porevolume Array of pore volumes.
|
||||||
/// \param[in] porevolume Array of pore volumes.
|
/// \param[in] source Transport source term.
|
||||||
/// \param[in] source Transport source term.
|
/// \param[in] dt Time step.
|
||||||
/// \param[in] dt Time step.
|
/// \param[in] wstate Well state.
|
||||||
/// \param[in, out] saturation Phase saturations.
|
/// \param[in, out] state Reservoir state. Saturation will be modified.
|
||||||
void solve(const double* porevolume,
|
virtual void solve(const double* porevolume,
|
||||||
const double* source,
|
const double* source,
|
||||||
const double dt,
|
const double dt,
|
||||||
Opm::TwophaseState& state,
|
const Opm::WellState& well_state,
|
||||||
const Opm::WellState& well_state);
|
Opm::TwophaseState& state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Disallow copying and assignment.
|
||||||
TransportSolverTwophaseImplicit(const TransportSolverTwophaseImplicit&);
|
TransportSolverTwophaseImplicit(const TransportSolverTwophaseImplicit&);
|
||||||
TransportSolverTwophaseImplicit& operator=(const TransportSolverTwophaseImplicit&);
|
TransportSolverTwophaseImplicit& operator=(const TransportSolverTwophaseImplicit&);
|
||||||
|
|
||||||
|
// Defining types for the underlying transport solver.
|
||||||
typedef Opm::SimpleFluid2pWrappingProps TwophaseFluid;
|
typedef Opm::SimpleFluid2pWrappingProps TwophaseFluid;
|
||||||
typedef Opm::SinglePointUpwindTwoPhase<TwophaseFluid> TransportModel;
|
typedef Opm::SinglePointUpwindTwoPhase<TwophaseFluid> TransportModel;
|
||||||
|
|
||||||
//using namespace ImplicitTransportDefault;
|
|
||||||
|
|
||||||
typedef ImplicitTransportDefault::NewtonVectorCollection< ::std::vector<double> > NVecColl;
|
typedef ImplicitTransportDefault::NewtonVectorCollection< ::std::vector<double> > NVecColl;
|
||||||
typedef ImplicitTransportDefault::JacobianSystem < struct CSRMatrix, NVecColl > JacSys;
|
typedef ImplicitTransportDefault::JacobianSystem < struct CSRMatrix, NVecColl > JacSys;
|
||||||
|
|
||||||
template <class Vector>
|
template <class Vector>
|
||||||
class MaxNorm {
|
class MaxNorm {
|
||||||
public:
|
public:
|
||||||
@ -97,15 +100,15 @@ namespace Opm{
|
|||||||
return ImplicitTransportDefault::AccumulationNorm <Vector, ImplicitTransportDefault::MaxAbs>::norm(v);
|
return ImplicitTransportDefault::AccumulationNorm <Vector, ImplicitTransportDefault::MaxAbs>::norm(v);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Opm::ImplicitTransport<TransportModel,
|
typedef Opm::ImplicitTransport<TransportModel,
|
||||||
JacSys ,
|
JacSys ,
|
||||||
MaxNorm ,
|
MaxNorm ,
|
||||||
ImplicitTransportDefault::VectorNegater ,
|
ImplicitTransportDefault::VectorNegater ,
|
||||||
ImplicitTransportDefault::VectorZero ,
|
ImplicitTransportDefault::VectorZero ,
|
||||||
ImplicitTransportDefault::MatrixZero ,
|
ImplicitTransportDefault::MatrixZero ,
|
||||||
ImplicitTransportDefault::VectorAssign > TransportSolver;
|
ImplicitTransportDefault::VectorAssign > TransportSolver;
|
||||||
//Opm::LinearSolverFactory
|
|
||||||
|
// Data members.
|
||||||
Opm::ImplicitTransportLinAlgSupport::CSRMatrixUmfpackSolver linsolver_;
|
Opm::ImplicitTransportLinAlgSupport::CSRMatrixUmfpackSolver linsolver_;
|
||||||
TransportSolver tsolver_;
|
TransportSolver tsolver_;
|
||||||
const UnstructuredGrid& grid_;
|
const UnstructuredGrid& grid_;
|
||||||
@ -113,9 +116,9 @@ namespace Opm{
|
|||||||
const Opm::IncompPropertiesInterface& props_;
|
const Opm::IncompPropertiesInterface& props_;
|
||||||
const Opm::RockCompressibility& rock_comp_;
|
const Opm::RockCompressibility& rock_comp_;
|
||||||
const Opm::WellsManager& wells_;
|
const Opm::WellsManager& wells_;
|
||||||
|
|
||||||
TransportSource* tsrc_;
|
TransportSource* tsrc_;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // namespace Opm
|
||||||
|
|
||||||
#endif // OPM_TRANSPORTSOLVERTWOPHASEIMPLICIT_HEADER_INCLUDED
|
#endif // OPM_TRANSPORTSOLVERTWOPHASEIMPLICIT_HEADER_INCLUDED
|
||||||
|
@ -37,13 +37,13 @@ namespace Opm
|
|||||||
/// \param[in] porevolume Array of pore volumes.
|
/// \param[in] porevolume Array of pore volumes.
|
||||||
/// \param[in] source Transport source term.
|
/// \param[in] source Transport source term.
|
||||||
/// \param[in] dt Time step.
|
/// \param[in] dt Time step.
|
||||||
/// \param[in, out] state Reservoir state. Saturation will be modified.
|
|
||||||
/// \param[in] wstate Well state.
|
/// \param[in] wstate Well state.
|
||||||
|
/// \param[in, out] state Reservoir state. Saturation will be modified.
|
||||||
virtual void solve(const double* porevolume,
|
virtual void solve(const double* porevolume,
|
||||||
const double* source,
|
const double* source,
|
||||||
const double dt,
|
const double dt,
|
||||||
TwophaseState& state,
|
const WellState& wstate,
|
||||||
const WellState& wstate) = 0;
|
TwophaseState& state) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user