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:
Andreas Lauser
2015-05-28 13:15:42 +02:00
parent 01555da823
commit 2b085e0062
8 changed files with 154 additions and 117 deletions

View File

@@ -68,29 +68,32 @@
namespace Opm
{
template <class GridT>
class SimulatorFullyImplicitCompressiblePolymer;
template <>
struct SimulatorTraits<SimulatorFullyImplicitCompressiblePolymer>
template <class GridT>
struct SimulatorTraits<SimulatorFullyImplicitCompressiblePolymer<GridT> >
{
typedef PolymerBlackoilState ReservoirState;
typedef WellStateFullyImplicitBlackoilPolymer WellState;
typedef BlackoilOutputWriter OutputWriter;
typedef UnstructuredGrid Grid;
typedef GridT Grid;
typedef FullyImplicitCompressiblePolymerSolver Solver;
};
/// Class collecting all necessary components for a two-phase simulation.
template <class GridT>
class SimulatorFullyImplicitCompressiblePolymer
: public SimulatorBase<SimulatorFullyImplicitCompressiblePolymer>
: public SimulatorBase<SimulatorFullyImplicitCompressiblePolymer<GridT> >
{
typedef SimulatorFullyImplicitCompressiblePolymer ThisType;
typedef SimulatorBase<ThisType> BaseType;
typedef typename BaseType::Solver Solver;
public:
/// Initialise from parameters and objects to observe.
SimulatorFullyImplicitCompressiblePolymer(const parameter::ParameterGroup& param,
const UnstructuredGrid& grid,
const GridT& grid,
const DerivedGeology& geo,
BlackoilPropsAdInterface& props,
const PolymerPropsAd& polymer_props,
@@ -101,42 +104,12 @@ namespace Opm
NewtonIterationBlackoilInterface& linsolver,
const double* gravity);
std::shared_ptr<Solver> createSolver(const Wells* wells)
{
return std::make_shared<Solver>(BaseType::grid_,
BaseType::props_,
BaseType::geo_,
BaseType::rock_comp_props_,
polymer_props_,
*wells,
BaseType::solver_);
}
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:
Opm::DeckConstPtr deck_;
const PolymerPropsAd& polymer_props_;