mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
Use WellStateFullyImplicitBlackoil class instead of WellState.
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||||
|
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
|
||||||
|
|
||||||
#include <opm/autodiff/SimulatorFullyImplicitBlackoil.hpp>
|
#include <opm/autodiff/SimulatorFullyImplicitBlackoil.hpp>
|
||||||
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
||||||
@@ -205,7 +205,7 @@ try
|
|||||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||||
<< std::flush;
|
<< std::flush;
|
||||||
|
|
||||||
WellState well_state;
|
WellStateFullyImplicitBlackoil well_state;
|
||||||
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
||||||
SimulatorTimer simtimer;
|
SimulatorTimer simtimer;
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ try
|
|||||||
|
|
||||||
SimulatorReport rep;
|
SimulatorReport rep;
|
||||||
// With a deck, we may have more epochs etc.
|
// With a deck, we may have more epochs etc.
|
||||||
WellState well_state;
|
WellStateFullyImplicitBlackoil well_state;
|
||||||
int step = 0;
|
int step = 0;
|
||||||
SimulatorTimer simtimer;
|
SimulatorTimer simtimer;
|
||||||
// Use timer for last epoch to obtain total time.
|
// Use timer for last epoch to obtain total time.
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <opm/autodiff/FullyImplicitBlackoilSolver.hpp>
|
#include <opm/autodiff/FullyImplicitBlackoilSolver.hpp>
|
||||||
#include <opm/autodiff/GeoProps.hpp>
|
#include <opm/autodiff/GeoProps.hpp>
|
||||||
#include <opm/autodiff/BlackoilPropsAd.hpp>
|
#include <opm/autodiff/BlackoilPropsAd.hpp>
|
||||||
|
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
|
||||||
|
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/wells.h>
|
#include <opm/core/wells.h>
|
||||||
@@ -37,7 +38,6 @@
|
|||||||
#include <opm/core/utility/Units.hpp>
|
#include <opm/core/utility/Units.hpp>
|
||||||
|
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
|
||||||
#include <opm/core/simulator/initState.hpp>
|
#include <opm/core/simulator/initState.hpp>
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
@@ -110,7 +110,7 @@ try
|
|||||||
initStateBasic(*g, props0, param, 0.0, state);
|
initStateBasic(*g, props0, param, 0.0, state);
|
||||||
initBlackoilSurfvol(*g, props0, state);
|
initBlackoilSurfvol(*g, props0, state);
|
||||||
|
|
||||||
Opm::WellState well_state;
|
Opm::WellStateFullyImplicitBlackoil well_state;
|
||||||
well_state.init(wells.get(), state);
|
well_state.init(wells.get(), state);
|
||||||
|
|
||||||
solver.step(1.0, state, well_state);
|
solver.step(1.0, state, well_state);
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
#include <opm/autodiff/AutoDiffHelpers.hpp>
|
#include <opm/autodiff/AutoDiffHelpers.hpp>
|
||||||
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
|
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
|
||||||
#include <opm/autodiff/GeoProps.hpp>
|
#include <opm/autodiff/GeoProps.hpp>
|
||||||
|
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
|
||||||
|
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/linalg/LinearSolverInterface.hpp>
|
#include <opm/core/linalg/LinearSolverInterface.hpp>
|
||||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/well_controls.h>
|
#include <opm/core/well_controls.h>
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ namespace {
|
|||||||
FullyImplicitBlackoilSolver::
|
FullyImplicitBlackoilSolver::
|
||||||
step(const double dt,
|
step(const double dt,
|
||||||
BlackoilState& x ,
|
BlackoilState& x ,
|
||||||
WellState& xw)
|
WellStateFullyImplicitBlackoil& xw)
|
||||||
{
|
{
|
||||||
const V pvdt = geo_.poreVolume() / dt;
|
const V pvdt = geo_.poreVolume() / dt;
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ namespace {
|
|||||||
|
|
||||||
FullyImplicitBlackoilSolver::SolutionState
|
FullyImplicitBlackoilSolver::SolutionState
|
||||||
FullyImplicitBlackoilSolver::constantState(const BlackoilState& x,
|
FullyImplicitBlackoilSolver::constantState(const BlackoilState& x,
|
||||||
const WellState& xw)
|
const WellStateFullyImplicitBlackoil& xw)
|
||||||
{
|
{
|
||||||
const int nc = grid_.number_of_cells;
|
const int nc = grid_.number_of_cells;
|
||||||
const int np = x.numPhases();
|
const int np = x.numPhases();
|
||||||
@@ -427,7 +427,7 @@ namespace {
|
|||||||
|
|
||||||
FullyImplicitBlackoilSolver::SolutionState
|
FullyImplicitBlackoilSolver::SolutionState
|
||||||
FullyImplicitBlackoilSolver::variableState(const BlackoilState& x,
|
FullyImplicitBlackoilSolver::variableState(const BlackoilState& x,
|
||||||
const WellState& xw)
|
const WellStateFullyImplicitBlackoil& xw)
|
||||||
{
|
{
|
||||||
const int nc = grid_.number_of_cells;
|
const int nc = grid_.number_of_cells;
|
||||||
const int np = x.numPhases();
|
const int np = x.numPhases();
|
||||||
@@ -616,7 +616,7 @@ namespace {
|
|||||||
FullyImplicitBlackoilSolver::
|
FullyImplicitBlackoilSolver::
|
||||||
assemble(const V& pvdt,
|
assemble(const V& pvdt,
|
||||||
const BlackoilState& x ,
|
const BlackoilState& x ,
|
||||||
const WellState& xw )
|
const WellStateFullyImplicitBlackoil& xw )
|
||||||
{
|
{
|
||||||
// Create the primary variables.
|
// Create the primary variables.
|
||||||
const SolutionState state = variableState(x, xw);
|
const SolutionState state = variableState(x, xw);
|
||||||
@@ -878,7 +878,7 @@ namespace {
|
|||||||
|
|
||||||
void FullyImplicitBlackoilSolver::updateState(const V& dx,
|
void FullyImplicitBlackoilSolver::updateState(const V& dx,
|
||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellState& well_state)
|
WellStateFullyImplicitBlackoil& well_state)
|
||||||
{
|
{
|
||||||
const int np = fluid_.numPhases();
|
const int np = fluid_.numPhases();
|
||||||
const int nc = grid_.number_of_cells;
|
const int nc = grid_.number_of_cells;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Opm {
|
|||||||
class RockCompressibility;
|
class RockCompressibility;
|
||||||
class LinearSolverInterface;
|
class LinearSolverInterface;
|
||||||
class BlackoilState;
|
class BlackoilState;
|
||||||
class WellState;
|
class WellStateFullyImplicitBlackoil;
|
||||||
|
|
||||||
|
|
||||||
/// A fully implicit solver for the black-oil problem.
|
/// A fully implicit solver for the black-oil problem.
|
||||||
@@ -76,7 +76,7 @@ namespace Opm {
|
|||||||
void
|
void
|
||||||
step(const double dt ,
|
step(const double dt ,
|
||||||
BlackoilState& state ,
|
BlackoilState& state ,
|
||||||
WellState& wstate);
|
WellStateFullyImplicitBlackoil& wstate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Types and enums
|
// Types and enums
|
||||||
@@ -148,11 +148,11 @@ namespace Opm {
|
|||||||
// Private methods.
|
// Private methods.
|
||||||
SolutionState
|
SolutionState
|
||||||
constantState(const BlackoilState& x,
|
constantState(const BlackoilState& x,
|
||||||
const WellState& xw);
|
const WellStateFullyImplicitBlackoil& xw);
|
||||||
|
|
||||||
SolutionState
|
SolutionState
|
||||||
variableState(const BlackoilState& x,
|
variableState(const BlackoilState& x,
|
||||||
const WellState& xw);
|
const WellStateFullyImplicitBlackoil& xw);
|
||||||
|
|
||||||
void
|
void
|
||||||
computeAccum(const SolutionState& state,
|
computeAccum(const SolutionState& state,
|
||||||
@@ -160,14 +160,14 @@ namespace Opm {
|
|||||||
|
|
||||||
void
|
void
|
||||||
assemble(const V& dtpv,
|
assemble(const V& dtpv,
|
||||||
const BlackoilState& x ,
|
const BlackoilState& x,
|
||||||
const WellState& xw );
|
const WellStateFullyImplicitBlackoil& xw);
|
||||||
|
|
||||||
V solveJacobianSystem() const;
|
V solveJacobianSystem() const;
|
||||||
|
|
||||||
void updateState(const V& dx,
|
void updateState(const V& dx,
|
||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellState& well_state);
|
WellStateFullyImplicitBlackoil& well_state);
|
||||||
|
|
||||||
std::vector<ADB>
|
std::vector<ADB>
|
||||||
computePressures(const SolutionState& state) const;
|
computePressures(const SolutionState& state) const;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <opm/autodiff/GeoProps.hpp>
|
#include <opm/autodiff/GeoProps.hpp>
|
||||||
#include <opm/autodiff/FullyImplicitBlackoilSolver.hpp>
|
#include <opm/autodiff/FullyImplicitBlackoilSolver.hpp>
|
||||||
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
|
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
|
||||||
|
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
|
||||||
|
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/wells.h>
|
#include <opm/core/wells.h>
|
||||||
@@ -48,7 +49,6 @@
|
|||||||
|
|
||||||
#include <opm/core/grid/ColumnExtract.hpp>
|
#include <opm/core/grid/ColumnExtract.hpp>
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
|
||||||
#include <opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.hpp>
|
#include <opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.hpp>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
@@ -77,7 +77,7 @@ namespace Opm
|
|||||||
|
|
||||||
SimulatorReport run(SimulatorTimer& timer,
|
SimulatorReport run(SimulatorTimer& timer,
|
||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellState& well_state);
|
WellStateFullyImplicitBlackoil& well_state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Data.
|
// Data.
|
||||||
@@ -127,7 +127,7 @@ namespace Opm
|
|||||||
|
|
||||||
SimulatorReport SimulatorFullyImplicitBlackoil::run(SimulatorTimer& timer,
|
SimulatorReport SimulatorFullyImplicitBlackoil::run(SimulatorTimer& timer,
|
||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellState& well_state)
|
WellStateFullyImplicitBlackoil& well_state)
|
||||||
{
|
{
|
||||||
return pimpl_->run(timer, state, well_state);
|
return pimpl_->run(timer, state, well_state);
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ namespace Opm
|
|||||||
std::copy(d.begin(), d.end(), std::ostream_iterator<double>(file, "\n"));
|
std::copy(d.begin(), d.end(), std::ostream_iterator<double>(file, "\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void outputWellStateMatlab(const Opm::WellState& well_state,
|
static void outputWellStateMatlab(const Opm::WellStateFullyImplicitBlackoil& well_state,
|
||||||
const int step,
|
const int step,
|
||||||
const std::string& output_dir)
|
const std::string& output_dir)
|
||||||
{
|
{
|
||||||
@@ -312,10 +312,10 @@ namespace Opm
|
|||||||
|
|
||||||
SimulatorReport SimulatorFullyImplicitBlackoil::Impl::run(SimulatorTimer& timer,
|
SimulatorReport SimulatorFullyImplicitBlackoil::Impl::run(SimulatorTimer& timer,
|
||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellState& well_state)
|
WellStateFullyImplicitBlackoil& well_state)
|
||||||
{
|
{
|
||||||
eclipseWriter_.writeInit(timer, state, well_state);
|
eclipseWriter_.writeInit(timer, state, well_state.basicWellState());
|
||||||
eclipseWriter_.writeTimeStep(timer, state, well_state);
|
eclipseWriter_.writeTimeStep(timer, state, well_state.basicWellState());
|
||||||
|
|
||||||
// Initialisation.
|
// Initialisation.
|
||||||
std::vector<double> porevol;
|
std::vector<double> porevol;
|
||||||
@@ -384,13 +384,9 @@ namespace Opm
|
|||||||
|
|
||||||
// Optionally, check if well controls are satisfied.
|
// Optionally, check if well controls are satisfied.
|
||||||
if (check_well_controls_) {
|
if (check_well_controls_) {
|
||||||
Opm::computePhaseFlowRatesPerWell(*wells_,
|
|
||||||
well_state.perfRates(),
|
|
||||||
fractional_flows,
|
|
||||||
well_resflows_phase);
|
|
||||||
std::cout << "Checking well conditions." << std::endl;
|
std::cout << "Checking well conditions." << std::endl;
|
||||||
// For testing we set surface := reservoir
|
// For testing we set surface := reservoir
|
||||||
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
|
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_state.wellRates(), well_state.wellRates());
|
||||||
++well_control_iteration;
|
++well_control_iteration;
|
||||||
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) {
|
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) {
|
||||||
OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
||||||
@@ -426,7 +422,7 @@ namespace Opm
|
|||||||
|
|
||||||
// write an output file for later inspection
|
// write an output file for later inspection
|
||||||
if (output_) {
|
if (output_) {
|
||||||
eclipseWriter_.writeTimeStep(timer, state, well_state);
|
eclipseWriter_.writeTimeStep(timer, state, well_state.basicWellState());
|
||||||
}
|
}
|
||||||
|
|
||||||
// advance to next timestep before reporting at this location
|
// advance to next timestep before reporting at this location
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Opm
|
|||||||
class LinearSolverInterface;
|
class LinearSolverInterface;
|
||||||
class SimulatorTimer;
|
class SimulatorTimer;
|
||||||
class BlackoilState;
|
class BlackoilState;
|
||||||
class WellState;
|
class WellStateFullyImplicitBlackoil;
|
||||||
struct SimulatorReport;
|
struct SimulatorReport;
|
||||||
|
|
||||||
/// Class collecting all necessary components for a two-phase simulation.
|
/// Class collecting all necessary components for a two-phase simulation.
|
||||||
@@ -84,7 +84,7 @@ namespace Opm
|
|||||||
/// \return simulation report, with timing data
|
/// \return simulation report, with timing data
|
||||||
SimulatorReport run(SimulatorTimer& timer,
|
SimulatorReport run(SimulatorTimer& timer,
|
||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellState& well_state);
|
WellStateFullyImplicitBlackoil& well_state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|||||||
Reference in New Issue
Block a user