mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-21 16:57:25 -06:00
WellState: template Scalar type
This commit is contained in:
parent
58f334b264
commit
be57843296
@ -62,7 +62,7 @@ struct Setup
|
||||
|
||||
const int step = 0;
|
||||
const auto& sched_state = schedule->operator[](step);
|
||||
WellState well_state(phaseUsage(runspec.phases()));
|
||||
WellState<double> well_state(phaseUsage(runspec.phases()));
|
||||
vfp_properties = std::make_unique<VFPProperties>(sched_state.vfpinj(), sched_state.vfpprod(), well_state);
|
||||
};
|
||||
};
|
||||
|
@ -80,8 +80,6 @@ struct NewtonRelaxationType<TypeTag, TTag::FlowNonLinearSolver> {
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class WellState;
|
||||
|
||||
// Available relaxation scheme types.
|
||||
enum class NonlinearRelaxType {
|
||||
Dampen,
|
||||
@ -167,9 +165,6 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
|
||||
|
||||
};
|
||||
|
||||
// Forwarding types from PhysicalModel.
|
||||
//typedef typename PhysicalModel::WellState WellState;
|
||||
|
||||
// --------- Public methods ---------
|
||||
|
||||
/// Construct solver for a given model.
|
||||
@ -180,7 +175,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
|
||||
/// \param[in] param parameters controlling nonlinear process
|
||||
/// \param[in, out] model physical simulation model.
|
||||
NonlinearSolver(const SolverParameters& param,
|
||||
std::unique_ptr<PhysicalModel> model)
|
||||
std::unique_ptr<PhysicalModel> model)
|
||||
: param_(param)
|
||||
, model_(std::move(model))
|
||||
, linearizations_(0)
|
||||
|
@ -489,7 +489,7 @@ namespace Opm {
|
||||
void updateAverageFormationFactor();
|
||||
|
||||
void computePotentials(const std::size_t widx,
|
||||
const WellState& well_state_copy,
|
||||
const WellState<Scalar>& well_state_copy,
|
||||
std::string& exc_msg,
|
||||
ExceptionType::ExcEnum& exc_type,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
@ -405,7 +405,7 @@ actionOnBrokenConstraints(const Group& group,
|
||||
const int reportStepIdx,
|
||||
const Group::GroupLimitAction group_limit_action,
|
||||
const Group::ProductionCMode& newControl,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
std::optional<std::string>& worst_offending_well,
|
||||
GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -500,7 +500,7 @@ updateGroupIndividualControl(const Group& group,
|
||||
std::map<std::string, std::string>& switched_prod,
|
||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||
GroupState& group_state,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
bool changed = false;
|
||||
|
@ -33,7 +33,7 @@ class BlackoilWellModelGeneric;
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
class SummaryState;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
/// Class for handling constraints for the blackoil well model.
|
||||
class BlackoilWellModelConstraints
|
||||
@ -64,7 +64,7 @@ public:
|
||||
const int reportStepIdx,
|
||||
const Group::GroupLimitAction group_limit_action,
|
||||
const Group::ProductionCMode& newControl,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
std::optional<std::string>& worst_offending_well,
|
||||
GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
@ -76,7 +76,7 @@ public:
|
||||
std::map<std::string, std::string>& switched_prod,
|
||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||
GroupState& group_state,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
private:
|
||||
|
@ -426,7 +426,7 @@ checkGEconLimits(
|
||||
void
|
||||
BlackoilWellModelGeneric::
|
||||
checkGconsaleLimits(const Group& group,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const int reportStepIdx,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -793,7 +793,7 @@ void
|
||||
BlackoilWellModelGeneric::
|
||||
updateWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState)
|
||||
const WellState<double>& wellState)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule_.getGroup(groupName, reportStepIdx);
|
||||
|
@ -66,7 +66,7 @@ namespace Opm {
|
||||
class SummaryConfig;
|
||||
class VFPProperties;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
} // namespace Opm
|
||||
|
||||
namespace Opm { namespace data {
|
||||
@ -121,7 +121,7 @@ public:
|
||||
/*
|
||||
Immutable version of the currently active wellstate.
|
||||
*/
|
||||
const WellState& wellState() const
|
||||
const WellState<double>& wellState() const
|
||||
{
|
||||
return this->active_wgstate_.well_state;
|
||||
}
|
||||
@ -129,7 +129,7 @@ public:
|
||||
/*
|
||||
Mutable version of the currently active wellstate.
|
||||
*/
|
||||
WellState& wellState()
|
||||
WellState<double>& wellState()
|
||||
{
|
||||
return this->active_wgstate_.well_state;
|
||||
}
|
||||
@ -138,7 +138,7 @@ public:
|
||||
Will return the currently active nupcolWellState; must initialize
|
||||
the internal nupcol wellstate with initNupcolWellState() first.
|
||||
*/
|
||||
const WellState& nupcolWellState() const
|
||||
const WellState<double>& nupcolWellState() const
|
||||
{
|
||||
return this->nupcol_wgstate_.well_state;
|
||||
}
|
||||
@ -283,7 +283,7 @@ protected:
|
||||
prevWellState() must have been stored with the commitWellState()
|
||||
function first.
|
||||
*/
|
||||
const WellState& prevWellState() const
|
||||
const WellState<double>& prevWellState() const
|
||||
{
|
||||
return this->last_valid_wgstate_.well_state;
|
||||
}
|
||||
@ -339,7 +339,7 @@ protected:
|
||||
|
||||
void updateWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState);
|
||||
const WellState<double>& wellState);
|
||||
void setWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
double wsolvent);
|
||||
@ -362,7 +362,7 @@ protected:
|
||||
void calculateEfficiencyFactors(const int reportStepIdx);
|
||||
|
||||
void checkGconsaleLimits(const Group& group,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const int reportStepIdx,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
@ -395,7 +395,7 @@ protected:
|
||||
const int episodeIndex);
|
||||
|
||||
virtual void computePotentials(const std::size_t widx,
|
||||
const WellState& well_state_copy,
|
||||
const WellState<double>& well_state_copy,
|
||||
std::string& exc_msg,
|
||||
ExceptionType::ExcEnum& exc_type,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
@ -223,7 +223,7 @@ void BlackoilWellModelRestart::
|
||||
loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
GroupState& grpState) const
|
||||
{
|
||||
using rt = data::Rates::opt;
|
||||
|
@ -41,7 +41,7 @@ class GuideRateConfig;
|
||||
struct PerforationData;
|
||||
struct PhaseUsage;
|
||||
template<class Scalar> class SingleWellState;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
/// Class for restarting the blackoil well model.
|
||||
class BlackoilWellModelRestart
|
||||
@ -68,7 +68,7 @@ public:
|
||||
void loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
GroupState& grpState) const;
|
||||
|
||||
private:
|
||||
|
@ -2206,7 +2206,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::computePotentials(const std::size_t widx,
|
||||
const WellState& well_state_copy,
|
||||
const WellState<Scalar>& well_state_copy,
|
||||
std::string& exc_msg,
|
||||
ExceptionType::ExcEnum& exc_type,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -2311,14 +2311,14 @@ namespace Opm {
|
||||
|
||||
for (const auto& well : well_container_) {
|
||||
auto& events = this->wellState().well(well->indexOfWell()).events;
|
||||
if (events.hasEvent(WellState::event_mask)) {
|
||||
if (events.hasEvent(WellState<Scalar>::event_mask)) {
|
||||
well->updateWellStateWithTarget(simulator_, this->groupState(), this->wellState(), deferred_logger);
|
||||
const auto& summary_state = simulator_.vanguard().summaryState();
|
||||
well->updatePrimaryVariables(summary_state, this->wellState(), deferred_logger);
|
||||
well->initPrimaryVariablesEvaluation();
|
||||
// There is no new well control change input within a report step,
|
||||
// so next time step, the well does not consider to have effective events anymore.
|
||||
events.clearEvent(WellState::event_mask);
|
||||
events.clearEvent(WellState<Scalar>::event_mask);
|
||||
}
|
||||
// these events only work for the first time step within the report step
|
||||
if (events.hasEvent(ScheduleEvents::REQUEST_OPEN_WELL)) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace Opm::WellGroupHelpers {
|
||||
|
||||
FractionCalculator::FractionCalculator(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const int report_step,
|
||||
const GuideRate* guide_rate,
|
||||
|
@ -29,7 +29,7 @@ namespace Opm {
|
||||
class GroupState;
|
||||
struct PhaseUsage;
|
||||
class Schedule;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
}
|
||||
|
||||
namespace Opm::WellGroupHelpers {
|
||||
@ -38,7 +38,7 @@ class FractionCalculator
|
||||
{
|
||||
public:
|
||||
FractionCalculator(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const int report_step,
|
||||
const GuideRate* guide_rate,
|
||||
@ -62,7 +62,7 @@ private:
|
||||
const std::string& always_included_child);
|
||||
GuideRate::RateVector getGroupRateVector(const std::string& group_name);
|
||||
const Schedule& schedule_;
|
||||
const WellState& well_state_;
|
||||
const WellState<double>& well_state_;
|
||||
const GroupState& group_state_;
|
||||
int report_step_;
|
||||
const GuideRate* guide_rate_;
|
||||
|
@ -30,7 +30,7 @@ namespace Opm {
|
||||
|
||||
GasLiftCommon::
|
||||
GasLiftCommon(
|
||||
WellState &well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState &group_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
const Parallel::Communication& comm,
|
||||
|
@ -29,7 +29,7 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class GasLiftCommon
|
||||
{
|
||||
@ -38,7 +38,7 @@ public:
|
||||
|
||||
protected:
|
||||
GasLiftCommon(
|
||||
WellState &well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState &group_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
const Parallel::Communication& comm,
|
||||
@ -54,7 +54,7 @@ protected:
|
||||
const std::string& msg,
|
||||
MessageType msg_type = MessageType::INFO) const;
|
||||
|
||||
WellState &well_state_;
|
||||
WellState<double>& well_state_;
|
||||
const GroupState& group_state_;
|
||||
DeferredLogger &deferred_logger_;
|
||||
const Parallel::Communication& comm_;
|
||||
|
@ -41,7 +41,7 @@ GasLiftGroupInfo(
|
||||
const int iteration_idx,
|
||||
const PhaseUsage &phase_usage,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState &group_state,
|
||||
const Communication &comm,
|
||||
bool glift_debug
|
||||
|
@ -39,7 +39,7 @@ class GroupState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class Well;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class GasLiftGroupInfo : public GasLiftCommon
|
||||
{
|
||||
@ -74,7 +74,7 @@ public:
|
||||
const int iteration_idx,
|
||||
const PhaseUsage& phase_usage,
|
||||
DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
bool glift_debug
|
||||
|
@ -36,6 +36,7 @@ namespace Opm
|
||||
template<class TypeTag>
|
||||
class GasLiftSingleWell : public GasLiftSingleWellGeneric
|
||||
{
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups;
|
||||
|
||||
@ -45,7 +46,7 @@ namespace Opm
|
||||
const Simulator& simulator,
|
||||
const SummaryState &summary_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
GasLiftGroupInfo &group_info,
|
||||
GLiftSyncGroups &sync_groups,
|
||||
|
@ -38,7 +38,7 @@ namespace Opm
|
||||
{
|
||||
|
||||
GasLiftSingleWellGeneric::GasLiftSingleWellGeneric(DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Well& ecl_well,
|
||||
const SummaryState& summary_state,
|
||||
|
@ -42,7 +42,7 @@ class GasLiftWellState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
class GroupState;
|
||||
|
||||
class GasLiftSingleWellGeneric : public GasLiftCommon
|
||||
@ -104,7 +104,7 @@ public:
|
||||
protected:
|
||||
GasLiftSingleWellGeneric(
|
||||
DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Well& ecl_well,
|
||||
const SummaryState& summary_state,
|
||||
|
@ -28,7 +28,7 @@ GasLiftSingleWell(const WellInterface<TypeTag> &well,
|
||||
const Simulator& simulator,
|
||||
const SummaryState &summary_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState &group_state,
|
||||
GasLiftGroupInfo &group_info,
|
||||
GLiftSyncGroups &sync_groups,
|
||||
|
@ -45,7 +45,7 @@ GasLiftStage2::GasLiftStage2(
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState &group_state,
|
||||
GLiftProdWells &prod_wells,
|
||||
GLiftOptWells &glift_wells,
|
||||
|
@ -40,7 +40,7 @@ class Group;
|
||||
class GroupState;
|
||||
class Schedule;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class GasLiftStage2 : public GasLiftCommon {
|
||||
using GasLiftSingleWell = GasLiftSingleWellGeneric;
|
||||
@ -62,7 +62,7 @@ public:
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
GLiftProdWells& prod_wells,
|
||||
GLiftOptWells& glift_wells,
|
||||
|
@ -34,7 +34,7 @@ namespace Opm
|
||||
class BlackoilWellModelGeneric;
|
||||
class DeferredLogger;
|
||||
class Group;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
class WellTestState;
|
||||
|
||||
class GroupEconomicLimitsChecker
|
||||
@ -74,7 +74,7 @@ class WellTestState;
|
||||
DeferredLogger &deferred_logger_;
|
||||
const std::string date_string_;
|
||||
const UnitSystem& unit_system_;
|
||||
const WellState &well_state_;
|
||||
const WellState<double>& well_state_;
|
||||
WellTestState &well_test_state_;
|
||||
const Schedule &schedule_;
|
||||
GroupEconProductionLimits::GEconGroupProp gecon_props_;
|
||||
|
@ -90,12 +90,12 @@ namespace Opm
|
||||
/// updating the well state based the current control mode
|
||||
virtual void updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const override;
|
||||
@ -109,35 +109,35 @@ namespace Opm
|
||||
/// xw to update Well State
|
||||
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
/// computing the well potentials for group control
|
||||
virtual void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
void updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override; // const?
|
||||
void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override; // const?
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
|
||||
void updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
double connectionDensity(const int globalConnIdx,
|
||||
const int openConnIdx) const override;
|
||||
@ -148,7 +148,7 @@ namespace Opm
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const override;
|
||||
const WellState<Scalar>& well_state) const override;
|
||||
|
||||
std::vector<double> computeCurrentWellRates(const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
@ -176,7 +176,7 @@ namespace Opm
|
||||
// updating the well_state based on well solution dwells
|
||||
void updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double relaxation_factor = 1.0);
|
||||
|
||||
@ -243,10 +243,10 @@ namespace Opm
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
std::vector<double> computeWellPotentialWithTHP(
|
||||
const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::vector<double>
|
||||
computeWellPotentialWithTHP(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
||||
std::vector<double>& well_potentials,
|
||||
@ -258,7 +258,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
@ -266,7 +266,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control = false,
|
||||
@ -276,11 +276,11 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;
|
||||
virtual void updateWaterThroughput(const double dt, WellState<Scalar>& well_state) const override;
|
||||
|
||||
EvalWell getSegmentSurfaceVolume(const Simulator& simulator, const int seg_idx) const;
|
||||
|
||||
@ -297,30 +297,31 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitProd(
|
||||
const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double maxPerfPress(const Simulator& simulator) const;
|
||||
|
||||
// check whether the well is operable under BHP limit with current reservoir condition
|
||||
void checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
void checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& ebos_simulator,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// check whether the well is operable under THP limit with current reservoir condition
|
||||
void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
void checkOperabilityUnderTHPLimit(const Simulator& ebos_simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// updating the inflow based on the current reservoir condition
|
||||
void updateIPR(const Simulator& simulator,
|
||||
void updateIPR(const Simulator& ebos_simulator,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void MultisegmentWellAssemble<FluidSystem,Indices>::
|
||||
assembleControlEq(const WellState& well_state,
|
||||
assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -36,7 +36,7 @@ template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariable
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class handling assemble of the equation system for MultisegmentWell.
|
||||
template<class FluidSystem, class Indices>
|
||||
@ -70,7 +70,7 @@ public:
|
||||
{}
|
||||
|
||||
//! \brief Assemble control equation.
|
||||
void assembleControlEq(const WellState& well_state,
|
||||
void assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -313,7 +313,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
|
||||
const bool /*use_well_weights*/,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int seg_pressure_var_ind,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
// Add the pressure contribution to the cpr system for the well
|
||||
|
||||
@ -397,7 +397,7 @@ template void MultisegmentWellEquations<double,numWellEq,numEq>:: \
|
||||
const bool, \
|
||||
const WellInterfaceGeneric&, \
|
||||
const int, \
|
||||
const WellState&) const;
|
||||
const WellState<double>&) const;
|
||||
|
||||
INSTANCE(2,1)
|
||||
INSTANCE(2,2)
|
||||
|
@ -42,7 +42,7 @@ template<class Scalar> class MultisegmentWellGeneric;
|
||||
class WellContributions;
|
||||
#endif
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class Scalar, int numWellEq, int numEq>
|
||||
class MultisegmentWellEquations
|
||||
@ -120,7 +120,7 @@ public:
|
||||
const bool /*use_well_weights*/,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int seg_pressure_var_ind,
|
||||
const WellState& well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
//! \brief Returns a const reference to the residual.
|
||||
const BVectorWell& residual() const
|
||||
|
@ -78,7 +78,7 @@ initMatrixAndVectors(const int num_cells)
|
||||
template<typename FluidSystem, typename Indices>
|
||||
ConvergenceReport
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
getWellConvergence(const WellState& well_state,
|
||||
getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double max_residual_allowed,
|
||||
@ -199,7 +199,7 @@ template<typename FluidSystem, typename Indices>
|
||||
void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleAccelerationPressureLoss(const int seg,
|
||||
WellState& well_state)
|
||||
WellState<Scalar>& well_state)
|
||||
{
|
||||
// Computes and assembles p-drop due to acceleration
|
||||
assert(seg != 0); // top segment can not enter here
|
||||
@ -246,7 +246,7 @@ template<typename FluidSystem, typename Indices>
|
||||
void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleDefaultPressureEq(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density)
|
||||
{
|
||||
assert(seg != 0); // not top segment
|
||||
@ -293,7 +293,7 @@ void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleICDPressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -377,7 +377,7 @@ template<typename FluidSystem, typename Indices>
|
||||
void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleAccelerationAndHydroPressureLosses(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density)
|
||||
{
|
||||
if (this->accelerationalPressureLossConsidered()) {
|
||||
@ -409,7 +409,7 @@ void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assemblePressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -473,7 +473,7 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||
template<typename FluidSystem, typename Indices>
|
||||
double
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
getControlTolerance(const WellState& well_state,
|
||||
getControlTolerance(const WellState<Scalar>& well_state,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -540,7 +540,7 @@ getControlTolerance(const WellState& well_state,
|
||||
template<typename FluidSystem, typename Indices>
|
||||
double
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
getResidualMeasureValue(const WellState& well_state,
|
||||
getResidualMeasureValue(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& residuals,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
|
@ -44,7 +44,7 @@ class WellContributions;
|
||||
class SummaryState;
|
||||
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<typename FluidSystem, typename Indices>
|
||||
class MultisegmentWellEval : public MultisegmentWellGeneric<typename FluidSystem::Scalar>
|
||||
@ -79,31 +79,31 @@ protected:
|
||||
void initMatrixAndVectors(const int num_cells);
|
||||
|
||||
void assembleDefaultPressureEq(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density);
|
||||
|
||||
// assemble pressure equation for ICD segments
|
||||
void assembleICDPressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void assembleAccelerationAndHydroPressureLosses(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density);
|
||||
|
||||
|
||||
void assemblePressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
ConvergenceReport getWellConvergence(const WellState& well_state,
|
||||
ConvergenceReport getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double max_residual_allowed,
|
||||
@ -118,19 +118,19 @@ protected:
|
||||
getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double getControlTolerance(const WellState& well_state,
|
||||
double getControlTolerance(const WellState<Scalar>& well_state,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double getResidualMeasureValue(const WellState& well_state,
|
||||
double getResidualMeasureValue(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& residuals,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void assembleAccelerationPressureLoss(const int seg,
|
||||
WellState& well_state);
|
||||
WellState<Scalar>& well_state);
|
||||
|
||||
EvalWell pressureDropAutoICD(const int seg,
|
||||
const UnitSystem& unit_system) const;
|
||||
|
@ -55,7 +55,7 @@ void
|
||||
MultisegmentWellGeneric<Scalar>::
|
||||
scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
WellState& well_state) const
|
||||
WellState<Scalar>& well_state) const
|
||||
{
|
||||
auto& ws = well_state.well(baseif_.indexOfWell());
|
||||
auto& segments = ws.segments;
|
||||
@ -84,10 +84,10 @@ scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inle
|
||||
}
|
||||
|
||||
std::vector<double> rates;
|
||||
WellState::calculateSegmentRates(segment_inlets,
|
||||
segment_perforations,
|
||||
perforation_rates,
|
||||
num_single_phase, 0, rates);
|
||||
WellState<Scalar>::calculateSegmentRates(segment_inlets,
|
||||
segment_perforations,
|
||||
perforation_rates,
|
||||
num_single_phase, 0, rates);
|
||||
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
||||
segment_rates[baseif_.numPhases() * seg + phase] = rates[seg];
|
||||
}
|
||||
@ -98,7 +98,7 @@ scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inle
|
||||
template <typename Scalar>
|
||||
void
|
||||
MultisegmentWellGeneric<Scalar>::
|
||||
scaleSegmentPressuresWithBhp(WellState& well_state) const
|
||||
scaleSegmentPressuresWithBhp(WellState<Scalar>& well_state) const
|
||||
{
|
||||
auto& ws = well_state.well(baseif_.indexOfWell());
|
||||
auto& segments = ws.segments;
|
||||
|
@ -35,7 +35,7 @@ class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
enum class WellSegmentCompPressureDrop;
|
||||
class WellSegments;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template <typename Scalar>
|
||||
class MultisegmentWellGeneric
|
||||
@ -57,8 +57,8 @@ protected:
|
||||
// scale the segment rates and pressure based on well rates and bhp
|
||||
void scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
WellState& well_state) const;
|
||||
void scaleSegmentPressuresWithBhp(WellState& well_state) const;
|
||||
WellState<Scalar>& well_state) const;
|
||||
void scaleSegmentPressuresWithBhp(WellState<Scalar>& well_state) const;
|
||||
|
||||
// components of the pressure drop to be included
|
||||
WellSegmentCompPressureDrop compPressureDrop() const;
|
||||
|
@ -67,7 +67,8 @@ init()
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
|
||||
update(const WellState& well_state, const bool stop_or_zero_rate_target)
|
||||
update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target)
|
||||
{
|
||||
static constexpr int Water = BlackoilPhases::Aqua;
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
@ -214,7 +215,7 @@ void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
|
||||
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ namespace Opm
|
||||
class DeferredLogger;
|
||||
template<class Scalar> class MultisegmentWellGeneric;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
class MultisegmentWellPrimaryVariables
|
||||
@ -92,7 +92,8 @@ public:
|
||||
void init();
|
||||
|
||||
//! \brief Copy values from well state.
|
||||
void update(const WellState& well_state, const bool stop_or_zero_rate_target);
|
||||
void update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target);
|
||||
|
||||
//! \brief Update values from newton update vector.
|
||||
void updateNewton(const BVectorWell& dwells,
|
||||
@ -105,7 +106,7 @@ public:
|
||||
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& /* deferred_logger */)
|
||||
{
|
||||
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||
@ -173,7 +173,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
Base::updateWellStateWithTarget(simulator, group_state, well_state, deferred_logger);
|
||||
@ -193,7 +193,7 @@ namespace Opm
|
||||
ConvergenceReport
|
||||
MultisegmentWell<TypeTag>::
|
||||
getWellConvergence(const SummaryState& /* summary_state */,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const
|
||||
@ -255,7 +255,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
|
||||
@ -275,7 +275,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -346,7 +346,7 @@ namespace Opm
|
||||
well_flux.resize(np, 0.0);
|
||||
const bool allow_cf = this->getAllowCrossFlow();
|
||||
const int nseg = this->numberOfSegments();
|
||||
const WellState& well_state = simulator.problem().wellModel().wellState();
|
||||
const WellState<Scalar>& well_state = simulator.problem().wellModel().wellState();
|
||||
const auto& ws = well_state.well(this->indexOfWell());
|
||||
auto segments_copy = ws.segments;
|
||||
segments_copy.scale_pressure(bhp);
|
||||
@ -391,7 +391,7 @@ namespace Opm
|
||||
well_copy.debug_cost_counter_ = 0;
|
||||
|
||||
// store a copy of the well state, we don't want to update the real well state
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||
|
||||
@ -452,10 +452,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::vector<double>
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeWellPotentialWithTHP(
|
||||
const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const
|
||||
computeWellPotentialWithTHP(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -513,7 +512,7 @@ namespace Opm
|
||||
well_copy.debug_cost_counter_ = 0;
|
||||
|
||||
// store a copy of the well state, we don't want to update the real well state
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||
|
||||
@ -572,7 +571,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -676,7 +675,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double relaxation_factor)
|
||||
{
|
||||
@ -710,7 +709,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -729,7 +728,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto fluidState = [&simulator, this](const int perf)
|
||||
@ -834,7 +833,7 @@ namespace Opm
|
||||
const BVector& weights,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
// Add the pressure contribution to the cpr system for the well
|
||||
this->linSys_.extractCPRPressureMatrix(jacobian,
|
||||
@ -1150,7 +1149,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
checkOperabilityUnderBHPLimit(const WellState& /*well_state*/, const Simulator& simulator, DeferredLogger& deferred_logger)
|
||||
checkOperabilityUnderBHPLimit(const WellState<Scalar>& /*well_state*/,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = simulator.vanguard().summaryState();
|
||||
const double bhp_limit = WellBhpThpCalculator(*this).mostStrictBhpFromBhpLimits(summaryState);
|
||||
@ -1308,7 +1309,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateIPRImplicit(const Simulator& simulator, WellState& well_state, DeferredLogger& deferred_logger)
|
||||
updateIPRImplicit(const Simulator& simulator,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Compute IPR based on *converged* well-equation:
|
||||
// For a component rate r the derivative dr/dbhp is obtained by
|
||||
@ -1375,10 +1378,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
checkOperabilityUnderTHPLimit(
|
||||
const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = simulator.vanguard().summaryState();
|
||||
const auto obtain_bhp = this->isProducer()
|
||||
@ -1432,7 +1434,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -1584,7 +1586,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control /*false*/,
|
||||
@ -1775,7 +1777,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -1978,7 +1980,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWaterThroughput(const double /*dt*/, WellState& /*well_state*/) const
|
||||
updateWaterThroughput(const double /*dt*/, WellState<Scalar>& /*well_state*/) const
|
||||
{
|
||||
}
|
||||
|
||||
@ -2016,7 +2018,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::optional<double>
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeBhpAtThpLimitProd(const WellState& well_state,
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
|
@ -143,7 +143,7 @@ namespace Opm
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const override;
|
||||
@ -157,49 +157,49 @@ namespace Opm
|
||||
/// xw to update Well State
|
||||
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
/// computing the well potentials for group control
|
||||
virtual void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) /* const */ override;
|
||||
void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) /* const */ override;
|
||||
|
||||
void updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
|
||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
virtual double connectionDensity(const int globalConnIdx,
|
||||
const int openConnIdx) const override;
|
||||
double connectionDensity(const int globalConnIdx,
|
||||
const int openConnIdx) const override;
|
||||
|
||||
virtual void addWellContributions(SparseMatrixAdapter& mat) const override;
|
||||
void addWellContributions(SparseMatrixAdapter& mat) const override;
|
||||
|
||||
virtual void addWellPressureEquations(PressureMatrix& mat,
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const override;
|
||||
void addWellPressureEquations(PressureMatrix& mat,
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState<Scalar>& well_state) const override;
|
||||
|
||||
// iterate well equations with the specified control until converged
|
||||
bool iterateWellEqWithControl(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
@ -208,14 +208,14 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control = false,
|
||||
const bool fixed_status = false) override;
|
||||
|
||||
/// \brief Wether the Jacobian will also have well contributions in it.
|
||||
virtual bool jacobianContainsWellContributions() const override
|
||||
bool jacobianContainsWellContributions() const override
|
||||
{
|
||||
return this->param_.matrix_add_well_contributions_;
|
||||
}
|
||||
@ -227,28 +227,26 @@ namespace Opm
|
||||
std::vector<double>& potentials,
|
||||
double alq) const;
|
||||
|
||||
void computeWellRatesWithThpAlqProd(
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
std::vector<double>& potentials,
|
||||
double alq) const;
|
||||
void computeWellRatesWithThpAlqProd(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
std::vector<double>& potentials,
|
||||
double alq) const;
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitProdWithAlq(
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
const double alq_value,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitProdWithAlq(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
const double alq_value,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
void updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void computeWellRatesWithBhp(
|
||||
const Simulator& simulator,
|
||||
const double& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
void computeWellRatesWithBhp(const Simulator& simulator,
|
||||
const double& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
// NOTE: These cannot be protected since they are used by GasLiftRuntime
|
||||
using Base::phaseUsage;
|
||||
@ -267,23 +265,23 @@ namespace Opm
|
||||
// updating the well_state based on well solution dwells
|
||||
void updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// calculate the properties for the well connections
|
||||
// to calulate the pressure difference between well connections.
|
||||
using WellConnectionProps = typename StdWellEval::StdWellConnections::Properties;
|
||||
void computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
WellConnectionProps& props) const;
|
||||
|
||||
void computeWellConnectionDensitesPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const WellConnectionProps& props,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void computeWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
template<class Value>
|
||||
@ -323,13 +321,13 @@ namespace Opm
|
||||
std::vector<double> computeWellPotentialWithTHP(
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger,
|
||||
const WellState &well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual double getRefDensity() const override;
|
||||
double getRefDensity() const override;
|
||||
|
||||
// get the mobility for specific perforation
|
||||
template<class Value>
|
||||
@ -348,29 +346,29 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
void assembleWellEqWithoutIterationImpl(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void calculateSinglePerf(const Simulator& simulator,
|
||||
const int perf,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
std::vector<EvalWell>& cq_s,
|
||||
EvalWell& water_flux_s,
|
||||
@ -378,13 +376,13 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
// check whether the well is operable under BHP limit with current reservoir condition
|
||||
void checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
void checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// check whether the well is operable under THP limit with current reservoir condition
|
||||
void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// updating the inflow based on the current reservoir condition
|
||||
@ -397,7 +395,7 @@ namespace Opm
|
||||
|
||||
// whether the well can produce / inject based on the current well state (bhp)
|
||||
bool canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// turn on crossflow to avoid singular well equations
|
||||
@ -433,12 +431,13 @@ namespace Opm
|
||||
|
||||
// handle the extra equations for polymer injectivity study
|
||||
void handleInjectivityEquations(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
const EvalWell& water_flux_s,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;
|
||||
void updateWaterThroughput(const double dt,
|
||||
WellState<Scalar>& well_state) const override;
|
||||
|
||||
// checking convergence of extra equations, if there are any
|
||||
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
||||
@ -447,20 +446,22 @@ namespace Opm
|
||||
// updating the connectionRates_ related polymer molecular weight
|
||||
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
||||
const IntensiveQuantities& int_quants,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitProd(const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
private:
|
||||
Eval connectionRateEnergy(const double maxOilSaturation,
|
||||
|
@ -84,7 +84,7 @@ private:
|
||||
template<class FluidSystem, class Indices>
|
||||
void
|
||||
StandardWellAssemble<FluidSystem,Indices>::
|
||||
assembleControlEq(const WellState& well_state,
|
||||
assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -35,7 +35,7 @@ template<class Scalar, int numEq> class StandardWellEquations;
|
||||
template<class FluidSystem, class Indices> class StandardWellPrimaryVariables;
|
||||
class SummaryState;
|
||||
template<class FluidSystem> class WellInterfaceFluidSystem;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class handling assemble of the equation system for StandardWell.
|
||||
template<class FluidSystem, class Indices>
|
||||
@ -52,7 +52,7 @@ public:
|
||||
{}
|
||||
|
||||
//! \brief Assemble control equation.
|
||||
void assembleControlEq(const WellState& well_state,
|
||||
void assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -287,7 +287,7 @@ computeDensities(const std::vector<Scalar>& perfComponentRates,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellConnections<FluidSystem,Indices>::
|
||||
computePropertiesForPressures(const WellState& well_state,
|
||||
computePropertiesForPressures(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& getTemperature,
|
||||
const std::function<Scalar(int)>& getSaltConcentration,
|
||||
const std::function<int(int)>& pvtRegionIdx,
|
||||
@ -421,7 +421,7 @@ computePropertiesForPressures(const WellState& well_state,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellConnections<FluidSystem,Indices>::
|
||||
computeProperties(const WellState& well_state,
|
||||
computeProperties(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& invB,
|
||||
const std::function<Scalar(int,int)>& mobility,
|
||||
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
||||
|
@ -35,7 +35,7 @@ namespace Opm
|
||||
class DeferredLogger;
|
||||
enum class Phase;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
class StandardWellConnections
|
||||
@ -54,7 +54,7 @@ public:
|
||||
std::vector<Scalar> surf_dens_perf;
|
||||
};
|
||||
|
||||
void computePropertiesForPressures(const WellState& well_state,
|
||||
void computePropertiesForPressures(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& getTemperature,
|
||||
const std::function<Scalar(int)>& getSaltConcentration,
|
||||
const std::function<int(int)>& pvtRegionIdx,
|
||||
@ -63,7 +63,7 @@ public:
|
||||
Properties& props) const;
|
||||
|
||||
//! \brief Compute connection properties (densities, pressure drop, ...)
|
||||
void computeProperties(const WellState& well_state,
|
||||
void computeProperties(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& invB,
|
||||
const std::function<Scalar(int,int)>& mobility,
|
||||
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
||||
|
@ -293,7 +293,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
|
||||
const bool use_well_weights,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int bhp_var_index,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
// This adds pressure quation for cpr
|
||||
// For use_well_weights=true
|
||||
@ -415,7 +415,7 @@ template void StandardWellEquations<double,N>:: \
|
||||
const bool, \
|
||||
const WellInterfaceGeneric&, \
|
||||
const int, \
|
||||
const WellState&) const;
|
||||
const WellState<double>&) const;
|
||||
|
||||
INSTANCE(1)
|
||||
INSTANCE(2)
|
||||
|
@ -40,7 +40,7 @@ template<class Scalar, int numEq> class StandardWellEquationAccess;
|
||||
class WellContributions;
|
||||
#endif
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class Scalar, int numEq>
|
||||
class StandardWellEquations
|
||||
@ -117,7 +117,7 @@ public:
|
||||
const bool use_well_weights,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int bhp_var_index,
|
||||
const WellState& well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
//! \brief Get the number of blocks of the C and B matrices.
|
||||
unsigned int getNumBlocks() const;
|
||||
|
@ -70,7 +70,7 @@ template<class FluidSystem, class Indices>
|
||||
void
|
||||
StandardWellEval<FluidSystem,Indices>::
|
||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
@ -99,7 +99,7 @@ computeAccumWell()
|
||||
template<class FluidSystem, class Indices>
|
||||
ConvergenceReport
|
||||
StandardWellEval<FluidSystem,Indices>::
|
||||
getWellConvergence(const WellState& well_state,
|
||||
getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
const double maxResidualAllowed,
|
||||
const double tol_wells,
|
||||
|
@ -41,7 +41,7 @@ class Schedule;
|
||||
class SummaryState;
|
||||
class WellContributions;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
class StandardWellEval
|
||||
@ -79,7 +79,7 @@ protected:
|
||||
// computing the accumulation term for later use in well mass equations
|
||||
void computeAccumWell();
|
||||
|
||||
ConvergenceReport getWellConvergence(const WellState& well_state,
|
||||
ConvergenceReport getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
const double maxResidualAllowed,
|
||||
const double tol_wells,
|
||||
@ -95,7 +95,7 @@ protected:
|
||||
const bool has_polymermw);
|
||||
|
||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
@ -119,7 +119,7 @@ resize(const int numWellEq)
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
update(const WellState& well_state,
|
||||
update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -227,7 +227,7 @@ update(const WellState& well_state,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
updatePolyMW(const WellState& well_state)
|
||||
updatePolyMW(const WellState<Scalar>& well_state)
|
||||
{
|
||||
if (well_.isInjector()) {
|
||||
const auto& ws = well_state.well(well_.indexOfWell());
|
||||
@ -324,7 +324,7 @@ updateNewtonPolyMW(const BVectorWell& dwells)
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
copyToWellState(WellState& well_state,
|
||||
copyToWellState(WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
static constexpr int Water = BlackoilPhases::Aqua;
|
||||
@ -429,7 +429,7 @@ copyToWellState(WellState& well_state,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
copyToWellStatePolyMW(WellState& well_state) const
|
||||
copyToWellStatePolyMW(WellState<Scalar>& well_state) const
|
||||
{
|
||||
if (well_.isInjector()) {
|
||||
auto& ws = well_state.well(well_.indexOfWell());
|
||||
|
@ -34,7 +34,7 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class holding primary variables for StandardWell.
|
||||
template<class FluidSystem, class Indices>
|
||||
@ -102,12 +102,12 @@ public:
|
||||
int numWellEq() const { return numWellEq_; }
|
||||
|
||||
//! \brief Copy values from well state.
|
||||
void update(const WellState& well_state,
|
||||
void update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
//! \brief Copy polymer molecular weigt values from well state.
|
||||
void updatePolyMW(const WellState& well_state);
|
||||
void updatePolyMW(const WellState<Scalar>& well_state);
|
||||
|
||||
//! \brief Update values from newton update vector.
|
||||
void updateNewton(const BVectorWell& dwells,
|
||||
@ -123,10 +123,11 @@ public:
|
||||
void checkFinite(DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Copy values to well state.
|
||||
void copyToWellState(WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
void copyToWellState(WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Copy polymer molecular weight values to well state.
|
||||
void copyToWellStatePolyMW(WellState& well_state) const;
|
||||
void copyToWellStatePolyMW(WellState<Scalar>& well_state) const;
|
||||
|
||||
//! \brief Returns scaled volume fraction for a component.
|
||||
EvalWell volumeFractionScaled(const int compIdx) const;
|
||||
|
@ -332,7 +332,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -358,7 +358,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -481,7 +481,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
calculateSinglePerf(const Simulator& simulator,
|
||||
const int perf,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
std::vector<EvalWell>& cq_s,
|
||||
EvalWell& water_flux_s,
|
||||
@ -687,7 +687,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -730,7 +730,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
@ -840,7 +840,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Compute IPR based on *converged* well-equation:
|
||||
@ -915,7 +915,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -985,7 +985,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = simulator.vanguard().summaryState();
|
||||
@ -1076,7 +1076,7 @@ namespace Opm
|
||||
bool
|
||||
StandardWell<TypeTag>::
|
||||
canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const double bhp = well_state.well(this->index_of_well_).bhp;
|
||||
@ -1123,7 +1123,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
WellConnectionProps& props) const
|
||||
{
|
||||
std::function<Scalar(int,int)> getTemperature =
|
||||
@ -1169,7 +1169,7 @@ namespace Opm
|
||||
ConvergenceReport
|
||||
StandardWell<TypeTag>::
|
||||
getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const
|
||||
@ -1214,7 +1214,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto fluidState = [&simulator, this](const int perf)
|
||||
@ -1289,7 +1289,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computeWellConnectionDensitesPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const WellConnectionProps& props,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -1331,7 +1331,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computeWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// 1. Compute properties required by computePressureDelta().
|
||||
@ -1351,7 +1351,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -1373,7 +1373,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -1422,7 +1422,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -1498,7 +1498,7 @@ namespace Opm
|
||||
// iterate to get a more accurate well density
|
||||
// create a copy of the well_state to use. If the operability checking is sucessful, we use this one
|
||||
// to replace the original one
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
|
||||
// Get the current controls.
|
||||
@ -1553,7 +1553,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
computeWellPotentialWithTHP(const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger,
|
||||
const WellState &well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -1595,7 +1595,7 @@ namespace Opm
|
||||
StandardWell<TypeTag> well_copy(*this);
|
||||
|
||||
// store a copy of the well state, we don't want to update the real well state
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||
|
||||
@ -1694,7 +1694,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) // const
|
||||
{
|
||||
@ -1766,7 +1766,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -1875,7 +1875,7 @@ namespace Opm
|
||||
const BVector& weights,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
this->linSys_.extractCPRPressureMatrix(jacobian,
|
||||
weights,
|
||||
@ -1997,7 +1997,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updateWaterThroughput(const double dt, WellState &well_state) const
|
||||
updateWaterThroughput(const double dt, WellState<Scalar>& well_state) const
|
||||
{
|
||||
if constexpr (Base::has_polymermw) {
|
||||
if (this->isInjector()) {
|
||||
@ -2045,7 +2045,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
handleInjectivityEquations(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
const EvalWell& water_flux_s,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -2113,7 +2113,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
||||
const IntensiveQuantities& int_quants,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -2154,7 +2154,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::optional<double>
|
||||
StandardWell<TypeTag>::
|
||||
computeBhpAtThpLimitProd(const WellState& well_state,
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -2282,7 +2282,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -2329,7 +2329,7 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control /*false*/,
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
|
||||
const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
|
||||
const WellState& well_state)
|
||||
const WellState<double>& well_state)
|
||||
:well_state_(well_state)
|
||||
{
|
||||
for (const auto& vfpinj : inj_tables)
|
||||
@ -95,7 +95,7 @@ public:
|
||||
private:
|
||||
VFPInjProperties m_inj;
|
||||
VFPProdProperties m_prod;
|
||||
const WellState& well_state_;
|
||||
const WellState<double>& well_state_;
|
||||
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ WGState::WGState(const PhaseUsage& pu) :
|
||||
WGState WGState::serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
{
|
||||
WGState result(PhaseUsage{});
|
||||
result.well_state = WellState::serializationTestObject(pinfo);
|
||||
result.well_state = WellState<double>::serializationTestObject(pinfo);
|
||||
result.group_state = GroupState::serializationTestObject();
|
||||
result.well_test_state = WellTestState::serializationTestObject();
|
||||
|
||||
|
@ -41,7 +41,7 @@ struct WGState {
|
||||
|
||||
void wtest_state(WellTestState wtest_state);
|
||||
|
||||
WellState well_state;
|
||||
WellState<double> well_state;
|
||||
GroupState group_state;
|
||||
WellTestState well_test_state;
|
||||
|
||||
|
@ -53,7 +53,7 @@ template<class FluidSystem>
|
||||
template<class EvalWell>
|
||||
void
|
||||
WellAssemble<FluidSystem>::
|
||||
assembleControlEqProd(const WellState& well_state,
|
||||
assembleControlEqProd(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -189,7 +189,7 @@ template<class FluidSystem>
|
||||
template<class EvalWell>
|
||||
void
|
||||
WellAssemble<FluidSystem>::
|
||||
assembleControlEqInj(const WellState& well_state,
|
||||
assembleControlEqInj(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -277,7 +277,7 @@ assembleControlEqInj(const WellState& well_state,
|
||||
|
||||
#define INSTANCE_METHODS(A,...) \
|
||||
template void WellAssemble<A>:: \
|
||||
assembleControlEqProd<__VA_ARGS__>(const WellState&, \
|
||||
assembleControlEqProd<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
|
||||
const GroupState&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
@ -288,7 +288,7 @@ assembleControlEqProd<__VA_ARGS__>(const WellState&, \
|
||||
__VA_ARGS__&, \
|
||||
DeferredLogger&) const; \
|
||||
template void WellAssemble<A>:: \
|
||||
assembleControlEqInj<__VA_ARGS__>(const WellState&, \
|
||||
assembleControlEqInj<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
|
||||
const GroupState&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
|
@ -40,7 +40,7 @@ class GroupState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
template<class FluidSystem> class WellInterfaceFluidSystem;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
struct WellInjectionControls;
|
||||
struct WellProductionControls;
|
||||
|
||||
@ -49,12 +49,13 @@ class WellAssemble {
|
||||
static constexpr int Water = BlackoilPhases::Aqua;
|
||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
using Scalar = typename FluidSystem::Scalar;
|
||||
|
||||
public:
|
||||
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well);
|
||||
|
||||
template<class EvalWell>
|
||||
void assembleControlEqProd(const WellState& well_state,
|
||||
void assembleControlEqProd(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -66,7 +67,7 @@ public:
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class EvalWell>
|
||||
void assembleControlEqInj(const WellState& well_state,
|
||||
void assembleControlEqInj(const WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -286,7 +286,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
const std::function<double()>& alq_value,
|
||||
const std::array<unsigned,3>& active,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
@ -327,7 +327,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
||||
|
||||
template<class EvalWell>
|
||||
EvalWell WellBhpThpCalculator::
|
||||
calculateBhpFromThp(const WellState& well_state,
|
||||
calculateBhpFromThp(const WellState<double>& well_state,
|
||||
const std::vector<EvalWell>& rates,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
@ -390,7 +390,7 @@ calculateBhpFromThp(const WellState& well_state,
|
||||
|
||||
double
|
||||
WellBhpThpCalculator::
|
||||
calculateMinimumBhpFromThp(const WellState& well_state,
|
||||
calculateMinimumBhpFromThp(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho) const
|
||||
@ -867,7 +867,7 @@ bruteForceBracket(const std::function<double(const double)>& eq,
|
||||
}
|
||||
|
||||
bool WellBhpThpCalculator::
|
||||
isStableSolution(const WellState& well_state,
|
||||
isStableSolution(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const SummaryState& summaryState) const
|
||||
@ -902,7 +902,7 @@ isStableSolution(const WellState& well_state,
|
||||
}
|
||||
|
||||
std::optional<double> WellBhpThpCalculator::
|
||||
estimateStableBhp(const WellState& well_state,
|
||||
estimateStableBhp(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const double rho,
|
||||
@ -945,7 +945,7 @@ estimateStableBhp(const WellState& well_state,
|
||||
}
|
||||
|
||||
std::pair<double, double> WellBhpThpCalculator::
|
||||
getFloIPR(const WellState& well_state,
|
||||
getFloIPR(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summary_state) const
|
||||
{
|
||||
@ -969,7 +969,7 @@ getFloIPR(const WellState& well_state,
|
||||
|
||||
#define INSTANCE(...) \
|
||||
template __VA_ARGS__ WellBhpThpCalculator:: \
|
||||
calculateBhpFromThp<__VA_ARGS__>(const WellState&, \
|
||||
calculateBhpFromThp<__VA_ARGS__>(const WellState<double>&, \
|
||||
const std::vector<__VA_ARGS__>&, \
|
||||
const Well&, \
|
||||
const SummaryState&, \
|
||||
|
@ -36,7 +36,7 @@ class DeferredLogger;
|
||||
class SummaryState;
|
||||
class Well;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for computing BHP limits.
|
||||
class WellBhpThpCalculator {
|
||||
@ -86,37 +86,37 @@ public:
|
||||
const bool stop_or_zero_rate_target,
|
||||
const std::function<double()>& alq_value,
|
||||
const std::array<unsigned,3>& active,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class EvalWell>
|
||||
EvalWell calculateBhpFromThp(const WellState& well_state,
|
||||
const std::vector<EvalWell>& rates,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
template<class EvalWell>
|
||||
EvalWell calculateBhpFromThp(const WellState<double>& well_state,
|
||||
const std::vector<EvalWell>& rates,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double calculateMinimumBhpFromThp(const WellState& well_state,
|
||||
double calculateMinimumBhpFromThp(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho) const;
|
||||
const double rho) const;
|
||||
|
||||
bool isStableSolution(const WellState& well_state,
|
||||
bool isStableSolution(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const SummaryState& summaryState) const;
|
||||
|
||||
std::optional<double>
|
||||
estimateStableBhp (const WellState& well_state,
|
||||
estimateStableBhp (const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const double rho,
|
||||
const SummaryState& summaryState) const;
|
||||
|
||||
std::pair<double, double>
|
||||
getFloIPR(const WellState& well_state,
|
||||
getFloIPR(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summary_state) const;
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace Opm
|
||||
{
|
||||
|
||||
void WellConvergence::
|
||||
checkConvergenceControlEq(const WellState& well_state,
|
||||
checkConvergenceControlEq(const WellState<double>& well_state,
|
||||
const Tolerances& tolerances,
|
||||
const double well_control_residual,
|
||||
const bool well_is_stopped,
|
||||
|
@ -31,7 +31,7 @@ namespace Opm
|
||||
class ConvergenceReport;
|
||||
class DeferredLogger;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class WellConvergence
|
||||
{
|
||||
@ -49,7 +49,7 @@ public:
|
||||
};
|
||||
|
||||
// checking the convergence of the well control equations
|
||||
void checkConvergenceControlEq(const WellState& well_state,
|
||||
void checkConvergenceControlEq(const WellState<double>& well_state,
|
||||
const Tolerances& tolerances,
|
||||
const double well_control_residual,
|
||||
const bool well_is_stopped,
|
||||
|
@ -39,7 +39,7 @@ updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
||||
const double dt,
|
||||
const double conc,
|
||||
const std::size_t water_index,
|
||||
WellState& well_state)
|
||||
WellState<double>& well_state)
|
||||
{
|
||||
if (!well.isInjector()) {
|
||||
return;
|
||||
@ -77,7 +77,7 @@ updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
||||
|
||||
void WellFilterCake::
|
||||
updateInjFCMult(const WellInterfaceGeneric& well,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (inj_fc_multiplier_.empty()) {
|
||||
|
@ -27,7 +27,7 @@ namespace Opm {
|
||||
|
||||
class DeferredLogger;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for well calculations related to filter cakes.
|
||||
class WellFilterCake {
|
||||
@ -38,11 +38,11 @@ public:
|
||||
const double dt,
|
||||
const double conc,
|
||||
const std::size_t water_index,
|
||||
WellState& well_state);
|
||||
WellState<double>& well_state);
|
||||
|
||||
//! \brief Update the multiplier for well transmissbility due to cake filtration.
|
||||
void updateInjFCMult(const WellInterfaceGeneric& well,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
//! \brief Returns a const-ref to multipliers.
|
||||
|
@ -36,7 +36,7 @@ namespace Opm
|
||||
std::pair<bool, double>
|
||||
WellGroupConstraints::
|
||||
checkGroupConstraintsInj(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
@ -94,7 +94,7 @@ checkGroupConstraintsInj(const Group& group,
|
||||
std::pair<bool, double>
|
||||
WellGroupConstraints::
|
||||
checkGroupConstraintsProd(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
@ -124,7 +124,7 @@ checkGroupConstraintsProd(const Group& group,
|
||||
}
|
||||
|
||||
bool WellGroupConstraints::
|
||||
checkGroupConstraints(WellState& well_state,
|
||||
checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -41,7 +41,7 @@ using RegionId = int;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for computing well group constraints.
|
||||
class WellGroupConstraints {
|
||||
@ -51,7 +51,7 @@ public:
|
||||
|
||||
using RateConvFunc = std::function<void(const RegionId, const int, const std::optional<std::string>&, std::vector<double>&)>;
|
||||
|
||||
bool checkGroupConstraints(WellState& well_state,
|
||||
bool checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -61,7 +61,7 @@ public:
|
||||
private:
|
||||
std::pair<bool, double>
|
||||
checkGroupConstraintsInj(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
@ -71,7 +71,7 @@ private:
|
||||
|
||||
std::pair<bool, double>
|
||||
checkGroupConstraintsProd(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
|
@ -47,7 +47,7 @@ namespace Opm
|
||||
template<class EvalWell>
|
||||
void WellGroupControls::
|
||||
getGroupInjectionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -187,7 +187,7 @@ getGroupInjectionControl(const Group& group,
|
||||
std::optional<double>
|
||||
WellGroupControls::
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -302,7 +302,7 @@ getGroupInjectionTargetRate(const Group& group,
|
||||
|
||||
template<class EvalWell>
|
||||
void WellGroupControls::getGroupProductionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -409,7 +409,7 @@ void WellGroupControls::getGroupProductionControl(const Group& group,
|
||||
|
||||
double WellGroupControls::
|
||||
getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -505,7 +505,7 @@ getGroupProductionTargetRate(const Group& group,
|
||||
#define INSTANCE(...) \
|
||||
template void WellGroupControls:: \
|
||||
getGroupInjectionControl<__VA_ARGS__>(const Group&, \
|
||||
const WellState&, \
|
||||
const WellState<double>&, \
|
||||
const GroupState&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
@ -518,7 +518,7 @@ getGroupInjectionControl<__VA_ARGS__>(const Group&, \
|
||||
DeferredLogger& deferred_logger) const; \
|
||||
template void WellGroupControls:: \
|
||||
getGroupProductionControl<__VA_ARGS__>(const Group&, \
|
||||
const WellState&, \
|
||||
const WellState<double>&, \
|
||||
const GroupState&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
|
@ -40,7 +40,7 @@ using RegionId = int;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for computing well group controls.
|
||||
class WellGroupControls {
|
||||
@ -52,7 +52,7 @@ public:
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupInjectionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -66,7 +66,7 @@ public:
|
||||
|
||||
std::optional<double>
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -77,7 +77,7 @@ public:
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupProductionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -89,7 +89,7 @@ public:
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -73,7 +73,7 @@ namespace {
|
||||
double sumWellPhaseRates(bool res_rates,
|
||||
const Opm::Group& group,
|
||||
const Opm::Schedule& schedule,
|
||||
const Opm::WellState& wellState,
|
||||
const Opm::WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector)
|
||||
@ -204,7 +204,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumWellSurfaceRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector)
|
||||
@ -214,7 +214,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumWellResRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector)
|
||||
@ -224,7 +224,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumSolventRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const bool injector)
|
||||
{
|
||||
@ -269,7 +269,7 @@ namespace WellGroupHelpers
|
||||
const SummaryState& summaryState,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
GuideRate* guideRate,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
@ -330,7 +330,7 @@ namespace WellGroupHelpers
|
||||
const bool isInjector,
|
||||
const PhaseUsage& pu,
|
||||
const GuideRate& guide_rate,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state,
|
||||
std::vector<double>& groupTargetReduction)
|
||||
{
|
||||
@ -468,7 +468,7 @@ namespace WellGroupHelpers
|
||||
const int reportStepIdx,
|
||||
bool isInjector,
|
||||
const GroupState& group_state,
|
||||
WellState& wellState) {
|
||||
WellState<double>& wellState) {
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
bool individual_control = false;
|
||||
if (isInjector) {
|
||||
@ -534,7 +534,7 @@ namespace WellGroupHelpers
|
||||
void updateVREPForGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
@ -558,7 +558,7 @@ namespace WellGroupHelpers
|
||||
void updateReservoirRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
@ -582,7 +582,7 @@ namespace WellGroupHelpers
|
||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
@ -606,8 +606,8 @@ namespace WellGroupHelpers
|
||||
void updateWellRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
WellState& wellState)
|
||||
const WellState<double>& wellStateNupcol,
|
||||
WellState<double>& wellState)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
@ -636,7 +636,7 @@ namespace WellGroupHelpers
|
||||
void updateGroupProductionRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
@ -657,7 +657,7 @@ namespace WellGroupHelpers
|
||||
const int reportStepIdx,
|
||||
const PhaseUsage& pu,
|
||||
const SummaryState& st,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state,
|
||||
bool sum_rank)
|
||||
{
|
||||
@ -693,7 +693,7 @@ namespace WellGroupHelpers
|
||||
const RegionalValues& regional_values,
|
||||
const int reportStepIdx,
|
||||
const double dt,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
GroupState& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
@ -779,7 +779,7 @@ namespace WellGroupHelpers
|
||||
|
||||
std::map<std::string, double>
|
||||
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const VFPProdProperties& vfp_prod_props,
|
||||
const Schedule& schedule,
|
||||
@ -917,7 +917,9 @@ namespace WellGroupHelpers
|
||||
|
||||
|
||||
GuideRate::RateVector
|
||||
getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name)
|
||||
getWellRateVector(const WellState<double>& well_state,
|
||||
const PhaseUsage& pu,
|
||||
const std::string& name)
|
||||
{
|
||||
return getGuideRateVector(well_state.currentWellRates(name), pu);
|
||||
}
|
||||
@ -930,7 +932,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double getGuideRate(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
@ -984,7 +986,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double getGuideRateInj(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
@ -1035,7 +1037,7 @@ namespace WellGroupHelpers
|
||||
|
||||
|
||||
int groupControlledWells(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const int report_step,
|
||||
const std::string& group_name,
|
||||
@ -1107,7 +1109,7 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
@ -1253,7 +1255,7 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
@ -1407,7 +1409,7 @@ namespace WellGroupHelpers
|
||||
const Group::ProductionCMode& offendedControl,
|
||||
const PhaseUsage& pu,
|
||||
const Parallel::Communication& comm,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
std::pair<std::optional<std::string>, double> offending_well {std::nullopt, 0.0};
|
||||
@ -1531,7 +1533,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int report_step,
|
||||
const double sim_time,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guide_rate,
|
||||
@ -1549,7 +1551,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
WellState& wellState,
|
||||
WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate,
|
||||
@ -1626,7 +1628,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate)
|
||||
{
|
||||
@ -1665,7 +1667,7 @@ namespace WellGroupHelpers
|
||||
const AvgPMap&,
|
||||
int,
|
||||
double,
|
||||
const WellState&,
|
||||
const WellState<double>&,
|
||||
GroupState&);
|
||||
template void WellGroupHelpers::setRegionAveragePressureCalculator<AvgP>(const Group&,
|
||||
const Schedule&,
|
||||
|
@ -39,7 +39,7 @@ namespace Network { class ExtNetwork; }
|
||||
struct PhaseUsage;
|
||||
class Schedule;
|
||||
class VFPProdProperties;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
class FieldPropsManager;
|
||||
|
||||
namespace Network { class ExtNetwork; }
|
||||
@ -62,21 +62,21 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumWellSurfaceRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector);
|
||||
|
||||
double sumWellResRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector);
|
||||
|
||||
double sumSolventRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const bool injector);
|
||||
|
||||
@ -86,7 +86,7 @@ namespace WellGroupHelpers
|
||||
const bool isInjector,
|
||||
const PhaseUsage& pu,
|
||||
const GuideRate& guide_rate,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state,
|
||||
std::vector<double>& groupTargetReduction);
|
||||
|
||||
@ -96,7 +96,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
int report_step,
|
||||
double sim_time,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guide_rate,
|
||||
@ -108,7 +108,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
WellState& wellState,
|
||||
WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate,
|
||||
@ -118,7 +118,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate);
|
||||
|
||||
@ -127,7 +127,7 @@ namespace WellGroupHelpers
|
||||
const SummaryState& summaryState,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
GuideRate* guideRate,
|
||||
Opm::DeferredLogger& deferred_logger);
|
||||
@ -135,31 +135,31 @@ namespace WellGroupHelpers
|
||||
void updateVREPForGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state);
|
||||
|
||||
void updateReservoirRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state);
|
||||
|
||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state);
|
||||
|
||||
void updateWellRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
WellState& wellState);
|
||||
const WellState<double>& wellStateNupcol,
|
||||
WellState<double>& wellState);
|
||||
|
||||
void updateGroupProductionRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state);
|
||||
|
||||
void updateWellRatesFromGroupTargetScale(const double scale,
|
||||
@ -168,28 +168,29 @@ namespace WellGroupHelpers
|
||||
const int reportStepIdx,
|
||||
bool isInjector,
|
||||
const GroupState& group_state,
|
||||
WellState& wellState);
|
||||
WellState<double>& wellState);
|
||||
|
||||
void updateREINForGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const PhaseUsage& pu,
|
||||
const SummaryState& st,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
GroupState& group_state,
|
||||
bool sum_rank);
|
||||
|
||||
|
||||
/// Returns the name of the worst offending well and its fraction (i.e. violated_phase / preferred_phase)
|
||||
std::pair<std::optional<std::string>, double> worstOffendingWell(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const Group::ProductionCMode& offendedControl,
|
||||
const PhaseUsage& pu,
|
||||
const Parallel::Communication& comm,
|
||||
const WellState& wellState,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
/// Returns the name of the worst offending well and its fraction
|
||||
/// (i.e. violated_phase / preferred_phase)
|
||||
std::pair<std::optional<std::string>, double>
|
||||
worstOffendingWell(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const Group::ProductionCMode& offendedControl,
|
||||
const PhaseUsage& pu,
|
||||
const Parallel::Communication& comm,
|
||||
const WellState<double>& wellState,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
template <class RegionalValues>
|
||||
void updateGpMaintTargetForGroups(const Group& group,
|
||||
@ -197,26 +198,26 @@ namespace WellGroupHelpers
|
||||
const RegionalValues& regional_values,
|
||||
const int reportStepIdx,
|
||||
const double dt,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
GroupState& group_state);
|
||||
|
||||
std::map<std::string, double>
|
||||
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const VFPProdProperties& vfp_prod_props,
|
||||
const Schedule& schedule,
|
||||
const int report_time_step);
|
||||
|
||||
GuideRate::RateVector
|
||||
getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name);
|
||||
getWellRateVector(const WellState<double>& well_state, const PhaseUsage& pu, const std::string& name);
|
||||
|
||||
GuideRate::RateVector
|
||||
getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name);
|
||||
|
||||
double getGuideRate(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
@ -226,7 +227,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double getGuideRateInj(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
@ -235,7 +236,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu);
|
||||
|
||||
int groupControlledWells(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const int report_step,
|
||||
const std::string& group_name,
|
||||
@ -247,7 +248,7 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
@ -276,7 +277,7 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
|
@ -158,31 +158,31 @@ public:
|
||||
virtual void initPrimaryVariablesEvaluation() = 0;
|
||||
|
||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const = 0;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
void assembleWellEq(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// TODO: better name or further refactoring the function to make it more clear
|
||||
void prepareWellBeforeAssembling(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
@ -205,7 +205,7 @@ public:
|
||||
/// xw to update Well State
|
||||
virtual void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
/// Ax = Ax - C D^-1 B x
|
||||
@ -216,13 +216,13 @@ public:
|
||||
|
||||
// TODO: before we decide to put more information under mutable, this function is not const
|
||||
virtual void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
virtual void updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual void computeWellRatesWithBhpIterations(const Simulator& simulator,
|
||||
@ -231,18 +231,18 @@ public:
|
||||
DeferredLogger& deferred_logger) const = 0;
|
||||
|
||||
bool updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
enum class IndividualOrGroup { Individual, Group, Both };
|
||||
bool updateWellControl(const Simulator& simulator,
|
||||
const IndividualOrGroup iog,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) /* const */;
|
||||
|
||||
bool updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
@ -252,16 +252,16 @@ public:
|
||||
const bool fixed_status = false);
|
||||
|
||||
virtual void updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0; // should be const?
|
||||
|
||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const = 0;
|
||||
|
||||
virtual double connectionDensity(const int globalConnIdx,
|
||||
@ -280,7 +280,7 @@ public:
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const = 0;
|
||||
const WellState<Scalar>& well_state) const = 0;
|
||||
|
||||
void addCellRates(RateVector& rates, int cellIdx) const;
|
||||
|
||||
@ -290,36 +290,39 @@ public:
|
||||
// Simulator is not const is because that assembleWellEq is non-const Simulator
|
||||
void wellTesting(const Simulator& simulator,
|
||||
const double simulation_time,
|
||||
/* const */ WellState& well_state, const GroupState& group_state, WellTestState& welltest_state,
|
||||
/* const */ WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
WellTestState& welltest_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void checkWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool gliftBeginTimeStepWellTestIterateWellEquations(
|
||||
const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState &group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// check whether the well is operable under the current reservoir condition
|
||||
// mostly related to BHP limit and THP limit
|
||||
void updateWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool updateWellOperabilityFromWellEq(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// update perforation water throughput based on solved water rate
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const = 0;
|
||||
virtual void updateWaterThroughput(const double dt,
|
||||
WellState<Scalar>& well_state) const = 0;
|
||||
|
||||
/// Compute well rates based on current reservoir conditions and well variables.
|
||||
/// Used in updateWellStateRates().
|
||||
@ -330,11 +333,11 @@ public:
|
||||
/// If so, that rate is kept as is, but the others are set proportionally
|
||||
/// to the rates returned by computeCurrentWellRates().
|
||||
void updateWellStateRates(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void solveWellEquation(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
@ -391,26 +394,26 @@ protected:
|
||||
const std::vector<double>& compFrac() const;
|
||||
|
||||
std::vector<double> initialWellRateFractions(const Simulator& simulator,
|
||||
const WellState& well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
// check whether the well is operable under BHP limit with current reservoir condition
|
||||
virtual void checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
virtual void checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
// check whether the well is operable under THP limit with current reservoir condition
|
||||
virtual void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
virtual void updateIPR(const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const=0;
|
||||
DeferredLogger& deferred_logger) const = 0;
|
||||
|
||||
virtual void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
const WellInjectionControls& inj_controls,
|
||||
const WellProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
@ -419,7 +422,7 @@ protected:
|
||||
const double dt,
|
||||
const WellInjectionControls& inj_controls,
|
||||
const WellProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
@ -427,49 +430,49 @@ protected:
|
||||
const double dt,
|
||||
const WellInjectionControls& inj_controls,
|
||||
const WellProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control = false,
|
||||
const bool fixed_status = false) = 0;
|
||||
|
||||
virtual void updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
bool iterateWellEquations(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellWithTHPConstraint(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
std::optional<double> estimateOperableBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellWithBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
const double bhp,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellWithZeroRate(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellForTesting(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
|
@ -40,9 +40,6 @@
|
||||
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
||||
#include <opm/simulators/wells/WellState.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -180,7 +177,7 @@ checkIndividualConstraints(SingleWellState<double>& ws,
|
||||
template <typename FluidSystem>
|
||||
bool
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkGroupConstraints(WellState& well_state,
|
||||
checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -207,7 +204,7 @@ checkGroupConstraints(WellState& well_state,
|
||||
template <typename FluidSystem>
|
||||
bool
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkConstraints(WellState& well_state,
|
||||
checkConstraints(WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -242,7 +239,7 @@ template<typename FluidSystem>
|
||||
std::optional<double>
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -270,12 +267,12 @@ template<typename FluidSystem>
|
||||
double
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
double efficiencyFactor,
|
||||
DeferredLogger& deferred_logger) const
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
double efficiencyFactor,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto rCoeff = [this, &group_state](const RegionId id, const int region, const std::optional<std::string>& prod_gname, std::vector<double>& coeff)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ class GroupState;
|
||||
class Schedule;
|
||||
struct RatioLimitCheckReport;
|
||||
template<class Scalar> class SingleWellState;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem>
|
||||
class WellInterfaceFluidSystem : public WellInterfaceGeneric {
|
||||
@ -83,13 +83,13 @@ protected:
|
||||
const std::optional<Well::InjectionControls>& inj_controls = std::nullopt,
|
||||
const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
|
||||
|
||||
bool checkGroupConstraints(WellState& well_state,
|
||||
bool checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool checkConstraints(WellState& well_state,
|
||||
bool checkConstraints(WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -97,7 +97,7 @@ protected:
|
||||
|
||||
std::optional<double>
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -107,7 +107,7 @@ protected:
|
||||
|
||||
double
|
||||
getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -349,8 +349,8 @@ void WellInterfaceGeneric::setVFPProperties(const VFPProperties* vfp_properties_
|
||||
vfp_properties_ = vfp_properties_arg;
|
||||
}
|
||||
|
||||
void WellInterfaceGeneric::setPrevSurfaceRates(WellState& well_state,
|
||||
const WellState& prev_well_state) const
|
||||
void WellInterfaceGeneric::setPrevSurfaceRates(WellState<double>& well_state,
|
||||
const WellState<double>& prev_well_state) const
|
||||
{
|
||||
auto& ws = well_state.well(this->index_of_well_);
|
||||
auto& ws_prev = prev_well_state.well(this->index_of_well_);
|
||||
@ -505,7 +505,7 @@ bool WellInterfaceGeneric::thpLimitViolatedButNotSwitched() const
|
||||
return operability_status_.thp_limit_violated_but_not_switched;
|
||||
}
|
||||
|
||||
double WellInterfaceGeneric::getALQ(const WellState& well_state) const
|
||||
double WellInterfaceGeneric::getALQ(const WellState<double>& well_state) const
|
||||
{
|
||||
// no alq for injectors.
|
||||
if (isInjector())
|
||||
@ -534,7 +534,7 @@ void WellInterfaceGeneric::reportWellSwitching(const SingleWellState<double> &ws
|
||||
}
|
||||
}
|
||||
|
||||
bool WellInterfaceGeneric::isPressureControlled(const WellState& well_state) const
|
||||
bool WellInterfaceGeneric::isPressureControlled(const WellState<double>& well_state) const
|
||||
{
|
||||
const auto& ws = well_state.well(this->index_of_well_);
|
||||
if (this->isInjector()) {
|
||||
@ -551,7 +551,7 @@ bool WellInterfaceGeneric::isPressureControlled(const WellState& well_state) con
|
||||
|
||||
|
||||
bool WellInterfaceGeneric::wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const
|
||||
const WellState<double>& well_state) const
|
||||
{
|
||||
if (this->isProducer()) { // producers
|
||||
const auto prod_controls = this->well_ecl_.productionControls(summary_state);
|
||||
@ -565,7 +565,7 @@ bool WellInterfaceGeneric::wellUnderZeroRateTarget(const SummaryState& summary_s
|
||||
}
|
||||
|
||||
bool WellInterfaceGeneric::stopppedOrZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const
|
||||
const WellState<double>& well_state) const
|
||||
{
|
||||
return (this->wellIsStopped() || this->wellUnderZeroRateTarget(summary_state, well_state));
|
||||
|
||||
@ -675,7 +675,7 @@ int WellInterfaceGeneric::polymerInjTable_() const
|
||||
|
||||
std::pair<bool,bool> WellInterfaceGeneric::
|
||||
computeWellPotentials(std::vector<double>& well_potentials,
|
||||
const WellState& well_state)
|
||||
const WellState<double>& well_state)
|
||||
{
|
||||
const int np = this->number_of_phases_;
|
||||
well_potentials.resize(np, 0.0);
|
||||
@ -752,7 +752,7 @@ checkNegativeWellPotentials(std::vector<double>& well_potentials,
|
||||
|
||||
void WellInterfaceGeneric::
|
||||
prepareForPotentialCalculations(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
Well::InjectionControls& inj_controls,
|
||||
Well::ProductionControls& prod_controls) const
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ struct PhaseUsage;
|
||||
class SummaryState;
|
||||
class VFPProperties;
|
||||
class WellTestState;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
template<class Scalar> class SingleWellState;
|
||||
class GroupState;
|
||||
class Group;
|
||||
@ -95,7 +95,8 @@ public:
|
||||
void closeCompletions(const WellTestState& wellTestState);
|
||||
|
||||
void setVFPProperties(const VFPProperties* vfp_properties_arg);
|
||||
void setPrevSurfaceRates(WellState& well_state, const WellState& prev_well_state) const;
|
||||
void setPrevSurfaceRates(WellState<double>& well_state,
|
||||
const WellState<double>& prev_well_state) const;
|
||||
void setGuideRate(const GuideRate* guide_rate_arg);
|
||||
void setWellEfficiencyFactor(const double efficiency_factor);
|
||||
void setRepRadiusPerfLength();
|
||||
@ -176,7 +177,7 @@ public:
|
||||
}
|
||||
|
||||
double getTHPConstraint(const SummaryState& summaryState) const;
|
||||
double getALQ(const WellState& well_state) const;
|
||||
double getALQ(const WellState<double>& well_state) const;
|
||||
double wsolvent() const;
|
||||
double rsRvInj() const;
|
||||
|
||||
@ -205,10 +206,10 @@ public:
|
||||
WellTestState& wellTestState,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool isPressureControlled(const WellState& well_state) const;
|
||||
bool isPressureControlled(const WellState<double>& well_state) const;
|
||||
|
||||
bool stopppedOrZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const;
|
||||
const WellState<double>& well_state) const;
|
||||
|
||||
double wellEfficiencyFactor() const
|
||||
{ return well_efficiency_factor_; }
|
||||
@ -236,18 +237,18 @@ protected:
|
||||
int polymerWaterTable_() const;
|
||||
|
||||
bool wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const;
|
||||
const WellState<double>& well_state) const;
|
||||
|
||||
std::pair<bool,bool>
|
||||
computeWellPotentials(std::vector<double>& well_potentials,
|
||||
const WellState& well_state);
|
||||
const WellState<double>& well_state);
|
||||
|
||||
void checkNegativeWellPotentials(std::vector<double>& well_potentials,
|
||||
const bool checkOperability,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void prepareForPotentialCalculations(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
Well::InjectionControls& inj_controls,
|
||||
Well::ProductionControls& prod_controls) const;
|
||||
|
||||
|
@ -186,7 +186,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
updateWellControl(const Simulator& simulator,
|
||||
const IndividualOrGroup iog,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) /* const */
|
||||
{
|
||||
@ -262,7 +262,7 @@ namespace Opm
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
@ -347,14 +347,14 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
wellTesting(const Simulator& simulator,
|
||||
const double simulation_time,
|
||||
/* const */ WellState& well_state,
|
||||
/* const */ WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
WellTestState& well_test_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
deferred_logger.info(" well " + this->name() + " is being tested");
|
||||
|
||||
WellState well_state_copy = well_state;
|
||||
WellState<Scalar> well_state_copy = well_state;
|
||||
auto& ws = well_state_copy.well(this->indexOfWell());
|
||||
|
||||
updateWellStateWithTarget(simulator, group_state, well_state_copy, deferred_logger);
|
||||
@ -445,7 +445,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
iterateWellEquations(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -479,8 +479,8 @@ namespace Opm
|
||||
solveWellWithTHPConstraint(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -568,7 +568,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
estimateOperableBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -592,7 +592,7 @@ namespace Opm
|
||||
solveWellWithBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
const double bhp,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Solve a well using single bhp-constraint (but close if not operable under this)
|
||||
@ -627,7 +627,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
solveWellWithZeroRate(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Solve a well as stopped
|
||||
@ -645,11 +645,13 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
solveWellForTesting(const Simulator& simulator, WellState& well_state, const GroupState& group_state,
|
||||
solveWellForTesting(const Simulator& simulator,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// keep a copy of the original well state
|
||||
const WellState well_state0 = well_state;
|
||||
const WellState<Scalar> well_state0 = well_state;
|
||||
const double dt = simulator.timeStepSize();
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
const bool has_thp_limit = this->wellHasTHPConstraints(summary_state);
|
||||
@ -679,7 +681,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
solveWellEquation(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -687,7 +689,7 @@ namespace Opm
|
||||
return;
|
||||
|
||||
// keep a copy of the original well state
|
||||
const WellState well_state0 = well_state;
|
||||
const WellState<Scalar> well_state0 = well_state;
|
||||
const double dt = simulator.timeStepSize();
|
||||
bool converged = iterateWellEquations(simulator, dt, well_state, group_state, deferred_logger);
|
||||
|
||||
@ -737,7 +739,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
assembleWellEq(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -754,7 +756,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -773,7 +775,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
prepareWellBeforeAssembling(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -863,7 +865,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
checkWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
|
||||
@ -890,7 +892,7 @@ namespace Opm
|
||||
gliftBeginTimeStepWellTestIterateWellEquations(
|
||||
const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState &group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -923,7 +925,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -967,7 +969,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (this->param_.local_well_solver_control_switching_) {
|
||||
@ -1003,13 +1005,13 @@ namespace Opm
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
updateWellOperabilityFromWellEq(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// only makes sense if we're using this parameter is true
|
||||
assert(this->param_.local_well_solver_control_switching_);
|
||||
this->operability_status_.resetOperability();
|
||||
WellState well_state_copy = well_state;
|
||||
WellState<Scalar> well_state_copy = well_state;
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
const double dt = simulator.timeStepSize();
|
||||
// equations should be converged at this stage, so only one it is needed
|
||||
@ -1022,7 +1024,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
|
||||
@ -1399,7 +1401,8 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::vector<double>
|
||||
WellInterface<TypeTag>::
|
||||
initialWellRateFractions(const Simulator& simulator, const WellState& well_state) const
|
||||
initialWellRateFractions(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
const int np = this->number_of_phases_;
|
||||
std::vector<double> scaling_factor(np);
|
||||
@ -1446,7 +1449,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateWellStateRates(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// Check if the rates of this well only are single-phase, do nothing
|
||||
@ -1754,7 +1757,7 @@ namespace Opm
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
|
@ -126,28 +126,32 @@ void PackUnpackXConn::unpack([[maybe_unused]] const int link,
|
||||
|
||||
namespace Opm {
|
||||
|
||||
WellState::WellState(const ParallelWellInfo& pinfo)
|
||||
template<class Scalar>
|
||||
WellState<Scalar>::WellState(const ParallelWellInfo& pinfo)
|
||||
: phase_usage_{}
|
||||
{
|
||||
wells_.add("test4",
|
||||
SingleWellState<double>{"dummy", pinfo, false, 0.0, {}, phase_usage_, 0.0});
|
||||
SingleWellState<Scalar>{"dummy", pinfo, false, 0.0, {}, phase_usage_, 0.0});
|
||||
}
|
||||
|
||||
WellState WellState::serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
template<class Scalar>
|
||||
WellState<Scalar> WellState<Scalar>::
|
||||
serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
{
|
||||
WellState result(PhaseUsage{});
|
||||
result.alq_state = ALQState<double>::serializationTestObject();
|
||||
result.alq_state = ALQState<Scalar>::serializationTestObject();
|
||||
result.well_rates = {{"test2", {true, {1.0}}}, {"test3", {false, {2.0}}}};
|
||||
result.wells_.add("test4", SingleWellState<double>::serializationTestObject(pinfo));
|
||||
result.wells_.add("test4", SingleWellState<Scalar>::serializationTestObject(pinfo));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void WellState::base_init(const std::vector<double>& cellPressures,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::base_init(const std::vector<Scalar>& cellPressures,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
// clear old name mapping
|
||||
this->wells_.clear();
|
||||
@ -164,22 +168,24 @@ void WellState::base_init(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::initSingleProducer(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state) {
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initSingleProducer(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const auto& pu = this->phase_usage_;
|
||||
const double temp = 273.15 + 15.56;
|
||||
const Scalar temp = 273.15 + 15.56;
|
||||
|
||||
auto& ws = this->wells_.add(well.name(),
|
||||
SingleWellState<double>{well.name(),
|
||||
well_info,
|
||||
true,
|
||||
pressure_first_connection,
|
||||
well_perf_data,
|
||||
pu,
|
||||
temp});
|
||||
SingleWellState{well.name(),
|
||||
well_info,
|
||||
true,
|
||||
pressure_first_connection,
|
||||
well_perf_data,
|
||||
pu,
|
||||
temp});
|
||||
|
||||
// the rest of the code needs to executed even if ws.perf_data is empty
|
||||
// as this does not say anything for the whole well if it is distributed.
|
||||
@ -191,16 +197,17 @@ void WellState::initSingleProducer(const Well& well,
|
||||
ws.update_producer_targets(well, summary_state);
|
||||
}
|
||||
|
||||
void WellState::initSingleInjector(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state) {
|
||||
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initSingleInjector(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const auto& pu = this->phase_usage_;
|
||||
const double temp = well.temperature();
|
||||
const Scalar temp = well.temperature();
|
||||
|
||||
auto& ws = this->wells_.add(well.name(), SingleWellState<double>{well.name(),
|
||||
auto& ws = this->wells_.add(well.name(), SingleWellState<Scalar>{well.name(),
|
||||
well_info,
|
||||
false,
|
||||
pressure_first_connection,
|
||||
@ -218,13 +225,14 @@ void WellState::initSingleInjector(const Well& well,
|
||||
ws.update_injector_targets(well, summary_state);
|
||||
}
|
||||
|
||||
void WellState::initSingleWell(const std::vector<double>& cellPressures,
|
||||
const Well& well,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const ParallelWellInfo& well_info,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initSingleWell(const std::vector<Scalar>& cellPressures,
|
||||
const Well& well,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const ParallelWellInfo& well_info,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
double pressure_first_connection = -1;
|
||||
Scalar pressure_first_connection = -1;
|
||||
if (!well_perf_data.empty())
|
||||
pressure_first_connection = cellPressures[well_perf_data[0].cell_index];
|
||||
pressure_first_connection = well_info.broadcastFirstPerforationValue(pressure_first_connection);
|
||||
@ -238,14 +246,15 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::init(const std::vector<double>& cellPressures,
|
||||
const Schedule& schedule,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const int report_step,
|
||||
const WellState* prevState,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures,
|
||||
const Schedule& schedule,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const int report_step,
|
||||
const WellState* prevState,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
// call init on base class
|
||||
this->base_init(cellPressures, wells_ecl, parallel_well_info,
|
||||
@ -255,7 +264,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
wells_ecl);
|
||||
for (const auto& wname : schedule.wellNames(report_step))
|
||||
{
|
||||
well_rates.insert({wname, std::make_pair(false, std::vector<double>(this->numPhases()))});
|
||||
well_rates.insert({wname, std::make_pair(false, std::vector<Scalar>(this->numPhases()))});
|
||||
}
|
||||
for (const auto& winfo: parallel_well_info)
|
||||
{
|
||||
@ -291,7 +300,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
for (int perf = 0; perf < num_perf_this_well; ++perf) {
|
||||
if (wells_ecl[w].getStatus() == Well::Status::OPEN) {
|
||||
for (int p = 0; p < this->numPhases(); ++p) {
|
||||
perf_data.phase_rates[this->numPhases()*perf + p] = ws.surface_rates[p] / double(global_num_perf_this_well);
|
||||
perf_data.phase_rates[this->numPhases()*perf + p] = ws.surface_rates[p] / Scalar(global_num_perf_this_well);
|
||||
}
|
||||
}
|
||||
perf_data.pressure[perf] = cellPressures[well_perf_data[w][perf].cell_index];
|
||||
@ -318,7 +327,6 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
switch (wells_ecl[w].getStatus()) {
|
||||
case Well::Status::SHUT:
|
||||
@ -390,7 +398,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
auto& target_rates = perf_data.phase_rates;
|
||||
for (int perf_index = 0; perf_index < num_perf_this_well; perf_index++) {
|
||||
for (int p = 0; p < np; ++p) {
|
||||
target_rates[perf_index*np + p] = new_well.surface_rates[p] / double(global_num_perf_this_well);
|
||||
target_rates[perf_index*np + p] = new_well.surface_rates[p] / Scalar(global_num_perf_this_well);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -406,19 +414,19 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updateWellsDefaultALQ(wells_ecl, summary_state);
|
||||
}
|
||||
|
||||
void WellState::resize(const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const Schedule& schedule,
|
||||
const bool handle_ms_well,
|
||||
const std::size_t numCells,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::resize(const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const Schedule& schedule,
|
||||
const bool handle_ms_well,
|
||||
const std::size_t numCells,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
|
||||
const std::vector<Scalar> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
|
||||
init(tmp, schedule, wells_ecl, parallel_well_info, 0, nullptr, well_perf_data, summary_state);
|
||||
|
||||
if (handle_ms_well) {
|
||||
@ -426,8 +434,9 @@ void WellState::resize(const std::vector<Well>& wells_ecl,
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<double>&
|
||||
WellState::currentWellRates(const std::string& wellName) const
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
WellState<Scalar>::currentWellRates(const std::string& wellName) const
|
||||
{
|
||||
auto it = well_rates.find(wellName);
|
||||
|
||||
@ -438,7 +447,8 @@ WellState::currentWellRates(const std::string& wellName) const
|
||||
return it->second.second;
|
||||
}
|
||||
|
||||
void WellState::
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::
|
||||
gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||
std::vector<data::Connection>& to_connections,
|
||||
const Parallel::Communication& comm) const
|
||||
@ -463,9 +473,10 @@ gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||
toOwnerComm.exchange(lineariser);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
data::Wells
|
||||
WellState::report(const int* globalCellIdxMap,
|
||||
const std::function<bool(const int)>& wasDynamicallyClosed) const
|
||||
WellState<Scalar>::report(const int* globalCellIdxMap,
|
||||
const std::function<bool(const int)>& wasDynamicallyClosed) const
|
||||
{
|
||||
if (this->numWells() == 0) {
|
||||
return {};
|
||||
@ -573,10 +584,11 @@ WellState::report(const int* globalCellIdxMap,
|
||||
return res;
|
||||
}
|
||||
|
||||
void WellState::reportConnections(std::vector<data::Connection>& connections,
|
||||
const PhaseUsage &pu,
|
||||
std::size_t well_index,
|
||||
const int* globalCellIdxMap) const
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::reportConnections(std::vector<data::Connection>& connections,
|
||||
const PhaseUsage &pu,
|
||||
std::size_t well_index,
|
||||
const int* globalCellIdxMap) const
|
||||
{
|
||||
using rt = data::Rates::opt;
|
||||
const auto& ws = this->well(well_index);
|
||||
@ -655,8 +667,9 @@ void WellState::reportConnections(std::vector<data::Connection>& connections,
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
const WellState* prev_well_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
const WellState* prev_well_state)
|
||||
{
|
||||
// still using the order in wells
|
||||
const int nw = wells_ecl.size();
|
||||
@ -677,7 +690,7 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
// assuming the order of the perforations in well_ecl is the same with Wells
|
||||
const WellConnections& completion_set = well_ecl.getConnections();
|
||||
// number of segment for this single well
|
||||
ws.segments = SegmentState<double>{np, segment_set};
|
||||
ws.segments = SegmentState<Scalar>{np, segment_set};
|
||||
const int well_nseg = segment_set.size();
|
||||
int n_activeperf = 0;
|
||||
|
||||
@ -728,7 +741,7 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
}
|
||||
|
||||
const auto& perf_rates = perf_data.phase_rates;
|
||||
std::vector<double> perforation_rates(perf_rates.begin(), perf_rates.end());
|
||||
std::vector<Scalar> perforation_rates(perf_rates.begin(), perf_rates.end());
|
||||
|
||||
calculateSegmentRates(segment_inlets, segment_perforations, perforation_rates, np, 0 /* top segment */, ws.segments.rates);
|
||||
// for the segment pressure, the segment pressure is the same with the first perforation belongs to the segment
|
||||
@ -784,12 +797,13 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WellState::calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
const std::vector<double>& perforation_rates,
|
||||
const int np, const int segment,
|
||||
std::vector<double>& segment_rates)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::
|
||||
calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
const std::vector<Scalar>& perforation_rates,
|
||||
const int np, const int segment,
|
||||
std::vector<Scalar>& segment_rates)
|
||||
{
|
||||
// the rate of the segment equals to the sum of the contribution from the perforations and inlet segment rates.
|
||||
// the first segment is always the top segment, its rates should be equal to the well rates.
|
||||
@ -812,31 +826,36 @@ WellState::calculateSegmentRates(const std::vector<std::vector<int>>& segment_in
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::stopWell(int well_index)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::stopWell(int well_index)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.stop();
|
||||
}
|
||||
|
||||
void WellState::openWell(int well_index)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::openWell(int well_index)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.open();
|
||||
}
|
||||
|
||||
void WellState::shutWell(int well_index)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::shutWell(int well_index)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.shut();
|
||||
}
|
||||
|
||||
void WellState::updateStatus(int well_index, WellStatus status)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::updateStatus(int well_index, WellStatus status)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.updateStatus(status);
|
||||
}
|
||||
|
||||
void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::communicateGroupRates(const Parallel::Communication& comm)
|
||||
{
|
||||
// Compute the size of the data.
|
||||
std::size_t sz = 0;
|
||||
@ -848,9 +867,8 @@ void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
||||
}
|
||||
sz += this->alq_state.pack_size();
|
||||
|
||||
|
||||
// Make a vector and collect all data into it.
|
||||
std::vector<double> data(sz);
|
||||
std::vector<Scalar> data(sz);
|
||||
std::size_t pos = 0;
|
||||
for (const auto& [_, owner_rates] : this->well_rates) {
|
||||
(void)_;
|
||||
@ -884,7 +902,8 @@ void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
||||
assert(pos == sz);
|
||||
}
|
||||
|
||||
void WellState::updateGlobalIsGrup(const Parallel::Communication& comm)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::updateGlobalIsGrup(const Parallel::Communication& comm)
|
||||
{
|
||||
this->global_well_info.value().clear();
|
||||
for (std::size_t well_index = 0; well_index < this->size(); well_index++) {
|
||||
@ -897,10 +916,11 @@ void WellState::updateGlobalIsGrup(const Parallel::Communication& comm)
|
||||
this->global_well_info.value().communicate(comm);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
data::Segment
|
||||
WellState::reportSegmentResults(const int well_id,
|
||||
const int seg_ix,
|
||||
const int seg_no) const
|
||||
WellState<Scalar>::reportSegmentResults(const int well_id,
|
||||
const int seg_ix,
|
||||
const int seg_no) const
|
||||
{
|
||||
using PhaseQuant = data::SegmentPhaseQuantity::Item;
|
||||
using PhaseDensity = data::SegmentPhaseDensity::Item;
|
||||
@ -976,8 +996,9 @@ WellState::reportSegmentResults(const int well_id,
|
||||
return seg_res;
|
||||
}
|
||||
|
||||
bool WellState::wellIsOwned(std::size_t well_index,
|
||||
[[maybe_unused]] const std::string& wellName) const
|
||||
template<class Scalar>
|
||||
bool WellState<Scalar>::wellIsOwned(std::size_t well_index,
|
||||
[[maybe_unused]] const std::string& wellName) const
|
||||
{
|
||||
const auto& well_info = this->parallelWellInfo(well_index);
|
||||
assert(well_info.name() == wellName);
|
||||
@ -985,7 +1006,8 @@ bool WellState::wellIsOwned(std::size_t well_index,
|
||||
return well_info.isOwner();
|
||||
}
|
||||
|
||||
bool WellState::wellIsOwned(const std::string& wellName) const
|
||||
template<class Scalar>
|
||||
bool WellState<Scalar>::wellIsOwned(const std::string& wellName) const
|
||||
{
|
||||
const auto& well_index = this->index(wellName);
|
||||
if (!well_index.has_value()) {
|
||||
@ -996,7 +1018,10 @@ bool WellState::wellIsOwned(const std::string& wellName) const
|
||||
return wellIsOwned(well_index.value(), wellName);
|
||||
}
|
||||
|
||||
void WellState::updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::
|
||||
updateWellsDefaultALQ(const std::vector<Well>& wells_ecl,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const int nw = wells_ecl.size();
|
||||
for (int i = 0; i<nw; i++) {
|
||||
@ -1009,18 +1034,23 @@ void WellState::updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, const
|
||||
}
|
||||
}
|
||||
|
||||
bool WellState::operator==(const WellState& rhs) const
|
||||
template<class Scalar>
|
||||
bool WellState<Scalar>::operator==(const WellState& rhs) const
|
||||
{
|
||||
return this->alq_state == rhs.alq_state &&
|
||||
this->well_rates == rhs.well_rates &&
|
||||
this->wells_ == rhs.wells_;
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
const ParallelWellInfo&
|
||||
WellState::parallelWellInfo(std::size_t well_index) const
|
||||
WellState<Scalar>::parallelWellInfo(std::size_t well_index) const
|
||||
{
|
||||
const auto& ws = this->well(well_index);
|
||||
return ws.parallel_info;
|
||||
}
|
||||
|
||||
|
||||
template class WellState<double>;
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -57,6 +57,7 @@ enum class WellStatus;
|
||||
|
||||
/// The state of a set of wells, tailored for use by the fully
|
||||
/// implicit blackoil simulator.
|
||||
template<class Scalar>
|
||||
class WellState
|
||||
{
|
||||
public:
|
||||
@ -75,15 +76,16 @@ public:
|
||||
|
||||
static WellState serializationTestObject(const ParallelWellInfo& pinfo);
|
||||
|
||||
std::size_t size() const {
|
||||
std::size_t size() const
|
||||
{
|
||||
return this->wells_.size();
|
||||
}
|
||||
|
||||
std::vector<std::string> wells() const {
|
||||
std::vector<std::string> wells() const
|
||||
{
|
||||
return this->wells_.wells();
|
||||
}
|
||||
|
||||
|
||||
int numWells() const
|
||||
{
|
||||
return this->size();
|
||||
@ -91,12 +93,10 @@ public:
|
||||
|
||||
const ParallelWellInfo& parallelWellInfo(std::size_t well_index) const;
|
||||
|
||||
|
||||
|
||||
/// Allocate and initialize if wells is non-null. Also tries
|
||||
/// to give useful initial values to the bhp(), wellRates()
|
||||
/// and perfPhaseRatesORG() fields, depending on controls
|
||||
void init(const std::vector<double>& cellPressures,
|
||||
void init(const std::vector<Scalar>& cellPressures,
|
||||
const Schedule& schedule,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
@ -113,15 +113,18 @@ public:
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
void setCurrentWellRates(const std::string& wellName, const std::vector<double>& new_rates ) {
|
||||
void setCurrentWellRates(const std::string& wellName,
|
||||
const std::vector<Scalar>& new_rates)
|
||||
{
|
||||
auto& [owner, rates] = this->well_rates.at(wellName);
|
||||
if (owner)
|
||||
rates = new_rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& currentWellRates(const std::string& wellName) const;
|
||||
const std::vector<Scalar>& currentWellRates(const std::string& wellName) const;
|
||||
|
||||
bool hasWellRates(const std::string& wellName) const {
|
||||
bool hasWellRates(const std::string& wellName) const
|
||||
{
|
||||
return this->well_rates.find(wellName) != this->well_rates.end();
|
||||
}
|
||||
|
||||
@ -130,15 +133,16 @@ public:
|
||||
this->well_rates.clear();
|
||||
}
|
||||
|
||||
void gatherVectorsOnRoot(const std::vector< data::Connection >& from_connections,
|
||||
std::vector< data::Connection >& to_connections,
|
||||
void gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||
std::vector<data::Connection>& to_connections,
|
||||
const Parallel::Communication& comm) const;
|
||||
|
||||
data::Wells
|
||||
report(const int* globalCellIdxMap,
|
||||
const std::function<bool(const int)>& wasDynamicallyClosed) const;
|
||||
|
||||
void reportConnections(std::vector<data::Connection>& connections, const PhaseUsage &pu,
|
||||
void reportConnections(std::vector<data::Connection>& connections,
|
||||
const PhaseUsage &pu,
|
||||
std::size_t well_index,
|
||||
const int* globalCellIdxMap) const;
|
||||
|
||||
@ -146,61 +150,75 @@ public:
|
||||
void initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
const WellState* prev_well_state);
|
||||
|
||||
static void calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets, const std::vector<std::vector<int>>&segment_perforations,
|
||||
const std::vector<double>& perforation_rates, const int np, const int segment, std::vector<double>& segment_rates);
|
||||
static void calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets, const
|
||||
std::vector<std::vector<int>>& segment_perforations,
|
||||
const std::vector<Scalar>& perforation_rates,
|
||||
const int np,
|
||||
const int segment,
|
||||
std::vector<Scalar>& segment_rates);
|
||||
|
||||
|
||||
void communicateGroupRates(const Parallel::Communication& comm);
|
||||
|
||||
void updateGlobalIsGrup(const Parallel::Communication& comm);
|
||||
|
||||
bool isInjectionGrup(const std::string& name) const {
|
||||
bool isInjectionGrup(const std::string& name) const
|
||||
{
|
||||
return this->global_well_info.value().in_injecting_group(name);
|
||||
}
|
||||
|
||||
bool isProductionGrup(const std::string& name) const {
|
||||
bool isProductionGrup(const std::string& name) const
|
||||
{
|
||||
return this->global_well_info.value().in_producing_group(name);
|
||||
}
|
||||
|
||||
double getALQ( const std::string& name) const
|
||||
Scalar getALQ(const std::string& name) const
|
||||
{
|
||||
return this->alq_state.get(name);
|
||||
}
|
||||
|
||||
void setALQ( const std::string& name, double value)
|
||||
void setALQ(const std::string& name, Scalar value)
|
||||
{
|
||||
this->alq_state.set(name, value);
|
||||
}
|
||||
|
||||
int gliftGetDebugCounter() {
|
||||
int gliftGetDebugCounter()
|
||||
{
|
||||
return this->alq_state.get_debug_counter();
|
||||
}
|
||||
|
||||
void gliftSetDebugCounter(int value) {
|
||||
void gliftSetDebugCounter(int value)
|
||||
{
|
||||
return this->alq_state.set_debug_counter(value);
|
||||
}
|
||||
|
||||
int gliftUpdateDebugCounter() {
|
||||
int gliftUpdateDebugCounter()
|
||||
{
|
||||
return this->alq_state.update_debug_counter();
|
||||
}
|
||||
|
||||
bool gliftCheckAlqOscillation(const std::string &name) const {
|
||||
bool gliftCheckAlqOscillation(const std::string &name) const
|
||||
{
|
||||
return this->alq_state.oscillation(name);
|
||||
}
|
||||
|
||||
int gliftGetAlqDecreaseCount(const std::string &name) {
|
||||
int gliftGetAlqDecreaseCount(const std::string &name)
|
||||
{
|
||||
return this->alq_state.get_decrement_count(name);
|
||||
}
|
||||
|
||||
int gliftGetAlqIncreaseCount(const std::string &name) {
|
||||
int gliftGetAlqIncreaseCount(const std::string &name)
|
||||
{
|
||||
return this->alq_state.get_increment_count(name);
|
||||
}
|
||||
|
||||
void gliftUpdateAlqIncreaseCount(const std::string &name, bool increase) {
|
||||
void gliftUpdateAlqIncreaseCount(const std::string &name, bool increase)
|
||||
{
|
||||
this->alq_state.update_count(name, increase);
|
||||
}
|
||||
|
||||
void gliftTimeStepInit() {
|
||||
void gliftTimeStepInit()
|
||||
{
|
||||
this->alq_state.reset_count();
|
||||
}
|
||||
|
||||
@ -208,13 +226,16 @@ public:
|
||||
// reset current_alq and update default_alq. ALQ is used for
|
||||
// constant lift gas injection and for gas lift optimization
|
||||
// (THP controlled wells).
|
||||
void updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, const SummaryState& summary_state);
|
||||
void updateWellsDefaultALQ(const std::vector<Well>& wells_ecl,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
int wellNameToGlobalIdx(const std::string &name) {
|
||||
int wellNameToGlobalIdx(const std::string& name)
|
||||
{
|
||||
return this->global_well_info.value().well_index(name);
|
||||
}
|
||||
|
||||
std::string globalIdxToWellName(const int index) {
|
||||
std::string globalIdxToWellName(const int index)
|
||||
{
|
||||
return this->global_well_info.value().well_name(index);
|
||||
}
|
||||
|
||||
@ -235,63 +256,69 @@ public:
|
||||
return this->phase_usage_.num_phases;
|
||||
}
|
||||
|
||||
const PhaseUsage& phaseUsage() const {
|
||||
const PhaseUsage& phaseUsage() const
|
||||
{
|
||||
return this->phase_usage_;
|
||||
}
|
||||
|
||||
/// One rate per well and phase.
|
||||
std::vector<double>& wellRates(std::size_t well_index) { return this->wells_[well_index].surface_rates; }
|
||||
const std::vector<double>& wellRates(std::size_t well_index) const { return this->wells_[well_index].surface_rates; }
|
||||
std::vector<Scalar>& wellRates(std::size_t well_index)
|
||||
{ return this->wells_[well_index].surface_rates; }
|
||||
const std::vector<Scalar>& wellRates(std::size_t well_index) const
|
||||
{ return this->wells_[well_index].surface_rates; }
|
||||
|
||||
const std::string& name(std::size_t well_index) const {
|
||||
const std::string& name(std::size_t well_index) const
|
||||
{
|
||||
return this->wells_.well_name(well_index);
|
||||
}
|
||||
|
||||
std::optional<std::size_t> index(const std::string& well_name) const {
|
||||
std::optional<std::size_t> index(const std::string& well_name) const
|
||||
{
|
||||
return this->wells_.well_index(well_name);
|
||||
}
|
||||
|
||||
const SingleWellState<double>& operator[](std::size_t well_index) const
|
||||
const SingleWellState<Scalar>& operator[](std::size_t well_index) const
|
||||
{
|
||||
return this->wells_[well_index];
|
||||
}
|
||||
|
||||
const SingleWellState<double>& operator[](const std::string& well_name) const
|
||||
const SingleWellState<Scalar>& operator[](const std::string& well_name) const
|
||||
{
|
||||
return this->wells_[well_name];
|
||||
}
|
||||
|
||||
SingleWellState<double>& operator[](std::size_t well_index)
|
||||
SingleWellState<Scalar>& operator[](std::size_t well_index)
|
||||
{
|
||||
return this->wells_[well_index];
|
||||
}
|
||||
|
||||
SingleWellState<double>& operator[](const std::string& well_name)
|
||||
SingleWellState<Scalar>& operator[](const std::string& well_name)
|
||||
{
|
||||
return this->wells_[well_name];
|
||||
}
|
||||
|
||||
const SingleWellState<double>& well(std::size_t well_index) const
|
||||
const SingleWellState<Scalar>& well(std::size_t well_index) const
|
||||
{
|
||||
return this->operator[](well_index);
|
||||
}
|
||||
|
||||
const SingleWellState<double>& well(const std::string& well_name) const
|
||||
const SingleWellState<Scalar>& well(const std::string& well_name) const
|
||||
{
|
||||
return this->operator[](well_name);
|
||||
}
|
||||
|
||||
SingleWellState<double>& well(std::size_t well_index)
|
||||
SingleWellState<Scalar>& well(std::size_t well_index)
|
||||
{
|
||||
return this->operator[](well_index);
|
||||
}
|
||||
|
||||
SingleWellState<double>& well(const std::string& well_name)
|
||||
SingleWellState<Scalar>& well(const std::string& well_name)
|
||||
{
|
||||
return this->operator[](well_name);
|
||||
}
|
||||
|
||||
bool has(const std::string& well_name) const {
|
||||
bool has(const std::string& well_name) const
|
||||
{
|
||||
return this->wells_.has(well_name);
|
||||
}
|
||||
|
||||
@ -322,7 +349,7 @@ private:
|
||||
// The wells_ variable is essentially a map of all the wells on the current
|
||||
// process. Observe that since a well can be split over several processes a
|
||||
// well might appear in the WellContainer on different processes.
|
||||
WellContainer<SingleWellState<double>> wells_;
|
||||
WellContainer<SingleWellState<Scalar>> wells_;
|
||||
|
||||
// The members alq_state, global_well_info and well_rates are map like
|
||||
// structures which will have entries for *all* the wells in the system.
|
||||
@ -331,12 +358,12 @@ private:
|
||||
// WellStateFullyImplicitBlackoil class should be default constructible,
|
||||
// whereas the GlobalWellInfo is not.
|
||||
std::optional<GlobalWellInfo> global_well_info;
|
||||
ALQState<double> alq_state;
|
||||
ALQState<Scalar> alq_state;
|
||||
|
||||
// The well_rates variable is defined for all wells on all processors. The
|
||||
// bool in the value pair is whether the current process owns the well or
|
||||
// not.
|
||||
std::map<std::string, std::pair<bool, std::vector<double>>> well_rates;
|
||||
std::map<std::string, std::pair<bool, std::vector<Scalar>>> well_rates;
|
||||
|
||||
data::Segment
|
||||
reportSegmentResults(const int well_id,
|
||||
@ -349,13 +376,13 @@ private:
|
||||
/// wellRates() fields, depending on controls. The
|
||||
/// perfRates() field is filled with zero, and perfPress()
|
||||
/// with -1e100.
|
||||
void base_init(const std::vector<double>& cellPressures,
|
||||
void base_init(const std::vector<Scalar>& cellPressures,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
void initSingleWell(const std::vector<double>& cellPressures,
|
||||
void initSingleWell(const std::vector<Scalar>& cellPressures,
|
||||
const Well& well,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const ParallelWellInfo& well_info,
|
||||
@ -363,19 +390,17 @@ private:
|
||||
|
||||
void initSingleProducer(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
void initSingleInjector(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
|
||||
#endif // OPM_WELLSTATEFULLYIMPLICITBLACKOIL_HEADER_INCLUDED
|
||||
|
@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(WellContainer)
|
||||
BOOST_AUTO_TEST_CASE(WellState)
|
||||
{
|
||||
Opm::ParallelWellInfo dummy;
|
||||
auto data_out = Opm::WellState::serializationTestObject(dummy);
|
||||
auto data_out = Opm::WellState<double>::serializationTestObject(dummy);
|
||||
Opm::Serialization::MemPacker packer;
|
||||
Opm::Serializer ser(packer);
|
||||
ser.pack(data_out);
|
||||
@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(WGState)
|
||||
ser.pack(data_out);
|
||||
const size_t pos1 = ser.position();
|
||||
decltype(data_out) data_in(Opm::PhaseUsage{});
|
||||
data_in.well_state = Opm::WellState(dummy);
|
||||
data_in.well_state = Opm::WellState<double>(dummy);
|
||||
ser.unpack(data_in);
|
||||
const size_t pos2 = ser.position();
|
||||
BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for WGState");
|
||||
@ -271,9 +271,9 @@ public:
|
||||
eclState, phase_usage, comm)
|
||||
{
|
||||
if (deserialize) {
|
||||
active_wgstate_.well_state = WellState(dummy);
|
||||
last_valid_wgstate_.well_state = WellState(dummy);
|
||||
nupcol_wgstate_.well_state = WellState(dummy);
|
||||
active_wgstate_.well_state = WellState<double>(dummy);
|
||||
last_valid_wgstate_.well_state = WellState<double>(dummy);
|
||||
nupcol_wgstate_.well_state = WellState<double>(dummy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ public:
|
||||
{}
|
||||
|
||||
void computePotentials(const std::size_t,
|
||||
const WellState&,
|
||||
const WellState<double>&,
|
||||
std::string&,
|
||||
ExceptionType::ExcEnum&,
|
||||
DeferredLogger&) override
|
||||
|
@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(G1)
|
||||
//using EclProblem = Opm::EclProblem<TypeTag>;
|
||||
//using EclWellModel = typename EclProblem::EclWellModel;
|
||||
using WellModel = Opm::BlackoilWellModel<TypeTag>;
|
||||
using WellState = Opm::WellState;
|
||||
using WellState = Opm::WellState<double>;
|
||||
using StdWell = Opm::StandardWell<TypeTag>;
|
||||
using GasLiftSingleWell = Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GasLiftGroupInfo = Opm::GasLiftGroupInfo;
|
||||
|
@ -136,11 +136,11 @@ struct Setup
|
||||
};
|
||||
|
||||
namespace {
|
||||
Opm::WellState
|
||||
Opm::WellState<double>
|
||||
buildWellState(const Setup& setup, const std::size_t timeStep,
|
||||
std::vector<Opm::ParallelWellInfo>& pinfos)
|
||||
{
|
||||
auto state = Opm::WellState{setup.pu};
|
||||
auto state = Opm::WellState<double>{setup.pu};
|
||||
|
||||
const auto cpress =
|
||||
std::vector<double>(setup.grid.c_grid()->number_of_cells,
|
||||
@ -171,7 +171,7 @@ namespace {
|
||||
|
||||
|
||||
void setSegPress(const std::vector<Opm::Well>& wells,
|
||||
Opm::WellState& wstate)
|
||||
Opm::WellState<double>& wstate)
|
||||
{
|
||||
const auto nWell = wells.size();
|
||||
|
||||
@ -200,8 +200,8 @@ namespace {
|
||||
|
||||
|
||||
void setSegRates(const std::vector<Opm::Well>& wells,
|
||||
const Opm::PhaseUsage& pu,
|
||||
Opm::WellState& wstate)
|
||||
const Opm::PhaseUsage& pu,
|
||||
Opm::WellState<double>& wstate)
|
||||
{
|
||||
const auto wat = pu.phase_used[Opm::BlackoilPhases::Aqua];
|
||||
const auto iw = wat ? pu.phase_pos[Opm::BlackoilPhases::Aqua] : -1;
|
||||
|
Loading…
Reference in New Issue
Block a user