22#ifndef OPM_MULTISEGMENTWELL_HEADER_INCLUDED
23#define OPM_MULTISEGMENTWELL_IMPL_HEADER_INCLUDED
28#include <opm/common/Exceptions.hpp>
29#include <opm/common/OpmLog/OpmLog.hpp>
31#include <opm/input/eclipse/Schedule/MSW/Segment.hpp>
32#include <opm/input/eclipse/Schedule/MSW/Valve.hpp>
33#include <opm/input/eclipse/Schedule/MSW/WellSegments.hpp>
34#include <opm/input/eclipse/Schedule/Well/Connection.hpp>
35#include <opm/input/eclipse/Schedule/Well/WellConnections.hpp>
37#include <opm/input/eclipse/Units/Units.hpp>
39#include <opm/material/densead/EvaluationFormat.hpp>
49#if COMPILE_BDA_BRIDGE && (HAVE_CUDA || HAVE_OPENCL)
57 template <
typename TypeTag>
64 const int pvtRegionIdx,
65 const int num_components,
67 const int index_of_well,
68 const std::vector<PerforationData>& perf_data)
69 :
Base(well, pw_info, time_step, param, rate_converter, pvtRegionIdx, num_components, num_phases, index_of_well, perf_data)
72 , segment_fluid_initial_(this->numberOfSegments(), std::vector<double>(this->num_components_, 0.0))
76 OPM_THROW(std::runtime_error,
"solvent is not supported by multisegment well yet");
80 OPM_THROW(std::runtime_error,
"polymer is not supported by multisegment well yet");
84 OPM_THROW(std::runtime_error,
"energy is not supported by multisegment well yet");
88 OPM_THROW(std::runtime_error,
"foam is not supported by multisegment well yet");
92 OPM_THROW(std::runtime_error,
"brine is not supported by multisegment well yet");
96 OPM_THROW(std::runtime_error,
"water evaporation is not supported by multisegment well yet");
100 OPM_THROW(std::runtime_error,
101 "dissolved gas/ vapporized oil in injected oil/gas not supported by multisegment well yet."
102 " \n See (WCONINJE item 10 / WCONHIST item 8)");
104 if constexpr (!Indices::oilEnabled && Indices::numPhases > 1) {
105 OPM_THROW(std::runtime_error,
"water + gas case not supported by multisegment well yet");
115 template <
typename TypeTag>
119 const std::vector<double>& depth_arg,
120 const double gravity_arg,
122 const std::vector< Scalar >& B_avg,
123 const bool changed_to_open_this_step)
125 Base::init(phase_usage_arg, depth_arg, gravity_arg, num_cells, B_avg, changed_to_open_this_step);
137 this->initMatrixAndVectors(num_cells);
140 for (
int perf = 0; perf < this->number_of_perforations_; ++perf) {
141 const int cell_idx = this->well_cells_[perf];
142 this->cell_perforation_depth_diffs_[perf] = depth_arg[cell_idx] - this->perf_depth_[perf];
150 template <
typename TypeTag>
155 this->primary_variables_.init();
162 template <
typename TypeTag>
169 const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
170 this->primary_variables_.update(well_state, stop_or_zero_rate_target);
178 template <
typename TypeTag>
186 Base::updateWellStateWithTarget(simulator, group_state, well_state, deferred_logger);
189 this->scaleSegmentRatesWithWellRates(this->segments_.inlets(),
190 this->segments_.perforations(),
192 this->scaleSegmentPressuresWithBhp(well_state);
199 template <
typename TypeTag>
204 const std::vector<double>& B_avg,
206 const bool relax_tolerance)
const
208 return this->MSWEval::getWellConvergence(well_state,
211 this->param_.max_residual_allowed_,
212 this->param_.tolerance_wells_,
213 this->param_.relaxed_tolerance_flow_well_,
214 this->param_.tolerance_pressure_ms_wells_,
215 this->param_.relaxed_tolerance_pressure_ms_well_,
217 this->wellIsStopped());
225 template <
typename TypeTag>
230 if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
234 if (this->param_.matrix_add_well_contributions_) {
239 this->linSys_.apply(x, Ax);
246 template <
typename TypeTag>
251 if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
255 this->linSys_.apply(r);
260 template <
typename TypeTag>
268 if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
273 this->linSys_.recoverSolutionWell(x, xw);
274 updateWellState(summary_state, xw, well_state, deferred_logger);
281 template <
typename TypeTag>
286 std::vector<double>& well_potentials,
289 const auto [compute_potential, bhp_controlled_well] =
292 if (!compute_potential) {
296 debug_cost_counter_ = 0;
297 bool converged_implicit =
false;
298 if (this->param_.local_well_solver_control_switching_) {
299 converged_implicit = computeWellPotentialsImplicit(simulator, well_potentials, deferred_logger);
300 if (!converged_implicit) {
301 deferred_logger.
debug(
"Implicit potential calculations failed for well "
302 + this->name() +
", reverting to original aproach.");
305 if (!converged_implicit) {
307 const auto& summaryState = simulator.vanguard().summaryState();
308 if (!Base::wellHasTHPConstraints(summaryState) || bhp_controlled_well) {
309 computeWellRatesAtBhpLimit(simulator, well_potentials, deferred_logger);
311 well_potentials = computeWellPotentialWithTHP(
312 well_state, simulator, deferred_logger);
315 deferred_logger.
debug(
"Cost in iterations of finding well potential for well "
318 this->checkNegativeWellPotentials(well_potentials,
319 this->param_.check_well_operability_,
326 template<
typename TypeTag>
330 std::vector<double>& well_flux,
333 if (this->well_ecl_.isInjector()) {
334 const auto controls = this->well_ecl_.injectionControls(simulator.vanguard().summaryState());
335 computeWellRatesWithBhpIterations(simulator, controls.bhp_limit, well_flux, deferred_logger);
337 const auto controls = this->well_ecl_.productionControls(simulator.vanguard().summaryState());
338 computeWellRatesWithBhpIterations(simulator, controls.bhp_limit, well_flux, deferred_logger);
342 template<
typename TypeTag>
347 std::vector<double>& well_flux,
351 const int np = this->number_of_phases_;
353 well_flux.resize(np, 0.0);
354 const bool allow_cf = this->getAllowCrossFlow();
355 const int nseg = this->numberOfSegments();
356 const WellState<Scalar>& well_state = simulator.problem().wellModel().wellState();
357 const auto& ws = well_state.
well(this->indexOfWell());
358 auto segments_copy = ws.segments;
359 segments_copy.scale_pressure(
bhp);
360 const auto& segment_pressure = segments_copy.pressure;
361 for (
int seg = 0; seg < nseg; ++seg) {
362 for (
const int perf : this->segments_.perforations()[seg]) {
363 const int cell_idx = this->well_cells_[perf];
364 const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, 0);
366 std::vector<Scalar> mob(this->num_components_, 0.);
367 getMobility(simulator, perf, mob, deferred_logger);
368 const double trans_mult = simulator.problem().template wellTransMultiplier<double>(intQuants, cell_idx);
369 const auto& wellstate_nupcol = simulator.problem().wellModel().nupcolWellState().well(this->index_of_well_);
370 const std::vector<Scalar> Tw = this->wellIndex(perf, intQuants, trans_mult, wellstate_nupcol);
371 const Scalar seg_pressure = segment_pressure[seg];
372 std::vector<Scalar> cq_s(this->num_components_, 0.);
375 computePerfRate(intQuants, mob, Tw, seg, perf, seg_pressure,
376 allow_cf, cq_s, perf_press, perf_rates, deferred_logger);
378 for(
int p = 0; p < np; ++p) {
379 well_flux[this->modelCompIdxToFlowCompIdx(p)] += cq_s[p];
383 this->parallel_well_info_.communication().sum(well_flux.data(), well_flux.size());
387 template<
typename TypeTag>
392 std::vector<double>& well_flux,
402 const auto& group_state = simulator.problem().wellModel().groupState();
403 auto& ws = well_state_copy.
well(this->index_of_well_);
406 const auto& summary_state = simulator.vanguard().summaryState();
407 auto inj_controls = well_copy.
well_ecl_.isInjector()
408 ? well_copy.
well_ecl_.injectionControls(summary_state)
409 : Well::InjectionControls(0);
410 auto prod_controls = well_copy.
well_ecl_.isProducer()
411 ? well_copy.
well_ecl_.productionControls(summary_state) :
412 Well::ProductionControls(0);
416 inj_controls.bhp_limit =
bhp;
417 ws.injection_cmode = Well::InjectorCMode::BHP;
419 prod_controls.bhp_limit =
bhp;
420 ws.production_cmode = Well::ProducerCMode::BHP;
426 const int np = this->number_of_phases_;
428 for (
int phase = 0; phase < np; ++phase){
429 trivial = trivial && (ws.well_potentials[phase] == 0.0) ;
432 const double sign = well_copy.
well_ecl_.isInjector() ? 1.0 : -1.0;
433 for (
int phase = 0; phase < np; ++phase) {
434 ws.surface_rates[phase] = sign * ws.well_potentials[phase];
438 this->segments_.perforations(),
442 const double dt = simulator.timeStepSize();
449 well_flux.resize(np, 0.0);
450 for (
int compIdx = 0; compIdx < this->num_components_; ++compIdx) {
452 well_flux[this->modelCompIdxToFlowCompIdx(compIdx)] = rate.value();
459 template<
typename TypeTag>
466 std::vector<double> potentials(this->number_of_phases_, 0.0);
467 const auto& summary_state = simulator.vanguard().summaryState();
469 const auto& well = this->well_ecl_;
470 if (well.isInjector()){
471 auto bhp_at_thp_limit = computeBhpAtThpLimitInj(simulator, summary_state, deferred_logger);
472 if (bhp_at_thp_limit) {
473 const auto& controls = well.injectionControls(summary_state);
474 const double bhp = std::min(*bhp_at_thp_limit, controls.bhp_limit);
475 computeWellRatesWithBhpIterations(simulator,
bhp, potentials, deferred_logger);
476 deferred_logger.
debug(
"Converged thp based potential calculation for well "
479 deferred_logger.
warning(
"FAILURE_GETTING_CONVERGED_POTENTIAL",
480 "Failed in getting converged thp based potential calculation for well "
481 + this->name() +
". Instead the bhp based value is used");
482 const auto& controls = well.injectionControls(summary_state);
483 const double bhp = controls.bhp_limit;
484 computeWellRatesWithBhpIterations(simulator,
bhp, potentials, deferred_logger);
487 auto bhp_at_thp_limit = computeBhpAtThpLimitProd(
488 well_state, simulator, summary_state, deferred_logger);
489 if (bhp_at_thp_limit) {
490 const auto& controls = well.productionControls(summary_state);
491 const double bhp = std::max(*bhp_at_thp_limit, controls.bhp_limit);
492 computeWellRatesWithBhpIterations(simulator,
bhp, potentials, deferred_logger);
493 deferred_logger.
debug(
"Converged thp based potential calculation for well "
496 deferred_logger.
warning(
"FAILURE_GETTING_CONVERGED_POTENTIAL",
497 "Failed in getting converged thp based potential calculation for well "
498 + this->name() +
". Instead the bhp based value is used");
499 const auto& controls = well.productionControls(summary_state);
500 const double bhp = controls.bhp_limit;
501 computeWellRatesWithBhpIterations(simulator,
bhp, potentials, deferred_logger);
508 template<
typename TypeTag>
512 std::vector<double>& well_potentials,
523 const auto& group_state = simulator.problem().wellModel().groupState();
524 auto& ws = well_state_copy.
well(this->index_of_well_);
527 const auto& summary_state = simulator.vanguard().summaryState();
528 auto inj_controls = well_copy.
well_ecl_.isInjector()
529 ? well_copy.
well_ecl_.injectionControls(summary_state)
530 : Well::InjectionControls(0);
531 auto prod_controls = well_copy.
well_ecl_.isProducer()
532 ? well_copy.
well_ecl_.productionControls(summary_state)
533 : Well::ProductionControls(0);
541 const int np = this->number_of_phases_;
543 for (
int phase = 0; phase < np; ++phase){
544 trivial = trivial && (ws.well_potentials[phase] == 0.0) ;
547 const double sign = well_copy.
well_ecl_.isInjector() ? 1.0 : -1.0;
548 for (
int phase = 0; phase < np; ++phase) {
549 ws.surface_rates[phase] = sign * ws.well_potentials[phase];
553 this->segments_.perforations(),
557 const double dt = simulator.timeStepSize();
559 bool converged =
false;
560 if (this->well_ecl_.isProducer() && this->wellHasTHPConstraints(summary_state)) {
561 converged = well_copy.
solveWellWithTHPConstraint(simulator, dt, inj_controls, prod_controls, well_state_copy, group_state, deferred_logger);
563 converged = well_copy.
iterateWellEqWithSwitching(simulator, dt, inj_controls, prod_controls, well_state_copy, group_state, deferred_logger);
567 well_potentials.clear();
568 well_potentials.resize(np, 0.0);
569 for (
int compIdx = 0; compIdx < this->num_components_; ++compIdx) {
571 well_potentials[this->modelCompIdxToFlowCompIdx(compIdx)] = rate.value();
577 template <
typename TypeTag>
584 if (!this->isOperableAndSolvable() && !this->wellIsStopped())
return;
589 const BVectorWell dx_well = this->linSys_.solve();
591 updateWellState(summary_state, dx_well, well_state, deferred_logger);
593 catch(
const NumericalProblem& exp) {
597 deferred_logger.
problem(
"In MultisegmentWell::solveEqAndUpdateWellState for well "
598 + this->name() +
": "+exp.what());
607 template <
typename TypeTag>
612 for (
int perf = 0; perf < this->number_of_perforations_; ++perf) {
614 std::vector<double> kr(this->number_of_phases_, 0.0);
615 std::vector<double> density(this->number_of_phases_, 0.0);
617 const int cell_idx = this->well_cells_[perf];
618 const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, 0);
619 const auto& fs = intQuants.fluidState();
625 const int water_pos = pu.
phase_pos[Water];
626 kr[water_pos] = intQuants.relativePermeability(FluidSystem::waterPhaseIdx).value();
627 sum_kr += kr[water_pos];
628 density[water_pos] = fs.density(FluidSystem::waterPhaseIdx).value();
633 kr[oil_pos] = intQuants.relativePermeability(FluidSystem::oilPhaseIdx).value();
634 sum_kr += kr[oil_pos];
635 density[oil_pos] = fs.density(FluidSystem::oilPhaseIdx).value();
640 kr[gas_pos] = intQuants.relativePermeability(FluidSystem::gasPhaseIdx).value();
641 sum_kr += kr[gas_pos];
642 density[gas_pos] = fs.density(FluidSystem::gasPhaseIdx).value();
645 assert(sum_kr != 0.);
648 double average_density = 0.;
649 for (
int p = 0; p < this->number_of_phases_; ++p) {
650 average_density += kr[p] * density[p];
652 average_density /= sum_kr;
654 this->cell_perforation_pressure_diffs_[perf] = this->gravity_ * average_density * this->cell_perforation_depth_diffs_[perf];
662 template <
typename TypeTag>
667 for (
int seg = 0; seg < this->numberOfSegments(); ++seg) {
669 const double surface_volume = getSegmentSurfaceVolume(simulator, seg).value();
670 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
671 segment_fluid_initial_[seg][comp_idx] = surface_volume * this->primary_variables_.surfaceVolumeFraction(seg, comp_idx).value();
680 template <
typename TypeTag>
684 const BVectorWell& dwells,
687 const double relaxation_factor)
689 if (!this->isOperableAndSolvable() && !this->wellIsStopped())
return;
691 const double dFLimit = this->param_.dwell_fraction_max_;
692 const double max_pressure_change = this->param_.max_pressure_change_ms_wells_;
693 const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
694 this->primary_variables_.updateNewton(dwells,
697 stop_or_zero_rate_target,
698 max_pressure_change);
700 this->primary_variables_.copyToWellState(*
this, getRefDensity(), stop_or_zero_rate_target,
701 well_state, summary_state, deferred_logger);
704 auto& ws = well_state.
well(this->index_of_well_);
705 this->segments_.copyPhaseDensities(ws.pu, ws.segments);
708 Base::calculateReservoirRates(well_state.
well(this->index_of_well_));
715 template <
typename TypeTag>
722 const auto& summary_state = simulator.vanguard().summaryState();
723 updatePrimaryVariables(summary_state, well_state, deferred_logger);
724 initPrimaryVariablesEvaluation();
725 computePerfCellPressDiffs(simulator);
726 computeInitialSegmentFluids(simulator);
733 template<
typename TypeTag>
741 auto fluidState = [&simulator,
this](
const int perf)
743 const auto cell_idx = this->well_cells_[perf];
744 return simulator.model()
745 .intensiveQuantities(cell_idx, 0).fluidState();
748 const int np = this->number_of_phases_;
749 auto setToZero = [np](
double* x) ->
void
751 std::fill_n(x, np, 0.0);
754 auto addVector = [np](
const double* src,
double* dest) ->
void
756 std::transform(src, src + np, dest, dest, std::plus<>{});
759 auto& ws = well_state.
well(this->index_of_well_);
760 auto& perf_data = ws.perf_data;
761 auto* connPI = perf_data.prod_index.data();
762 auto* wellPI = ws.productivity_index.data();
766 const auto preferred_phase = this->well_ecl_.getPreferredPhase();
767 auto subsetPerfID = 0;
769 for (
const auto& perf : *this->perf_data_){
770 auto allPerfID = perf.ecl_index;
772 auto connPICalc = [&wellPICalc, allPerfID](
const double mobility) ->
double
777 std::vector<Scalar> mob(this->num_components_, 0.0);
778 getMobility(simulator,
static_cast<int>(subsetPerfID), mob, deferred_logger);
780 const auto& fs = fluidState(subsetPerfID);
783 if (this->isInjector()) {
784 this->computeConnLevelInjInd(fs, preferred_phase, connPICalc,
785 mob, connPI, deferred_logger);
788 this->computeConnLevelProdInd(fs, connPICalc, mob, connPI);
791 addVector(connPI, wellPI);
797 assert (
static_cast<int>(subsetPerfID) == this->number_of_perforations_ &&
798 "Internal logic error in processing connections for PI/II");
805 template<
typename TypeTag>
809 [[maybe_unused]]
const int openConnIdx)
const
814 const auto segNum = this->wellEcl()
815 .getConnections()[globalConnIdx].segment();
817 const auto segIdx = this->wellEcl()
818 .getSegments().segmentNumberToIndex(segNum);
820 return this->segments_.density(segIdx).value();
827 template<
typename TypeTag>
832 this->linSys_.extract(jacobian);
836 template<
typename TypeTag>
841 const int pressureVarIndex,
842 const bool use_well_weights,
846 this->linSys_.extractCPRPressureMatrix(jacobian,
856 template<
typename TypeTag>
857 template<
class Value>
863 const std::vector<Value>& b_perfcells,
864 const std::vector<Value>& mob_perfcells,
865 const std::vector<Scalar>& Tw,
867 const Value& segment_pressure,
868 const Value& segment_density,
869 const bool& allow_cf,
870 const std::vector<Value>& cmix_s,
871 std::vector<Value>& cq_s,
877 const Value perf_seg_press_diff = this->gravity() * segment_density *
878 this->segments_.perforation_depth_diff(perf);
880 const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
884 perf_press = segment_pressure + perf_seg_press_diff;
887 const Value cell_press_at_perf = pressure_cell - cell_perf_press_diff;
890 const Value drawdown = cell_press_at_perf - perf_press;
893 if (drawdown > 0.0) {
895 if (!allow_cf && this->isInjector()) {
900 for (
int comp_idx = 0; comp_idx < this->numComponents(); ++comp_idx) {
901 const Value cq_p = - Tw[comp_idx] * (mob_perfcells[comp_idx] * drawdown);
902 cq_s[comp_idx] = b_perfcells[comp_idx] * cq_p;
905 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
906 const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
907 const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
908 const Value cq_s_oil = cq_s[oilCompIdx];
909 const Value cq_s_gas = cq_s[gasCompIdx];
910 cq_s[gasCompIdx] += rs * cq_s_oil;
911 cq_s[oilCompIdx] += rv * cq_s_gas;
915 if (!allow_cf && this->isProducer()) {
920 Value total_mob = mob_perfcells[0];
921 for (
int comp_idx = 1; comp_idx < this->numComponents(); ++comp_idx) {
922 total_mob += mob_perfcells[comp_idx];
926 Value volume_ratio = 0.0;
927 if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
928 const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
929 volume_ratio += cmix_s[waterCompIdx] / b_perfcells[waterCompIdx];
932 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
933 const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
934 const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
939 const Value d = 1.0 - rv * rs;
941 if (getValue(d) == 0.0) {
943 fmt::format(
"Zero d value obtained for well {} "
944 "during flux calculation with rs {} and rv {}",
945 this->name(), rs, rv),
949 const Value tmp_oil = (cmix_s[oilCompIdx] - rv * cmix_s[gasCompIdx]) / d;
950 volume_ratio += tmp_oil / b_perfcells[oilCompIdx];
952 const Value tmp_gas = (cmix_s[gasCompIdx] - rs * cmix_s[oilCompIdx]) / d;
953 volume_ratio += tmp_gas / b_perfcells[gasCompIdx];
955 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
956 const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
957 volume_ratio += cmix_s[oilCompIdx] / b_perfcells[oilCompIdx];
959 if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
960 const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
961 volume_ratio += cmix_s[gasCompIdx] / b_perfcells[gasCompIdx];
965 for (
int componentIdx = 0; componentIdx < this->numComponents(); ++componentIdx) {
966 const Value cqt_i = - Tw[componentIdx] * (total_mob * drawdown);
967 Value cqt_is = cqt_i / volume_ratio;
968 cq_s[componentIdx] = cmix_s[componentIdx] * cqt_is;
973 if (this->isProducer()) {
974 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
975 const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
976 const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
985 const double d = 1.0 - getValue(rv) * getValue(rs);
988 perf_rates.
vap_oil = getValue(rv) * (getValue(cq_s[gasCompIdx]) - getValue(rs) * getValue(cq_s[oilCompIdx])) / d;
991 perf_rates.
dis_gas = getValue(rs) * (getValue(cq_s[oilCompIdx]) - getValue(rv) * getValue(cq_s[gasCompIdx])) / d;
996 template <
typename TypeTag>
997 template<
class Value>
1001 const std::vector<Value>& mob_perfcells,
1002 const std::vector<Scalar>& Tw,
1005 const Value& segment_pressure,
1006 const bool& allow_cf,
1007 std::vector<Value>& cq_s,
1013 auto obtain = [
this](
const Eval& value)
1015 if constexpr (std::is_same_v<Value, Scalar>) {
1016 static_cast<void>(
this);
1017 return getValue(value);
1019 return this->extendEval(value);
1022 auto obtainN = [](
const auto& value)
1024 if constexpr (std::is_same_v<Value, Scalar>) {
1025 return getValue(value);
1030 const auto& fs = int_quants.fluidState();
1032 const Value pressure_cell = obtain(this->getPerfCellPressure(fs));
1033 const Value rs = obtain(fs.Rs());
1034 const Value rv = obtain(fs.Rv());
1037 std::vector<Value> b_perfcells(this->num_components_, 0.0);
1039 for (
unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
1040 if (!FluidSystem::phaseIsActive(phaseIdx)) {
1044 const unsigned compIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::solventComponentIndex(phaseIdx));
1045 b_perfcells[compIdx] = obtain(fs.invB(phaseIdx));
1048 std::vector<Value> cmix_s(this->numComponents(), 0.0);
1049 for (
int comp_idx = 0; comp_idx < this->numComponents(); ++comp_idx) {
1050 cmix_s[comp_idx] = obtainN(this->primary_variables_.surfaceVolumeFraction(seg, comp_idx));
1053 this->computePerfRate(pressure_cell,
1061 obtainN(this->segments_.density(seg)),
1070 template <
typename TypeTag>
1089 int pvt_region_index;
1092 const int cell_idx = this->well_cells_[0];
1093 const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, 0);
1094 const auto& fs = intQuants.fluidState();
1095 temperature.setValue(fs.temperature(FluidSystem::oilPhaseIdx).value());
1096 saltConcentration = this->extendEval(fs.saltConcentration());
1097 pvt_region_index = fs.pvtRegionIndex();
1100 this->segments_.computeFluidProperties(temperature,
1102 this->primary_variables_,
1107 template <
typename TypeTag>
1108 template<
class Value>
1113 std::vector<Value>& mob,
1116 auto obtain = [
this](
const Eval& value)
1118 if constexpr (std::is_same_v<Value, Scalar>) {
1119 static_cast<void>(
this);
1120 return getValue(value);
1122 return this->extendEval(value);
1129 const auto perf_ecl_index = this->perforationData()[perf].ecl_index;
1130 const Connection& con = this->well_ecl_.getConnections()[perf_ecl_index];
1131 const int seg = this->segmentNumberToIndex(con.segment());
1135 const double segment_pres = this->primary_variables_.getSegmentPressure(seg).value();
1136 const double perf_seg_press_diff = this->gravity() * this->segments_.density(seg).value()
1137 * this->segments_.perforation_depth_diff(perf);
1138 const double perf_press = segment_pres + perf_seg_press_diff;
1139 const double multiplier = this->getInjMult(perf, segment_pres, perf_press);
1140 for (std::size_t i = 0; i < mob.size(); ++i) {
1141 mob[i] *= multiplier;
1148 template<
typename TypeTag>
1153 return this->segments_.getRefDensity();
1156 template<
typename TypeTag>
1163 const auto& summaryState = simulator.vanguard().summaryState();
1167 const bool bhp_limit_not_defaulted = bhp_limit > 1.5 * unit::barsa;
1168 if ( bhp_limit_not_defaulted || !this->wellHasTHPConstraints(summaryState) ) {
1171 double total_ipr_mass_rate = 0.0;
1172 for (
unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx)
1174 if (!FluidSystem::phaseIsActive(phaseIdx)) {
1178 const unsigned compIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::solventComponentIndex(phaseIdx));
1179 const double ipr_rate = this->ipr_a_[compIdx] - this->ipr_b_[compIdx] * bhp_limit;
1181 const double rho = FluidSystem::referenceDensity( phaseIdx, Base::pvtRegionIdx() );
1182 total_ipr_mass_rate += ipr_rate * rho;
1184 if ( (this->isProducer() && total_ipr_mass_rate < 0.) || (this->isInjector() && total_ipr_mass_rate > 0.) ) {
1185 this->operability_status_.operable_under_only_bhp_limit =
false;
1189 if (this->operability_status_.operable_under_only_bhp_limit && this->wellHasTHPConstraints(summaryState)) {
1193 std::vector<double> well_rates_bhp_limit;
1194 computeWellRatesWithBhp(simulator, bhp_limit, well_rates_bhp_limit, deferred_logger);
1196 const double thp_limit = this->getTHPConstraint(summaryState);
1199 this->getRefDensity(),
1200 this->wellEcl().alq_value(summaryState),
1203 if ( (this->isProducer() && thp < thp_limit) || (this->isInjector() && thp > thp_limit) ) {
1204 this->operability_status_.obey_thp_limit_under_bhp_limit =
false;
1215 this->operability_status_.operable_under_only_bhp_limit =
true;
1216 this->operability_status_.obey_thp_limit_under_bhp_limit =
false;
1222 template<
typename TypeTag>
1230 std::fill(this->ipr_a_.begin(), this->ipr_a_.end(), 0.);
1231 std::fill(this->ipr_b_.begin(), this->ipr_b_.end(), 0.);
1233 const int nseg = this->numberOfSegments();
1234 std::vector<double> seg_dp(nseg, 0.0);
1235 for (
int seg = 0; seg < nseg; ++seg) {
1237 const double dp = this->getSegmentDp(seg,
1238 this->segments_.density(seg).value(),
1241 for (
const int perf : this->segments_.perforations()[seg]) {
1242 std::vector<Scalar> mob(this->num_components_, 0.0);
1245 getMobility(simulator, perf, mob, deferred_logger);
1247 const int cell_idx = this->well_cells_[perf];
1248 const auto& int_quantities = simulator.model().intensiveQuantities(cell_idx, 0);
1249 const auto& fs = int_quantities.fluidState();
1251 const double perf_seg_press_diff = this->segments_.getPressureDiffSegPerf(seg, perf);
1253 const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
1254 const double pressure_cell = this->getPerfCellPressure(fs).value();
1257 std::vector<double> b_perf(this->num_components_);
1258 for (std::size_t phase = 0; phase < FluidSystem::numPhases; ++phase) {
1259 if (!FluidSystem::phaseIsActive(phase)) {
1262 const unsigned comp_idx = Indices::canonicalToActiveComponentIndex(FluidSystem::solventComponentIndex(phase));
1263 b_perf[comp_idx] = fs.invB(phase).value();
1267 const double h_perf = cell_perf_press_diff + perf_seg_press_diff + dp;
1268 const double pressure_diff = pressure_cell - h_perf;
1271 if ( (this->isProducer() && pressure_diff < 0.) || (this->isInjector() && pressure_diff > 0.) ) {
1272 deferred_logger.
debug(
"CROSSFLOW_IPR",
1273 "cross flow found when updateIPR for well " + this->name());
1277 const double trans_mult = simulator.problem().template wellTransMultiplier<double>(int_quantities, cell_idx);
1278 const auto& wellstate_nupcol = simulator.problem().wellModel().nupcolWellState().well(this->index_of_well_);
1279 const std::vector<Scalar> tw_perf = this->wellIndex(perf, int_quantities, trans_mult, wellstate_nupcol);
1280 std::vector<double> ipr_a_perf(this->ipr_a_.size());
1281 std::vector<double> ipr_b_perf(this->ipr_b_.size());
1282 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
1283 const double tw_mob = tw_perf[comp_idx] * mob[comp_idx] * b_perf[comp_idx];
1284 ipr_a_perf[comp_idx] += tw_mob * pressure_diff;
1285 ipr_b_perf[comp_idx] += tw_mob;
1289 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
1290 const unsigned oil_comp_idx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
1291 const unsigned gas_comp_idx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
1292 const double rs = (fs.Rs()).value();
1293 const double rv = (fs.Rv()).value();
1295 const double dis_gas_a = rs * ipr_a_perf[oil_comp_idx];
1296 const double vap_oil_a = rv * ipr_a_perf[gas_comp_idx];
1298 ipr_a_perf[gas_comp_idx] += dis_gas_a;
1299 ipr_a_perf[oil_comp_idx] += vap_oil_a;
1301 const double dis_gas_b = rs * ipr_b_perf[oil_comp_idx];
1302 const double vap_oil_b = rv * ipr_b_perf[gas_comp_idx];
1304 ipr_b_perf[gas_comp_idx] += dis_gas_b;
1305 ipr_b_perf[oil_comp_idx] += vap_oil_b;
1308 for (std::size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) {
1309 this->ipr_a_[comp_idx] += ipr_a_perf[comp_idx];
1310 this->ipr_b_[comp_idx] += ipr_b_perf[comp_idx];
1316 template<
typename TypeTag>
1330 auto rates = well_state.
well(this->index_of_well_).surface_rates;
1332 for (std::size_t p = 0; p < rates.size(); ++p) {
1333 zero_rates &= rates[p] == 0.0;
1335 auto& ws = well_state.
well(this->index_of_well_);
1337 const auto msg = fmt::format(
"updateIPRImplicit: Well {} has zero rate, IPRs might be problematic", this->name());
1338 deferred_logger.
debug(msg);
1350 const auto& group_state = simulator.problem().wellModel().groupState();
1352 std::fill(ws.implicit_ipr_a.begin(), ws.implicit_ipr_a.end(), 0.);
1353 std::fill(ws.implicit_ipr_b.begin(), ws.implicit_ipr_b.end(), 0.);
1355 auto inj_controls = Well::InjectionControls(0);
1356 auto prod_controls = Well::ProductionControls(0);
1357 prod_controls.addControl(Well::ProducerCMode::BHP);
1358 prod_controls.bhp_limit = well_state.
well(this->index_of_well_).bhp;
1361 const auto cmode = ws.production_cmode;
1362 ws.production_cmode = Well::ProducerCMode::BHP;
1363 const double dt = simulator.timeStepSize();
1364 assembleWellEqWithoutIteration(simulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger);
1366 BVectorWell rhs(this->numberOfSegments());
1368 rhs[0][SPres] = -1.0;
1370 const BVectorWell x_well = this->linSys_.solve(rhs);
1371 constexpr int num_eq = MSWEval::numWellEq;
1372 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx){
1373 const EvalWell comp_rate = this->primary_variables_.getQs(comp_idx);
1374 const int idx = this->modelCompIdxToFlowCompIdx(comp_idx);
1375 for (
size_t pvIdx = 0; pvIdx < num_eq; ++pvIdx) {
1377 ws.implicit_ipr_b[idx] -= x_well[0][pvIdx]*comp_rate.derivative(pvIdx+Indices::numEq);
1379 ws.implicit_ipr_a[idx] = ws.implicit_ipr_b[idx]*ws.bhp - comp_rate.value();
1382 ws.production_cmode = cmode;
1385 template<
typename TypeTag>
1392 const auto& summaryState = simulator.vanguard().summaryState();
1393 const auto obtain_bhp = this->isProducer()
1394 ? computeBhpAtThpLimitProd(
1395 well_state, simulator, summaryState, deferred_logger)
1396 : computeBhpAtThpLimitInj(simulator, summaryState, deferred_logger);
1399 this->operability_status_.can_obtain_bhp_with_thp_limit =
true;
1402 this->operability_status_.obey_bhp_limit_with_thp_limit = (*obtain_bhp >= bhp_limit);
1404 const double thp_limit = this->getTHPConstraint(summaryState);
1405 if (this->isProducer() && *obtain_bhp < thp_limit) {
1406 const std::string msg =
" obtained bhp " +
std::to_string(unit::convert::to(*obtain_bhp, unit::barsa))
1407 +
" bars is SMALLER than thp limit "
1409 +
" bars as a producer for well " + this->name();
1410 deferred_logger.
debug(msg);
1412 else if (this->isInjector() && *obtain_bhp > thp_limit) {
1413 const std::string msg =
" obtained bhp " +
std::to_string(unit::convert::to(*obtain_bhp, unit::barsa))
1414 +
" bars is LARGER than thp limit "
1416 +
" bars as a injector for well " + this->name();
1417 deferred_logger.
debug(msg);
1422 this->operability_status_.can_obtain_bhp_with_thp_limit =
false;
1423 this->operability_status_.obey_bhp_limit_with_thp_limit =
false;
1424 if (!this->wellIsStopped()) {
1425 const double thp_limit = this->getTHPConstraint(summaryState);
1426 deferred_logger.
debug(
" could not find bhp value at thp limit "
1428 +
" bar for well " + this->name() +
", the well might need to be closed ");
1437 template<
typename TypeTag>
1442 const Well::InjectionControls& inj_controls,
1443 const Well::ProductionControls& prod_controls,
1448 if (!this->isOperableAndSolvable() && !this->wellIsStopped())
return true;
1450 const int max_iter_number = this->param_.max_inner_iter_ms_wells_;
1454 const auto& [isFinite, residuals] = this->getFiniteWellResiduals(Base::B_avg_, deferred_logger);
1459 std::vector<std::vector<Scalar> > residual_history;
1460 std::vector<double> measure_history;
1463 double relaxation_factor = 1.;
1464 const double min_relaxation_factor = 0.6;
1465 bool converged =
false;
1466 int stagnate_count = 0;
1467 bool relax_convergence =
false;
1468 this->regularize_ =
false;
1469 for (; it < max_iter_number; ++it, ++debug_cost_counter_) {
1471 assembleWellEqWithoutIteration(simulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger);
1473 BVectorWell dx_well;
1475 dx_well = this->linSys_.solve();
1477 catch(
const NumericalProblem& exp) {
1481 deferred_logger.
problem(
"In MultisegmentWell::iterateWellEqWithControl for well "
1482 + this->name() +
": "+exp.what());
1486 if (it > this->param_.strict_inner_iter_wells_) {
1487 relax_convergence =
true;
1488 this->regularize_ =
true;
1491 const auto& summary_state = simulator.vanguard().summaryState();
1492 const auto report = getWellConvergence(summary_state, well_state, Base::B_avg_, deferred_logger, relax_convergence);
1493 if (report.converged()) {
1500 const auto& [isFinite, residuals] = this->getFiniteWellResiduals(Base::B_avg_, deferred_logger);
1504 residual_history.push_back(residuals);
1505 measure_history.push_back(this->getResidualMeasureValue(well_state,
1506 residual_history[it],
1507 this->param_.tolerance_wells_,
1508 this->param_.tolerance_pressure_ms_wells_,
1513 bool is_oscillate =
false;
1514 bool is_stagnate =
false;
1520 if (is_oscillate || is_stagnate) {
1522 std::ostringstream sstr;
1523 if (relaxation_factor == min_relaxation_factor) {
1526 if (stagnate_count == 6) {
1527 sstr <<
" well " << this->name() <<
" observes severe stagnation and/or oscillation. We relax the tolerance and check for convergence. \n";
1528 const auto reportStag = getWellConvergence(summary_state, well_state, Base::B_avg_, deferred_logger,
true);
1529 if (reportStag.converged()) {
1531 sstr <<
" well " << this->name() <<
" manages to get converged with relaxed tolerances in " << it <<
" inner iterations";
1532 deferred_logger.
debug(sstr.str());
1539 const double reduction_mutliplier = 0.9;
1540 relaxation_factor = std::max(relaxation_factor * reduction_mutliplier, min_relaxation_factor);
1544 sstr <<
" well " << this->name() <<
" observes stagnation in inner iteration " << it <<
"\n";
1548 sstr <<
" well " << this->name() <<
" observes oscillation in inner iteration " << it <<
"\n";
1550 sstr <<
" relaxation_factor is " << relaxation_factor <<
" now\n";
1552 this->regularize_ =
true;
1553 deferred_logger.
debug(sstr.str());
1555 updateWellState(summary_state, dx_well, well_state, deferred_logger, relaxation_factor);
1556 initPrimaryVariablesEvaluation();
1561 std::ostringstream sstr;
1562 sstr <<
" Well " << this->name() <<
" converged in " << it <<
" inner iterations.";
1563 if (relax_convergence)
1564 sstr <<
" (A relaxed tolerance was used after "<< this->param_.strict_inner_iter_wells_ <<
" iterations)";
1565 deferred_logger.
debug(sstr.str());
1567 std::ostringstream sstr;
1568 sstr <<
" Well " << this->name() <<
" did not converge in " << it <<
" inner iterations.";
1569#define EXTRA_DEBUG_MSW 0
1571 sstr <<
"***** Outputting the residual history for well " << this->name() <<
" during inner iterations:";
1572 for (
int i = 0; i < it; ++i) {
1573 const auto& residual = residual_history[i];
1574 sstr <<
" residual at " << i <<
"th iteration ";
1575 for (
const auto& res : residual) {
1578 sstr <<
" " << measure_history[i] <<
" \n";
1581#undef EXTRA_DEBUG_MSW
1582 deferred_logger.
debug(sstr.str());
1589 template<
typename TypeTag>
1594 const Well::InjectionControls& inj_controls,
1595 const Well::ProductionControls& prod_controls,
1599 const bool fixed_control ,
1600 const bool fixed_status )
1602 const int max_iter_number = this->param_.max_inner_iter_ms_wells_;
1606 const auto& [isFinite, residuals] = this->getFiniteWellResiduals(Base::B_avg_, deferred_logger);
1611 std::vector<std::vector<Scalar> > residual_history;
1612 std::vector<double> measure_history;
1615 double relaxation_factor = 1.;
1616 const double min_relaxation_factor = 0.6;
1617 bool converged =
false;
1618 [[maybe_unused]]
int stagnate_count = 0;
1619 bool relax_convergence =
false;
1620 this->regularize_ =
false;
1621 const auto& summary_state = simulator.vanguard().summaryState();
1626 const int min_its_after_switch = 3;
1627 int its_since_last_switch = min_its_after_switch;
1628 int switch_count= 0;
1630 const auto well_status_orig = this->wellStatus_;
1631 const auto operability_orig = this->operability_status_;
1632 auto well_status_cur = well_status_orig;
1634 const bool allow_open = this->well_ecl_.getStatus() == WellStatus::OPEN &&
1635 well_state.
well(this->index_of_well_).status == WellStatus::OPEN;
1637 const bool allow_switching = !this->wellUnderZeroRateTarget(summary_state, well_state) &&
1638 (!fixed_control || !fixed_status) && allow_open;
1639 bool changed =
false;
1640 bool final_check =
false;
1642 this->operability_status_.resetOperability();
1643 this->operability_status_.solvable =
true;
1645 for (; it < max_iter_number; ++it, ++debug_cost_counter_) {
1646 its_since_last_switch++;
1647 if (allow_switching && its_since_last_switch >= min_its_after_switch){
1648 const double wqTotal = this->primary_variables_.getWQTotal().value();
1649 changed = this->updateWellControlAndStatusLocalIteration(simulator, well_state, group_state, inj_controls, prod_controls, wqTotal, deferred_logger, fixed_control, fixed_status);
1651 its_since_last_switch = 0;
1653 if (well_status_cur != this->wellStatus_) {
1654 well_status_cur = this->wellStatus_;
1657 if (!changed && final_check) {
1660 final_check =
false;
1664 assembleWellEqWithoutIteration(simulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger);
1666 const BVectorWell dx_well = this->linSys_.solve();
1668 if (it > this->param_.strict_inner_iter_wells_) {
1669 relax_convergence =
true;
1670 this->regularize_ =
true;
1673 const auto report = getWellConvergence(summary_state, well_state, Base::B_avg_, deferred_logger, relax_convergence);
1674 converged = report.converged();
1678 if (switch_count > 0 && its_since_last_switch < min_its_after_switch) {
1680 its_since_last_switch = min_its_after_switch;
1688 const auto& [isFinite, residuals] = this->getFiniteWellResiduals(Base::B_avg_, deferred_logger);
1692 residual_history.push_back(residuals);
1696 measure_history.push_back(this->getResidualMeasureValue(well_state,
1697 residual_history[it],
1698 this->param_.tolerance_wells_,
1699 this->param_.tolerance_pressure_ms_wells_,
1702 bool is_oscillate =
false;
1703 bool is_stagnate =
false;
1709 if (is_oscillate || is_stagnate) {
1711 std::string message;
1712 if (relaxation_factor == min_relaxation_factor) {
1715 fmt::format_to(std::back_inserter(message),
" Well {} observes severe stagnation and/or oscillation."
1716 " We relax the tolerance and check for convergence. \n", this->name());
1717 const auto reportStag = getWellConvergence(summary_state, well_state, Base::B_avg_,
1718 deferred_logger,
true);
1719 if (reportStag.converged()) {
1721 fmt::format_to(std::back_inserter(message),
" Well {} manages to get converged with relaxed tolerances in {} inner iterations", this->name(), it);
1722 deferred_logger.
debug(message);
1729 constexpr double reduction_mutliplier = 0.9;
1730 relaxation_factor = std::max(relaxation_factor * reduction_mutliplier, min_relaxation_factor);
1734 fmt::format_to(std::back_inserter(message),
" well {} observes stagnation in inner iteration {}\n", this->name(), it);
1737 fmt::format_to(std::back_inserter(message),
" well {} observes oscillation in inner iteration {}\n", this->name(), it);
1739 fmt::format_to(std::back_inserter(message),
" relaxation_factor is {} now\n", relaxation_factor);
1741 this->regularize_ =
true;
1742 deferred_logger.
debug(message);
1745 updateWellState(summary_state, dx_well, well_state, deferred_logger, relaxation_factor);
1746 initPrimaryVariablesEvaluation();
1750 if (allow_switching){
1752 const bool is_stopped = this->wellIsStopped();
1753 if (this->wellHasTHPConstraints(summary_state)){
1754 this->operability_status_.can_obtain_bhp_with_thp_limit = !is_stopped;
1755 this->operability_status_.obey_thp_limit_under_bhp_limit = !is_stopped;
1757 this->operability_status_.operable_under_only_bhp_limit = !is_stopped;
1760 std::string message = fmt::format(
" Well {} converged in {} inner iterations ("
1761 "{} control/status switches).", this->name(), it, switch_count);
1762 if (relax_convergence) {
1763 message.append(fmt::format(
" (A relaxed tolerance was used after {} iterations)",
1764 this->param_.strict_inner_iter_wells_));
1766 deferred_logger.
debug(message);
1768 this->wellStatus_ = well_status_orig;
1769 this->operability_status_ = operability_orig;
1770 const std::string message = fmt::format(
" Well {} did not converge in {} inner iterations ("
1771 "{} control/status switches).", this->name(), it, switch_count);
1772 deferred_logger.
debug(message);
1773 this->primary_variables_.outputLowLimitPressureSegments(deferred_logger);
1780 template<
typename TypeTag>
1785 const Well::InjectionControls& inj_controls,
1786 const Well::ProductionControls& prod_controls,
1791 if (!this->isOperableAndSolvable() && !this->wellIsStopped())
return;
1794 this->segments_.updateUpwindingSegments(this->primary_variables_);
1797 computeSegmentFluidProperties(simulator, deferred_logger);
1800 this->linSys_.clear();
1802 auto& ws = well_state.
well(this->index_of_well_);
1803 ws.phase_mixing_rates.fill(0.0);
1810 const bool allow_cf = this->getAllowCrossFlow() || openCrossFlowAvoidSingularity(simulator);
1812 const int nseg = this->numberOfSegments();
1814 for (
int seg = 0; seg < nseg; ++seg) {
1818 const EvalWell segment_surface_volume = getSegmentSurfaceVolume(simulator, seg);
1823 const Scalar regularization_factor = this->regularize_? this->param_.regularization_factor_wells_ : 1.0;
1825 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
1826 const EvalWell accumulation_term = regularization_factor * (segment_surface_volume * this->primary_variables_.surfaceVolumeFraction(seg, comp_idx)
1827 - segment_fluid_initial_[seg][comp_idx]) / dt;
1829 assembleAccumulationTerm(seg, comp_idx, accumulation_term, this->linSys_);
1834 const int seg_upwind = this->segments_.upwinding_segment(seg);
1835 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
1837 this->primary_variables_.getSegmentRateUpwinding(seg,
1840 this->well_efficiency_factor_;
1842 assembleOutflowTerm(seg, seg_upwind, comp_idx, segment_rate, this->linSys_);
1848 for (
const int inlet : this->segments_.inlets()[seg]) {
1849 const int inlet_upwind = this->segments_.upwinding_segment(inlet);
1850 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
1852 this->primary_variables_.getSegmentRateUpwinding(inlet,
1855 this->well_efficiency_factor_;
1857 assembleInflowTerm(seg, inlet, inlet_upwind, comp_idx, inlet_rate, this->linSys_);
1863 const EvalWell seg_pressure = this->primary_variables_.getSegmentPressure(seg);
1864 auto& perf_data = ws.perf_data;
1865 auto& perf_rates = perf_data.phase_rates;
1866 auto& perf_press_state = perf_data.pressure;
1867 for (
const int perf : this->segments_.perforations()[seg]) {
1868 const int cell_idx = this->well_cells_[perf];
1869 const auto& int_quants = simulator.model().intensiveQuantities(cell_idx, 0);
1870 std::vector<EvalWell> mob(this->num_components_, 0.0);
1871 getMobility(simulator, perf, mob, deferred_logger);
1872 const double trans_mult = simulator.problem().template wellTransMultiplier<double>(int_quants, cell_idx);
1873 const auto& wellstate_nupcol = simulator.problem().wellModel().nupcolWellState().well(this->index_of_well_);
1874 const std::vector<Scalar> Tw = this->wellIndex(perf, int_quants, trans_mult, wellstate_nupcol);
1875 std::vector<EvalWell> cq_s(this->num_components_, 0.0);
1878 computePerfRate(int_quants, mob, Tw, seg, perf, seg_pressure,
1879 allow_cf, cq_s, perf_press, perfRates, deferred_logger);
1882 if (this->isProducer()) {
1883 ws.phase_mixing_rates[ws.dissolved_gas] += perfRates.
dis_gas;
1884 ws.phase_mixing_rates[ws.vaporized_oil] += perfRates.
vap_oil;
1885 perf_data.phase_mixing_rates[perf][ws.dissolved_gas] = perfRates.
dis_gas;
1886 perf_data.phase_mixing_rates[perf][ws.vaporized_oil] = perfRates.
vap_oil;
1890 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
1891 perf_rates[perf*this->number_of_phases_ + this->modelCompIdxToFlowCompIdx(comp_idx)] = cq_s[comp_idx].value();
1893 perf_press_state[perf] = perf_press.value();
1895 for (
int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
1897 const EvalWell cq_s_effective = cq_s[comp_idx] * this->well_efficiency_factor_;
1899 this->connectionRates_[perf][comp_idx] = Base::restrictEval(cq_s_effective);
1902 assemblePerforationEq(seg, cell_idx, comp_idx, cq_s_effective, this->linSys_);
1908 const auto& summaryState = simulator.vanguard().summaryState();
1909 const Schedule& schedule = simulator.vanguard().schedule();
1911 assembleControlEq(well_state,
1918 this->primary_variables_,
1922 const UnitSystem& unit_system = simulator.vanguard().eclState().getDeckUnitSystem();
1923 const auto& summary_state = simulator.vanguard().summaryState();
1924 this->assemblePressureEq(seg, unit_system, well_state, summary_state, this->param_.use_average_density_ms_wells_, deferred_logger);
1928 this->linSys_.createSolver();
1934 template<
typename TypeTag>
1939 return !this->getAllowCrossFlow() && allDrawDownWrongDirection(simulator);
1943 template<
typename TypeTag>
1948 bool all_drawdown_wrong_direction =
true;
1949 const int nseg = this->numberOfSegments();
1951 for (
int seg = 0; seg < nseg; ++seg) {
1952 const EvalWell segment_pressure = this->primary_variables_.getSegmentPressure(seg);
1953 for (
const int perf : this->segments_.perforations()[seg]) {
1955 const int cell_idx = this->well_cells_[perf];
1956 const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, 0);
1957 const auto& fs = intQuants.fluidState();
1960 const EvalWell perf_seg_press_diff = this->segments_.getPressureDiffSegPerf(seg, perf);
1962 const double cell_perf_press_diff = this->cell_perforation_pressure_diffs_[perf];
1964 const double pressure_cell = this->getPerfCellPressure(fs).value();
1965 const double perf_press = pressure_cell - cell_perf_press_diff;
1968 const EvalWell drawdown = perf_press - (segment_pressure + perf_seg_press_diff);
1973 if ( (drawdown < 0. && this->isInjector()) ||
1974 (drawdown > 0. && this->isProducer()) ) {
1975 all_drawdown_wrong_direction =
false;
1981 return all_drawdown_wrong_direction;
1987 template<
typename TypeTag>
1998 template<
typename TypeTag>
2005 int pvt_region_index;
2009 const int cell_idx = this->well_cells_[0];
2010 const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, 0);
2011 const auto& fs = intQuants.fluidState();
2012 temperature.setValue(fs.temperature(FluidSystem::oilPhaseIdx).value());
2013 saltConcentration = this->extendEval(fs.saltConcentration());
2014 pvt_region_index = fs.pvtRegionIndex();
2017 return this->segments_.getSurfaceVolume(temperature,
2019 this->primary_variables_,
2025 template<
typename TypeTag>
2026 std::optional<double>
2030 const SummaryState& summary_state,
2036 this->getALQ(well_state),
2042 template<
typename TypeTag>
2043 std::optional<double>
2046 const SummaryState& summary_state,
2047 const double alq_value,
2051 auto frates = [
this, &simulator, &deferred_logger](
const double bhp) {
2057 std::vector<double> rates(3);
2058 computeWellRatesWithBhp(simulator,
bhp, rates, deferred_logger);
2063 computeBhpAtThpLimitProd(frates,
2065 this->maxPerfPress(simulator),
2066 this->getRefDensity(),
2068 this->getTHPConstraint(summary_state),
2074 auto fratesIter = [
this, &simulator, &deferred_logger](
const double bhp) {
2078 std::vector<double> rates(3);
2079 computeWellRatesWithBhpIterations(simulator,
bhp, rates, deferred_logger);
2084 computeBhpAtThpLimitProd(fratesIter,
2086 this->maxPerfPress(simulator),
2087 this->getRefDensity(),
2089 this->getTHPConstraint(summary_state),
2093 template<
typename TypeTag>
2094 std::optional<double>
2097 const SummaryState& summary_state,
2101 auto frates = [
this, &simulator, &deferred_logger](
const double bhp) {
2107 std::vector<double> rates(3);
2108 computeWellRatesWithBhp(simulator,
bhp, rates, deferred_logger);
2113 computeBhpAtThpLimitInj(frates,
2115 this->getRefDensity(),
2124 auto fratesIter = [
this, &simulator, &deferred_logger](
const double bhp) {
2128 std::vector<double> rates(3);
2129 computeWellRatesWithBhpIterations(simulator,
bhp, rates, deferred_logger);
2134 computeBhpAtThpLimitInj(fratesIter,
2136 this->getRefDensity(),
2147 template<
typename TypeTag>
2152 double max_pressure = 0.0;
2153 const int nseg = this->numberOfSegments();
2154 for (
int seg = 0; seg < nseg; ++seg) {
2155 for (
const int perf : this->segments_.perforations()[seg]) {
2156 const int cell_idx = this->well_cells_[perf];
2157 const auto& int_quants = simulator.model().intensiveQuantities(cell_idx, 0);
2158 const auto& fs = int_quants.fluidState();
2159 double pressure_cell = this->getPerfCellPressure(fs).value();
2160 max_pressure = std::max(max_pressure, pressure_cell);
2163 return max_pressure;
2170 template<
typename TypeTag>
2177 std::vector<Scalar> well_q_s(this->num_components_, 0.0);
2178 const bool allow_cf = this->getAllowCrossFlow() || openCrossFlowAvoidSingularity(simulator);
2179 const int nseg = this->numberOfSegments();
2180 for (
int seg = 0; seg < nseg; ++seg) {
2182 const Scalar seg_pressure = getValue(this->primary_variables_.getSegmentPressure(seg));
2183 for (
const int perf : this->segments_.perforations()[seg]) {
2184 const int cell_idx = this->well_cells_[perf];
2185 const auto& int_quants = simulator.model().intensiveQuantities(cell_idx, 0);
2186 std::vector<Scalar> mob(this->num_components_, 0.0);
2187 getMobility(simulator, perf, mob, deferred_logger);
2188 const double trans_mult = simulator.problem().template wellTransMultiplier<double>(int_quants, cell_idx);
2189 const auto& wellstate_nupcol = simulator.problem().wellModel().nupcolWellState().well(this->index_of_well_);
2190 const std::vector<Scalar> Tw = this->wellIndex(perf, int_quants, trans_mult, wellstate_nupcol);
2191 std::vector<Scalar> cq_s(this->num_components_, 0.0);
2194 computePerfRate(int_quants, mob, Tw, seg, perf, seg_pressure,
2195 allow_cf, cq_s, perf_press, perf_rates, deferred_logger);
2196 for (
int comp = 0; comp < this->num_components_; ++comp) {
2197 well_q_s[comp] += cq_s[comp];
2205 template <
typename TypeTag>
2210 const int num_seg = this->numberOfSegments();
2211 constexpr int num_eq = MSWEval::numWellEq;
2212 std::vector<double> retval(num_seg * num_eq);
2213 for (
int ii = 0; ii < num_seg; ++ii) {
2214 const auto& pv = this->primary_variables_.value(ii);
2215 std::copy(pv.begin(), pv.end(), retval.begin() + ii * num_eq);
2223 template <
typename TypeTag>
2228 const int num_seg = this->numberOfSegments();
2229 constexpr int num_eq = MSWEval::numWellEq;
2230 std::array<double, num_eq> tmp;
2231 for (
int ii = 0; ii < num_seg; ++ii) {
2232 const auto start = it + num_seg * num_eq;
2233 std::copy(start, start + num_eq, tmp.begin());
2234 this->primary_variables_.setValue(ii, tmp);
2236 return num_seg * num_eq;
#define OPM_DEFLOG_PROBLEM(Exception, message, deferred_logger)
Definition: DeferredLoggingErrorHelpers.hpp:61
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
void warning(const std::string &tag, const std::string &message)
void problem(const std::string &tag, const std::string &message)
void debug(const std::string &tag, const std::string &message)
Definition: GroupState.hpp:35
Class handling assemble of the equation system for MultisegmentWell.
Definition: MultisegmentWellAssemble.hpp:44
typename PrimaryVariables::EvalWell EvalWell
Definition: MultisegmentWellEval.hpp:64
PrimaryVariables primary_variables_
The primary variables.
Definition: MultisegmentWellEval.hpp:140
void scaleSegmentPressuresWithBhp(WellState< Scalar > &well_state) const
void scaleSegmentRatesWithWellRates(const std::vector< std::vector< int > > &segment_inlets, const std::vector< std::vector< int > > &segment_perforations, WellState< Scalar > &well_state) const
Definition: MultisegmentWell.hpp:36
double connectionDensity(const int globalConnIdx, const int openConnIdx) const override
Definition: MultisegmentWell_impl.hpp:808
ConvergenceReport getWellConvergence(const SummaryState &summary_state, const WellState< Scalar > &well_state, const std::vector< double > &B_avg, DeferredLogger &deferred_logger, const bool relax_tolerance) const override
check whether the well equations get converged for this well
Definition: MultisegmentWell_impl.hpp:202
int setPrimaryVars(std::vector< double >::const_iterator it) override
Definition: MultisegmentWell_impl.hpp:2226
void solveEqAndUpdateWellState(const SummaryState &summary_state, WellState< Scalar > &well_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:580
void calculateExplicitQuantities(const Simulator &simulator, const WellState< Scalar > &well_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:718
void addWellContributions(SparseMatrixAdapter &jacobian) const override
Definition: MultisegmentWell_impl.hpp:830
virtual bool iterateWellEqWithSwitching(const Simulator &simulator, const double dt, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, WellState< Scalar > &well_state, const GroupState< Scalar > &group_state, DeferredLogger &deferred_logger, const bool fixed_control=false, const bool fixed_status=false) override
Definition: MultisegmentWell_impl.hpp:1592
void computeWellRatesWithBhpIterations(const Simulator &simulator, const Scalar &bhp, std::vector< double > &well_flux, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:390
bool computeWellPotentialsImplicit(const Simulator &simulator, std::vector< double > &well_potentials, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:511
void computePerfRate(const IntensiveQuantities &int_quants, const std::vector< Value > &mob_perfcells, const std::vector< Scalar > &Tw, const int seg, const int perf, const Value &segment_pressure, const bool &allow_cf, std::vector< Value > &cq_s, Value &perf_press, PerforationRates &perf_rates, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:1000
std::optional< double > computeBhpAtThpLimitProdWithAlq(const Simulator &simulator, const SummaryState &summary_state, const double alq_value, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:2045
void apply(const BVector &x, BVector &Ax) const override
Ax = Ax - C D^-1 B x.
Definition: MultisegmentWell_impl.hpp:228
void updateWellState(const SummaryState &summary_state, const BVectorWell &dwells, WellState< Scalar > &well_state, DeferredLogger &deferred_logger, const double relaxation_factor=1.0)
Definition: MultisegmentWell_impl.hpp:683
void init(const PhaseUsage *phase_usage_arg, const std::vector< double > &depth_arg, const double gravity_arg, const int num_cells, const std::vector< Scalar > &B_avg, const bool changed_to_open_this_step) override
Definition: MultisegmentWell_impl.hpp:118
void getMobility(const Simulator &simulator, const int perf, std::vector< Value > &mob, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:1111
void computeWellRatesAtBhpLimit(const Simulator &simulator, std::vector< double > &well_flux, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:329
virtual bool iterateWellEqWithControl(const Simulator &simulator, const double dt, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, WellState< Scalar > &well_state, const GroupState< Scalar > &group_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:1440
std::optional< double > computeBhpAtThpLimitInj(const Simulator &simulator, const SummaryState &summary_state, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2096
void checkOperabilityUnderBHPLimit(const WellState< Scalar > &well_state, const Simulator &ebos_simulator, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:1159
bool openCrossFlowAvoidSingularity(const Simulator &simulator) const
Definition: MultisegmentWell_impl.hpp:1937
void updateProductivityIndex(const Simulator &simulator, const WellProdIndexCalculator &wellPICalc, WellState< Scalar > &well_state, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:736
void computeSegmentFluidProperties(const Simulator &simulator, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:1073
EvalWell getSegmentSurfaceVolume(const Simulator &simulator, const int seg_idx) const
Definition: MultisegmentWell_impl.hpp:2001
bool allDrawDownWrongDirection(const Simulator &simulator) const
Definition: MultisegmentWell_impl.hpp:1946
void computeWellPotentials(const Simulator &simulator, const WellState< Scalar > &well_state, std::vector< double > &well_potentials, DeferredLogger &deferred_logger) override
computing the well potentials for group control
Definition: MultisegmentWell_impl.hpp:284
void updateWellStateWithTarget(const Simulator &simulator, const GroupState< Scalar > &group_state, WellState< Scalar > &well_state, DeferredLogger &deferred_logger) const override
updating the well state based the current control mode
Definition: MultisegmentWell_impl.hpp:181
int debug_cost_counter_
Definition: MultisegmentWell.hpp:174
void addWellPressureEquations(PressureMatrix &mat, const BVector &x, const int pressureVarIndex, const bool use_well_weights, const WellState< Scalar > &well_state) const override
Definition: MultisegmentWell_impl.hpp:839
std::vector< double > computeWellPotentialWithTHP(const WellState< Scalar > &well_state, const Simulator &simulator, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:462
static constexpr bool has_polymer
Definition: WellInterface.hpp:113
virtual void assembleWellEqWithoutIteration(const Simulator &simulator, const double dt, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, WellState< Scalar > &well_state, const GroupState< Scalar > &group_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:1783
void updatePrimaryVariables(const SummaryState &summary_state, const WellState< Scalar > &well_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:165
static constexpr bool has_solvent
Definition: WellInterface.hpp:111
void checkOperabilityUnderTHPLimit(const Simulator &ebos_simulator, const WellState< Scalar > &well_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:1388
void computePerfCellPressDiffs(const Simulator &simulator)
Definition: MultisegmentWell_impl.hpp:610
virtual double getRefDensity() const override
Definition: MultisegmentWell_impl.hpp:1151
std::vector< double > computeCurrentWellRates(const Simulator &simulator, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:2173
std::vector< double > getPrimaryVars() const override
Definition: MultisegmentWell_impl.hpp:2208
void updateIPR(const Simulator &ebos_simulator, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:1225
virtual void updateWaterThroughput(const double dt, WellState< Scalar > &well_state) const override
Definition: MultisegmentWell_impl.hpp:1990
std::optional< double > computeBhpAtThpLimitProd(const WellState< Scalar > &well_state, const Simulator &simulator, const SummaryState &summary_state, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2028
void initPrimaryVariablesEvaluation() override
Definition: MultisegmentWell_impl.hpp:153
void recoverWellSolutionAndUpdateWellState(const SummaryState &summary_state, const BVector &x, WellState< Scalar > &well_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:263
void updateIPRImplicit(const Simulator &simulator, WellState< Scalar > &well_state, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:1319
double maxPerfPress(const Simulator &simulator) const
Definition: MultisegmentWell_impl.hpp:2150
MultisegmentWell(const Well &well, const ParallelWellInfo &pw_info, const int time_step, const ModelParameters ¶m, const RateConverterType &rate_converter, const int pvtRegionIdx, const int num_components, const int num_phases, const int index_of_well, const std::vector< PerforationData > &perf_data)
Definition: MultisegmentWell_impl.hpp:59
void computeWellRatesWithBhp(const Simulator &simulator, const double &bhp, std::vector< double > &well_flux, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:345
void computeInitialSegmentFluids(const Simulator &simulator)
Definition: MultisegmentWell_impl.hpp:665
EvalWell getQs(const int comp_idx) const
Returns scaled rate for a component.
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:184
Class for computing BHP limits.
Definition: WellBhpThpCalculator.hpp:42
double mostStrictBhpFromBhpLimits(const SummaryState &summaryState) const
Obtain the most strict BHP from BHP limits.
double calculateThpFromBhp(const std::vector< double > &rates, const double bhp, const double rho, const std::optional< double > &alq, const double thp_limit, DeferredLogger &deferred_logger) const
Calculates THP from BHP.
std::pair< bool, bool > computeWellPotentials(std::vector< double > &well_potentials, const WellState< double > &well_state)
void prepareForPotentialCalculations(const SummaryState &summary_state, WellState< double > &well_state, Well::InjectionControls &inj_controls, Well::ProductionControls &prod_controls) const
Well well_ecl_
Definition: WellInterfaceGeneric.hpp:302
Definition: WellInterfaceIndices.hpp:35
Definition: WellInterface.hpp:75
Dune::BCRSMatrix< Opm::MatrixBlock< double, 1, 1 > > PressureMatrix
Definition: WellInterface.hpp:102
static constexpr bool has_brine
Definition: WellInterface.hpp:119
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: WellInterface.hpp:82
void getMobility(const Simulator &simulator, const int perf, std::vector< Value > &mob, Callback &extendEval, DeferredLogger &deferred_logger) const
Definition: WellInterface_impl.hpp:1691
typename WellInterfaceFluidSystem< FluidSystem >::RateConverterType RateConverterType
Definition: WellInterface.hpp:105
GetPropType< TypeTag, Properties::IntensiveQuantities > IntensiveQuantities
Definition: WellInterface.hpp:85
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: WellInterface.hpp:96
static constexpr bool has_watVapor
Definition: WellInterface.hpp:120
Dune::BlockVector< VectorBlockType > BVector
Definition: WellInterface.hpp:101
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: WellInterface.hpp:83
static constexpr bool has_foam
Definition: WellInterface.hpp:118
typename Base::Eval Eval
Definition: WellInterface.hpp:100
static constexpr bool has_energy
Definition: WellInterface.hpp:114
GetPropType< TypeTag, Properties::Indices > Indices
Definition: WellInterface.hpp:84
bool solveWellWithTHPConstraint(const Simulator &simulator, const double dt, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, WellState< Scalar > &well_state, const GroupState< Scalar > &group_state, DeferredLogger &deferred_logger)
Definition: WellInterface_impl.hpp:486
bool thp_update_iterations
Definition: WellInterface.hpp:377
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: WellInterface.hpp:87
Definition: WellProdIndexCalculator.hpp:36
double connectionProdIndStandard(const std::size_t connIdx, const double connMobility) const
Definition: WellState.hpp:62
const SingleWellState< Scalar > & well(std::size_t well_index) const
Definition: WellState.hpp:300
@ NONE
Definition: DeferredLogger.hpp:46
void detectOscillations(const std::vector< std::vector< double > > &residualHistory, const int it, const int numPhases, const double relaxRelTol, bool &oscillate, bool &stagnate)
Detect oscillation or stagnation in a given residual history.
VFPEvaluation bhp(const VFPProdTable &table, const double aqua, const double liquid, const double vapour, const double thp, const double alq, const double explicit_wfr, const double explicit_gfr, const bool use_vfpexplicit)
Definition: BlackoilPhases.hpp:27
PhaseUsage phaseUsage(const Phases &phases)
Determine the active phases.
std::string to_string(const ConvergenceReport::ReservoirFailure::Type t)
Solver parameters for the BlackoilModel.
Definition: BlackoilModelParameters.hpp:484
Definition: PerforationData.hpp:40
double dis_gas
Definition: PerforationData.hpp:41
double vap_oil
Definition: PerforationData.hpp:43
Definition: BlackoilPhases.hpp:46
std::array< int, MaxNumPhases+NumCryptoPhases > phase_used
Definition: BlackoilPhases.hpp:51
std::array< int, MaxNumPhases+NumCryptoPhases > phase_pos
Definition: BlackoilPhases.hpp:52