mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-02 04:26:55 -06:00
unify the run() methods and the constructors of the 2p-compressible and the flow_polymer with the one from flow
This commit is contained in:
parent
a816ab9a0c
commit
0f1a7a16d7
@ -179,10 +179,10 @@ try
|
|||||||
grid.reset(new GridManager(eclipseState->getEclipseGrid(), porv));
|
grid.reset(new GridManager(eclipseState->getEclipseGrid(), porv));
|
||||||
auto &cGrid = *grid->c_grid();
|
auto &cGrid = *grid->c_grid();
|
||||||
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
|
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
|
||||||
Opm::BlackoilOutputWriter outputWriter(cGrid,
|
Opm::PolymerBlackoilOutputWriter outputWriter(cGrid,
|
||||||
param,
|
param,
|
||||||
eclipseState,
|
eclipseState,
|
||||||
pu );
|
pu );
|
||||||
|
|
||||||
// Rock and fluid init
|
// Rock and fluid init
|
||||||
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, *grid->c_grid(), param));
|
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, *grid->c_grid(), param));
|
||||||
|
@ -167,10 +167,10 @@ try
|
|||||||
grid.reset(new GridManager(eclipseState->getEclipseGrid(), porv));
|
grid.reset(new GridManager(eclipseState->getEclipseGrid(), porv));
|
||||||
auto &cGrid = *grid->c_grid();
|
auto &cGrid = *grid->c_grid();
|
||||||
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
|
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
|
||||||
Opm::BlackoilOutputWriter outputWriter(cGrid,
|
Opm::PolymerBlackoilOutputWriter outputWriter(cGrid,
|
||||||
param,
|
param,
|
||||||
eclipseState,
|
eclipseState,
|
||||||
pu );
|
pu );
|
||||||
|
|
||||||
// Rock and fluid init
|
// Rock and fluid init
|
||||||
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, *grid->c_grid(), param));
|
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, *grid->c_grid(), param));
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
|
#include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
|
||||||
#include <opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp>
|
#include <opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp>
|
||||||
#include <opm/polymer/fullyimplicit/WellStateFullyImplicitBlackoilPolymer.hpp>
|
#include <opm/polymer/fullyimplicit/WellStateFullyImplicitBlackoilPolymer.hpp>
|
||||||
|
#include <opm/polymer/fullyimplicit/PolymerBlackoilOutputWriter.hpp>
|
||||||
#include <opm/polymer/PolymerBlackoilState.hpp>
|
#include <opm/polymer/PolymerBlackoilState.hpp>
|
||||||
#include <opm/polymer/PolymerInflow.hpp>
|
#include <opm/polymer/PolymerInflow.hpp>
|
||||||
|
|
||||||
@ -78,6 +79,17 @@
|
|||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
template<class GridT>
|
||||||
|
class SimulatorFullyImplicitBlackoilPolymer;
|
||||||
|
|
||||||
|
template<class GridT>
|
||||||
|
struct SimulatorTraits<SimulatorFullyImplicitBlackoilPolymer<GridT> >
|
||||||
|
{
|
||||||
|
typedef WellStateFullyImplicitBlackoilPolymer WellState;
|
||||||
|
typedef PolymerBlackoilState ReservoirState;
|
||||||
|
typedef PolymerBlackoilOutputWriter OutputWriter;
|
||||||
|
};
|
||||||
|
|
||||||
/// Class collecting all necessary components for a two-phase simulation.
|
/// Class collecting all necessary components for a two-phase simulation.
|
||||||
template<class GridT>
|
template<class GridT>
|
||||||
class SimulatorFullyImplicitBlackoilPolymer
|
class SimulatorFullyImplicitBlackoilPolymer
|
||||||
@ -102,12 +114,46 @@ namespace Opm
|
|||||||
const bool vapoil,
|
const bool vapoil,
|
||||||
const bool polymer,
|
const bool polymer,
|
||||||
std::shared_ptr<EclipseState> eclipse_state,
|
std::shared_ptr<EclipseState> eclipse_state,
|
||||||
BlackoilOutputWriter& output_writer,
|
PolymerBlackoilOutputWriter& output_writer,
|
||||||
Opm::DeckConstPtr& deck,
|
Opm::DeckConstPtr& deck,
|
||||||
const std::vector<double>& threshold_pressures_by_face);
|
const std::vector<double>& threshold_pressures_by_face);
|
||||||
|
|
||||||
|
#if 0
|
||||||
SimulatorReport run(SimulatorTimer& timer,
|
SimulatorReport run(SimulatorTimer& timer,
|
||||||
PolymerBlackoilState& state);
|
PolymerBlackoilState& state);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void computeRESV(const std::size_t step,
|
||||||
|
const Wells* wells,
|
||||||
|
const PolymerBlackoilState& x,
|
||||||
|
WellState& xw)
|
||||||
|
{
|
||||||
|
BaseType::computeRESV(step, wells, x.blackoilState(), xw);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleAdditionalWellInflow(SimulatorTimer& timer,
|
||||||
|
WellsManager& wells_manager,
|
||||||
|
typename BaseType::WellState& well_state,
|
||||||
|
const Wells* wells)
|
||||||
|
{
|
||||||
|
// compute polymer inflow
|
||||||
|
std::unique_ptr<PolymerInflowInterface> polymer_inflow_ptr;
|
||||||
|
if (deck_->hasKeyword("WPOLYMER")) {
|
||||||
|
if (wells_manager.c_wells() == 0) {
|
||||||
|
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||||
|
}
|
||||||
|
polymer_inflow_ptr.reset(new PolymerInflowFromDeck(deck_, BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
|
||||||
|
} else {
|
||||||
|
polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day,
|
||||||
|
1.0*Opm::unit::day,
|
||||||
|
0.0));
|
||||||
|
}
|
||||||
|
std::vector<double> polymer_inflow_c(Opm::UgGridHelpers::numCells(BaseType::grid_));
|
||||||
|
polymer_inflow_ptr->getInflowValues(timer.simulationTimeElapsed(),
|
||||||
|
timer.simulationTimeElapsed() + timer.currentStepLength(),
|
||||||
|
polymer_inflow_c);
|
||||||
|
well_state.polymerInflow() = polymer_inflow_c;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PolymerPropsAd& polymer_props_;
|
const PolymerPropsAd& polymer_props_;
|
||||||
|
@ -35,7 +35,7 @@ namespace Opm
|
|||||||
const bool has_vapoil,
|
const bool has_vapoil,
|
||||||
const bool has_polymer,
|
const bool has_polymer,
|
||||||
std::shared_ptr<EclipseState> eclipse_state,
|
std::shared_ptr<EclipseState> eclipse_state,
|
||||||
BlackoilOutputWriter& output_writer,
|
PolymerBlackoilOutputWriter& output_writer,
|
||||||
Opm::DeckConstPtr& deck,
|
Opm::DeckConstPtr& deck,
|
||||||
const std::vector<double>& threshold_pressures_by_face)
|
const std::vector<double>& threshold_pressures_by_face)
|
||||||
: BaseType(param,
|
: BaseType(param,
|
||||||
@ -54,28 +54,9 @@ namespace Opm
|
|||||||
, has_polymer_(has_polymer)
|
, has_polymer_(has_polymer)
|
||||||
, deck_(deck)
|
, deck_(deck)
|
||||||
{
|
{
|
||||||
// Misc init.
|
|
||||||
const int num_cells = AutoDiffGrid::numCells(grid);
|
|
||||||
BaseType::allcells_.resize(num_cells);
|
|
||||||
for (int cell = 0; cell < num_cells; ++cell) {
|
|
||||||
BaseType::allcells_[cell] = cell;
|
|
||||||
}
|
|
||||||
#if HAVE_MPI
|
|
||||||
if ( BaseType::terminal_output_ ) {
|
|
||||||
if ( BaseType::solver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
|
|
||||||
{
|
|
||||||
const ParallelISTLInformation& info =
|
|
||||||
boost::any_cast<const ParallelISTLInformation&>(BaseType::solver_.parallelInformation());
|
|
||||||
// Only rank 0 does print to std::cout
|
|
||||||
BaseType::terminal_output_= (info.communicator().rank()==0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
SimulatorReport SimulatorFullyImplicitBlackoilPolymer<T>::run(SimulatorTimer& timer,
|
SimulatorReport SimulatorFullyImplicitBlackoilPolymer<T>::run(SimulatorTimer& timer,
|
||||||
PolymerBlackoilState& state)
|
PolymerBlackoilState& state)
|
||||||
@ -233,4 +214,5 @@ namespace Opm
|
|||||||
report.total_linear_iterations = totalLinearIterations;
|
report.total_linear_iterations = totalLinearIterations;
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <opm/autodiff/SimulatorBase.hpp>
|
#include <opm/autodiff/SimulatorBase.hpp>
|
||||||
|
|
||||||
#include <opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.hpp>
|
#include <opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.hpp>
|
||||||
|
#include <opm/polymer/fullyimplicit/PolymerBlackoilOutputWriter.hpp>
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/wells.h>
|
#include <opm/core/wells.h>
|
||||||
#include <opm/core/pressure/flow_bc.h>
|
#include <opm/core/pressure/flow_bc.h>
|
||||||
@ -67,6 +68,17 @@
|
|||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
template <class GridT>
|
||||||
|
class SimulatorFullyImplicitCompressiblePolymer;
|
||||||
|
|
||||||
|
template<class GridT>
|
||||||
|
struct SimulatorTraits<SimulatorFullyImplicitCompressiblePolymer<GridT> >
|
||||||
|
{
|
||||||
|
typedef PolymerBlackoilState ReservoirState;
|
||||||
|
typedef WellStateFullyImplicitBlackoil WellState;
|
||||||
|
typedef PolymerBlackoilOutputWriter OutputWriter;
|
||||||
|
};
|
||||||
|
|
||||||
/// Class collecting all necessary components for a two-phase simulation.
|
/// Class collecting all necessary components for a two-phase simulation.
|
||||||
template <class GridT>
|
template <class GridT>
|
||||||
class SimulatorFullyImplicitCompressiblePolymer
|
class SimulatorFullyImplicitCompressiblePolymer
|
||||||
@ -84,7 +96,7 @@ namespace Opm
|
|||||||
const PolymerPropsAd& polymer_props,
|
const PolymerPropsAd& polymer_props,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
std::shared_ptr<EclipseState> eclipse_state,
|
std::shared_ptr<EclipseState> eclipse_state,
|
||||||
BlackoilOutputWriter& output_writer,
|
PolymerBlackoilOutputWriter& output_writer,
|
||||||
Opm::DeckConstPtr& deck,
|
Opm::DeckConstPtr& deck,
|
||||||
NewtonIterationBlackoilInterface& linsolver,
|
NewtonIterationBlackoilInterface& linsolver,
|
||||||
const double* gravity);
|
const double* gravity);
|
||||||
@ -96,7 +108,7 @@ namespace Opm
|
|||||||
/// \param[in,out] state state of reservoir: pressure, fluxes
|
/// \param[in,out] state state of reservoir: pressure, fluxes
|
||||||
/// \return simulation report, with timing data
|
/// \return simulation report, with timing data
|
||||||
SimulatorReport run(SimulatorTimer& timer,
|
SimulatorReport run(SimulatorTimer& timer,
|
||||||
PolymerBlackoilState& state);
|
typename BaseType::ReservoirState& state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Opm::DeckConstPtr deck_;
|
Opm::DeckConstPtr deck_;
|
||||||
|
Loading…
Reference in New Issue
Block a user