mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changing reservoir related members to pointers for MultisegmentWells
This commit is contained in:
parent
66cd66e61b
commit
7d0d50eb53
@ -71,8 +71,9 @@ namespace Opm {
|
||||
const std::vector<WellMultiSegmentConstPtr>& wells_multisegment)
|
||||
: Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver,
|
||||
eclState, has_disgas, has_vapoil, terminal_output)
|
||||
, ms_wells_(wells_multisegment, fluid_, active_, phaseCondition_)
|
||||
, ms_wells_(wells_multisegment)
|
||||
{
|
||||
ms_wells_.init(&fluid_, &active_, &phaseCondition_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,16 +140,10 @@ namespace Opm {
|
||||
|
||||
|
||||
MultisegmentWells::
|
||||
MultisegmentWells(const std::vector<WellMultiSegmentConstPtr>& wells_ms,
|
||||
const BlackoilPropsAdInterface& fluid_arg,
|
||||
const std::vector<bool>& active_arg,
|
||||
const std::vector<PhasePresence>& pc_arg)
|
||||
MultisegmentWells(const std::vector<WellMultiSegmentConstPtr>& wells_ms)
|
||||
: wells_multisegment_(wells_ms)
|
||||
, wops_ms_(wells_ms)
|
||||
, num_phases_(wells_ms.empty()? 0 : wells_ms[0]->numberOfPhases())
|
||||
, fluid_(fluid_arg)
|
||||
, active_(active_arg)
|
||||
, phase_condition_(pc_arg)
|
||||
, well_segment_perforation_pressure_diffs_(ADB::null())
|
||||
, well_segment_densities_(ADB::null())
|
||||
, well_segment_pressures_delta_(ADB::null())
|
||||
@ -178,6 +172,20 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
void
|
||||
MultisegmentWells::init(const BlackoilPropsAdInterface* fluid_arg,
|
||||
const std::vector<bool>* active_arg,
|
||||
const std::vector<PhasePresence>* pc_arg)
|
||||
{
|
||||
fluid_ = fluid_arg;
|
||||
active_ = active_arg;
|
||||
phase_condition_ = pc_arg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const std::vector<WellMultiSegmentConstPtr>&
|
||||
MultisegmentWells::wells() const
|
||||
{
|
||||
|
@ -80,10 +80,11 @@ namespace Opm {
|
||||
// --------- Public methods ---------
|
||||
// TODO: using a vector of WellMultiSegmentConstPtr for now
|
||||
// TODO: it should use const Wells or something else later.
|
||||
MultisegmentWells(const std::vector<WellMultiSegmentConstPtr>& wells_multisegment,
|
||||
const BlackoilPropsAdInterface& fluid_arg,
|
||||
const std::vector<bool>& active_arg,
|
||||
const std::vector<PhasePresence>& pc_arg);
|
||||
MultisegmentWells(const std::vector<WellMultiSegmentConstPtr>& wells_multisegment);
|
||||
|
||||
void init(const BlackoilPropsAdInterface* fluid_arg,
|
||||
const std::vector<bool>* active_arg,
|
||||
const std::vector<PhasePresence>* pc_arg);
|
||||
|
||||
const std::vector<WellMultiSegmentConstPtr>& wells() const;
|
||||
const MultisegmentWellOps& wellOps() const;
|
||||
@ -178,9 +179,10 @@ namespace Opm {
|
||||
const int num_phases_;
|
||||
int nseg_total_;
|
||||
int nperf_total_;
|
||||
const BlackoilPropsAdInterface& fluid_;
|
||||
const std::vector<bool>& active_;
|
||||
const std::vector<PhasePresence>& phase_condition_;
|
||||
|
||||
const BlackoilPropsAdInterface* fluid_;
|
||||
const std::vector<bool>* active_;
|
||||
const std::vector<PhasePresence>* phase_condition_;
|
||||
|
||||
// Pressure correction due to the different depth of the perforation
|
||||
// and the cell center of the grid block
|
||||
|
@ -139,7 +139,7 @@ namespace Opm
|
||||
const int nseg = nseg_total_;
|
||||
const int nperf = nperf_total_;
|
||||
|
||||
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
|
||||
const Opm::PhaseUsage& pu = fluid_->phaseUsage();
|
||||
|
||||
cq_s.resize(np, ADB::null());
|
||||
|
||||
@ -201,7 +201,7 @@ namespace Opm
|
||||
cq_ps[phase] = b_perfcells[phase] * cq_p;
|
||||
}
|
||||
|
||||
if (active_[Oil] && active_[Gas]) {
|
||||
if ((*active_)[Oil] && (*active_)[Gas]) {
|
||||
const int oilpos = pu.phase_pos[Oil];
|
||||
const int gaspos = pu.phase_pos[Gas];
|
||||
const ADB cq_psOil = cq_ps[oilpos];
|
||||
@ -285,11 +285,11 @@ namespace Opm
|
||||
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
ADB tmp = cmix_s[phase];
|
||||
if (phase == Oil && active_[Gas]) {
|
||||
if (phase == Oil && (*active_)[Gas]) {
|
||||
const int gaspos = pu.phase_pos[Gas];
|
||||
tmp = tmp - rv_perfcells * cmix_s[gaspos] / d;
|
||||
}
|
||||
if (phase == Gas && active_[Oil]) {
|
||||
if (phase == Gas && (*active_)[Oil]) {
|
||||
const int oilpos = pu.phase_pos[Oil];
|
||||
tmp = tmp - rs_perfcells * cmix_s[oilpos] / d;
|
||||
}
|
||||
@ -357,37 +357,37 @@ namespace Opm
|
||||
// Compute PVT properties for segments.
|
||||
std::vector<PhasePresence> segment_cond(nseg_total);
|
||||
for (int s = 0; s < nseg_total; ++s) {
|
||||
segment_cond[s] = phase_condition_[segment_cells[s]];
|
||||
segment_cond[s] = (*phase_condition_)[segment_cells[s]];
|
||||
}
|
||||
std::vector<ADB> b_seg(np, ADB::null());
|
||||
// Viscosities for different phases
|
||||
std::vector<ADB> mu_seg(np, ADB::null());
|
||||
ADB rsmax_seg = ADB::null();
|
||||
ADB rvmax_seg = ADB::null();
|
||||
const PhaseUsage& pu = fluid_.phaseUsage();
|
||||
const PhaseUsage& pu = fluid_->phaseUsage();
|
||||
if (pu.phase_used[Water]) {
|
||||
b_seg[pu.phase_pos[Water]] = fluid_.bWat(segment_press, segment_temp, segment_cells);
|
||||
mu_seg[pu.phase_pos[Water]] = fluid_.muWat(segment_press, segment_temp, segment_cells);
|
||||
b_seg[pu.phase_pos[Water]] = fluid_->bWat(segment_press, segment_temp, segment_cells);
|
||||
mu_seg[pu.phase_pos[Water]] = fluid_->muWat(segment_press, segment_temp, segment_cells);
|
||||
}
|
||||
assert(active_[Oil]);
|
||||
assert((*active_)[Oil]);
|
||||
const ADB segment_so = subset(state.saturation[pu.phase_pos[Oil]], segment_cells);
|
||||
if (pu.phase_used[Oil]) {
|
||||
const ADB segment_rs = subset(state.rs, segment_cells);
|
||||
b_seg[pu.phase_pos[Oil]] = fluid_.bOil(segment_press, segment_temp, segment_rs,
|
||||
b_seg[pu.phase_pos[Oil]] = fluid_->bOil(segment_press, segment_temp, segment_rs,
|
||||
segment_cond, segment_cells);
|
||||
// rsmax_seg = fluidRsSat(segment_press, segment_so, segment_cells);
|
||||
rsmax_seg = fluid_.rsSat(segment_press, segment_so, segment_cells);
|
||||
mu_seg[pu.phase_pos[Oil]] = fluid_.muOil(segment_press, segment_temp, segment_rs,
|
||||
rsmax_seg = fluid_->rsSat(segment_press, segment_so, segment_cells);
|
||||
mu_seg[pu.phase_pos[Oil]] = fluid_->muOil(segment_press, segment_temp, segment_rs,
|
||||
segment_cond, segment_cells);
|
||||
}
|
||||
assert(active_[Gas]);
|
||||
assert((*active_)[Gas]);
|
||||
if (pu.phase_used[Gas]) {
|
||||
const ADB segment_rv = subset(state.rv, segment_cells);
|
||||
b_seg[pu.phase_pos[Gas]] = fluid_.bGas(segment_press, segment_temp, segment_rv,
|
||||
b_seg[pu.phase_pos[Gas]] = fluid_->bGas(segment_press, segment_temp, segment_rv,
|
||||
segment_cond, segment_cells);
|
||||
// rvmax_seg = fluidRvSat(segment_press, segment_so, segment_cells);
|
||||
rvmax_seg = fluid_.rvSat(segment_press, segment_so, segment_cells);
|
||||
mu_seg[pu.phase_pos[Gas]] = fluid_.muGas(segment_press, segment_temp, segment_rv,
|
||||
rvmax_seg = fluid_->rvSat(segment_press, segment_so, segment_cells);
|
||||
mu_seg[pu.phase_pos[Gas]] = fluid_->muGas(segment_press, segment_temp, segment_rv,
|
||||
segment_cond, segment_cells);
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ namespace Opm
|
||||
ADB big_values = ADB::constant(Vector::Constant(nseg_total, 1.e100));
|
||||
ADB mix_gas_oil = non_zero_mix_oilpos.select(mix[gaspos] / mix[oilpos], big_values);
|
||||
ADB mix_oil_gas = non_zero_mix_gaspos.select(mix[oilpos] / mix[gaspos], big_values);
|
||||
if (active_[Oil]) {
|
||||
if ((*active_)[Oil]) {
|
||||
Vector selectorUnderRsmax = Vector::Zero(nseg_total);
|
||||
Vector selectorAboveRsmax = Vector::Zero(nseg_total);
|
||||
for (int s = 0; s < nseg_total; ++s) {
|
||||
@ -453,7 +453,7 @@ namespace Opm
|
||||
}
|
||||
rs = non_zero_mix_oilpos.select(selectorAboveRsmax * rsmax_seg + selectorUnderRsmax * mix_gas_oil, rs);
|
||||
}
|
||||
if (active_[Gas]) {
|
||||
if ((*active_)[Gas]) {
|
||||
Vector selectorUnderRvmax = Vector::Zero(nseg_total);
|
||||
Vector selectorAboveRvmax = Vector::Zero(nseg_total);
|
||||
for (int s = 0; s < nseg_total; ++s) {
|
||||
@ -471,7 +471,7 @@ namespace Opm
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
x[phase] = mix[phase];
|
||||
}
|
||||
if (active_[Gas] && active_[Oil]) {
|
||||
if ((*active_)[Gas] && (*active_)[Oil]) {
|
||||
x[gaspos] = (mix[gaspos] - mix[oilpos] * rs) / (Vector::Ones(nseg_total) - rs * rv);
|
||||
x[oilpos] = (mix[oilpos] - mix[gaspos] * rv) / (Vector::Ones(nseg_total) - rs * rv);
|
||||
}
|
||||
@ -485,7 +485,7 @@ namespace Opm
|
||||
// Compute segment densities.
|
||||
ADB dens = ADB::constant(Vector::Zero(nseg_total));
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
const Vector surface_density = fluid_.surfaceDensity(phase, segment_cells);
|
||||
const Vector surface_density = fluid_->surfaceDensity(phase, segment_cells);
|
||||
dens += surface_density * mix[phase];
|
||||
}
|
||||
well_segment_densities_ = dens / volrat;
|
||||
@ -501,7 +501,7 @@ namespace Opm
|
||||
segment_mass_flow_rates_ = ADB::constant(Vector::Zero(nseg_total));
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
// TODO: how to remove one repeated surfaceDensity()
|
||||
const Vector surface_density = fluid_.surfaceDensity(phase, segment_cells);
|
||||
const Vector surface_density = fluid_->surfaceDensity(phase, segment_cells);
|
||||
segment_mass_flow_rates_ += surface_density * segqs[phase];
|
||||
}
|
||||
|
||||
@ -592,13 +592,13 @@ namespace Opm
|
||||
ADB liquid = ADB::constant(Vector::Zero(nseg_total));
|
||||
ADB vapour = ADB::constant(Vector::Zero(nseg_total));
|
||||
|
||||
if (active_[Water]) {
|
||||
if ((*active_)[Water]) {
|
||||
aqua += subset(state.segqs, Span(nseg_total, 1, BlackoilPhases::Aqua * nseg_total));
|
||||
}
|
||||
if (active_[Oil]) {
|
||||
if ((*active_)[Oil]) {
|
||||
liquid += subset(state.segqs, Span(nseg_total, 1, BlackoilPhases::Liquid * nseg_total));
|
||||
}
|
||||
if (active_[Gas]) {
|
||||
if ((*active_)[Gas]) {
|
||||
vapour += subset(state.segqs, Span(nseg_total, 1, BlackoilPhases::Vapour * nseg_total));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user