22 template <
typename Flu
idSystem>
23 CompWellState<FluidSystem>::
24 CompWellState(
const CompositionalConfig& comp_config)
25 : comp_config_(comp_config)
30 template <
typename Flu
idSystem>
31 void CompWellState<FluidSystem>::
32 init(
const std::vector<Well>& wells_ecl,
33 const std::vector<Scalar>& cell_pressures,
34 const Scalar temperature,
35 const std::vector<std::vector<Scalar>>& cell_mole_fractions,
36 const std::vector<std::vector<CompConnectionData> >& well_connection_data,
37 const SummaryState& summary_state,
38 const CompWellState* prev_well_state)
40 this->base_init(wells_ecl, cell_pressures, temperature, cell_mole_fractions, well_connection_data, summary_state);
42 if (!prev_well_state) {
46 for (
const auto& well_name : this->wells_.wells()) {
47 if (prev_well_state->wells_.has(well_name)) {
48 this->wells_[well_name].copyRuntimeStateFrom(prev_well_state->wells_[well_name]);
53 template <
typename Flu
idSystem>
54 void CompWellState<FluidSystem>::
55 base_init(
const std::vector<Well>& wells_ecl,
56 const std::vector<Scalar>& cell_pressures,
57 const Scalar temperature,
58 const std::vector<std::vector<Scalar>>& cell_mole_fractions,
59 const std::vector<std::vector<CompConnectionData>>& well_connection_data,
60 const SummaryState& summary_state)
64 const auto num_wells = wells_ecl.size();
66 for (
auto w = 0*num_wells; w < num_wells; ++w) {
67 const Well& well = wells_ecl[w];
68 const auto& conn_data = well_connection_data[w];
69 initSingleWell(well, cell_pressures, temperature, cell_mole_fractions, conn_data, summary_state);
74 template <
typename Flu
idSystem>
75 void CompWellState<FluidSystem>::
76 initSingleWell(
const Well& well,
77 const std::vector<Scalar>& cell_pressures,
78 const Scalar tempearture,
79 const std::vector<std::vector<Scalar>>& cell_mole_fractions,
80 const std::vector<CompConnectionData>& conn_data,
81 const SummaryState& summary_state)
83 if (well.isInjector()) {
84 initSingleInjector(well, cell_pressures, tempearture, conn_data, summary_state);
86 initSingleProducer(well, cell_pressures, tempearture, cell_mole_fractions, conn_data, summary_state);
91 template <
typename Flu
idSystem>
92 void CompWellState<FluidSystem>::
93 initSingleInjector(
const Well& well,
94 const std::vector<Scalar>& ,
95 const Scalar temperature,
96 const std::vector<CompConnectionData>& conn_data,
97 const SummaryState& summary_state)
99 auto& ws = this->wells_.add(well.name(),
100 SingleWellState(well.name(),
105 ws.update_injector_targets(well, summary_state);
108 template <
typename Flu
idSystem>
109 void CompWellState<FluidSystem>::
110 initSingleProducer(
const Well& well,
111 const std::vector<Scalar>& ,
112 const Scalar temperature,
113 const std::vector<std::vector<Scalar>>& cell_mole_fractions,
114 const std::vector<CompConnectionData>& conn_data,
115 const SummaryState& summary_state)
117 auto& ws = this->wells_.add(well.name(),
118 SingleWellState(well.name(),
123 ws.update_producer_targets(well, cell_mole_fractions, summary_state);
126 template <
typename Flu
idSystem>
127 const typename CompWellState<FluidSystem>::SingleWellState&
128 CompWellState<FluidSystem>::
129 operator[](
const std::string& well_name)
const 131 return this->wells_[well_name];
134 template <
typename Flu
idSystem>
135 typename CompWellState<FluidSystem>::SingleWellState&
136 CompWellState<FluidSystem>::
137 operator[](
const std::string& well_name)
139 return this->wells_[well_name];
142 template <
typename Flu
idSystem>
144 CompWellState<FluidSystem>::
147 if (this->wells_.empty()) {
150 using rt = data::Rates::opt;
153 for (std::size_t w = 0; w < this->wells_.size(); ++w) {
154 const auto& ws = this->wells_[w];
155 if (ws.status == Well::Status::SHUT) {
158 auto& well = res[ws.name];
160 well.temperature = ws.temperature;
161 const auto& surface_rates = ws.surface_phase_rates;
162 if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
163 well.rates.set(rt::wat, surface_rates[FluidSystem::waterPhaseIdx]);
165 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
166 well.rates.set(rt::oil, surface_rates[FluidSystem::oilPhaseIdx]);
168 if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
169 well.rates.set(rt::gas, surface_rates[FluidSystem::gasPhaseIdx]);
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45