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