WellFractureFlowSplit.hpp
Go to the documentation of this file.
1/*
2 Copyright 2026 SINTEF Digital, Mathematics and Cybernetics.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_WELL_FRACTURE_FLOW_SPLIT_HPP_INCLUDED
21#define OPM_WELL_FRACTURE_FLOW_SPLIT_HPP_INCLUDED
22
23#include <opm/material/common/MathToolbox.hpp>
24
25#include <cassert>
26
27namespace Opm {
28
38template <class FluidSystem, class Scalar, class Simulator,
39 class WellContainer, class WellState>
41 const WellContainer& well_container,
42 WellState& well_state,
43 const WellState& nupcol_well_state)
44{
45 for (const auto& well : well_container) {
46 if (!well->isInjector()) {
47 continue;
48 }
49
50 const auto& fracture_indices = well->wellIndexFracture();
51 if (fracture_indices.empty()) {
52 continue; // no fracture crosses this well
53 }
54
55 const auto& wellstate_nupcol = nupcol_well_state.well(well->indexOfWell());
56 auto& single_wellstate = well_state.well(well->indexOfWell());
57 auto& perf_data = single_wellstate.perf_data;
58 auto& filtrate_data = perf_data.filtrate_data;
59 auto& fracture_data = perf_data.fracture_data;
60
61 const int nperf = static_cast<int>(well->wellIndex().size());
62 assert(static_cast<int>(fracture_indices.size()) == nperf);
63
64 Scalar total_flow_fracture = 0.0;
65 const int np = well_state.numPhases();
66
67 auto obtain = [](const auto& value) { return getValue(value); };
68
69 for (int perf = 0; perf < nperf; ++perf) {
70 const auto cell_idx = well->perforationData()[perf].cell_index;
71 const auto& intQuants =
72 simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/0);
73 const auto trans_mult = simulator.problem()
74 .template wellTransMultiplier<Scalar>(intQuants, cell_idx, obtain);
75
76 const Scalar matrix_wi = well->wellIndex()[perf] * trans_mult;
77 const Scalar perf_pressure = wellstate_nupcol.perf_data.pressure[perf];
78 const Scalar fracture_wi = fracture_indices[perf].wellIndex(perf_pressure);
79 const Scalar effective_wi = matrix_wi + fracture_wi;
80
81 auto& fracture_rate = fracture_data.water_rate[perf];
82 if (effective_wi > 0.0) {
83 const Scalar matrix_frac = matrix_wi / effective_wi;
84 filtrate_data.flow_factor[perf] = matrix_frac;
85 fracture_rate = (1.0 - matrix_frac)
86 * perf_data.phase_rates[perf*np + FluidSystem::waterPhaseIdx];
87 total_flow_fracture += fracture_rate;
88 }
89 else {
90 filtrate_data.flow_factor[perf] = 0.0;
91 fracture_rate = 0.0;
92 }
93 }
94
95 single_wellstate.frac_rate = total_flow_fracture;
96 }
97}
98
99} // namespace Opm
100
101#endif // OPM_WELL_FRACTURE_FLOW_SPLIT_HPP_INCLUDED
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:40