mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #542 from andlaus/implement_MULTFLT_in_SCHEDULE_section
implement abililty to change the geology during the simulation run
This commit is contained in:
commit
226e414380
@ -434,7 +434,7 @@ try
|
|||||||
<< std::flush;
|
<< std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulatorReport fullReport = simulator.run(simtimer, state);
|
SimulatorReport fullReport = simulator.run(eclipseState, simtimer, state);
|
||||||
|
|
||||||
if( output_cout )
|
if( output_cout )
|
||||||
{
|
{
|
||||||
|
@ -407,7 +407,7 @@ try
|
|||||||
<< std::flush;
|
<< std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulatorReport fullReport = simulator.run(simtimer, state);
|
SimulatorReport fullReport = simulator.run(eclipseState, simtimer, state);
|
||||||
|
|
||||||
if( output_cout )
|
if( output_cout )
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,17 @@ namespace Opm
|
|||||||
, trans_(Opm::AutoDiffGrid::numFaces(grid))
|
, trans_(Opm::AutoDiffGrid::numFaces(grid))
|
||||||
, gpot_ (Vector::Zero(Opm::AutoDiffGrid::cell2Faces(grid).noEntries(), 1))
|
, gpot_ (Vector::Zero(Opm::AutoDiffGrid::cell2Faces(grid).noEntries(), 1))
|
||||||
, z_(Opm::AutoDiffGrid::numCells(grid))
|
, z_(Opm::AutoDiffGrid::numCells(grid))
|
||||||
|
, use_local_perm_(use_local_perm)
|
||||||
|
{
|
||||||
|
update(grid, props, eclState, grav);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// compute the all geological properties at a given report step
|
||||||
|
template <class Props, class Grid>
|
||||||
|
void update(const Grid& grid,
|
||||||
|
const Props& props ,
|
||||||
|
Opm::EclipseStateConstPtr eclState,
|
||||||
|
const double* grav)
|
||||||
{
|
{
|
||||||
int numCells = AutoDiffGrid::numCells(grid);
|
int numCells = AutoDiffGrid::numCells(grid);
|
||||||
int numFaces = AutoDiffGrid::numFaces(grid);
|
int numFaces = AutoDiffGrid::numFaces(grid);
|
||||||
@ -121,7 +132,7 @@ namespace Opm
|
|||||||
Vector htrans(AutoDiffGrid::numCellFaces(grid));
|
Vector htrans(AutoDiffGrid::numCellFaces(grid));
|
||||||
Grid* ug = const_cast<Grid*>(& grid);
|
Grid* ug = const_cast<Grid*>(& grid);
|
||||||
|
|
||||||
if (! use_local_perm) {
|
if (! use_local_perm_) {
|
||||||
tpfa_htrans_compute(ug, props.permeability(), htrans.data());
|
tpfa_htrans_compute(ug, props.permeability(), htrans.data());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -205,9 +216,7 @@ namespace Opm
|
|||||||
Vector gpot_ ;
|
Vector gpot_ ;
|
||||||
Vector z_;
|
Vector z_;
|
||||||
double gravity_[3]; // Size 3 even if grid is 2-dim.
|
double gravity_[3]; // Size 3 even if grid is 2-dim.
|
||||||
|
bool use_local_perm_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ namespace Opm
|
|||||||
/// \param[in] threshold_pressures_by_face if nonempty, threshold pressures that inhibit flow
|
/// \param[in] threshold_pressures_by_face if nonempty, threshold pressures that inhibit flow
|
||||||
SimulatorBase(const parameter::ParameterGroup& param,
|
SimulatorBase(const parameter::ParameterGroup& param,
|
||||||
const Grid& grid,
|
const Grid& grid,
|
||||||
const DerivedGeology& geo,
|
DerivedGeology& geo,
|
||||||
BlackoilPropsAdInterface& props,
|
BlackoilPropsAdInterface& props,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
NewtonIterationBlackoilInterface& linsolver,
|
NewtonIterationBlackoilInterface& linsolver,
|
||||||
@ -134,11 +134,13 @@ namespace Opm
|
|||||||
/// Run the simulation.
|
/// Run the simulation.
|
||||||
/// This will run succesive timesteps until timer.done() is true. It will
|
/// This will run succesive timesteps until timer.done() is true. It will
|
||||||
/// modify the reservoir and well states.
|
/// modify the reservoir and well states.
|
||||||
|
/// \param[in] eclState the object which represents an internalized ECL deck
|
||||||
/// \param[in,out] timer governs the requested reporting timesteps
|
/// \param[in,out] timer governs the requested reporting timesteps
|
||||||
/// \param[in,out] state state of reservoir: pressure, fluxes
|
/// \param[in,out] state state of reservoir: pressure, fluxes
|
||||||
/// \param[in,out] well_state state of wells: bhp, perforation rates
|
/// \param[in,out] well_state state of wells: bhp, perforation rates
|
||||||
/// \return simulation report, with timing data
|
/// \return simulation report, with timing data
|
||||||
SimulatorReport run(SimulatorTimer& timer,
|
SimulatorReport run(EclipseStateConstPtr eclState,
|
||||||
|
SimulatorTimer& timer,
|
||||||
ReservoirState& state);
|
ReservoirState& state);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -176,7 +178,7 @@ namespace Opm
|
|||||||
const RockCompressibility* rock_comp_props_;
|
const RockCompressibility* rock_comp_props_;
|
||||||
const double* gravity_;
|
const double* gravity_;
|
||||||
// Solvers
|
// Solvers
|
||||||
const DerivedGeology& geo_;
|
DerivedGeology& geo_;
|
||||||
NewtonIterationBlackoilInterface& solver_;
|
NewtonIterationBlackoilInterface& solver_;
|
||||||
// Misc. data
|
// Misc. data
|
||||||
std::vector<int> allcells_;
|
std::vector<int> allcells_;
|
||||||
|
@ -27,7 +27,7 @@ namespace Opm
|
|||||||
template <class Implementation>
|
template <class Implementation>
|
||||||
SimulatorBase<Implementation>::SimulatorBase(const parameter::ParameterGroup& param,
|
SimulatorBase<Implementation>::SimulatorBase(const parameter::ParameterGroup& param,
|
||||||
const Grid& grid,
|
const Grid& grid,
|
||||||
const DerivedGeology& geo,
|
DerivedGeology& geo,
|
||||||
BlackoilPropsAdInterface& props,
|
BlackoilPropsAdInterface& props,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
NewtonIterationBlackoilInterface& linsolver,
|
NewtonIterationBlackoilInterface& linsolver,
|
||||||
@ -74,7 +74,8 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Implementation>
|
template <class Implementation>
|
||||||
SimulatorReport SimulatorBase<Implementation>::run(SimulatorTimer& timer,
|
SimulatorReport SimulatorBase<Implementation>::run(EclipseStateConstPtr eclState,
|
||||||
|
SimulatorTimer& timer,
|
||||||
ReservoirState& state)
|
ReservoirState& state)
|
||||||
{
|
{
|
||||||
WellState prev_well_state;
|
WellState prev_well_state;
|
||||||
@ -88,6 +89,9 @@ namespace Opm
|
|||||||
std::string tstep_filename = output_writer_.outputDirectory() + "/step_timing.txt";
|
std::string tstep_filename = output_writer_.outputDirectory() + "/step_timing.txt";
|
||||||
std::ofstream tstep_os(tstep_filename.c_str());
|
std::ofstream tstep_os(tstep_filename.c_str());
|
||||||
|
|
||||||
|
const auto& schedule = eclState->getSchedule();
|
||||||
|
const auto& events = schedule->getEvents();
|
||||||
|
|
||||||
// adaptive time stepping
|
// adaptive time stepping
|
||||||
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
|
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
|
||||||
if( param_.getDefault("timestep.adaptive", true ) )
|
if( param_.getDefault("timestep.adaptive", true ) )
|
||||||
@ -164,6 +168,21 @@ namespace Opm
|
|||||||
solver->step(timer.currentStepLength(), state, well_state);
|
solver->step(timer.currentStepLength(), state, well_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update the derived geology (transmissibilities, pore volumes, etc) if the
|
||||||
|
// has geology changed for the next report step
|
||||||
|
const int nextTimeStepIdx = timer.currentStepNum() + 1;
|
||||||
|
if (nextTimeStepIdx < timer.numSteps()
|
||||||
|
&& events.hasEvent(ScheduleEvents::GEO_MODIFIER, nextTimeStepIdx)) {
|
||||||
|
// bring the contents of the keywords to the current state of the SCHEDULE
|
||||||
|
// section
|
||||||
|
//
|
||||||
|
// TODO (?): handle the parallel case (maybe this works out of the box)
|
||||||
|
ScheduleConstPtr schedule = eclipse_state_->getSchedule();
|
||||||
|
DeckConstPtr miniDeck = schedule->getModifierDeck(nextTimeStepIdx);
|
||||||
|
eclipse_state_->applyModifierDeck(miniDeck);
|
||||||
|
geo_.update(grid_, props_, eclipse_state_, gravity_);
|
||||||
|
}
|
||||||
|
|
||||||
// take time that was used to solve system for this reportStep
|
// take time that was used to solve system for this reportStep
|
||||||
solver_timer.stop();
|
solver_timer.stop();
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
// forward the constructor to the base class
|
// forward the constructor to the base class
|
||||||
SimulatorFullyImplicitBlackoil(const parameter::ParameterGroup& param,
|
SimulatorFullyImplicitBlackoil(const parameter::ParameterGroup& param,
|
||||||
const typename Base::Grid& grid,
|
const typename Base::Grid& grid,
|
||||||
const DerivedGeology& geo,
|
DerivedGeology& geo,
|
||||||
BlackoilPropsAdInterface& props,
|
BlackoilPropsAdInterface& props,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
NewtonIterationBlackoilInterface& linsolver,
|
NewtonIterationBlackoilInterface& linsolver,
|
||||||
|
@ -106,7 +106,7 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
|
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
|
||||||
const GridT& grid,
|
const GridT& grid,
|
||||||
const DerivedGeology& geo,
|
DerivedGeology& geo,
|
||||||
BlackoilPropsAdInterface& props,
|
BlackoilPropsAdInterface& props,
|
||||||
const SolventPropsAdFromDeck& solvent_props,
|
const SolventPropsAdFromDeck& solvent_props,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
|
@ -26,7 +26,7 @@ namespace Opm
|
|||||||
SimulatorFullyImplicitBlackoilSolvent<GridT>::
|
SimulatorFullyImplicitBlackoilSolvent<GridT>::
|
||||||
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
|
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
|
||||||
const GridT& grid,
|
const GridT& grid,
|
||||||
const DerivedGeology& geo,
|
DerivedGeology& geo,
|
||||||
BlackoilPropsAdInterface& props,
|
BlackoilPropsAdInterface& props,
|
||||||
const SolventPropsAdFromDeck& solvent_props,
|
const SolventPropsAdFromDeck& solvent_props,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
|
Loading…
Reference in New Issue
Block a user