mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fully implicit simulators: various cleanups
these are mostly stylistic: the function bodies of most new methods have been moved to the _impl.hpp file and the Simulator classes are now templated on the grid type, so it should be not too hard to switch them to Dune::CpGrid.
This commit is contained in:
@@ -78,32 +78,35 @@
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
template <class GridT>
|
||||
class SimulatorFullyImplicitBlackoilPolymer;
|
||||
|
||||
template<>
|
||||
struct SimulatorTraits<SimulatorFullyImplicitBlackoilPolymer>
|
||||
template<class GridT>
|
||||
struct SimulatorTraits<SimulatorFullyImplicitBlackoilPolymer<GridT> >
|
||||
{
|
||||
typedef WellStateFullyImplicitBlackoilPolymer WellState;
|
||||
typedef PolymerBlackoilState ReservoirState;
|
||||
typedef BlackoilOutputWriter OutputWriter;
|
||||
typedef UnstructuredGrid Grid;
|
||||
typedef GridT Grid;
|
||||
typedef BlackoilPolymerModel<Grid> Model;
|
||||
typedef NewtonSolver<Model> Solver;
|
||||
};
|
||||
|
||||
/// Class collecting all necessary components for a blackoil simulation with polymer
|
||||
/// injection.
|
||||
template <class GridT>
|
||||
class SimulatorFullyImplicitBlackoilPolymer
|
||||
: public SimulatorBase<SimulatorFullyImplicitBlackoilPolymer >
|
||||
: public SimulatorBase<SimulatorFullyImplicitBlackoilPolymer<GridT> >
|
||||
{
|
||||
typedef SimulatorFullyImplicitBlackoilPolymer ThisType;
|
||||
typedef SimulatorFullyImplicitBlackoilPolymer<GridT> ThisType;
|
||||
typedef SimulatorBase<ThisType> BaseType;
|
||||
|
||||
typedef SimulatorTraits<ThisType> Traits;
|
||||
typedef typename Traits::Solver Solver;
|
||||
|
||||
public:
|
||||
SimulatorFullyImplicitBlackoilPolymer(const parameter::ParameterGroup& param,
|
||||
const typename BaseType::Grid& grid,
|
||||
const GridT& grid,
|
||||
const DerivedGeology& geo,
|
||||
BlackoilPropsAdInterface& props,
|
||||
const PolymerPropsAd& polymer_props,
|
||||
@@ -118,58 +121,12 @@ namespace Opm
|
||||
Opm::DeckConstPtr& deck,
|
||||
const std::vector<double>& threshold_pressures_by_face);
|
||||
|
||||
std::shared_ptr<Solver> createSolver(const Wells* wells)
|
||||
{
|
||||
typedef typename Traits::Model Model;
|
||||
typedef typename Model::ModelParameters ModelParams;
|
||||
ModelParams modelParams( param_ );
|
||||
typedef NewtonSolver<Model> Solver;
|
||||
|
||||
auto model = std::make_shared<Model>(modelParams,
|
||||
BaseType::grid_,
|
||||
BaseType::props_,
|
||||
BaseType::geo_,
|
||||
BaseType::rock_comp_props_,
|
||||
polymer_props_,
|
||||
wells,
|
||||
BaseType::solver_,
|
||||
BaseType::has_disgas_,
|
||||
BaseType::has_vapoil_,
|
||||
has_polymer_,
|
||||
BaseType::terminal_output_);
|
||||
|
||||
if (!threshold_pressures_by_face_.empty()) {
|
||||
model->setThresholdPressures(threshold_pressures_by_face_);
|
||||
}
|
||||
|
||||
typedef typename Solver::SolverParameters SolverParams;
|
||||
SolverParams solverParams( param_ );
|
||||
return std::make_shared<Solver>(solverParams, model);
|
||||
}
|
||||
std::shared_ptr<Solver> createSolver(const Wells* wells);
|
||||
|
||||
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;
|
||||
}
|
||||
const Wells* wells);
|
||||
|
||||
private:
|
||||
const PolymerPropsAd& polymer_props_;
|
||||
|
||||
Reference in New Issue
Block a user