mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add StandardWellEval
This commit is contained in:
parent
bb050683f1
commit
eb06c4bd70
@ -66,6 +66,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/simulators/wells/MultisegmentWellGeneric.cpp
|
||||
opm/simulators/wells/ParallelWellInfo.cpp
|
||||
opm/simulators/wells/SegmentState.cpp
|
||||
opm/simulators/wells/StandardWellEval.cpp
|
||||
opm/simulators/wells/StandardWellGeneric.cpp
|
||||
opm/simulators/wells/TargetCalculator.cpp
|
||||
opm/simulators/wells/VFPHelpers.cpp
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAVE_CUDA || HAVE_OPENCL
|
||||
#include <opm/simulators/linalg/bda/WellContributions.hpp>
|
||||
#endif
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
|
@ -23,10 +23,6 @@
|
||||
#ifndef OPM_STANDARDWELL_HEADER_INCLUDED
|
||||
#define OPM_STANDARDWELL_HEADER_INCLUDED
|
||||
|
||||
#if HAVE_CUDA || HAVE_OPENCL
|
||||
#include <opm/simulators/linalg/bda/WellContributions.hpp>
|
||||
#endif
|
||||
|
||||
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
||||
#include <opm/simulators/wells/RateConverter.hpp>
|
||||
#include <opm/simulators/wells/StandardWellGeneric.hpp>
|
||||
@ -47,6 +43,8 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
|
||||
|
||||
#include <opm/simulators/wells/StandardWellEval.hpp>
|
||||
|
||||
#include <dune/common/dynvector.hh>
|
||||
#include <dune/common/dynmatrix.hh>
|
||||
|
||||
@ -59,11 +57,16 @@ namespace Opm
|
||||
|
||||
template<typename TypeTag>
|
||||
class StandardWell : public WellInterface<TypeTag>
|
||||
, public StandardWellGeneric<GetPropType<TypeTag, Properties::Scalar>>
|
||||
, public StandardWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
|
||||
GetPropType<TypeTag, Properties::Indices>,
|
||||
GetPropType<TypeTag, Properties::Scalar>>
|
||||
{
|
||||
|
||||
public:
|
||||
typedef WellInterface<TypeTag> Base;
|
||||
using StdWellEval = StandardWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
|
||||
GetPropType<TypeTag, Properties::Indices>,
|
||||
GetPropType<TypeTag, Properties::Scalar>>;
|
||||
|
||||
// TODO: some functions working with AD variables handles only with values (double) without
|
||||
// dealing with derivatives. It can be beneficial to make functions can work with either AD or scalar value.
|
||||
@ -89,6 +92,7 @@ namespace Opm
|
||||
using Base::has_solvent;
|
||||
using Base::has_zFraction;
|
||||
using Base::has_polymer;
|
||||
using Base::has_polymermw;
|
||||
using Base::has_foam;
|
||||
using Base::has_brine;
|
||||
using Base::has_energy;
|
||||
@ -135,9 +139,10 @@ namespace Opm
|
||||
using Base::Gas;
|
||||
|
||||
using typename Base::BVector;
|
||||
using typename Base::Eval;
|
||||
|
||||
typedef DenseAd::DynamicEvaluation<Scalar, numStaticWellEq + numEq + 1> EvalWell;
|
||||
using Eval = typename StdWellEval::Eval;
|
||||
using EvalWell = typename StdWellEval::EvalWell;
|
||||
using BVectorWell = typename StdWellEval::BVectorWell;
|
||||
|
||||
using Base::contiSolventEqIdx;
|
||||
using Base::contiZfracEqIdx;
|
||||
@ -166,10 +171,6 @@ namespace Opm
|
||||
|
||||
virtual void initPrimaryVariablesEvaluation() const override;
|
||||
|
||||
void updateWellStateWithTarget(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceReport getWellConvergence(const WellState& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
@ -181,11 +182,6 @@ namespace Opm
|
||||
/// r = r - C D^-1 Rw
|
||||
virtual void apply(BVector& r) const override;
|
||||
|
||||
#if HAVE_CUDA || HAVE_OPENCL
|
||||
/// add the contribution (C, D^-1, B matrices) of this Well to the WellContributions object
|
||||
void addWellContribution(WellContributions& wellContribs) const;
|
||||
#endif
|
||||
|
||||
/// using the solution x to recover the solution xw for wells and applying
|
||||
/// xw to update Well State
|
||||
virtual void recoverWellSolutionAndUpdateWellState(const BVector& x,
|
||||
@ -329,39 +325,6 @@ namespace Opm
|
||||
using Base::ipr_a_;
|
||||
using Base::ipr_b_;
|
||||
using Base::changed_to_stopped_this_step_;
|
||||
using typename StandardWellGeneric<Scalar>::BVectorWell;
|
||||
|
||||
|
||||
// total number of the well equations and primary variables
|
||||
// there might be extra equations be used, numWellEq will be updated during the initialization
|
||||
int numWellEq_ = numStaticWellEq;
|
||||
|
||||
// the values for the primary varibles
|
||||
// based on different solutioin strategies, the wells can have different primary variables
|
||||
mutable std::vector<double> primary_variables_;
|
||||
|
||||
// the Evaluation for the well primary variables, which contain derivativles and are used in AD calculation
|
||||
mutable std::vector<EvalWell> primary_variables_evaluation_;
|
||||
|
||||
// the saturations in the well bore under surface conditions at the beginning of the time step
|
||||
std::vector<double> F0_;
|
||||
|
||||
// Optimize only wells under THP control
|
||||
bool glift_optimize_only_thp_wells = true;
|
||||
|
||||
const EvalWell& getBhp() const;
|
||||
|
||||
EvalWell getQs(const int comp_idx) const;
|
||||
|
||||
const EvalWell& getWQTotal() const;
|
||||
|
||||
EvalWell wellVolumeFractionScaled(const int phase) const;
|
||||
|
||||
EvalWell wellVolumeFraction(const unsigned compIdx) const;
|
||||
|
||||
EvalWell wellSurfaceVolumeFraction(const int phase) const;
|
||||
|
||||
EvalWell extendEval(const Eval& in) const;
|
||||
|
||||
Eval getPerfCellPressure(const FluidState& fs) const;
|
||||
|
||||
@ -382,14 +345,6 @@ namespace Opm
|
||||
std::vector<double>& rvmax_perf,
|
||||
std::vector<double>& surf_dens_perf) const;
|
||||
|
||||
// TODO: not total sure whether it is a good idea to put this function here
|
||||
// the major reason to put here is to avoid the usage of Wells struct
|
||||
void computeConnectionDensities(const std::vector<double>& perfComponentRates,
|
||||
const std::vector<double>& b_perf,
|
||||
const std::vector<double>& rsmax_perf,
|
||||
const std::vector<double>& rvmax_perf,
|
||||
const std::vector<double>& surf_dens_perf);
|
||||
|
||||
void computeWellConnectionDensitesPressures(const Simulator& ebosSimulator,
|
||||
const WellState& well_state,
|
||||
const std::vector<double>& b_perf,
|
||||
@ -397,9 +352,6 @@ namespace Opm
|
||||
const std::vector<double>& rvmax_perf,
|
||||
const std::vector<double>& surf_dens_perf);
|
||||
|
||||
// computing the accumulation term for later use in well mass equations
|
||||
void computeAccumWell();
|
||||
|
||||
void computeWellConnectionPressures(const Simulator& ebosSimulator,
|
||||
const WellState& well_state);
|
||||
|
||||
@ -447,19 +399,6 @@ namespace Opm
|
||||
|
||||
void updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
|
||||
void updateThp(WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
||||
void assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// handle the non reasonable fractions due to numerical overshoot
|
||||
void processFractions() const;
|
||||
|
||||
|
||||
virtual void assembleWellEqWithoutIteration(const Simulator& ebosSimulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
@ -508,11 +447,6 @@ namespace Opm
|
||||
// TODO: looking for better alternative to avoid wrong-signed well rates
|
||||
bool openCrossFlowAvoidSingularity(const Simulator& ebos_simulator) const;
|
||||
|
||||
// calculate a relaxation factor to avoid overshoot of the fractions for producers
|
||||
// which might result in negative rates
|
||||
static double relaxationFactorFractionsProducer(const std::vector<double>& primary_variables,
|
||||
const BVectorWell& dwells);
|
||||
|
||||
// calculate the skin pressure based on water velocity, throughput and polymer concentration.
|
||||
// throughput is used to describe the formation damage during water/polymer injection.
|
||||
// calculated skin pressure will be applied to the drawdown during perforation rate calculation
|
||||
|
1281
opm/simulators/wells/StandardWellEval.cpp
Normal file
1281
opm/simulators/wells/StandardWellEval.cpp
Normal file
File diff suppressed because it is too large
Load Diff
195
opm/simulators/wells/StandardWellEval.hpp
Normal file
195
opm/simulators/wells/StandardWellEval.hpp
Normal file
@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
||||
Copyright 2017 Statoil ASA.
|
||||
Copyright 2016 - 2017 IRIS AS.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
|
||||
#define OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
|
||||
|
||||
#include <opm/simulators/wells/StandardWellGeneric.hpp>
|
||||
|
||||
#include <opm/material/densead/DynamicEvaluation.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
class ConvergenceReport;
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellContributions;
|
||||
template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
class StandardWellEval : public StandardWellGeneric<Scalar>
|
||||
{
|
||||
protected:
|
||||
// number of the conservation equations
|
||||
static constexpr int numWellConservationEq = Indices::numPhases + Indices::numSolvents;
|
||||
// number of the well control equations
|
||||
static constexpr int numWellControlEq = 1;
|
||||
// number of the well equations that will always be used
|
||||
// based on the solution strategy, there might be other well equations be introduced
|
||||
static constexpr int numStaticWellEq = numWellConservationEq + numWellControlEq;
|
||||
// the index for Bhp in primary variables and also the index of well control equation
|
||||
// they both will be the last one in their respective system.
|
||||
// TODO: we should have indices for the well equations and well primary variables separately
|
||||
static constexpr int Bhp = numStaticWellEq - numWellControlEq;
|
||||
|
||||
// the positions of the primary variables for StandardWell
|
||||
// the first one is the weighted total rate (WQ_t), the second and the third ones are F_w and F_g,
|
||||
// which represent the fraction of Water and Gas based on the weighted total rate, the last one is BHP.
|
||||
// correspondingly, we have four well equations for blackoil model, the first three are mass
|
||||
// converstation equations, and the last one is the well control equation.
|
||||
// primary variables related to other components, will be before the Bhp and after F_g.
|
||||
// well control equation is always the last well equation.
|
||||
// TODO: in the current implementation, we use the well rate as the first primary variables for injectors,
|
||||
// instead of G_t.
|
||||
static constexpr bool gasoil = Indices::numPhases == 2 && (Indices::compositionSwitchIdx >= 0);
|
||||
static constexpr int WQTotal = 0;
|
||||
static constexpr int WFrac = gasoil ? -1000 : 1;
|
||||
static constexpr int GFrac = gasoil ? 1 : 2;
|
||||
static constexpr int SFrac = !Indices::enableSolvent ? -1000 : 3;
|
||||
|
||||
public:
|
||||
using EvalWell = DenseAd::DynamicEvaluation<Scalar, numStaticWellEq + Indices::numEq + 1>;
|
||||
using Eval = DenseAd::Evaluation<Scalar, Indices::numEq>;
|
||||
using BVectorWell = typename StandardWellGeneric<Scalar>::BVectorWell;
|
||||
|
||||
#if HAVE_CUDA || HAVE_OPENCL
|
||||
/// add the contribution (C, D^-1, B matrices) of this Well to the WellContributions object
|
||||
void addWellContribution(WellContributions& wellContribs) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
StandardWellEval(const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif);
|
||||
|
||||
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif_;
|
||||
|
||||
void initPrimaryVariablesEvaluation() const;
|
||||
|
||||
const EvalWell& getBhp() const
|
||||
{
|
||||
return primary_variables_evaluation_[Bhp];
|
||||
}
|
||||
|
||||
const EvalWell& getWQTotal() const
|
||||
{
|
||||
return primary_variables_evaluation_[WQTotal];
|
||||
}
|
||||
|
||||
EvalWell extendEval(const Eval& in) const;
|
||||
EvalWell getQs(const int compIdx) const;
|
||||
EvalWell wellSurfaceVolumeFraction(const int compIdx) const;
|
||||
EvalWell wellVolumeFraction(const unsigned compIdx) const;
|
||||
EvalWell wellVolumeFractionScaled(const int phase) const;
|
||||
|
||||
// calculate a relaxation factor to avoid overshoot of the fractions for producers
|
||||
// which might result in negative rates
|
||||
static double relaxationFactorFractionsProducer(const std::vector<double>& primary_variables,
|
||||
const BVectorWell& dwells);
|
||||
|
||||
void assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// computing the accumulation term for later use in well mass equations
|
||||
void computeAccumWell();
|
||||
|
||||
// TODO: not total sure whether it is a good idea to put this function here
|
||||
// the major reason to put here is to avoid the usage of Wells struct
|
||||
void computeConnectionDensities(const std::vector<double>& perfComponentRates,
|
||||
const std::vector<double>& b_perf,
|
||||
const std::vector<double>& rsmax_perf,
|
||||
const std::vector<double>& rvmax_perf,
|
||||
const std::vector<double>& surf_dens_perf);
|
||||
|
||||
void computePerfRate(const std::vector<EvalWell>& mob,
|
||||
const EvalWell& pressure,
|
||||
const EvalWell& bhp,
|
||||
const EvalWell& rs,
|
||||
const EvalWell& rv,
|
||||
std::vector<EvalWell>& b_perfcells_dense,
|
||||
const double Tw,
|
||||
const int perf,
|
||||
const bool allow_cf,
|
||||
const bool enable_polymermw,
|
||||
std::vector<EvalWell>& cq_s,
|
||||
double& perf_dis_gas_rate,
|
||||
double& perf_vap_oil_rate,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
ConvergenceReport getWellConvergence(const WellState& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
const double tol_wells,
|
||||
const double maxResidualAllowed,
|
||||
std::vector<double>& res,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void init(std::vector<double>& perf_depth,
|
||||
const std::vector<double>& depth_arg,
|
||||
const int num_cells,
|
||||
const bool has_polymermw);
|
||||
|
||||
// handle the non reasonable fractions due to numerical overshoot
|
||||
void processFractions() const;
|
||||
|
||||
void updatePrimaryVariables(const WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void updatePrimaryVariablesPolyMW(const BVectorWell& dwells) const;
|
||||
|
||||
void updateWellStateFromPrimaryVariables(WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
||||
const double dFLimit,
|
||||
const double dBHPLimit) const;
|
||||
|
||||
void updateWellStateFromPrimaryVariablesPolyMW(WellState& well_state) const;
|
||||
|
||||
void updateThp(WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
// total number of the well equations and primary variables
|
||||
// there might be extra equations be used, numWellEq will be updated during the initialization
|
||||
int numWellEq_ = numStaticWellEq;
|
||||
|
||||
// the values for the primary varibles
|
||||
// based on different solutioin strategies, the wells can have different primary variables
|
||||
mutable std::vector<double> primary_variables_;
|
||||
|
||||
// the Evaluation for the well primary variables, which contain derivativles and are used in AD calculation
|
||||
mutable std::vector<EvalWell> primary_variables_evaluation_;
|
||||
|
||||
// the saturations in the well bore under surface conditions at the beginning of the time step
|
||||
std::vector<double> F0_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
|
@ -48,12 +48,11 @@ namespace Opm
|
||||
template<class Scalar>
|
||||
StandardWellGeneric<Scalar>::
|
||||
StandardWellGeneric(int Bhp,
|
||||
const ParallelWellInfo& pw_info,
|
||||
const WellInterfaceGeneric& baseif)
|
||||
: baseif_(baseif)
|
||||
, perf_densities_(baseif_.numPerfs())
|
||||
, perf_pressure_diffs_(baseif_.numPerfs())
|
||||
, parallelB_(duneB_, pw_info)
|
||||
, parallelB_(duneB_, baseif_.parallelWellInfo())
|
||||
, Bhp_(Bhp)
|
||||
{
|
||||
duneB_.setBuildMode(OffDiagMatWell::row_wise);
|
||||
|
@ -72,7 +72,6 @@ public:
|
||||
|
||||
protected:
|
||||
StandardWellGeneric(int Bhp,
|
||||
const ParallelWellInfo& pw_info,
|
||||
const WellInterfaceGeneric& baseif);
|
||||
|
||||
// calculate a relaxation factor to avoid overshoot of total rates
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -66,7 +66,7 @@ getGroupInjectionControl(const Group& group,
|
||||
const EvalWell& injection_rate,
|
||||
EvalWell& control_eq,
|
||||
double efficiencyFactor,
|
||||
DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// Setting some defaults to silence warnings below.
|
||||
// Will be overwritten in the switch statement.
|
||||
@ -183,7 +183,7 @@ getGroupProductionControl(const Group& group,
|
||||
const EvalWell& bhp,
|
||||
const std::vector<EvalWell>& rates,
|
||||
EvalWell& control_eq,
|
||||
double efficiencyFactor)
|
||||
double efficiencyFactor) const
|
||||
{
|
||||
const Group::ProductionCMode& currentGroupControl = group_state.production_control(group.name());
|
||||
if (currentGroupControl == Group::ProductionCMode::FLD ||
|
||||
@ -278,7 +278,7 @@ assembleControlEqProd_(const WellState& well_state,
|
||||
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
||||
const std::function<EvalWell()>& bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto current = well_state.currentProductionControl(baseif_.indexOfWell());
|
||||
const auto& pu = baseif_.phaseUsage();
|
||||
@ -392,7 +392,7 @@ assembleControlEqInj_(const WellState& well_state,
|
||||
const EvalWell& injection_rate,
|
||||
const std::function<EvalWell()>& bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto current = well_state.currentInjectionControl(baseif_.indexOfWell());
|
||||
const InjectorType injectorType = controls.injector_type;
|
||||
@ -514,7 +514,7 @@ assembleControlEqProd_<__VA_ARGS__>(const WellState&, \
|
||||
const std::vector<__VA_ARGS__>&, \
|
||||
const std::function<__VA_ARGS__()>&, \
|
||||
__VA_ARGS__&, \
|
||||
DeferredLogger&); \
|
||||
DeferredLogger&) const; \
|
||||
template void WellInterfaceEval<A>:: \
|
||||
assembleControlEqInj_<__VA_ARGS__>(const WellState&, \
|
||||
const GroupState&, \
|
||||
@ -525,7 +525,7 @@ assembleControlEqInj_<__VA_ARGS__>(const WellState&, \
|
||||
const __VA_ARGS__&, \
|
||||
const std::function<__VA_ARGS__()>&, \
|
||||
__VA_ARGS__&, \
|
||||
DeferredLogger&); \
|
||||
DeferredLogger&) const; \
|
||||
template __VA_ARGS__ WellInterfaceEval<A>:: \
|
||||
calculateBhpFromThp<__VA_ARGS__>(const WellState&, \
|
||||
const std::vector<__VA_ARGS__>&, \
|
||||
|
@ -48,33 +48,14 @@ class WellInterfaceEval {
|
||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
|
||||
protected:
|
||||
WellInterfaceEval(const WellInterfaceFluidSystem<FluidSystem>& baseif);
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupInjectionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
const EvalWell& bhp,
|
||||
const EvalWell& injection_rate,
|
||||
EvalWell& control_eq,
|
||||
double efficiencyFactor,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupProductionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const EvalWell& bhp,
|
||||
const std::vector<EvalWell>& rates,
|
||||
EvalWell& control_eq,
|
||||
double efficiencyFactor);
|
||||
public:
|
||||
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, class BhpFromThpFunc>
|
||||
void assembleControlEqProd(const WellState& well_state,
|
||||
@ -86,7 +67,7 @@ protected:
|
||||
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
||||
BhpFromThpFunc bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
std::function<EvalWell()> eval = [&bhp_from_thp]() { return bhp_from_thp(); };
|
||||
assembleControlEqProd_(well_state,
|
||||
@ -111,7 +92,7 @@ protected:
|
||||
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
||||
const std::function<EvalWell()>& bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger);
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class EvalWell, class BhpFromThpFunc>
|
||||
void assembleControlEqInj(const WellState& well_state,
|
||||
@ -123,7 +104,7 @@ protected:
|
||||
const EvalWell& injection_rate,
|
||||
BhpFromThpFunc bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger)
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
std::function<EvalWell()> eval = [&bhp_from_thp]() { return bhp_from_thp(); };
|
||||
assembleControlEqInj_(well_state,
|
||||
@ -148,15 +129,59 @@ protected:
|
||||
const EvalWell& injection_rate,
|
||||
const std::function<EvalWell()>& bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger);
|
||||
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;
|
||||
protected:
|
||||
WellInterfaceEval(const WellInterfaceFluidSystem<FluidSystem>& baseif);
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupInjectionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
const EvalWell& bhp,
|
||||
const EvalWell& injection_rate,
|
||||
EvalWell& control_eq,
|
||||
double efficiencyFactor,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupProductionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const EvalWell& bhp,
|
||||
const std::vector<EvalWell>& rates,
|
||||
EvalWell& control_eq,
|
||||
double efficiencyFactor) const;
|
||||
|
||||
template<class EvalWell>
|
||||
void assembleControlEqProd(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::ProductionControls& controls,
|
||||
const EvalWell& bhp,
|
||||
const std::vector<EvalWell>& rates, // Always 3 canonical rates.
|
||||
const EvalWell& bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class EvalWell>
|
||||
void assembleControlEqInj_(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& controls,
|
||||
const EvalWell& bhp,
|
||||
const EvalWell& injection_rate,
|
||||
const std::function<EvalWell()>& bhp_from_thp,
|
||||
EvalWell& control_eq,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
const WellInterfaceFluidSystem<FluidSystem>& baseif_;
|
||||
};
|
||||
|
@ -118,6 +118,10 @@ public:
|
||||
return guide_rate_;
|
||||
}
|
||||
|
||||
int numComponents() const{
|
||||
return num_components_;
|
||||
}
|
||||
|
||||
int numPhases() const {
|
||||
return number_of_phases_;
|
||||
}
|
||||
@ -156,13 +160,13 @@ public:
|
||||
|
||||
double getTHPConstraint(const SummaryState& summaryState) const;
|
||||
double getALQ(const WellState& well_state) const;
|
||||
double wsolvent() const;
|
||||
|
||||
protected:
|
||||
// whether a well is specified with a non-zero and valid VFP table number
|
||||
bool isVFPActive(DeferredLogger& deferred_logger) const;
|
||||
|
||||
protected:
|
||||
bool getAllowCrossFlow() const;
|
||||
double wsolvent() const;
|
||||
double mostStrictBhpFromBhpLimits(const SummaryState& summaryState) const;
|
||||
void updateWellTestStatePhysical(const WellState& well_state,
|
||||
const double simulation_time,
|
||||
|
@ -129,6 +129,7 @@ INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,fa
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,false,0u,2u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,2u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,true,0u,2u>)
|
||||
|
||||
// Blackoil
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,0u,0u,0u,false,false,0u>)
|
||||
@ -138,6 +139,7 @@ INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<1u,0u,0u,0u,false,false,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,1u,0u,0u,false,false,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,0u,1u,0u,false,false,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,0u,0u,1u,false,false,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,0u,0u,1u,false,false,1u>)
|
||||
|
||||
// Alternative indices
|
||||
INSTANCE(EclAlternativeBlackOilIndexTraits,BlackOilIndices<0u,0u,0u,0u,false,false,0u>)
|
||||
|
@ -38,6 +38,10 @@ public:
|
||||
using WellInterfaceFluidSystem<FluidSystem>::Oil;
|
||||
using WellInterfaceFluidSystem<FluidSystem>::Water;
|
||||
|
||||
int flowPhaseToEbosCompIdx(const int phaseIdx) const;
|
||||
int ebosCompIdxToFlowCompIdx(const unsigned compIdx) const;
|
||||
double scalingFactor(const int phaseIdx) const;
|
||||
|
||||
protected:
|
||||
WellInterfaceIndices(const Well& well,
|
||||
const ParallelWellInfo& parallel_well_info,
|
||||
@ -48,11 +52,6 @@ protected:
|
||||
const int num_phases,
|
||||
const int index_of_well,
|
||||
const std::vector<PerforationData>& perf_data);
|
||||
|
||||
int flowPhaseToEbosCompIdx( const int phaseIdx ) const;
|
||||
int ebosCompIdxToFlowCompIdx( const unsigned compIdx ) const;
|
||||
|
||||
double scalingFactor(const int phaseIdx) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user