mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
renaming solveWellEqUntilConverged to be iterateWellEquations
This commit is contained in:
parent
fefa5c22ce
commit
11807747cb
@ -136,6 +136,8 @@ public:
|
|||||||
EWOMS_HIDE_PARAM(TypeTag, UseMultisegmentWell);
|
EWOMS_HIDE_PARAM(TypeTag, UseMultisegmentWell);
|
||||||
EWOMS_HIDE_PARAM(TypeTag, TolerancePressureMsWells);
|
EWOMS_HIDE_PARAM(TypeTag, TolerancePressureMsWells);
|
||||||
EWOMS_HIDE_PARAM(TypeTag, MaxPressureChangeMsWells);
|
EWOMS_HIDE_PARAM(TypeTag, MaxPressureChangeMsWells);
|
||||||
|
EWOMS_HIDE_PARAM(TypeTag, UseInnerIterationsMsWells);
|
||||||
|
EWOMS_HIDE_PARAM(TypeTag, MaxInnerIterMsWells);
|
||||||
EWOMS_HIDE_PARAM(TypeTag, UseInnerIterationsWells);
|
EWOMS_HIDE_PARAM(TypeTag, UseInnerIterationsWells);
|
||||||
EWOMS_HIDE_PARAM(TypeTag, MaxInnerIterWells);
|
EWOMS_HIDE_PARAM(TypeTag, MaxInnerIterWells);
|
||||||
EWOMS_HIDE_PARAM(TypeTag, MaxSinglePrecisionDays);
|
EWOMS_HIDE_PARAM(TypeTag, MaxSinglePrecisionDays);
|
||||||
|
@ -29,9 +29,6 @@ BEGIN_PROPERTIES
|
|||||||
|
|
||||||
NEW_TYPE_TAG(FlowModelParameters);
|
NEW_TYPE_TAG(FlowModelParameters);
|
||||||
|
|
||||||
NEW_PROP_TAG(Scalar);
|
|
||||||
NEW_PROP_TAG(EclDeckFileName);
|
|
||||||
|
|
||||||
NEW_PROP_TAG(DbhpMaxRel);
|
NEW_PROP_TAG(DbhpMaxRel);
|
||||||
NEW_PROP_TAG(DwellFractionMax);
|
NEW_PROP_TAG(DwellFractionMax);
|
||||||
NEW_PROP_TAG(MaxResidualAllowed);
|
NEW_PROP_TAG(MaxResidualAllowed);
|
||||||
@ -59,6 +56,8 @@ NEW_PROP_TAG(StrictInnerIterMsWells);
|
|||||||
NEW_PROP_TAG(RelaxedFlowTolInnerIterMsw);
|
NEW_PROP_TAG(RelaxedFlowTolInnerIterMsw);
|
||||||
NEW_PROP_TAG(RelaxedPressureTolInnerIterMsw);
|
NEW_PROP_TAG(RelaxedPressureTolInnerIterMsw);
|
||||||
NEW_PROP_TAG(RegularizationFactorMsw);
|
NEW_PROP_TAG(RegularizationFactorMsw);
|
||||||
|
NEW_PROP_TAG(UseInnerIterationsWells);
|
||||||
|
NEW_PROP_TAG(MaxInnerIterWells);
|
||||||
|
|
||||||
SET_SCALAR_PROP(FlowModelParameters, DbhpMaxRel, 1.0);
|
SET_SCALAR_PROP(FlowModelParameters, DbhpMaxRel, 1.0);
|
||||||
SET_SCALAR_PROP(FlowModelParameters, DwellFractionMax, 0.2);
|
SET_SCALAR_PROP(FlowModelParameters, DwellFractionMax, 0.2);
|
||||||
@ -80,8 +79,15 @@ SET_SCALAR_PROP(FlowModelParameters, TolerancePressureMsWells, 0.01*1e5);
|
|||||||
SET_SCALAR_PROP(FlowModelParameters, MaxPressureChangeMsWells, 10*1e5);
|
SET_SCALAR_PROP(FlowModelParameters, MaxPressureChangeMsWells, 10*1e5);
|
||||||
SET_BOOL_PROP(FlowModelParameters, UseInnerIterationsMsWells, true);
|
SET_BOOL_PROP(FlowModelParameters, UseInnerIterationsMsWells, true);
|
||||||
SET_INT_PROP(FlowModelParameters, MaxInnerIterMsWells, 100);
|
SET_INT_PROP(FlowModelParameters, MaxInnerIterMsWells, 100);
|
||||||
|
SET_BOOL_PROP(FlowModelParameters, UseInnerIterationsWells, true);
|
||||||
|
SET_INT_PROP(FlowModelParameters, MaxInnerIterWells, 100);
|
||||||
|
SET_INT_PROP(FlowModelParameters, StrictInnerIterMsWells, 40);
|
||||||
|
SET_SCALAR_PROP(FlowModelParameters, RegularizationFactorMsw, 1);
|
||||||
SET_BOOL_PROP(FlowModelParameters, EnableWellOperabilityCheck, true);
|
SET_BOOL_PROP(FlowModelParameters, EnableWellOperabilityCheck, true);
|
||||||
|
|
||||||
|
SET_SCALAR_PROP(FlowModelParameters, RelaxedFlowTolInnerIterMsw, 1);
|
||||||
|
SET_SCALAR_PROP(FlowModelParameters, RelaxedPressureTolInnerIterMsw, 0.5e5);
|
||||||
|
|
||||||
// if openMP is available, determine the number threads per process automatically.
|
// if openMP is available, determine the number threads per process automatically.
|
||||||
#if _OPENMP
|
#if _OPENMP
|
||||||
SET_INT_PROP(FlowModelParameters, ThreadsPerProcess, -1);
|
SET_INT_PROP(FlowModelParameters, ThreadsPerProcess, -1);
|
||||||
@ -118,6 +124,12 @@ namespace Opm
|
|||||||
double tolerance_well_control_;
|
double tolerance_well_control_;
|
||||||
/// Tolerance for the pressure equations for multisegment wells
|
/// Tolerance for the pressure equations for multisegment wells
|
||||||
double tolerance_pressure_ms_wells_;
|
double tolerance_pressure_ms_wells_;
|
||||||
|
|
||||||
|
/// Relaxed tolerance for the inner iteration for the MSW flow solution
|
||||||
|
double relaxed_inner_tolerance_flow_ms_well_;
|
||||||
|
/// Relaxed tolerance for the inner iteration for the MSW pressure solution
|
||||||
|
double relaxed_inner_tolerance_pressure_ms_well_;
|
||||||
|
|
||||||
/// Maximum pressure change over an iteratio for ms wells
|
/// Maximum pressure change over an iteratio for ms wells
|
||||||
double max_pressure_change_ms_wells_;
|
double max_pressure_change_ms_wells_;
|
||||||
|
|
||||||
@ -127,6 +139,18 @@ namespace Opm
|
|||||||
/// Maximum inner iteration number for ms wells
|
/// Maximum inner iteration number for ms wells
|
||||||
int max_inner_iter_ms_wells_;
|
int max_inner_iter_ms_wells_;
|
||||||
|
|
||||||
|
/// Strict inner iteration number for ms wells
|
||||||
|
int strict_inner_iter_ms_wells_;
|
||||||
|
|
||||||
|
/// Regularization factor for ms wells
|
||||||
|
int regularization_factor_ms_wells_;
|
||||||
|
|
||||||
|
/// Whether to use inner iterations for standard wells
|
||||||
|
bool use_inner_iterations_wells_;
|
||||||
|
|
||||||
|
/// Maximum inner iteration number for standard wells
|
||||||
|
int max_inner_iter_wells_;
|
||||||
|
|
||||||
/// Maximum iteration number of the well equation solution
|
/// Maximum iteration number of the well equation solution
|
||||||
int max_welleq_iter_;
|
int max_welleq_iter_;
|
||||||
|
|
||||||
@ -173,9 +197,15 @@ namespace Opm
|
|||||||
max_welleq_iter_ = EWOMS_GET_PARAM(TypeTag, int, MaxWelleqIter);
|
max_welleq_iter_ = EWOMS_GET_PARAM(TypeTag, int, MaxWelleqIter);
|
||||||
use_multisegment_well_ = EWOMS_GET_PARAM(TypeTag, bool, UseMultisegmentWell);
|
use_multisegment_well_ = EWOMS_GET_PARAM(TypeTag, bool, UseMultisegmentWell);
|
||||||
tolerance_pressure_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, TolerancePressureMsWells);
|
tolerance_pressure_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, TolerancePressureMsWells);
|
||||||
|
relaxed_inner_tolerance_flow_ms_well_ = EWOMS_GET_PARAM(TypeTag, Scalar, RelaxedFlowTolInnerIterMsw);
|
||||||
|
relaxed_inner_tolerance_pressure_ms_well_ = EWOMS_GET_PARAM(TypeTag, Scalar, RelaxedPressureTolInnerIterMsw);
|
||||||
max_pressure_change_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells);
|
max_pressure_change_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells);
|
||||||
use_inner_iterations_ms_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseInnerIterationsMsWells);
|
use_inner_iterations_ms_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseInnerIterationsMsWells);
|
||||||
max_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterMsWells);
|
max_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterMsWells);
|
||||||
|
strict_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, StrictInnerIterMsWells);
|
||||||
|
regularization_factor_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, RegularizationFactorMsw);
|
||||||
|
use_inner_iterations_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseInnerIterationsWells);
|
||||||
|
max_inner_iter_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterWells);
|
||||||
maxSinglePrecisionTimeStep_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxSinglePrecisionDays) *24*60*60;
|
maxSinglePrecisionTimeStep_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxSinglePrecisionDays) *24*60*60;
|
||||||
max_strict_iter_ = EWOMS_GET_PARAM(TypeTag, int, MaxStrictIter);
|
max_strict_iter_ = EWOMS_GET_PARAM(TypeTag, int, MaxStrictIter);
|
||||||
solve_welleq_initially_ = EWOMS_GET_PARAM(TypeTag, bool, SolveWelleqInitially);
|
solve_welleq_initially_ = EWOMS_GET_PARAM(TypeTag, bool, SolveWelleqInitially);
|
||||||
@ -199,9 +229,15 @@ namespace Opm
|
|||||||
EWOMS_REGISTER_PARAM(TypeTag, int, MaxWelleqIter, "Maximum number of iterations to determine solution the well equations");
|
EWOMS_REGISTER_PARAM(TypeTag, int, MaxWelleqIter, "Maximum number of iterations to determine solution the well equations");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, bool, UseMultisegmentWell, "Use the well model for multi-segment wells instead of the one for single-segment wells");
|
EWOMS_REGISTER_PARAM(TypeTag, bool, UseMultisegmentWell, "Use the well model for multi-segment wells instead of the one for single-segment wells");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, TolerancePressureMsWells, "Tolerance for the pressure equations for multi-segment wells");
|
EWOMS_REGISTER_PARAM(TypeTag, Scalar, TolerancePressureMsWells, "Tolerance for the pressure equations for multi-segment wells");
|
||||||
|
EWOMS_REGISTER_PARAM(TypeTag, Scalar, RelaxedFlowTolInnerIterMsw, "Relaxed tolerance for the inner iteration for the MSW flow solution");
|
||||||
|
EWOMS_REGISTER_PARAM(TypeTag, Scalar, RelaxedPressureTolInnerIterMsw, "Relaxed tolerance for the inner iteration for the MSW pressure solution");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells, "Maximum relative pressure change for a single iteration of the multi-segment well model");
|
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells, "Maximum relative pressure change for a single iteration of the multi-segment well model");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, bool, UseInnerIterationsMsWells, "Use nested iterations for multi-segment wells");
|
EWOMS_REGISTER_PARAM(TypeTag, bool, UseInnerIterationsMsWells, "Use nested iterations for multi-segment wells");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, int, MaxInnerIterMsWells, "Maximum number of inner iterations for multi-segment wells");
|
EWOMS_REGISTER_PARAM(TypeTag, int, MaxInnerIterMsWells, "Maximum number of inner iterations for multi-segment wells");
|
||||||
|
EWOMS_REGISTER_PARAM(TypeTag, int, StrictInnerIterMsWells, "Number of inner iterations for multi-segment wells with strict tolerance");
|
||||||
|
EWOMS_REGISTER_PARAM(TypeTag, bool, UseInnerIterationsWells, "Use nested iterations for standard wells");
|
||||||
|
EWOMS_REGISTER_PARAM(TypeTag, int, MaxInnerIterWells, "Maximum number of inner iterations for standard wells");
|
||||||
|
EWOMS_REGISTER_PARAM(TypeTag, Scalar, RegularizationFactorMsw, "Regularization factor for ms wells");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxSinglePrecisionDays, "Maximum time step size where single precision floating point arithmetic can be used solving for the linear systems of equations");
|
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxSinglePrecisionDays, "Maximum time step size where single precision floating point arithmetic can be used solving for the linear systems of equations");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, int, MaxStrictIter, "Maximum number of Newton iterations before relaxed tolerances are used for the CNV convergence criterion");
|
EWOMS_REGISTER_PARAM(TypeTag, int, MaxStrictIter, "Maximum number of Newton iterations before relaxed tolerances are used for the CNV convergence criterion");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, bool, SolveWelleqInitially, "Fully solve the well equations before each iteration of the reservoir model");
|
EWOMS_REGISTER_PARAM(TypeTag, bool, SolveWelleqInitially, "Fully solve the well equations before each iteration of the reservoir model");
|
||||||
|
@ -407,14 +407,13 @@ namespace Opm
|
|||||||
|
|
||||||
bool accelerationalPressureLossConsidered() const;
|
bool accelerationalPressureLossConsidered() const;
|
||||||
|
|
||||||
// TODO: try to make ebosSimulator const, as it should be
|
bool iterateWellEqWithControl(const Simulator& ebosSimulator,
|
||||||
void iterateWellEquations(const Simulator& ebosSimulator,
|
const std::vector<Scalar>& B_avg,
|
||||||
const std::vector<Scalar>& B_avg,
|
const double dt,
|
||||||
const double dt,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
WellState& well_state,
|
||||||
WellState& well_state,
|
Opm::DeferredLogger& deferred_logger);
|
||||||
Opm::DeferredLogger& deferred_logger);
|
|
||||||
|
|
||||||
virtual void wellTestingPhysical(const Simulator& simulator, const std::vector<double>& B_avg,
|
virtual void wellTestingPhysical(const Simulator& simulator, const std::vector<double>& B_avg,
|
||||||
const double simulation_time, const int report_step,
|
const double simulation_time, const int report_step,
|
||||||
|
@ -262,10 +262,10 @@ namespace Opm
|
|||||||
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
||||||
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
||||||
|
|
||||||
const bool use_inner_iterations = param_.use_inner_iterations_wells_;
|
const bool use_inner_iterations = param_.use_inner_iterations_ms_wells_;
|
||||||
if (use_inner_iterations) {
|
if (use_inner_iterations) {
|
||||||
|
|
||||||
iterateWellEquations(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
iterateWellEqWithControl(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
assembleWellEqWithoutIteration(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
assembleWellEqWithoutIteration(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
||||||
@ -850,7 +850,8 @@ namespace Opm
|
|||||||
well_copy.calculateExplicitQuantities(ebosSimulator, well_state_copy, deferred_logger);
|
well_copy.calculateExplicitQuantities(ebosSimulator, well_state_copy, deferred_logger);
|
||||||
const double dt = ebosSimulator.timeStepSize();
|
const double dt = ebosSimulator.timeStepSize();
|
||||||
// iterate to get a solution at the given bhp.
|
// iterate to get a solution at the given bhp.
|
||||||
well_copy.iterateWellEquations(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state_copy, deferred_logger);
|
well_copy.iterateWellEqWithControl(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state_copy,
|
||||||
|
deferred_logger);
|
||||||
|
|
||||||
// compute the potential and store in the flux vector.
|
// compute the potential and store in the flux vector.
|
||||||
well_flux.clear();
|
well_flux.clear();
|
||||||
@ -2373,17 +2374,17 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
bool
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
iterateWellEquations(const Simulator& ebosSimulator,
|
iterateWellEqWithControl(const Simulator& ebosSimulator,
|
||||||
const std::vector<Scalar>& B_avg,
|
const std::vector<Scalar>& B_avg,
|
||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
Opm::DeferredLogger& deferred_logger)
|
Opm::DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const int max_iter_number = param_.max_inner_iter_wells_;
|
const int max_iter_number = param_.max_inner_iter_ms_wells_;
|
||||||
const WellState well_state0 = well_state;
|
const WellState well_state0 = well_state;
|
||||||
const std::vector<Scalar> residuals0 = getWellResiduals(B_avg);
|
const std::vector<Scalar> residuals0 = getWellResiduals(B_avg);
|
||||||
std::vector<std::vector<Scalar> > residual_history;
|
std::vector<std::vector<Scalar> > residual_history;
|
||||||
@ -2433,7 +2434,7 @@ namespace Opm
|
|||||||
converged = true;
|
converged = true;
|
||||||
sstr << " well " << name() << " manages to get converged with relaxed tolerances in " << it << " inner iterations";
|
sstr << " well " << name() << " manages to get converged with relaxed tolerances in " << it << " inner iterations";
|
||||||
deferred_logger.debug(sstr.str());
|
deferred_logger.debug(sstr.str());
|
||||||
return;
|
return converged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2481,6 +2482,8 @@ namespace Opm
|
|||||||
#endif
|
#endif
|
||||||
deferred_logger.debug(sstr.str());
|
deferred_logger.debug(sstr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return converged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,6 +218,15 @@ namespace Opm
|
|||||||
|
|
||||||
virtual void addWellContributions(SparseMatrixAdapter& mat) const override;
|
virtual void addWellContributions(SparseMatrixAdapter& mat) const override;
|
||||||
|
|
||||||
|
// iterate well equations with the specified control until converged
|
||||||
|
bool iterateWellEqWithControl(const Simulator& ebosSimulator,
|
||||||
|
const std::vector<double>& B_avg,
|
||||||
|
const double dt,
|
||||||
|
const Well::InjectionControls& inj_controls,
|
||||||
|
const Well::ProductionControls& prod_controls,
|
||||||
|
WellState& well_state,
|
||||||
|
Opm::DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
/// \brief Wether the Jacobian will also have well contributions in it.
|
/// \brief Wether the Jacobian will also have well contributions in it.
|
||||||
virtual bool jacobianContainsWellContributions() const override
|
virtual bool jacobianContainsWellContributions() const override
|
||||||
{
|
{
|
||||||
|
@ -523,7 +523,8 @@ namespace Opm
|
|||||||
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
||||||
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
||||||
if (use_inner_iterations) {
|
if (use_inner_iterations) {
|
||||||
Base::solveWellEqUntilConverged(ebosSimulator, B_avg, well_state, deferred_logger);
|
this->iterateWellEqWithControl(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state,
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
assembleWellEqWithoutIteration(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
assembleWellEqWithoutIteration(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
||||||
}
|
}
|
||||||
@ -2483,7 +2484,12 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
well_state_copy.bhp()[index_of_well_] = bhp;
|
well_state_copy.bhp()[index_of_well_] = bhp;
|
||||||
|
|
||||||
bool converged = this->solveWellEqUntilConverged(ebosSimulator, B_avg, well_state_copy, deferred_logger);
|
const double dt = ebosSimulator.timeStepSize();
|
||||||
|
const auto& summary_state = ebosSimulator.vanguard().summaryState();
|
||||||
|
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
||||||
|
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
||||||
|
bool converged = this->iterateWellEqWithControl(ebosSimulator, B_avg, dt, inj_controls, prod_controls,
|
||||||
|
well_state_copy, deferred_logger);
|
||||||
|
|
||||||
if (!converged) {
|
if (!converged) {
|
||||||
const std::string msg = " well " + name() + " did not get converged during well potential calculations "
|
const std::string msg = " well " + name() + " did not get converged during well potential calculations "
|
||||||
@ -3034,7 +3040,12 @@ namespace Opm
|
|||||||
|
|
||||||
calculateExplicitQuantities(ebos_simulator, well_state_copy, deferred_logger);
|
calculateExplicitQuantities(ebos_simulator, well_state_copy, deferred_logger);
|
||||||
|
|
||||||
const bool converged = this->solveWellEqUntilConverged(ebos_simulator, B_avg, well_state_copy, deferred_logger);
|
const double dt = ebos_simulator.timeStepSize();
|
||||||
|
const auto& summary_state = ebos_simulator.vanguard().summaryState();
|
||||||
|
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
||||||
|
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
||||||
|
const bool converged = this->iterateWellEqWithControl(ebos_simulator, B_avg, dt, inj_controls, prod_controls,
|
||||||
|
well_state_copy, deferred_logger);
|
||||||
|
|
||||||
if (!converged) {
|
if (!converged) {
|
||||||
const std::string msg = " well " + name() + " did not get converged during well testing for physical reason";
|
const std::string msg = " well " + name() + " did not get converged during well testing for physical reason";
|
||||||
@ -3801,4 +3812,47 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
bool
|
||||||
|
StandardWell<TypeTag>::
|
||||||
|
iterateWellEqWithControl(const Simulator& ebosSimulator,
|
||||||
|
const std::vector<double>& B_avg,
|
||||||
|
const double dt,
|
||||||
|
const Well::InjectionControls& inj_controls,
|
||||||
|
const Well::ProductionControls& prod_controls,
|
||||||
|
WellState& well_state,
|
||||||
|
Opm::DeferredLogger& deferred_logger)
|
||||||
|
{
|
||||||
|
const int max_iter = param_.max_welleq_iter_;
|
||||||
|
int it = 0;
|
||||||
|
// const double dt = ebosSimulator.timeStepSize();
|
||||||
|
// const auto& summary_state = ebosSimulator.vanguard().summaryState();
|
||||||
|
// const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
||||||
|
// const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
||||||
|
bool converged;
|
||||||
|
do {
|
||||||
|
assembleWellEqWithoutIteration(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
||||||
|
|
||||||
|
auto report = getWellConvergence(well_state, B_avg, deferred_logger);
|
||||||
|
|
||||||
|
converged = report.converged();
|
||||||
|
if (converged) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
|
solveEqAndUpdateWellState(well_state, deferred_logger);
|
||||||
|
|
||||||
|
// We don't allow for switching well controls while computing well potentials and testing wells
|
||||||
|
// updateWellControl(ebosSimulator, well_state, deferred_logger);
|
||||||
|
initPrimaryVariablesEvaluation();
|
||||||
|
} while (it < max_iter);
|
||||||
|
|
||||||
|
return converged;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -458,8 +458,16 @@ namespace Opm
|
|||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
Opm::DeferredLogger& deferred_logger
|
Opm::DeferredLogger& deferred_logger) = 0;
|
||||||
) = 0;
|
|
||||||
|
// iterate well equations with the specified control until converged
|
||||||
|
virtual bool iterateWellEqWithControl(const Simulator& ebosSimulator,
|
||||||
|
const std::vector<double>& B_avg,
|
||||||
|
const double dt,
|
||||||
|
const Well::InjectionControls& inj_controls,
|
||||||
|
const Well::ProductionControls& prod_controls,
|
||||||
|
WellState& well_state,
|
||||||
|
Opm::DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
void updateWellTestStateEconomic(const WellState& well_state,
|
void updateWellTestStateEconomic(const WellState& well_state,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
@ -477,11 +485,6 @@ namespace Opm
|
|||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
Opm::DeferredLogger& deferred_logger);
|
Opm::DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool solveWellEqUntilConverged(const Simulator& ebosSimulator,
|
|
||||||
const std::vector<double>& B_avg,
|
|
||||||
WellState& well_state,
|
|
||||||
Opm::DeferredLogger& deferred_logger);
|
|
||||||
|
|
||||||
void scaleProductivityIndex(const int perfIdx, double& productivity_index, const bool new_well, Opm::DeferredLogger& deferred_logger);
|
void scaleProductivityIndex(const int perfIdx, double& productivity_index, const bool new_well, Opm::DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void initCompletions();
|
void initCompletions();
|
||||||
|
@ -1281,46 +1281,6 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
bool
|
|
||||||
WellInterface<TypeTag>::
|
|
||||||
solveWellEqUntilConverged(const Simulator& ebosSimulator,
|
|
||||||
const std::vector<double>& B_avg,
|
|
||||||
WellState& well_state,
|
|
||||||
Opm::DeferredLogger& deferred_logger)
|
|
||||||
{
|
|
||||||
const int max_iter = param_.max_welleq_iter_;
|
|
||||||
int it = 0;
|
|
||||||
const double dt = ebosSimulator.timeStepSize();
|
|
||||||
const auto& summary_state = ebosSimulator.vanguard().summaryState();
|
|
||||||
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
|
||||||
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
|
||||||
bool converged;
|
|
||||||
do {
|
|
||||||
assembleWellEqWithoutIteration(ebosSimulator, B_avg, dt, inj_controls, prod_controls, well_state, deferred_logger);
|
|
||||||
|
|
||||||
auto report = getWellConvergence(well_state, B_avg, deferred_logger);
|
|
||||||
|
|
||||||
converged = report.converged();
|
|
||||||
if (converged) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
++it;
|
|
||||||
solveEqAndUpdateWellState(well_state, deferred_logger);
|
|
||||||
|
|
||||||
// We don't allow for switching well controls while computing well potentials and testing wells
|
|
||||||
// updateWellControl(ebosSimulator, well_state, deferred_logger);
|
|
||||||
initPrimaryVariablesEvaluation();
|
|
||||||
} while (it < max_iter);
|
|
||||||
|
|
||||||
return converged;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
WellInterface<TypeTag>::calculateReservoirRates(WellState& well_state) const
|
WellInterface<TypeTag>::calculateReservoirRates(WellState& well_state) const
|
||||||
@ -1367,7 +1327,12 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
// keep a copy of the original well state
|
// keep a copy of the original well state
|
||||||
const WellState well_state0 = well_state;
|
const WellState well_state0 = well_state;
|
||||||
const bool converged = solveWellEqUntilConverged(ebosSimulator, B_avg, well_state, deferred_logger);
|
const double dt = ebosSimulator.timeStepSize();
|
||||||
|
const auto& summary_state = ebosSimulator.vanguard().summaryState();
|
||||||
|
const auto inj_controls = well_ecl_.isInjector() ? well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0);
|
||||||
|
const auto prod_controls = well_ecl_.isProducer() ? well_ecl_.productionControls(summary_state) : Well::ProductionControls(0);
|
||||||
|
const bool converged = iterateWellEqWithControl(ebosSimulator, B_avg, dt, inj_controls, prod_controls,
|
||||||
|
well_state, deferred_logger);
|
||||||
if (converged) {
|
if (converged) {
|
||||||
deferred_logger.debug("WellTest: Well equation for well " + name() + " converged");
|
deferred_logger.debug("WellTest: Well equation for well " + name() + " converged");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user