Merge pull request #4867 from vkip/bflowijk

Adding support for the BFLOW[I|J|K] summary vectors.
This commit is contained in:
Bård Skaflestad 2023-09-13 13:31:22 +02:00 committed by GitHub
commit ee042501bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 14 deletions

View File

@ -191,9 +191,12 @@ EclGenericOutputBlackoilModule(const EclipseState& eclState,
this->regionNodes_[phase] = summaryConfig_.keywords(key_pattern);
}
// Check for any BFLOW[I|J|K] summary keys
blockFlows_ = summaryConfig_.keywords("BFLOW*").size() > 0;
// Check if FLORES/FLOWS is set in any RPTRST in the schedule
anyFlores_ = false; // Used for the initialization of the sparse table
anyFlows_ = false;
anyFlows_ = blockFlows_;
enableFlores_ = false; // Used for the output of i+, j+, k+
enableFloresn_ = false; // Used for the special case of nnc
enableFlows_ = false;
@ -376,15 +379,6 @@ assignToSolution(data::Solution& sol)
DataEntry{"1OVERBG", UnitSystem::measure::gas_inverse_formation_volume_factor, invB_[gasPhaseIdx]},
DataEntry{"1OVERBO", UnitSystem::measure::oil_inverse_formation_volume_factor, invB_[oilPhaseIdx]},
DataEntry{"1OVERBW", UnitSystem::measure::water_inverse_formation_volume_factor, invB_[waterPhaseIdx]},
DataEntry{"FLOGASI+", UnitSystem::measure::gas_surface_rate, flowsi_[gasCompIdx]},
DataEntry{"FLOGASJ+", UnitSystem::measure::gas_surface_rate, flowsj_[gasCompIdx]},
DataEntry{"FLOGASK+", UnitSystem::measure::gas_surface_rate, flowsk_[gasCompIdx]},
DataEntry{"FLOOILI+", UnitSystem::measure::liquid_surface_rate, flowsi_[oilCompIdx]},
DataEntry{"FLOOILJ+", UnitSystem::measure::liquid_surface_rate, flowsj_[oilCompIdx]},
DataEntry{"FLOOILK+", UnitSystem::measure::liquid_surface_rate, flowsk_[oilCompIdx]},
DataEntry{"FLOWATI+", UnitSystem::measure::liquid_surface_rate, flowsi_[waterCompIdx]},
DataEntry{"FLOWATJ+", UnitSystem::measure::liquid_surface_rate, flowsj_[waterCompIdx]},
DataEntry{"FLOWATK+", UnitSystem::measure::liquid_surface_rate, flowsk_[waterCompIdx]},
DataEntry{"FLRGASI+", UnitSystem::measure::rate, floresi_[gasCompIdx]},
DataEntry{"FLRGASJ+", UnitSystem::measure::rate, floresj_[gasCompIdx]},
DataEntry{"FLRGASK+", UnitSystem::measure::rate, floresk_[gasCompIdx]},
@ -422,6 +416,19 @@ assignToSolution(data::Solution& sol)
DataEntry{"WAT_VISC", UnitSystem::measure::viscosity, viscosity_[waterPhaseIdx]},
};
// Separate these as flows*_ may be defined due to BFLOW[I|J|K] even without FLOWS in RPTRST
const auto flowsSolutionArrays = std::array {
DataEntry{"FLOGASI+", UnitSystem::measure::gas_surface_rate, flowsi_[gasCompIdx]},
DataEntry{"FLOGASJ+", UnitSystem::measure::gas_surface_rate, flowsj_[gasCompIdx]},
DataEntry{"FLOGASK+", UnitSystem::measure::gas_surface_rate, flowsk_[gasCompIdx]},
DataEntry{"FLOOILI+", UnitSystem::measure::liquid_surface_rate, flowsi_[oilCompIdx]},
DataEntry{"FLOOILJ+", UnitSystem::measure::liquid_surface_rate, flowsj_[oilCompIdx]},
DataEntry{"FLOOILK+", UnitSystem::measure::liquid_surface_rate, flowsk_[oilCompIdx]},
DataEntry{"FLOWATI+", UnitSystem::measure::liquid_surface_rate, flowsi_[waterCompIdx]},
DataEntry{"FLOWATJ+", UnitSystem::measure::liquid_surface_rate, flowsj_[waterCompIdx]},
DataEntry{"FLOWATK+", UnitSystem::measure::liquid_surface_rate, flowsk_[waterCompIdx]},
};
const auto extendedSolutionArrays = std::array {
DataEntry{"BIOFILM", UnitSystem::measure::identity, cBiofilm_},
DataEntry{"CALCITE", UnitSystem::measure::identity, cCalcite_},
@ -476,6 +483,12 @@ assignToSolution(data::Solution& sol)
doInsert(array, data::TargetType::RESTART_SOLUTION);
}
if (this->enableFlows_) {
for (const auto& array : flowsSolutionArrays) {
doInsert(array, data::TargetType::RESTART_SOLUTION);
}
}
for (const auto& array : extendedSolutionArrays) {
doInsert(array, data::TargetType::RESTART_OPM_EXTENDED);
}
@ -962,9 +975,12 @@ doAllocBuffers(unsigned bufferSize,
enableFlows_ = false;
enableFlowsn_ = false;
if (rstKeywords["FLOWS"] > 0) {
rstKeywords["FLOWS"] = 0;
enableFlows_ = true;
const bool rstFlows = (rstKeywords["FLOWS"] > 0);
if (blockFlows_ || rstFlows) {
if (rstFlows) {
rstKeywords["FLOWS"] = 0;
enableFlows_ = true;
}
const std::array<int, 3> phaseIdxs = { gasPhaseIdx, oilPhaseIdx, waterPhaseIdx };
const std::array<int, 3> compIdxs = { gasCompIdx, oilCompIdx, waterCompIdx };
@ -976,7 +992,7 @@ doAllocBuffers(unsigned bufferSize,
flowsj_[compIdxs[ii]].resize(bufferSize, 0.0);
flowsk_[compIdxs[ii]].resize(bufferSize, 0.0);
if (numOutputNnc > 0) {
if (rstFlows && numOutputNnc > 0) {
enableFlowsn_ = true;
flowsn_[compIdxs[ii]].first = rstName[ii];

View File

@ -207,6 +207,11 @@ public:
return enableFlows_;
}
bool hasBlockFlows() const
{
return blockFlows_;
}
bool anyFlows() const
{
return anyFlows_;
@ -365,6 +370,7 @@ protected:
bool anyFlows_;
bool anyFlores_;
bool blockFlows_;
bool enableFlows_;
bool enableFlores_;
bool enableFlowsn_;

View File

@ -913,6 +913,12 @@ public:
val.second *= elemCtx.simulator().model().dofTotalVolume(globalDofIdx)
* getValue(intQuants.porosity());
}
else if (key.first == "BFLOWI")
val.second = this->flowsi_[waterCompIdx][globalDofIdx];
else if (key.first == "BFLOWJ")
val.second = this->flowsj_[waterCompIdx][globalDofIdx];
else if (key.first == "BFLOWK")
val.second = this->flowsk_[waterCompIdx][globalDofIdx];
else {
std::string logstring = "Keyword '";
logstring.append(key.first);