Skip to content

Commit

Permalink
output
Browse files Browse the repository at this point in the history
  • Loading branch information
lisajulia committed Feb 26, 2025
1 parent 457ea2c commit 59ee6ee
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 10 deletions.
7 changes: 6 additions & 1 deletion opm/simulators/wells/MultisegmentWellSegments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,14 @@ MultisegmentWellSegments(const int numSegments,
const Scalar segment_depth = segment_set[segment_index].depth();
int local_perf_index = parallel_well_info.globalToLocal(i_perf_wells);
if (local_perf_index > -1) // If local_perf_index == -1, then the perforation is not on this process
if (local_perforation_depth_diffs_.size() > static_cast<std::size_t>(local_perf_index)) // If local_perforation_depth_diffs_.size() is not large enough, this is a SHUT connection
if (local_perforation_depth_diffs_.size() > static_cast<std::size_t>(local_perf_index)) {
// If local_perforation_depth_diffs_.size() is not large enough, this is a SHUT connection
local_perforation_depth_diffs_[local_perf_index] = well_.perfDepth()[i_perf_wells] - segment_depth;
}
i_perf_wells++;
}
}
std::cout << "First loop of MultisegmentWellSegments constructor done, local_perforation_depth_diffs_.size() = " << local_perforation_depth_diffs_.size() << std::endl;

// initialize the segment_inlets_
for (const Segment& segment : segment_set) {
Expand All @@ -125,6 +128,7 @@ MultisegmentWellSegments(const int numSegments,
inlets_[outlet_segment_index].push_back(segment_index);
}
}
std::cout << "Second loop of MultisegmentWellSegments constructor done, segment_set.size() = " << segment_set.size() << std::endl;

// calculating the depth difference between the segment and its oulet_segments
// for the top segment, we will make its zero unless we find other purpose to use this value
Expand All @@ -135,6 +139,7 @@ MultisegmentWellSegments(const int numSegments,
const Scalar outlet_depth = outlet_segment.depth();
depth_diffs_[seg] = segment_depth - outlet_depth;
}
std::cout << "Third loop of MultisegmentWellSegments constructor done, numSegments = " << numSegments << std::endl;
}

template<class FluidSystem, class Indices>
Expand Down
33 changes: 24 additions & 9 deletions opm/simulators/wells/MultisegmentWell_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,10 @@ namespace Opm
if (local_perf_index < 0) // then the perforation is not on this process
continue;
if (this->well_cells_.size() <= static_cast<std::size_t>(local_perf_index)) {// then the perforation belongs to a shut connection
std::cout << "computeWellRatesWithBhp, local_perf_index = " << local_perf_index << std::endl;
std::cout << "skip computeWellRatesWithBhp, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;
continue;
}
std::cout << "execute computeWellRatesWithBhp, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;
const int cell_idx = this->well_cells_[local_perf_index];
const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
// flux for each perforation
Expand Down Expand Up @@ -892,9 +893,10 @@ namespace Opm
if (local_perf_index < 0) // then the perforation is not on this process
return;
if (this->cell_perforation_pressure_diffs_.size() <= static_cast<std::size_t>(local_perf_index)) { // then the perforation belongs to a shut connection
std::cout << "computePerfRate, local_perf_index = " << local_perf_index << std::endl;
std::cout << "skip computePerfRate, local_perf_index = " << local_perf_index << ", << cell_perforation_depth_diffs_.size() = " << this->cell_perforation_pressure_diffs_.size() << std::endl;
return;
}
std::cout << "execute computePerfRate, local_perf_index = " << local_perf_index << ", << cell_perforation_depth_diffs_.size() = " << this->cell_perforation_pressure_diffs_.size() << std::endl;

// pressure difference between the segment and the perforation
const Value perf_seg_press_diff = this->gravity() * segment_density *
Expand Down Expand Up @@ -1114,7 +1116,7 @@ namespace Opm
Scalar fsTemperature;
using SaltConcType = typename std::decay<decltype(std::declval<decltype(simulator.model().intensiveQuantities(0, 0).fluidState())>().saltConcentration())>::type;
SaltConcType fsSaltConcentration;

std::cout << "computeSegmentFluidProperties, this->well_cells_.size() = " << this->well_cells_.size() << std::endl;
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
Expand All @@ -1127,16 +1129,20 @@ namespace Opm
fsSaltConcentration = fs.saltConcentration();
pvt_region_index = fs.pvtRegionIndex();
}
std::cout << "will broadcastFirstPerforationValue now" << std::endl;

// 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);
std::cout << "-" << std::endl;

fsSaltConcentration = this->pw_info_.broadcastFirstPerforationValue(fsSaltConcentration);
saltConcentration = this->extendEval(fsSaltConcentration);
std::cout << "-" << std::endl;

pvt_region_index = this->pw_info_.broadcastFirstPerforationValue(pvt_region_index);
std::cout << "done" << std::endl;

this->segments_.computeFluidProperties(temperature,
saltConcentration,
Expand Down Expand Up @@ -1284,9 +1290,10 @@ namespace Opm
if (local_perf_index < 0) // then the perforation is not on this process
continue;
if (this->well_cells_.size() <= static_cast<std::size_t>(local_perf_index)) {// then the perforation belongs to a shut connection
std::cout << "updateIPR, local_perf_index = " << local_perf_index << std::endl;
std::cout << "skip updateIPR, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;
continue;
}
std::cout << "execute updateIPR, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;

std::vector<Scalar> mob(this->num_components_, 0.0);

Expand Down Expand Up @@ -1872,9 +1879,10 @@ namespace Opm
if (local_perf_index < 0) // then the perforation is not on this process
continue;
if (this->well_cells_.size() <= static_cast<std::size_t>(local_perf_index)) {// then the perforation belongs to a shut connection
std::cout << "assembleWellEqWithoutIteration, local_perf_index = " << local_perf_index << std::endl;
std::cout << "skip assembleWellEqWithoutIteration, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;
continue;
}
std::cout << "execute assembleWellEqWithoutIteration, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;

const int cell_idx = this->well_cells_[local_perf_index];
const auto& int_quants = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
Expand Down Expand Up @@ -2027,9 +2035,10 @@ namespace Opm
if (local_perf_index < 0) // then the perforation is not on this process
continue;
if (this->well_cells_.size() <= static_cast<std::size_t>(local_perf_index)) {// then the perforation belongs to a shut connection
std::cout << "allDrawDownWrongDirection, local_perf_index = " << local_perf_index << std::endl;
std::cout << "skip allDrawDownWrongDirection, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;
continue;
}
std::cout << "execute allDrawDownWrongDirection, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;

const int cell_idx = this->well_cells_[local_perf_index];
const auto& intQuants = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
Expand Down Expand Up @@ -2093,6 +2102,7 @@ namespace Opm
using SaltConcType = typename std::decay<decltype(std::declval<decltype(simulator.model().intensiveQuantities(0, 0).fluidState())>().saltConcentration())>::type;
SaltConcType fsSaltConcentration;

std::cout << "getSegmentSurfaceVolume, this->well_cells_.size() = " << this->well_cells_.size() << std::endl;
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
Expand All @@ -2105,16 +2115,19 @@ namespace Opm
fsSaltConcentration = fs.saltConcentration();
pvt_region_index = fs.pvtRegionIndex();
}

std::cout << "will broadcastFirstPerforationValue now" << std::endl;
// 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);
std::cout << "-" << std::endl;

fsSaltConcentration = this->pw_info_.broadcastFirstPerforationValue(fsSaltConcentration);
saltConcentration = this->extendEval(fsSaltConcentration);
std::cout << "-" << std::endl;

pvt_region_index = this->pw_info_.broadcastFirstPerforationValue(pvt_region_index);
std::cout << "done" << std::endl;

return this->segments_.getSurfaceVolume(temperature,
saltConcentration,
Expand Down Expand Up @@ -2265,9 +2278,10 @@ namespace Opm
if (local_perf_index < 0) // then the perforation is not on this process
continue;
if (this->well_cells_.size() <= static_cast<std::size_t>(local_perf_index)) {// then the perforation belongs to a shut connection
std::cout << "maxPerfPress, local_perf_index = " << local_perf_index << std::endl;
std::cout << "skip maxPerfPress, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;
continue;
}
std::cout << "execute maxPerfPress, for seg " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() " << this->well_cells_.size() << std::endl;

const int cell_idx = this->well_cells_[local_perf_index];
const auto& int_quants = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
Expand Down Expand Up @@ -2301,9 +2315,10 @@ namespace Opm
if (local_perf_index < 0) // then the perforation is not on this process
continue;
if (this->well_cells_.size() <= static_cast<std::size_t>(local_perf_index)) {// then the perforation belongs to a shut connection
std::cout << "computeCurrentWellRates, local_perf_index = " << local_perf_index << std::endl;
std::cout << "skip computeCurrentWellRates for segment " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() = " << this->well_cells_.size() << std::endl;
continue;
}
std::cout << "execute computeCurrentWellRates for segment " << seg << ", local_perf_index = " << local_perf_index << ", this->well_cells_.size() = " << this->well_cells_.size() << std::endl;

const int cell_idx = this->well_cells_[local_perf_index];
const auto& int_quants = simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
Expand Down
Loading

0 comments on commit 59ee6ee

Please sign in to comment.