diff --git a/ebos/eclgenericoutputblackoilmodule.cc b/ebos/eclgenericoutputblackoilmodule.cc index ded98a672..5eb45e0f1 100644 --- a/ebos/eclgenericoutputblackoilmodule.cc +++ b/ebos/eclgenericoutputblackoilmodule.cc @@ -407,15 +407,15 @@ 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{"FLRGASI+", UnitSystem::measure::rate, floresi_[gasCompIdx]}, - DataEntry{"FLRGASJ+", UnitSystem::measure::rate, floresj_[gasCompIdx]}, - DataEntry{"FLRGASK+", UnitSystem::measure::rate, floresk_[gasCompIdx]}, - DataEntry{"FLROILI+", UnitSystem::measure::rate, floresi_[oilCompIdx]}, - DataEntry{"FLROILJ+", UnitSystem::measure::rate, floresj_[oilCompIdx]}, - DataEntry{"FLROILK+", UnitSystem::measure::rate, floresk_[oilCompIdx]}, - DataEntry{"FLRWATI+", UnitSystem::measure::rate, floresi_[waterCompIdx]}, - DataEntry{"FLRWATJ+", UnitSystem::measure::rate, floresj_[waterCompIdx]}, - DataEntry{"FLRWATK+", UnitSystem::measure::rate, floresk_[waterCompIdx]}, + DataEntry{"FLRGASI+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][gasCompIdx]}, + DataEntry{"FLRGASJ+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][gasCompIdx]}, + DataEntry{"FLRGASK+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][gasCompIdx]}, + DataEntry{"FLROILI+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][oilCompIdx]}, + DataEntry{"FLROILJ+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][oilCompIdx]}, + DataEntry{"FLROILK+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][oilCompIdx]}, + DataEntry{"FLRWATI+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][waterCompIdx]}, + DataEntry{"FLRWATJ+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][waterCompIdx]}, + DataEntry{"FLRWATK+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][waterCompIdx]}, DataEntry{"FOAM", UnitSystem::measure::identity, cFoam_}, DataEntry{"GASKR", UnitSystem::measure::identity, relativePermeability_[gasPhaseIdx]}, DataEntry{"GAS_DEN", UnitSystem::measure::density, density_[gasPhaseIdx]}, @@ -446,15 +446,33 @@ assignToSolution(data::Solution& sol) // 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]}, + DataEntry{"FLOGASI+", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][gasCompIdx]}, + DataEntry{"FLOGASJ+", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][gasCompIdx]}, + DataEntry{"FLOGASK+", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][gasCompIdx]}, + DataEntry{"FLOOILI+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][oilCompIdx]}, + DataEntry{"FLOOILJ+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][oilCompIdx]}, + DataEntry{"FLOOILK+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][oilCompIdx]}, + DataEntry{"FLOWATI+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][waterCompIdx]}, + DataEntry{"FLOWATJ+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][waterCompIdx]}, + DataEntry{"FLOWATK+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][waterCompIdx]}, + DataEntry{"FLOGASI-", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][gasCompIdx]}, + DataEntry{"FLOGASJ-", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][gasCompIdx]}, + DataEntry{"FLOGASK-", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][gasCompIdx]}, + DataEntry{"FLOOILI-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][oilCompIdx]}, + DataEntry{"FLOOILJ-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][oilCompIdx]}, + DataEntry{"FLOOILK-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][oilCompIdx]}, + DataEntry{"FLOWATI-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][waterCompIdx]}, + DataEntry{"FLOWATJ-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][waterCompIdx]}, + DataEntry{"FLOWATK-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx]}, + DataEntry{"FLRGASI-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][gasCompIdx]}, + DataEntry{"FLRGASJ-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][gasCompIdx]}, + DataEntry{"FLRGASK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][gasCompIdx]}, + DataEntry{"FLROILI-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][oilCompIdx]}, + DataEntry{"FLROILJ-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][oilCompIdx]}, + DataEntry{"FLROILK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][oilCompIdx]}, + DataEntry{"FLRWATI-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][waterCompIdx]}, + DataEntry{"FLRWATJ-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][waterCompIdx]}, + DataEntry{"FLRWATK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx]}, }; const auto extendedSolutionArrays = std::array { @@ -845,9 +863,9 @@ doAllocBuffers(const unsigned bufferSize, for (unsigned ii = 0; ii < phaseIdxs.size(); ++ii) { if (FluidSystem::phaseIsActive(phaseIdxs[ii])) { - flowsi_[compIdxs[ii]].resize(bufferSize, 0.0); - flowsj_[compIdxs[ii]].resize(bufferSize, 0.0); - flowsk_[compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0); } } } @@ -1062,9 +1080,15 @@ doAllocBuffers(const unsigned bufferSize, for (unsigned ii = 0; ii < phaseIdxs.size(); ++ii) { if (FluidSystem::phaseIsActive(phaseIdxs[ii])) { if (!blockFlows_) { // Already allocated if summary vectors requested - flowsi_[compIdxs[ii]].resize(bufferSize, 0.0); - flowsj_[compIdxs[ii]].resize(bufferSize, 0.0); - flowsk_[compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + } + + if (rstKeywords["FLOWS-"] > 0) { + flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][compIdxs[ii]].resize(bufferSize, 0.0); + flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][compIdxs[ii]].resize(bufferSize, 0.0); } if (numOutputNnc > 0) { @@ -1076,6 +1100,9 @@ doAllocBuffers(const unsigned bufferSize, } } } + if (rstKeywords["FLOWS-"] > 0) { + rstKeywords["FLOWS-"] = 0; + } } enableFlores_ = false; @@ -1090,9 +1117,15 @@ doAllocBuffers(const unsigned bufferSize, for (unsigned ii = 0; ii < phaseIdxs.size(); ++ii) { if (FluidSystem::phaseIsActive(phaseIdxs[ii])) { - floresi_[compIdxs[ii]].resize(bufferSize, 0.0); - floresj_[compIdxs[ii]].resize(bufferSize, 0.0); - floresk_[compIdxs[ii]].resize(bufferSize, 0.0); + flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0); + + if (rstKeywords["FLORES-"] > 0) { + flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][compIdxs[ii]].resize(bufferSize, 0.0); + flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][compIdxs[ii]].resize(bufferSize, 0.0); + flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][compIdxs[ii]].resize(bufferSize, 0.0); + } if (numOutputNnc > 0) { enableFloresn_ = true; @@ -1103,6 +1136,9 @@ doAllocBuffers(const unsigned bufferSize, } } } + if (rstKeywords["FLORES-"] > 0) { + rstKeywords["FLORES-"] = 0; + } } if (auto& den = rstKeywords["DEN"]; den > 0) { diff --git a/ebos/eclgenericoutputblackoilmodule.hh b/ebos/eclgenericoutputblackoilmodule.hh index b25c6a9b0..ed2c69ea6 100644 --- a/ebos/eclgenericoutputblackoilmodule.hh +++ b/ebos/eclgenericoutputblackoilmodule.hh @@ -23,6 +23,7 @@ #ifndef EWOMS_ECL_GENERIC_OUTPUT_BLACK_OIL_MODULE_HH #define EWOMS_ECL_GENERIC_OUTPUT_BLACK_OIL_MODULE_HH +#include #include #include @@ -284,6 +285,7 @@ protected: enum { gasCompIdx = FluidSystem::gasCompIdx }; enum { oilCompIdx = FluidSystem::oilCompIdx }; enum { waterCompIdx = FluidSystem::waterCompIdx }; + using Dir = FaceDir::DirEnum; EclGenericOutputBlackoilModule(const EclipseState& eclState, const Schedule& schedule, @@ -472,13 +474,8 @@ protected: std::array residual_; - - std::array flowsi_; - std::array flowsj_; - std::array flowsk_; - std::array floresi_; - std::array floresj_; - std::array floresk_; + std::array, 6> flows_; + std::array, 6> flores_; std::array, ScalarBuffer>>, 3> floresn_; std::array, ScalarBuffer>>, 3> flowsn_; diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index bfdf7f63b..e3d4ab25f 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -127,6 +127,7 @@ class EclOutputBlackOilModule : public EclGenericOutputBlackoilModule::Iterator; using BaseType = EclGenericOutputBlackoilModule; using Indices = GetPropType; + using Dir = FaceDir::DirEnum; enum { conti0EqIdx = Indices::conti0EqIdx }; enum { numPhases = FluidSystem::numPhases }; @@ -653,45 +654,17 @@ public: const auto& flowsInf = problem.model().linearizer().getFlowsInfo(); auto flowsInfos = flowsInf[globalDofIdx]; for (auto& flowsInfo : flowsInfos) { - if (flowsInfo.faceId == 1) { - if (!this->flowsi_[gasCompIdx].empty()) { - this->flowsi_[gasCompIdx][globalDofIdx] + if (flowsInfo.faceId >= 0) { + if (!this->flows_[flowsInfo.faceId][gasCompIdx].empty()) { + this->flows_[flowsInfo.faceId][gasCompIdx][globalDofIdx] = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)]; } - if (!this->flowsi_[oilCompIdx].empty()) { - this->flowsi_[oilCompIdx][globalDofIdx] + if (!this->flows_[flowsInfo.faceId][oilCompIdx].empty()) { + this->flows_[flowsInfo.faceId][oilCompIdx][globalDofIdx] = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)]; } - if (!this->flowsi_[waterCompIdx].empty()) { - this->flowsi_[waterCompIdx][globalDofIdx] - = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)]; - } - } - if (flowsInfo.faceId == 3) { - if (!this->flowsj_[gasCompIdx].empty()) { - this->flowsj_[gasCompIdx][globalDofIdx] - = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)]; - } - if (!this->flowsj_[oilCompIdx].empty()) { - this->flowsj_[oilCompIdx][globalDofIdx] - = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)]; - } - if (!this->flowsj_[waterCompIdx].empty()) { - this->flowsj_[waterCompIdx][globalDofIdx] - = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)]; - } - } - if (flowsInfo.faceId == 5) { - if (!this->flowsk_[gasCompIdx].empty()) { - this->flowsk_[gasCompIdx][globalDofIdx] - = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)]; - } - if (!this->flowsk_[oilCompIdx].empty()) { - this->flowsk_[oilCompIdx][globalDofIdx] - = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)]; - } - if (!this->flowsk_[waterCompIdx].empty()) { - this->flowsk_[waterCompIdx][globalDofIdx] + if (!this->flows_[flowsInfo.faceId][waterCompIdx].empty()) { + this->flows_[flowsInfo.faceId][waterCompIdx][globalDofIdx] = flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)]; } } @@ -720,48 +693,21 @@ public: const auto& floresInf = problem.model().linearizer().getFloresInfo(); auto floresInfos =floresInf[globalDofIdx]; for (auto& floresInfo : floresInfos) { - if (floresInfo.faceId == 1) { - if (!this->floresi_[gasCompIdx].empty()) { - this->floresi_[gasCompIdx][globalDofIdx] + if (floresInfo.faceId >= 0) { + if (!this->flores_[floresInfo.faceId][gasCompIdx].empty()) { + this->flores_[floresInfo.faceId][gasCompIdx][globalDofIdx] = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)]; } - if (!this->floresi_[oilCompIdx].empty()) { - this->floresi_[oilCompIdx][globalDofIdx] + if (!this->flores_[floresInfo.faceId][oilCompIdx].empty()) { + this->flores_[floresInfo.faceId][oilCompIdx][globalDofIdx] = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)]; } - if (!this->floresi_[waterCompIdx].empty()) { - this->floresi_[waterCompIdx][globalDofIdx] - = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)]; - } - } - if (floresInfo.faceId == 3) { - if (!this->floresj_[gasCompIdx].empty()) { - this->floresj_[gasCompIdx][globalDofIdx] - = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)]; - } - if (!this->floresj_[oilCompIdx].empty()) { - this->floresj_[oilCompIdx][globalDofIdx] - = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)]; - } - if (!this->floresj_[waterCompIdx].empty()) { - this->floresj_[waterCompIdx][globalDofIdx] - = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)]; - } - } - if (floresInfo.faceId == 5) { - if (!this->floresk_[gasCompIdx].empty()) { - this->floresk_[gasCompIdx][globalDofIdx] - = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)]; - } - if (!this->floresk_[oilCompIdx].empty()) { - this->floresk_[oilCompIdx][globalDofIdx] - = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)]; - } - if (!this->floresk_[waterCompIdx].empty()) { - this->floresk_[waterCompIdx][globalDofIdx] + if (!this->flores_[floresInfo.faceId][waterCompIdx].empty()) { + this->flores_[floresInfo.faceId][waterCompIdx][globalDofIdx] = floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)]; } } + if (floresInfo.faceId == -2) { if (!this->floresn_[gasCompIdx].second.first.empty()) { this->floresn_[gasCompIdx].second.first[floresInfo.nncId] = floresInfo.nncId; @@ -927,11 +873,11 @@ public: * getValue(intQuants.porosity()); } else if (key.first == "BFLOWI") - val.second = this->flowsi_[waterCompIdx][globalDofIdx]; + val.second = this->flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][waterCompIdx][globalDofIdx]; else if (key.first == "BFLOWJ") - val.second = this->flowsj_[waterCompIdx][globalDofIdx]; + val.second = this->flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][waterCompIdx][globalDofIdx]; else if (key.first == "BFLOWK") - val.second = this->flowsk_[waterCompIdx][globalDofIdx]; + val.second = this->flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][waterCompIdx][globalDofIdx]; else { std::string logstring = "Keyword '"; logstring.append(key.first); diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 7fa20abf2..46b6d0a3b 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -661,6 +661,10 @@ public: aquiferModel_.endTimeStep(); tracerModel_.endTimeStep(); + + // Compute flux for output + this->model().linearizer().updateFlowsInfo(); + // deal with DRSDT and DRVDT asImp_().updateCompositionChangeLimits_(); {