changed: introduce a struct PerforationRates

this holds various rates for a perforation that used to be
kept as separate variables
This commit is contained in:
Arne Morten Kvarving 2023-05-04 12:48:15 +02:00
parent 61e5ce3d73
commit 9bfe835652
3 changed files with 41 additions and 34 deletions

View File

@ -992,8 +992,7 @@ namespace Opm
cmix_s[comp_idx] = getValue(this->primary_variables_.surfaceVolumeFraction(seg, comp_idx));
}
Scalar perf_dis_gas_rate = 0.0;
Scalar perf_vap_oil_rate = 0.0;
PerforationRates perf_rates;
Scalar perf_press = 0.0;
this->computePerfRate(pressure_cell,
@ -1009,8 +1008,8 @@ namespace Opm
cmix_s,
cq_s,
perf_press,
perf_dis_gas_rate,
perf_vap_oil_rate,
perf_rates.dis_gas,
perf_rates.vap_oil,
deferred_logger);
}
@ -1621,14 +1620,16 @@ namespace Opm
const double Tw = this->well_index_[perf] * trans_mult;
std::vector<EvalWell> cq_s(this->num_components_, 0.0);
EvalWell perf_press;
double perf_dis_gas_rate = 0.;
double perf_vap_oil_rate = 0.;
computePerfRateEval(int_quants, mob, Tw, seg, perf, seg_pressure, allow_cf, cq_s, perf_press, perf_dis_gas_rate, perf_vap_oil_rate, deferred_logger);
PerforationRates perfRates;
computePerfRateEval(int_quants, mob, Tw, seg, perf, seg_pressure,
allow_cf, cq_s, perf_press,
perfRates.dis_gas,
perfRates.vap_oil, deferred_logger);
// updating the solution gas rate and solution oil rate
if (this->isProducer()) {
ws.dissolved_gas_rate += perf_dis_gas_rate;
ws.vaporized_oil_rate += perf_vap_oil_rate;
ws.dissolved_gas_rate += perfRates.dis_gas;
ws.vaporized_oil_rate += perfRates.vap_oil;
}
// store the perf pressure and rates

View File

@ -35,6 +35,14 @@ struct PerforationData
std::size_t ecl_index;
};
struct PerforationRates
{
double dis_gas = 0.0;
double dis_gas_in_water = 0.0;
double vap_oil = 0.0;
double vap_wat = 0.0;
};
} // namespace Opm
#endif // OPM_PERFORATIONDATA_HEADER_INCLUDED

View File

@ -215,10 +215,7 @@ namespace Opm
}
}
Scalar perf_dis_gas_rate = 0.0;
Scalar perf_vap_oil_rate = 0.0;
Scalar perf_vap_wat_rate = 0.0;
Scalar perf_dis_gas_rate_in_water = 0.0;
PerforationRates perf_rates;
// surface volume fraction of fluids within wellbore
std::vector<Scalar> cmix_s(this->numComponents(), 0.0);
@ -240,10 +237,10 @@ namespace Opm
skin_pressure,
cmix_s,
cq_s,
perf_dis_gas_rate,
perf_dis_gas_rate_in_water,
perf_vap_oil_rate,
perf_vap_wat_rate,
perf_rates.dis_gas,
perf_rates.dis_gas_in_water,
perf_rates.vap_oil,
perf_rates.vap_wat,
deferred_logger);
}
@ -642,14 +639,15 @@ namespace Opm
std::vector<EvalWell> mob(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.});
getMobilityEval(ebosSimulator, perf, mob, deferred_logger);
double perf_dis_gas_rate = 0.;
double perf_dis_gas_rate_in_water = 0.;
double perf_vap_oil_rate = 0.;
double perf_vap_wat_rate = 0.;
PerforationRates perf_rates;
double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier<double>(intQuants, cell_idx);
const double Tw = this->well_index_[perf] * trans_mult;
computePerfRateEval(intQuants, mob, bhp, Tw, perf, allow_cf,
cq_s, perf_dis_gas_rate, perf_dis_gas_rate_in_water, perf_vap_oil_rate, perf_vap_wat_rate, deferred_logger);
cq_s,
perf_rates.dis_gas,
perf_rates.dis_gas_in_water,
perf_rates.vap_oil,
perf_rates.vap_wat, deferred_logger);
auto& ws = well_state.well(this->index_of_well_);
auto& perf_data = ws.perf_data;
@ -667,10 +665,10 @@ namespace Opm
// updating the solution gas rate and solution oil rate
if (this->isProducer()) {
ws.dissolved_gas_rate += perf_dis_gas_rate;
ws.dissolved_gas_rate_in_water += perf_dis_gas_rate_in_water;
ws.vaporized_oil_rate += perf_vap_oil_rate;
ws.vaporized_wat_rate += perf_vap_wat_rate;
ws.dissolved_gas_rate += perf_rates.dis_gas;
ws.dissolved_gas_rate_in_water += perf_rates.dis_gas_in_water;
ws.vaporized_oil_rate += perf_rates.vap_oil;
ws.vaporized_wat_rate += perf_rates.vap_wat;
}
if constexpr (has_energy) {
@ -786,7 +784,7 @@ namespace Opm
if (this->isInjector()) {
cq_s_zfrac_effective *= this->wsolvent();
} else if (cq_s_zfrac_effective.value() != 0.0) {
const double dis_gas_frac = perf_dis_gas_rate / cq_s_zfrac_effective.value();
const double dis_gas_frac = perf_rates.dis_gas / cq_s_zfrac_effective.value();
cq_s_zfrac_effective *= this->extendEval(dis_gas_frac*intQuants.xVolume() + (1.0-dis_gas_frac)*intQuants.yVolume());
}
auto& perf_rate_solvent = perf_data.solvent_rates;
@ -800,7 +798,7 @@ namespace Opm
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
// Correction salt rate; evaporated water does not contain salt
EvalWell cq_s_sm = cq_s[waterCompIdx] - perf_vap_wat_rate;
EvalWell cq_s_sm = cq_s[waterCompIdx] - perf_rates.vap_wat;
if (this->isInjector()) {
cq_s_sm *= this->wsalt();
} else {
@ -2050,14 +2048,14 @@ namespace Opm
const EvalWell& bhp = this->primary_variables_.eval(Bhp);
std::vector<EvalWell> cq_s(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.});
double perf_dis_gas_rate = 0.;
double perf_dis_gas_rate_in_water = 0.;
double perf_vap_oil_rate = 0.;
double perf_vap_wat_rate = 0.;
PerforationRates perf_rates;
double trans_mult = ebos_simulator.problem().template rockCompTransMultiplier<double>(int_quant, cell_idx);
const double Tw = this->well_index_[perf] * trans_mult;
computePerfRateEval(int_quant, mob, bhp, Tw, perf, allow_cf,
cq_s, perf_dis_gas_rate, perf_dis_gas_rate_in_water, perf_vap_oil_rate, perf_vap_wat_rate, deferred_logger);
computePerfRateEval(int_quant, mob, bhp, Tw, perf, allow_cf, cq_s,
perf_rates.dis_gas,
perf_rates.dis_gas_in_water,
perf_rates.vap_oil,
perf_rates.vap_wat, deferred_logger);
// TODO: make area a member
const double area = 2 * M_PI * this->perf_rep_radius_[perf] * this->perf_length_[perf];
const auto& material_law_manager = ebos_simulator.problem().materialLawManager();