2017-06-15 04:41:03 -05:00
|
|
|
/*
|
2017-08-03 09:45:59 -05:00
|
|
|
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
2017-06-15 04:41:03 -05:00
|
|
|
Copyright 2017 Statoil ASA.
|
2017-08-03 09:45:59 -05:00
|
|
|
Copyright 2016 - 2017 IRIS AS.
|
2017-06-15 04:41:03 -05:00
|
|
|
|
|
|
|
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_HEADER_INCLUDED
|
|
|
|
#define OPM_STANDARDWELL_HEADER_INCLUDED
|
|
|
|
|
2021-05-12 01:47:22 -05:00
|
|
|
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
2019-06-20 02:09:19 -05:00
|
|
|
#include <opm/simulators/wells/RateConverter.hpp>
|
2021-03-03 06:59:26 -06:00
|
|
|
#include <opm/simulators/wells/VFPInjProperties.hpp>
|
|
|
|
#include <opm/simulators/wells/VFPProdProperties.hpp>
|
2019-05-07 06:06:02 -05:00
|
|
|
#include <opm/simulators/wells/WellInterface.hpp>
|
2020-10-09 06:38:33 -05:00
|
|
|
#include <opm/simulators/wells/WellProdIndexCalculator.hpp>
|
2020-10-09 08:09:28 -05:00
|
|
|
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
2017-06-15 04:41:03 -05:00
|
|
|
|
2019-09-16 04:22:14 -05:00
|
|
|
#include <opm/models/blackoil/blackoilpolymermodules.hh>
|
|
|
|
#include <opm/models/blackoil/blackoilsolventmodules.hh>
|
2020-10-10 09:20:25 -05:00
|
|
|
#include <opm/models/blackoil/blackoilextbomodules.hh>
|
2019-09-16 04:22:14 -05:00
|
|
|
#include <opm/models/blackoil/blackoilfoammodules.hh>
|
2019-12-03 10:48:17 -06:00
|
|
|
#include <opm/models/blackoil/blackoilbrinemodules.hh>
|
2021-10-06 12:32:35 -05:00
|
|
|
#include <opm/models/blackoil/blackoilmicpmodules.hh>
|
2019-07-04 02:50:08 -05:00
|
|
|
|
2022-12-23 06:31:41 -06:00
|
|
|
#include <opm/material/densead/Evaluation.hpp>
|
2021-12-14 01:30:15 -06:00
|
|
|
#include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
|
2019-03-25 06:52:34 -05:00
|
|
|
|
2021-06-01 08:49:24 -05:00
|
|
|
#include <opm/simulators/wells/StandardWellEval.hpp>
|
|
|
|
|
2019-03-25 06:52:34 -05:00
|
|
|
#include <dune/common/dynvector.hh>
|
|
|
|
#include <dune/common/dynmatrix.hh>
|
|
|
|
|
2021-03-03 06:59:26 -06:00
|
|
|
#include <memory>
|
2020-02-19 04:02:13 -06:00
|
|
|
#include <optional>
|
2019-10-02 04:16:52 -05:00
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
2017-06-19 07:49:49 -05:00
|
|
|
template<typename TypeTag>
|
2021-06-03 08:34:14 -05:00
|
|
|
class StandardWell : public WellInterface<TypeTag>
|
2021-06-01 08:49:24 -05:00
|
|
|
, public StandardWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
|
|
|
|
GetPropType<TypeTag, Properties::Indices>,
|
|
|
|
GetPropType<TypeTag, Properties::Scalar>>
|
2017-06-15 04:41:03 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2023-01-05 05:36:46 -06:00
|
|
|
using Base = WellInterface<TypeTag>;
|
2021-06-01 08:49:24 -05:00
|
|
|
using StdWellEval = StandardWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
|
|
|
|
GetPropType<TypeTag, Properties::Indices>,
|
|
|
|
GetPropType<TypeTag, Properties::Scalar>>;
|
2018-08-16 04:51:36 -05:00
|
|
|
|
2017-06-29 06:52:31 -05:00
|
|
|
// 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.
|
|
|
|
// And also, it can also be beneficial to make these functions hanle different types of AD variables.
|
2017-08-02 09:19:27 -05:00
|
|
|
using typename Base::Simulator;
|
|
|
|
using typename Base::IntensiveQuantities;
|
|
|
|
using typename Base::FluidSystem;
|
|
|
|
using typename Base::MaterialLaw;
|
|
|
|
using typename Base::ModelParameters;
|
2017-12-04 02:14:08 -06:00
|
|
|
using typename Base::Indices;
|
2017-11-23 01:37:30 -06:00
|
|
|
using typename Base::RateConverterType;
|
2019-10-02 05:48:29 -05:00
|
|
|
using typename Base::SparseMatrixAdapter;
|
2019-10-09 08:24:23 -05:00
|
|
|
using typename Base::FluidState;
|
2020-11-03 04:11:00 -06:00
|
|
|
using typename Base::RateVector;
|
2017-06-19 09:46:06 -05:00
|
|
|
|
2018-03-26 03:50:33 -05:00
|
|
|
using Base::has_solvent;
|
2020-10-10 09:20:25 -05:00
|
|
|
using Base::has_zFraction;
|
2018-03-26 03:50:33 -05:00
|
|
|
using Base::has_polymer;
|
2021-06-01 08:49:24 -05:00
|
|
|
using Base::has_polymermw;
|
2019-04-26 03:38:37 -05:00
|
|
|
using Base::has_foam;
|
2019-12-03 10:48:17 -06:00
|
|
|
using Base::has_brine;
|
2018-03-26 03:50:33 -05:00
|
|
|
using Base::has_energy;
|
2021-10-06 12:32:35 -05:00
|
|
|
using Base::has_micp;
|
2018-03-26 03:50:33 -05:00
|
|
|
|
2021-05-25 05:00:04 -05:00
|
|
|
using PolymerModule = BlackOilPolymerModule<TypeTag>;
|
|
|
|
using FoamModule = BlackOilFoamModule<TypeTag>;
|
|
|
|
using BrineModule = BlackOilBrineModule<TypeTag>;
|
2022-06-10 04:08:24 -05:00
|
|
|
using typename Base::PressureMatrix;
|
2019-07-04 02:50:08 -05:00
|
|
|
|
2018-05-18 03:57:08 -05:00
|
|
|
// number of the conservation equations
|
2021-09-06 05:47:21 -05:00
|
|
|
static constexpr int numWellConservationEq = Indices::numPhases + Indices::numSolvents;
|
2018-05-18 03:57:08 -05:00
|
|
|
// number of the well control equations
|
2021-09-06 05:47:21 -05:00
|
|
|
static constexpr int numWellControlEq = 1;
|
2018-12-12 08:58:15 -06:00
|
|
|
// number of the well equations that will always be used
|
|
|
|
// based on the solution strategy, there might be other well equations be introduced
|
2021-09-06 05:47:21 -05:00
|
|
|
static constexpr int numStaticWellEq = numWellConservationEq + numWellControlEq;
|
2018-05-09 08:07:43 -05:00
|
|
|
|
|
|
|
// the index for Bhp in primary variables and also the index of well control equation
|
2018-05-11 07:21:53 -05:00
|
|
|
// 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
|
2021-09-06 05:47:21 -05:00
|
|
|
static constexpr int Bhp = numStaticWellEq - numWellControlEq;
|
2018-12-12 08:58:15 -06:00
|
|
|
|
2022-11-09 05:26:46 -06:00
|
|
|
using StdWellEval::WQTotal;
|
|
|
|
|
2017-08-02 09:19:27 -05:00
|
|
|
using typename Base::Scalar;
|
2017-08-22 07:49:30 -05:00
|
|
|
|
2017-08-04 06:07:16 -05:00
|
|
|
|
2017-08-21 04:26:21 -05:00
|
|
|
using Base::name;
|
2017-11-08 06:57:36 -06:00
|
|
|
using Base::Water;
|
|
|
|
using Base::Oil;
|
|
|
|
using Base::Gas;
|
2017-08-04 06:07:16 -05:00
|
|
|
|
2017-08-02 09:19:27 -05:00
|
|
|
using typename Base::BVector;
|
2017-06-15 10:19:49 -05:00
|
|
|
|
2021-06-01 08:49:24 -05:00
|
|
|
using Eval = typename StdWellEval::Eval;
|
|
|
|
using EvalWell = typename StdWellEval::EvalWell;
|
|
|
|
using BVectorWell = typename StdWellEval::BVectorWell;
|
2017-08-03 08:14:36 -05:00
|
|
|
|
2020-10-09 08:09:28 -05:00
|
|
|
StandardWell(const Well& well,
|
|
|
|
const ParallelWellInfo& pw_info,
|
|
|
|
const int time_step,
|
2017-11-22 07:39:42 -06:00
|
|
|
const ModelParameters& param,
|
|
|
|
const RateConverterType& rate_converter,
|
2017-11-30 09:31:48 -06:00
|
|
|
const int pvtRegionIdx,
|
2019-10-23 02:09:45 -05:00
|
|
|
const int num_components,
|
|
|
|
const int num_phases,
|
|
|
|
const int index_of_well,
|
|
|
|
const std::vector<PerforationData>& perf_data);
|
2017-06-15 04:41:03 -05:00
|
|
|
|
2017-08-04 06:07:16 -05:00
|
|
|
virtual void init(const PhaseUsage* phase_usage_arg,
|
|
|
|
const std::vector<double>& depth_arg,
|
|
|
|
const double gravity_arg,
|
2020-11-27 00:57:55 -06:00
|
|
|
const int num_cells,
|
2022-04-12 01:44:52 -05:00
|
|
|
const std::vector< Scalar >& B_avg,
|
|
|
|
const bool changed_to_open_this_step) override;
|
2017-06-15 04:41:03 -05:00
|
|
|
|
|
|
|
|
2022-11-09 06:01:30 -06:00
|
|
|
void initPrimaryVariablesEvaluation() override;
|
2017-06-19 08:24:49 -05:00
|
|
|
|
2017-08-04 06:07:16 -05:00
|
|
|
/// check whether the well equations get converged for this well
|
2023-03-30 08:49:27 -05:00
|
|
|
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
|
|
|
const WellState& well_state,
|
2019-08-07 07:13:11 -05:00
|
|
|
const std::vector<double>& B_avg,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger,
|
2023-03-30 08:49:27 -05:00
|
|
|
const bool relax_tolerance) const override;
|
2017-06-26 07:35:43 -05:00
|
|
|
|
2017-08-22 10:14:52 -05:00
|
|
|
/// Ax = Ax - C D^-1 B x
|
2018-08-16 04:51:36 -05:00
|
|
|
virtual void apply(const BVector& x, BVector& Ax) const override;
|
2017-08-22 10:14:52 -05:00
|
|
|
/// r = r - C D^-1 Rw
|
2018-08-16 04:51:36 -05:00
|
|
|
virtual void apply(BVector& r) const override;
|
2017-07-21 07:21:17 -05:00
|
|
|
|
2017-08-04 06:07:16 -05:00
|
|
|
/// using the solution x to recover the solution xw for wells and applying
|
|
|
|
/// xw to update Well State
|
2023-03-22 09:10:00 -05:00
|
|
|
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
|
|
|
const BVector& x,
|
2022-11-09 06:01:30 -06:00
|
|
|
WellState& well_state,
|
|
|
|
DeferredLogger& deferred_logger) override;
|
2017-07-21 08:30:34 -05:00
|
|
|
|
2017-08-04 06:07:16 -05:00
|
|
|
/// computing the well potentials for group control
|
2017-07-24 08:09:44 -05:00
|
|
|
virtual void computeWellPotentials(const Simulator& ebosSimulator,
|
|
|
|
const WellState& well_state,
|
2019-02-03 01:13:11 -06:00
|
|
|
std::vector<double>& well_potentials,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) /* const */ override;
|
2017-08-07 10:49:35 -05:00
|
|
|
|
2023-03-22 09:10:00 -05:00
|
|
|
void updatePrimaryVariables(const SummaryState& summary_state,
|
|
|
|
const WellState& well_state,
|
|
|
|
DeferredLogger& deferred_logger) override;
|
2017-08-07 10:49:35 -05:00
|
|
|
|
2023-04-21 03:17:03 -05:00
|
|
|
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
|
|
|
WellState& well_state,
|
|
|
|
DeferredLogger& deferred_logger) override;
|
2017-09-05 04:09:58 -05:00
|
|
|
|
2017-09-05 04:20:43 -05:00
|
|
|
virtual void calculateExplicitQuantities(const Simulator& ebosSimulator,
|
2019-02-07 07:43:17 -06:00
|
|
|
const WellState& well_state,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) override; // should be const?
|
2018-02-26 05:23:20 -06:00
|
|
|
|
2020-10-09 06:38:33 -05:00
|
|
|
virtual void updateProductivityIndex(const Simulator& ebosSimulator,
|
|
|
|
const WellProdIndexCalculator& wellPICalc,
|
|
|
|
WellState& well_state,
|
|
|
|
DeferredLogger& deferred_logger) const override;
|
|
|
|
|
2021-01-04 08:18:23 -06:00
|
|
|
virtual void addWellContributions(SparseMatrixAdapter& mat) const override;
|
|
|
|
|
2022-04-28 02:32:07 -05:00
|
|
|
virtual void addWellPressureEquations(PressureMatrix& mat,
|
|
|
|
const BVector& x,
|
|
|
|
const int pressureVarIndex,
|
|
|
|
const bool use_well_weights,
|
|
|
|
const WellState& well_state) const override;
|
2018-02-26 05:23:20 -06:00
|
|
|
|
2020-06-02 07:54:45 -05:00
|
|
|
// iterate well equations with the specified control until converged
|
|
|
|
bool iterateWellEqWithControl(const Simulator& ebosSimulator,
|
|
|
|
const double dt,
|
|
|
|
const Well::InjectionControls& inj_controls,
|
|
|
|
const Well::ProductionControls& prod_controls,
|
|
|
|
WellState& well_state,
|
2021-04-22 10:31:21 -05:00
|
|
|
const GroupState& group_state,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) override;
|
2020-06-02 07:54:45 -05:00
|
|
|
|
2018-02-26 05:23:20 -06:00
|
|
|
/// \brief Wether the Jacobian will also have well contributions in it.
|
2018-08-16 04:51:36 -05:00
|
|
|
virtual bool jacobianContainsWellContributions() const override
|
2018-02-26 05:23:20 -06:00
|
|
|
{
|
2021-09-06 05:58:16 -05:00
|
|
|
return this->param_.matrix_add_well_contributions_;
|
2018-02-26 05:23:20 -06:00
|
|
|
}
|
2018-08-16 04:51:36 -05:00
|
|
|
|
2020-09-30 03:04:39 -05:00
|
|
|
/* returns BHP */
|
|
|
|
double computeWellRatesAndBhpWithThpAlqProd(const Simulator &ebos_simulator,
|
|
|
|
const SummaryState &summary_state,
|
|
|
|
DeferredLogger &deferred_logger,
|
|
|
|
std::vector<double> &potentials,
|
|
|
|
double alq) const;
|
|
|
|
|
|
|
|
void computeWellRatesWithThpAlqProd(
|
|
|
|
const Simulator &ebos_simulator,
|
|
|
|
const SummaryState &summary_state,
|
|
|
|
DeferredLogger &deferred_logger,
|
|
|
|
std::vector<double> &potentials,
|
|
|
|
double alq) const;
|
|
|
|
|
2022-10-19 05:23:02 -05:00
|
|
|
std::optional<double> computeBhpAtThpLimitProdWithAlq(
|
2020-09-30 03:04:39 -05:00
|
|
|
const Simulator& ebos_simulator,
|
|
|
|
const SummaryState& summary_state,
|
2022-10-19 05:23:02 -05:00
|
|
|
const double alq_value,
|
|
|
|
DeferredLogger& deferred_logger) const override;
|
2020-09-30 03:04:39 -05:00
|
|
|
|
2022-02-07 04:28:35 -06:00
|
|
|
virtual void computeWellRatesWithBhp(
|
2020-09-30 03:04:39 -05:00
|
|
|
const Simulator& ebosSimulator,
|
|
|
|
const double& bhp,
|
|
|
|
std::vector<double>& well_flux,
|
2022-02-07 04:28:35 -06:00
|
|
|
DeferredLogger& deferred_logger) const override;
|
2020-09-30 03:04:39 -05:00
|
|
|
|
|
|
|
// NOTE: These cannot be protected since they are used by GasLiftRuntime
|
|
|
|
using Base::phaseUsage;
|
|
|
|
using Base::vfp_properties_;
|
|
|
|
|
2020-10-15 07:15:05 -05:00
|
|
|
virtual std::vector<double> computeCurrentWellRates(const Simulator& ebosSimulator,
|
|
|
|
DeferredLogger& deferred_logger) const override;
|
2020-05-15 04:21:32 -05:00
|
|
|
|
2020-10-26 11:33:07 -05:00
|
|
|
void computeConnLevelProdInd(const FluidState& fs,
|
2020-11-06 14:13:10 -06:00
|
|
|
const std::function<double(const double)>& connPICalc,
|
2020-10-26 11:33:07 -05:00
|
|
|
const std::vector<EvalWell>& mobility,
|
|
|
|
double* connPI) const;
|
|
|
|
|
2020-11-06 14:13:10 -06:00
|
|
|
void computeConnLevelInjInd(const typename StandardWell<TypeTag>::FluidState& fs,
|
|
|
|
const Phase preferred_phase,
|
|
|
|
const std::function<double(const double)>& connIICalc,
|
2020-10-26 11:33:07 -05:00
|
|
|
const std::vector<EvalWell>& mobility,
|
|
|
|
double* connII,
|
|
|
|
DeferredLogger& deferred_logger) const;
|
2017-08-04 04:20:55 -05:00
|
|
|
|
2021-05-10 02:41:18 -05:00
|
|
|
|
2020-10-26 11:33:07 -05:00
|
|
|
protected:
|
2022-06-23 08:14:36 -05:00
|
|
|
bool regularize_;
|
|
|
|
|
2017-08-21 07:16:24 -05:00
|
|
|
// updating the well_state based on well solution dwells
|
2023-03-22 09:10:00 -05:00
|
|
|
void updateWellState(const SummaryState& summary_state,
|
|
|
|
const BVectorWell& dwells,
|
2019-02-07 07:43:17 -06:00
|
|
|
WellState& well_state,
|
2022-11-09 06:05:40 -06:00
|
|
|
DeferredLogger& deferred_logger);
|
2017-08-21 07:16:24 -05:00
|
|
|
|
2017-06-23 07:55:56 -05:00
|
|
|
// calculate the properties for the well connections
|
|
|
|
// to calulate the pressure difference between well connections.
|
2023-05-04 07:27:49 -05:00
|
|
|
using WellConnectionProps = typename StdWellEval::StdWellConnections::Properties;
|
2017-06-23 07:55:56 -05:00
|
|
|
void computePropertiesForWellConnectionPressures(const Simulator& ebosSimulator,
|
2017-11-30 10:14:29 -06:00
|
|
|
const WellState& well_state,
|
2023-05-04 07:27:49 -05:00
|
|
|
WellConnectionProps& props) const;
|
2017-06-23 08:54:05 -05:00
|
|
|
|
2021-04-20 08:42:27 -05:00
|
|
|
void computeWellConnectionDensitesPressures(const Simulator& ebosSimulator,
|
|
|
|
const WellState& well_state,
|
2023-05-04 07:27:49 -05:00
|
|
|
const WellConnectionProps& props,
|
2022-04-01 01:35:31 -05:00
|
|
|
DeferredLogger& deferred_logger);
|
2017-06-26 09:01:45 -05:00
|
|
|
|
2017-09-05 04:20:43 -05:00
|
|
|
void computeWellConnectionPressures(const Simulator& ebosSimulator,
|
2022-04-01 01:35:31 -05:00
|
|
|
const WellState& well_state,
|
|
|
|
DeferredLogger& deferred_logger);
|
2017-09-05 04:20:43 -05:00
|
|
|
|
2021-06-30 08:06:59 -05:00
|
|
|
void computePerfRateEval(const IntensiveQuantities& intQuants,
|
|
|
|
const std::vector<EvalWell>& mob,
|
|
|
|
const EvalWell& bhp,
|
|
|
|
const double Tw,
|
|
|
|
const int perf,
|
|
|
|
const bool allow_cf,
|
|
|
|
std::vector<EvalWell>& cq_s,
|
2023-05-04 06:02:17 -05:00
|
|
|
PerforationRates& perf_rates,
|
2021-06-30 08:06:59 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
|
|
|
|
|
|
|
void computePerfRateScalar(const IntensiveQuantities& intQuants,
|
|
|
|
const std::vector<Scalar>& mob,
|
|
|
|
const Scalar& bhp,
|
|
|
|
const double Tw,
|
|
|
|
const int perf,
|
|
|
|
const bool allow_cf,
|
|
|
|
std::vector<Scalar>& cq_s,
|
|
|
|
DeferredLogger& deferred_logger) const;
|
|
|
|
|
|
|
|
template<class Value>
|
|
|
|
void computePerfRate(const std::vector<Value>& mob,
|
|
|
|
const Value& pressure,
|
|
|
|
const Value& bhp,
|
|
|
|
const Value& rs,
|
|
|
|
const Value& rv,
|
2022-04-08 15:31:21 -05:00
|
|
|
const Value& rvw,
|
2022-11-24 07:32:41 -06:00
|
|
|
const Value& rsw,
|
2021-06-30 08:06:59 -05:00
|
|
|
std::vector<Value>& b_perfcells_dense,
|
2019-03-12 09:51:41 -05:00
|
|
|
const double Tw,
|
2018-12-12 08:58:15 -06:00
|
|
|
const int perf,
|
2018-12-13 06:29:59 -06:00
|
|
|
const bool allow_cf,
|
2021-06-30 08:06:59 -05:00
|
|
|
const Value& skin_pressure,
|
|
|
|
const std::vector<Value>& cmix_s,
|
|
|
|
std::vector<Value>& cq_s,
|
2023-05-04 06:02:17 -05:00
|
|
|
PerforationRates& perf_rates,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
2017-08-21 09:40:10 -05:00
|
|
|
|
2021-09-13 07:07:21 -05:00
|
|
|
void computeWellRatesWithBhpIterations(const Simulator& ebosSimulator,
|
2019-05-24 09:45:27 -05:00
|
|
|
const double& bhp,
|
|
|
|
std::vector<double>& well_flux,
|
2021-06-30 06:46:47 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
2017-07-24 07:48:57 -05:00
|
|
|
|
2020-09-30 03:04:39 -05:00
|
|
|
std::vector<double> computeWellPotentialWithTHP(
|
|
|
|
const Simulator& ebosSimulator,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger,
|
2020-09-30 03:04:39 -05:00
|
|
|
const WellState &well_state) const;
|
2017-08-04 06:07:16 -05:00
|
|
|
|
2023-01-30 05:41:45 -06:00
|
|
|
bool updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
|
|
|
WellState& well_state,
|
2023-02-14 08:46:08 -06:00
|
|
|
DeferredLogger& deferred_logger) const override;
|
2017-08-11 04:10:59 -05:00
|
|
|
|
2021-04-26 02:31:29 -05:00
|
|
|
virtual double getRefDensity() const override;
|
|
|
|
|
2017-08-04 06:07:16 -05:00
|
|
|
// get the mobility for specific perforation
|
2023-05-07 14:56:09 -05:00
|
|
|
template<class Value>
|
|
|
|
void getMobility(const Simulator& ebosSimulator,
|
|
|
|
const int perf,
|
|
|
|
std::vector<Value>& mob,
|
|
|
|
DeferredLogger& deferred_logger) const;
|
2017-08-31 00:50:28 -05:00
|
|
|
|
2017-11-23 09:10:37 -06:00
|
|
|
void updateWaterMobilityWithPolymer(const Simulator& ebos_simulator,
|
|
|
|
const int perf,
|
2019-02-07 07:43:17 -06:00
|
|
|
std::vector<EvalWell>& mob_water,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
2018-05-04 09:25:33 -05:00
|
|
|
|
|
|
|
void updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
2023-03-29 07:33:05 -05:00
|
|
|
const bool stop_or_zero_rate_target,
|
2022-11-09 06:06:11 -06:00
|
|
|
DeferredLogger& deferred_logger);
|
2018-05-04 09:25:33 -05:00
|
|
|
|
2023-03-29 07:33:05 -05:00
|
|
|
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
2023-03-28 08:22:50 -05:00
|
|
|
WellState& well_state,
|
|
|
|
DeferredLogger& deferred_logger) const;
|
2018-05-09 05:16:33 -05:00
|
|
|
|
2020-01-29 02:13:25 -06:00
|
|
|
virtual void assembleWellEqWithoutIteration(const Simulator& ebosSimulator,
|
|
|
|
const double dt,
|
|
|
|
const Well::InjectionControls& inj_controls,
|
|
|
|
const Well::ProductionControls& prod_controls,
|
|
|
|
WellState& well_state,
|
2021-04-22 10:31:21 -05:00
|
|
|
const GroupState& group_state,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) override;
|
2020-01-29 02:13:25 -06:00
|
|
|
|
2020-11-03 04:11:00 -06:00
|
|
|
void assembleWellEqWithoutIterationImpl(const Simulator& ebosSimulator,
|
|
|
|
const double dt,
|
2023-03-01 09:47:11 -06:00
|
|
|
const Well::InjectionControls& inj_controls,
|
|
|
|
const Well::ProductionControls& prod_controls,
|
2020-11-03 04:11:00 -06:00
|
|
|
WellState& well_state,
|
2021-04-22 10:31:21 -05:00
|
|
|
const GroupState& group_state,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger);
|
2020-11-03 04:11:00 -06:00
|
|
|
|
|
|
|
void calculateSinglePerf(const Simulator& ebosSimulator,
|
|
|
|
const int perf,
|
|
|
|
WellState& well_state,
|
|
|
|
std::vector<RateVector>& connectionRates,
|
|
|
|
std::vector<EvalWell>& cq_s,
|
|
|
|
EvalWell& water_flux_s,
|
2020-11-17 07:50:57 -06:00
|
|
|
EvalWell& cq_s_zfrac_effective,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
2020-11-03 04:11:00 -06:00
|
|
|
|
2018-11-15 07:31:41 -06:00
|
|
|
// check whether the well is operable under BHP limit with current reservoir condition
|
2021-10-01 06:47:53 -05:00
|
|
|
virtual void checkOperabilityUnderBHPLimit(const WellState& well_state, const Simulator& ebos_simulator, DeferredLogger& deferred_logger) override;
|
2018-11-15 07:31:41 -06:00
|
|
|
|
|
|
|
// check whether the well is operable under THP limit with current reservoir condition
|
2021-10-01 06:47:53 -05:00
|
|
|
virtual void checkOperabilityUnderTHPLimit(const Simulator& ebos_simulator, const WellState& well_state, DeferredLogger& deferred_logger) override;
|
2020-11-27 00:57:55 -06:00
|
|
|
|
|
|
|
// updating the inflow based on the current reservoir condition
|
2021-05-25 05:00:04 -05:00
|
|
|
virtual void updateIPR(const Simulator& ebos_simulator, DeferredLogger& deferred_logger) const override;
|
2018-11-15 07:31:41 -06:00
|
|
|
|
|
|
|
// for a well, when all drawdown are in the wrong direction, then this well will not
|
|
|
|
// be able to produce/inject .
|
2018-11-17 16:39:09 -06:00
|
|
|
bool allDrawDownWrongDirection(const Simulator& ebos_simulator) const;
|
|
|
|
|
2018-11-22 00:02:29 -06:00
|
|
|
// whether the well can produce / inject based on the current well state (bhp)
|
|
|
|
bool canProduceInjectWithCurrentBhp(const Simulator& ebos_simulator,
|
2019-02-03 01:13:11 -06:00
|
|
|
const WellState& well_state,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger);
|
2018-11-22 00:02:29 -06:00
|
|
|
|
2018-11-17 16:39:09 -06:00
|
|
|
// turn on crossflow to avoid singular well equations
|
|
|
|
// when the well is banned from cross-flow and the BHP is not properly initialized,
|
2018-11-20 06:49:11 -06:00
|
|
|
// we turn on crossflow to avoid singular well equations. It can result in wrong-signed
|
2018-11-17 16:39:09 -06:00
|
|
|
// well rates, it can cause problem for THP calculation
|
|
|
|
// TODO: looking for better alternative to avoid wrong-signed well rates
|
|
|
|
bool openCrossFlowAvoidSingularity(const Simulator& ebos_simulator) const;
|
2018-11-15 07:31:41 -06:00
|
|
|
|
2019-03-25 06:52:34 -05:00
|
|
|
// 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
|
|
|
|
// to handle the effect from formation damage.
|
|
|
|
EvalWell pskin(const double throuhgput,
|
|
|
|
const EvalWell& water_velocity,
|
|
|
|
const EvalWell& poly_inj_conc,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
2019-03-25 06:52:34 -05:00
|
|
|
|
|
|
|
// calculate the skin pressure based on water velocity, throughput during water injection.
|
|
|
|
EvalWell pskinwater(const double throughput,
|
|
|
|
const EvalWell& water_velocity,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
2019-03-25 06:52:34 -05:00
|
|
|
|
|
|
|
// calculate the injecting polymer molecular weight based on the througput and water velocity
|
|
|
|
EvalWell wpolymermw(const double throughput,
|
|
|
|
const EvalWell& water_velocity,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger) const;
|
2019-03-25 06:52:34 -05:00
|
|
|
|
2020-11-03 04:11:00 -06:00
|
|
|
// modify the water rate for polymer injectivity study
|
|
|
|
void handleInjectivityRate(const Simulator& ebosSimulator,
|
|
|
|
const int perf,
|
|
|
|
std::vector<EvalWell>& cq_s) const;
|
|
|
|
|
2019-03-25 06:52:34 -05:00
|
|
|
// handle the extra equations for polymer injectivity study
|
2020-11-03 04:11:00 -06:00
|
|
|
void handleInjectivityEquations(const Simulator& ebosSimulator,
|
|
|
|
const WellState& well_state,
|
|
|
|
const int perf,
|
|
|
|
const EvalWell& water_flux_s,
|
2021-05-25 05:00:04 -05:00
|
|
|
DeferredLogger& deferred_logger);
|
2018-11-30 05:15:51 -06:00
|
|
|
|
|
|
|
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;
|
2019-05-09 06:12:32 -05:00
|
|
|
|
2019-06-06 04:12:22 -05:00
|
|
|
// checking convergence of extra equations, if there are any
|
|
|
|
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
2019-06-25 14:53:37 -05:00
|
|
|
ConvergenceReport& report) const;
|
2019-06-06 04:12:22 -05:00
|
|
|
|
2019-06-06 04:47:59 -05:00
|
|
|
// updating the connectionRates_ related polymer molecular weight
|
|
|
|
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
|
|
|
const IntensiveQuantities& int_quants,
|
|
|
|
const WellState& well_state,
|
|
|
|
const int perf,
|
2020-11-03 04:11:00 -06:00
|
|
|
std::vector<RateVector>& connectionRates,
|
|
|
|
DeferredLogger& deferred_logger) const;
|
2019-06-06 04:47:59 -05:00
|
|
|
|
2019-08-07 07:13:11 -05:00
|
|
|
|
2020-09-30 03:04:39 -05:00
|
|
|
std::optional<double> computeBhpAtThpLimitProd(const WellState& well_state,
|
|
|
|
const Simulator& ebos_simulator,
|
2020-02-19 04:02:13 -06:00
|
|
|
const SummaryState& summary_state,
|
|
|
|
DeferredLogger& deferred_logger) const;
|
2019-11-05 06:31:59 -06:00
|
|
|
|
2020-02-19 04:02:13 -06:00
|
|
|
std::optional<double> computeBhpAtThpLimitInj(const Simulator& ebos_simulator,
|
|
|
|
const SummaryState& summary_state,
|
|
|
|
DeferredLogger& deferred_logger) const;
|
2019-11-05 06:31:59 -06:00
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-06-19 07:49:49 -05:00
|
|
|
#include "StandardWell_impl.hpp"
|
|
|
|
|
2017-06-15 04:41:03 -05:00
|
|
|
#endif // OPM_STANDARDWELL_HEADER_INCLUDED
|