20 #ifndef OPM_COMP_WELL_HPP 21 #define OPM_COMP_WELL_HPP 25 #include <flowexperimental/comp/wells/CompWellEquations.hpp> 26 #include <flowexperimental/comp/wells/CompWellFlash.hpp> 27 #include <flowexperimental/comp/wells/CompWellInterface.hpp> 28 #include <flowexperimental/comp/wells/CompWellPrimaryVariables.hpp> 30 #include <opm/simulators/wells/PerforationData.hpp> 34 template <
typename TypeTag>
47 constexpr
static unsigned num_comp = FluidSystem::numComponents;
49 using EvalWell =
typename PrimaryVariables::EvalWell;
50 using BVectorWell =
typename WellEquations::BVectorWell;
52 using VectorBlockType = Dune::FieldVector<Scalar, Indices::numEq>;
53 using BVector = Dune::BlockVector<VectorBlockType>;
60 using FluidState = CompositionalFluidState<T, FluidSystem>;
67 static constexpr
int num_phases = 2;
68 std::array<EvalWell, num_phases> surface_densities_{};
69 std::array<EvalWell, num_phases> volume_fractions_{};
70 std::array<std::array<EvalWell, num_comp>, num_phases> mass_fractions_{};
72 EvalWell density()
const {
73 EvalWell density = 0.;
74 for (
int i = 0; i < num_phases; ++i) {
75 density += surface_densities_[i] * volume_fractions_[i];
81 EvalWell massFraction(
int comp_idx)
const {
83 for (
unsigned p = 0; p < num_phases; ++p) {
84 mass += surface_densities_[p] * volume_fractions_[p] * mass_fractions_[p][comp_idx];
86 return mass / density();
92 const std::vector<CompConnectionData>& well_connection_data);
96 void calculateExplicitQuantities(
const Simulator& simulator,
97 const SingleWellState& well_state)
override;
99 void updatePrimaryVariables(
const Simulator& simulator,
100 const SingleWellState& well_state)
override;
102 void updateSecondaryQuantities(
const Simulator& simulator);
105 void assembleWellEq(
const Simulator& simulator,
106 const SingleWellState& well_state,
109 bool iterateWellEq(
const Simulator& simulator,
111 SingleWellState& well_state)
override;
113 void solveEqAndUpdateWellState(SingleWellState& well_state);
115 void apply(BVector& r)
const override;
117 void recoverWellSolutionAndUpdateWellState(
const BVector& x,
118 SingleWellState& well_state)
override;
120 bool getConvergence()
const override;
122 void addWellContributions(SparseMatrixAdapter&)
const override;
133 const Scalar wellbore_volume_ {21.6*0.001};
135 std::array<EvalWell, num_comp> mass_fractions_{0.};
136 EvalWell fluid_density_{0.};
138 std::array<Scalar, num_comp> component_masses_{0.};
140 std::array<EvalWell, num_comp> new_component_masses_{0.};
142 SurfaceConditons surface_conditions_;
145 void calculateSingleConnectionRate(
const Simulator& simulator,
146 std::vector<EvalWell>& con_rates)
const;
148 void updateTotalMass();
151 void updateSurfaceQuantities(
const Simulator& simulator);
153 void getMobility(
const Simulator& simulator,
154 const int connection_idx,
155 std::vector<EvalWell>& mob)
const;
159 void assembleSourceTerm(
const Scalar dt);
161 void assembleControlEq(
const SingleWellState& well_state,
162 const SummaryState& summary_state);
164 void assembleControlEqProd(
const SingleWellState& well_state,
165 const Well::ProductionControls& prod_controls,
166 EvalWell& control_eq)
const;
168 void assembleControlEqInj(
const SingleWellState& well_state,
169 const Well::InjectionControls& inj_controls,
170 EvalWell& control_eq)
const;
172 void updatePrimaryVariablesNewton(
const BVectorWell& dwells);
175 void updateWellStateFromPrimaryVariables(SingleWellState& well_state)
const;
177 void updateWellState(
const BVectorWell& dwells,
178 SingleWellState& well_state);
180 void updateWellControl(
const SummaryState& summary_state,
181 SingleWellState& well_state)
const;
183 template <
typename T>
185 updateSurfaceCondition_(
const StandardCond& surface_cond, FluidState<T>& fluid_state);
187 template <
typename T>
189 flashFluidState_(FluidState<T>& fluid_state);
194 #include "CompWell_impl.hpp" 196 #endif // OPM_COMPOSITIONAL_WELL_MODEL_HPP Definition: CompWellInterface.hpp:33
Definition: CompWellPrimaryVariables.hpp:32
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(...))
Definition: propertysystem.hh:233
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
Definition: CompWell.hpp:35
Static data associated with a well perforation.
Definition: BlackoilWellModelRestart.hpp:41
The Opm property system, traits with inheritance.
Definition: CompWellPrimaryVariables.hpp:35
Definition: CompWell.hpp:65