Skip to content

Commit

Permalink
Cover case: process does not contain any active perforations, getSegm…
Browse files Browse the repository at this point in the history
…entSurfaceVolume and computeSegmentFluidProperties
  • Loading branch information
lisajulia committed Feb 25, 2025
1 parent 0cfa56b commit d2b1203
Showing 1 changed file with 38 additions and 25 deletions.
63 changes: 38 additions & 25 deletions opm/simulators/wells/MultisegmentWell_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,26 +1110,33 @@ namespace Opm
// perforated cell
// TODO: later to investigate how to handle the pvt region
int pvt_region_index;
{
// using the first perforated cell, so we look for global index 0

Scalar fsTemperature;
Scalar fsSaltConcentration;

if (this->well_cells_.size() > 0) {
// this->well_cells_ is empty if this process does not contain active perforations
// using the pvt region of first perforated cell, so we look for global index 0
// TODO: it should be a member of the WellInterface, initialized properly
const int cell_idx = this->well_cells_[0];
const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/0);
const auto& fs = intQuants.fluidState();

// The following broadcast calls are neccessary to ensure that processes that do *not* contain
// the first perforation get the correct temperature, saltConcentration and pvt_region_index
auto fsTemperature = fs.temperature(FluidSystem::oilPhaseIdx).value();
fsTemperature = this->pw_info_.broadcastFirstPerforationValue(fsTemperature);
temperature.setValue(fsTemperature);

auto fsSaltConcentration = fs.saltConcentration();
fsSaltConcentration = this->pw_info_.broadcastFirstPerforationValue(fsSaltConcentration);
saltConcentration = this->extendEval(fsSaltConcentration);

fsTemperature = fs.temperature(FluidSystem::oilPhaseIdx).value();
fsSaltConcentration = fs.saltConcentration();
pvt_region_index = fs.pvtRegionIndex();
pvt_region_index = this->pw_info_.broadcastFirstPerforationValue(pvt_region_index);
}

// The following broadcast calls are neccessary to ensure that processes that do *not* contain
// the first perforation get the correct temperature, saltConcentration and pvt_region_index
fsTemperature = this->pw_info_.broadcastFirstPerforationValue(fsTemperature);
temperature.setValue(fsTemperature);

fsSaltConcentration = this->pw_info_.broadcastFirstPerforationValue(fsSaltConcentration);
saltConcentration = this->extendEval(fsSaltConcentration);

pvt_region_index = this->pw_info_.broadcastFirstPerforationValue(pvt_region_index);

this->segments_.computeFluidProperties(temperature,
saltConcentration,
this->primary_variables_,
Expand Down Expand Up @@ -2080,27 +2087,33 @@ namespace Opm
EvalWell temperature;
EvalWell saltConcentration;
int pvt_region_index;
{

Scalar fsTemperature;
Scalar fsSaltConcentration;

if (this->well_cells_.size() > 0) {
// this->well_cells_ is empty if this process does not contain active perforations
// using the pvt region of first perforated cell, so we look for global index 0
// TODO: it should be a member of the WellInterface, initialized properly
const int cell_idx = this->well_cells_[0];
const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/0);
const auto& fs = intQuants.fluidState();

// The following broadcast calls are neccessary to ensure that processes that do *not* contain
// the first perforation get the correct temperature, saltConcentration and pvt_region_index
auto fsTemperature = fs.temperature(FluidSystem::oilPhaseIdx).value();
fsTemperature = this->pw_info_.broadcastFirstPerforationValue(fsTemperature);
temperature.setValue(fsTemperature);

auto fsSaltConcentration = fs.saltConcentration();
fsSaltConcentration = this->pw_info_.broadcastFirstPerforationValue(fsSaltConcentration);
saltConcentration = this->extendEval(fsSaltConcentration);

fsTemperature = fs.temperature(FluidSystem::oilPhaseIdx).value();
fsSaltConcentration = fs.saltConcentration();
pvt_region_index = fs.pvtRegionIndex();
pvt_region_index = this->pw_info_.broadcastFirstPerforationValue(pvt_region_index);
}

// The following broadcast calls are neccessary to ensure that processes that do *not* contain
// the first perforation get the correct temperature, saltConcentration and pvt_region_index
fsTemperature = this->pw_info_.broadcastFirstPerforationValue(fsTemperature);
temperature.setValue(fsTemperature);

fsSaltConcentration = this->pw_info_.broadcastFirstPerforationValue(fsSaltConcentration);
saltConcentration = this->extendEval(fsSaltConcentration);

pvt_region_index = this->pw_info_.broadcastFirstPerforationValue(pvt_region_index);

return this->segments_.getSurfaceVolume(temperature,
saltConcentration,
this->primary_variables_,
Expand Down

0 comments on commit d2b1203

Please sign in to comment.