adding wells_multisegment_ member for multisegment model

and also updating the createSolver() function.
This commit is contained in:
Kai Bao
2015-09-22 17:15:55 +02:00
parent 00d9a57cc2
commit f0b363baa5
4 changed files with 48 additions and 60 deletions

View File

@@ -84,7 +84,8 @@ namespace Opm {
Opm::EclipseStateConstPtr eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output);
const bool terminal_output,
const std::vector<WellMultiSegmentConstPtr>& wells_multisegment);
/// Called once before each time step.
/// \param[in] dt time step size
@@ -171,13 +172,13 @@ namespace Opm {
V well_perforatoin_cell_pressure_diffs_;
const std::vector<WellMultiSegmentConstPtr> wells_multi_segment_;
const std::vector<WellMultiSegmentConstPtr> wells_multisegment_;
// return wells object
// TODO: remove this wells structure
using Base::wells;
const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return wells_multi_segment_; }
const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return wells_multisegment_; }
SolutionState
variableState(const ReservoirState& x,
@@ -455,8 +456,8 @@ namespace Opm {
};
/// Providing types by template specialisation of ModelTraits for BlackoilMultiSegmentModel.
template <class Grid>
struct ModelTraits< BlackoilMultiSegmentModel<Grid> >
template <class GridT>
struct ModelTraits< BlackoilMultiSegmentModel<GridT> >
{
typedef BlackoilState ReservoirState;
typedef WellStateMultiSegment WellState;

View File

@@ -72,7 +72,8 @@ namespace Opm {
Opm::EclipseStateConstPtr eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output)
const bool terminal_output,
const std::vector<WellMultiSegmentConstPtr>& wells_multisegment)
: Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver,
eclState, has_disgas, has_vapoil, terminal_output)
// not all will be necessary eventually
@@ -81,62 +82,10 @@ namespace Opm {
, well_perforation_pressure_cell_diffs_adb_(ADB::null())
, well_perforation_cell_densities_adb_(ADB::null())
, well_perforations_segment_pressure_diffs_(ADB::null())
, wells_multisegment_(wells_multisegment)
{
}
/* grid_ (grid)
, fluid_ (fluid)
, geo_ (geo)
, rock_comp_props_(rock_comp_props)
, wells_ (wells_arg)
, vfp_properties_(eclState->getTableManager()->getVFPInjTables(), eclState->getTableManager()->getVFPProdTables())
, linsolver_ (linsolver)
, active_(detail::activePhases(fluid.phaseUsage()))
, canph_ (detail::active2Canonical(fluid.phaseUsage()))
, cells_ (detail::buildAllCells(Opm::AutoDiffGrid::numCells(grid)))
, ops_ (grid, eclState)
, wops_ (wells_)
, has_disgas_(has_disgas)
, has_vapoil_(has_vapoil)
, param_( param )
, use_threshold_pressure_(false)
, rq_ (fluid.numPhases())
, phaseCondition_(AutoDiffGrid::numCells(grid))
, isRs_(V::Zero(AutoDiffGrid::numCells(grid)))
, isRv_(V::Zero(AutoDiffGrid::numCells(grid)))
, isSg_(V::Zero(AutoDiffGrid::numCells(grid)))
// , well_perforation_densities_adb_(ADB::null())
// , well_perforation_pressure_diffs_adb_(ADB::null())
// , well_perforation_pressure_cell_diffs_adb_(ADB::null())
// , well_perforation_cell_densities_adb_(ADB::null())
// , well_perforations_segment_pressure_diffs_(ADB::null())
, residual_ ( { std::vector<ADB>(fluid.numPhases(), ADB::null()),
ADB::null(),
ADB::null(),
{ 1.1169, 1.0031, 0.0031 }} ) // the default magic numbers
, terminal_output_ (terminal_output)
{
#if HAVE_MPI
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
{
const ParallelISTLInformation& info =
boost::any_cast<const ParallelISTLInformation&>(linsolver_.parallelInformation());
if ( terminal_output_ ) {
// Only rank 0 does print to std::cout if terminal_output is enabled
terminal_output_ = (info.communicator().rank()==0);
}
int local_number_of_wells = wells_->number_of_wells;
int global_number_of_wells = info.communicator().sum(local_number_of_wells);
wells_active_ = ( global_number_of_wells > 0 );
}else
{
wells_active_ = (wells_->number_of_wells > 0 );
}
#else
wells_active_ = (wells_->number_of_wells > 0 );
#endif
} */

View File

@@ -54,6 +54,7 @@ class SimulatorFullyImplicitBlackoilMultiSegment
typedef SimulatorTraits<ThisType> Traits;
typedef typename Traits::ReservoirState ReservoirState;
typedef typename Traits::WellState WellState;
typedef typename Traits::Solver Solver;
public:
// forward the constructor to the base class
SimulatorFullyImplicitBlackoilMultiSegment(const parameter::ParameterGroup& param,
@@ -72,10 +73,14 @@ public:
eclipse_state, output_writer, threshold_pressures_by_face)
{}
SimulatorReport run(SimulatorTimer& timer,
ReservoirState& state);
protected:
std::unique_ptr<Solver> createSolver(const Wells* wells, std::vector<WellMultiSegmentConstPtr>& wells_multisegment);
using Base::output_writer_;
using Base::param_;
using Base::solver_;
@@ -85,6 +90,11 @@ protected:
using Base::props_;
using Base::is_parallel_run_;
using Base::allcells_;
using Base::model_param_;
using Base::geo_;
using Base::rock_comp_props_;
using Base::has_disgas_;
using Base::has_vapoil_;
};
} // namespace Opm

View File

@@ -23,6 +23,34 @@
namespace Opm
{
template <class GridT>
auto SimulatorFullyImplicitBlackoilMultiSegment<GridT>::
createSolver(const Wells* wells, std::vector<WellMultiSegmentConstPtr>& wells_multisegment)
-> std::unique_ptr<Solver>
{
typedef typename Traits::Model Model;
auto model = std::unique_ptr<Model>(new Model(model_param_,
grid_,
props_,
geo_,
rock_comp_props_,
wells,
solver_,
eclipse_state_,
has_disgas_,
has_vapoil_,
terminal_output_,
wells_multisegment));
if (!Base::threshold_pressures_by_face_.empty()) {
model->setThresholdPressures(Base::threshold_pressures_by_face_);
}
return std::unique_ptr<ThisType::Solver>(new Solver(Base::solver_param_, std::move(model)));
}
template <class GridT>
SimulatorReport SimulatorFullyImplicitBlackoilMultiSegment<GridT>::run(SimulatorTimer& timer,
ReservoirState& state)
@@ -115,7 +143,7 @@ namespace Opm
// Run a multiple steps of the solver depending on the time step control.
solver_timer.start();
auto solver = Base::asImpl().createSolver(wells);
auto solver = createSolver(wells, wells_multisegment);
// If sub stepping is enabled allow the solver to sub cycle
// in case the report steps are too large for the solver to converge