mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Only compute well potential if needed
A boolen user parameter is added to controll the computation of well potential. This is a temporary fix to assure that no extra computation time is used on well potential calculation if it is not needed. The long term fix will require a more thorough revising of the well group implementation.
This commit is contained in:
@@ -1703,6 +1703,8 @@ namespace detail {
|
|||||||
const std::vector<ADB>& b_perfcells,
|
const std::vector<ADB>& b_perfcells,
|
||||||
WellState& well_state)
|
WellState& well_state)
|
||||||
{
|
{
|
||||||
|
//only compute well potentials if they are needed
|
||||||
|
if (param_.compute_well_potentials_) {
|
||||||
const int nw = wells().number_of_wells;
|
const int nw = wells().number_of_wells;
|
||||||
const int np = wells().number_of_phases;
|
const int np = wells().number_of_phases;
|
||||||
const Opm::PhaseUsage pu = fluid_.phaseUsage();
|
const Opm::PhaseUsage pu = fluid_.phaseUsage();
|
||||||
@@ -1790,6 +1792,7 @@ namespace detail {
|
|||||||
cq += superset(well_potentials[phase].value(), Span(nperf, np, phase), nperf*np);
|
cq += superset(well_potentials[phase].value(), Span(nperf, np, phase), nperf*np);
|
||||||
}
|
}
|
||||||
well_state.wellPotentials().assign(cq.data(), cq.data() + nperf*np);
|
well_state.wellPotentials().assign(cq.data(), cq.data() + nperf*np);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace Opm
|
|||||||
tolerance_wells_ = param.getDefault("tolerance_wells", tolerance_wells_ );
|
tolerance_wells_ = param.getDefault("tolerance_wells", tolerance_wells_ );
|
||||||
solve_welleq_initially_ = param.getDefault("solve_welleq_initially",solve_welleq_initially_);
|
solve_welleq_initially_ = param.getDefault("solve_welleq_initially",solve_welleq_initially_);
|
||||||
update_equations_scaling_ = param.getDefault("update_equations_scaling", update_equations_scaling_);
|
update_equations_scaling_ = param.getDefault("update_equations_scaling", update_equations_scaling_);
|
||||||
|
compute_well_potentials_ = param.getDefault("compute_well_potentials", compute_well_potentials_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ namespace Opm
|
|||||||
tolerance_wells_ = 1.0e-3;
|
tolerance_wells_ = 1.0e-3;
|
||||||
solve_welleq_initially_ = true;
|
solve_welleq_initially_ = true;
|
||||||
update_equations_scaling_ = false;
|
update_equations_scaling_ = false;
|
||||||
|
compute_well_potentials_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ namespace Opm
|
|||||||
/// Update scaling factors for mass balance equations
|
/// Update scaling factors for mass balance equations
|
||||||
bool update_equations_scaling_;
|
bool update_equations_scaling_;
|
||||||
|
|
||||||
|
/// Compute well potentials, needed to calculate default guide rates for group
|
||||||
|
/// controlled wells
|
||||||
|
bool compute_well_potentials_;
|
||||||
|
|
||||||
/// Construct from user parameters or defaults.
|
/// Construct from user parameters or defaults.
|
||||||
explicit BlackoilModelParameters( const parameter::ParameterGroup& param );
|
explicit BlackoilModelParameters( const parameter::ParameterGroup& param );
|
||||||
|
|
||||||
|
|||||||
@@ -222,12 +222,13 @@ namespace Opm
|
|||||||
// Increment timer, remember well state.
|
// Increment timer, remember well state.
|
||||||
++timer;
|
++timer;
|
||||||
prev_well_state = well_state;
|
prev_well_state = well_state;
|
||||||
// Compute Well potentials (only used to determine default guide rates for group controlled wells)
|
// Compute Well potentials if they are needed
|
||||||
// TODO: add some logic to avoid unnecessary calulations of well potentials.
|
// Only used to determine default guide rates for group controlled wells
|
||||||
|
if ( param_.getDefault("compute_well_potentials", false ) ) {
|
||||||
asImpl().computeWellPotentials(wells, state, well_state, well_potentials);
|
asImpl().computeWellPotentials(wells, state, well_state, well_potentials);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// Write final simulation state.
|
// Write final simulation state.
|
||||||
output_writer_.writeTimeStep( timer, state, prev_well_state );
|
output_writer_.writeTimeStep( timer, state, prev_well_state );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user