20#ifndef OPM_WELL_FRACTURE_FLOW_SPLIT_HPP_INCLUDED
21#define OPM_WELL_FRACTURE_FLOW_SPLIT_HPP_INCLUDED
23#include <opm/material/common/MathToolbox.hpp>
43template <
class FluidSystem,
class Scalar,
class Simulator,
44 class WellContainer,
class WellState>
50 using IndexTraits =
typename FluidSystem::IndexTraitsType;
52 for (
const auto& well : well_container) {
53 auto& single_wellstate = well_state.
well(well->indexOfWell());
54 auto& perf_data = single_wellstate.perf_data;
55 auto& filtrate_data = perf_data.filtrate_data;
56 auto& fracture_data = perf_data.fracture_data;
59 std::ranges::fill(fracture_data.injected_rate, Scalar{0});
60 std::ranges::fill(filtrate_data.flow_factor, Scalar{1});
61 fracture_data.injected_phase = -1;
63 if (!well->isInjector()) {
69 const auto inj_type = well->wellEcl().injectorType();
71 if (!inj_phase.has_value()) {
74 fracture_data.injected_phase =
75 static_cast<int>(*injectedCanonicalPhaseIdx<IndexTraits>(inj_type));
77 const auto& fracture_indices = well->wellIndexFracture();
78 if (fracture_indices.empty()) {
82 const auto& wellstate_nupcol = nupcol_well_state.
well(well->indexOfWell());
84 const int nperf =
static_cast<int>(well->wellIndex().size());
85 assert(
static_cast<int>(fracture_indices.size()) == nperf);
89 auto obtain = [](
const auto& value) {
return getValue(value); };
91 for (
int perf = 0; perf < nperf; ++perf) {
92 const auto cell_idx = well->perforationData()[perf].cell_index;
93 const auto& intQuants =
94 simulator.
model().intensiveQuantities(cell_idx, 0);
95 const auto trans_mult = simulator.
problem()
96 .template wellTransMultiplier<Scalar>(intQuants, cell_idx, obtain);
98 const Scalar matrix_wi = well->wellIndex()[perf] * trans_mult;
99 const Scalar perf_pressure = wellstate_nupcol.perf_data.pressure[perf];
100 const Scalar fracture_wi = fracture_indices[perf].wellIndex(perf_pressure);
101 const Scalar effective_wi = matrix_wi + fracture_wi;
103 auto& fracture_rate = fracture_data.injected_rate[perf];
104 if (effective_wi > 0.0) {
105 const Scalar matrix_frac = matrix_wi / effective_wi;
106 filtrate_data.flow_factor[perf] = matrix_frac;
107 fracture_rate = (1.0 - matrix_frac)
108 * perf_data.phase_rates[perf*np + *inj_phase];
111 filtrate_data.flow_factor[perf] = 0.0;
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:87
Problem & problem()
Return the object which specifies the pysical setup of the simulation.
Definition: simulator.hh:273
Model & model()
Return the physical model used in the simulation.
Definition: simulator.hh:260
Definition: WellContainer.hpp:46
Definition: WellState.hpp:68
constexpr int numPhases() const
The number of phases present.
Definition: WellState.hpp:274
const SingleWellState< Scalar, IndexTraits > & well(std::size_t well_index) const
Definition: WellState.hpp:315
Definition: blackoilbioeffectsmodules.hh:45
void updateWellFractureFlowSplit(const Simulator &simulator, const WellContainer &well_container, WellState &well_state, const WellState &nupcol_well_state)
Definition: WellFractureFlowSplit.hpp:45
std::optional< int > injectedActivePhaseIdx(const PhaseUsageInfo< IndexTraits > &pu, const InjectorType type)
Definition: InjectedPhase.hpp:50