Merge pull request #5038 from totto82/addBondaryFluxOutput

Add output of FLOWS- and FLORES-
This commit is contained in:
Atgeirr Flø Rasmussen 2023-12-21 15:46:50 +01:00 committed by GitHub
commit bf55fcfd93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 107 deletions

View File

@ -399,15 +399,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]},
@ -438,15 +438,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 {
@ -849,9 +867,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);
}
}
}
@ -1069,9 +1087,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) {
@ -1083,6 +1107,9 @@ doAllocBuffers(const unsigned bufferSize,
}
}
}
if (rstKeywords["FLOWS-"] > 0) {
rstKeywords["FLOWS-"] = 0;
}
}
enableFlores_ = false;
@ -1097,9 +1124,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;
@ -1110,6 +1143,9 @@ doAllocBuffers(const unsigned bufferSize,
}
}
}
if (rstKeywords["FLORES-"] > 0) {
rstKeywords["FLORES-"] = 0;
}
}
if (auto& den = rstKeywords["DEN"]; den > 0) {

View File

@ -23,6 +23,7 @@
#ifndef EWOMS_ECL_GENERIC_OUTPUT_BLACK_OIL_MODULE_HH
#define EWOMS_ECL_GENERIC_OUTPUT_BLACK_OIL_MODULE_HH
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/Inplace.hpp>
@ -286,6 +287,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,
@ -475,13 +477,8 @@ protected:
std::array<ScalarBuffer, numPhases> residual_;
std::array<ScalarBuffer, numPhases> flowsi_;
std::array<ScalarBuffer, numPhases> flowsj_;
std::array<ScalarBuffer, numPhases> flowsk_;
std::array<ScalarBuffer, numPhases> floresi_;
std::array<ScalarBuffer, numPhases> floresj_;
std::array<ScalarBuffer, numPhases> floresk_;
std::array<std::array<ScalarBuffer, numPhases>, 6> flows_;
std::array<std::array<ScalarBuffer, numPhases>, 6> flores_;
std::array<std::pair<std::string, std::pair<std::vector<int>, ScalarBuffer>>, 3> floresn_;
std::array<std::pair<std::string, std::pair<std::vector<int>, ScalarBuffer>>, 3> flowsn_;

View File

@ -127,6 +127,7 @@ class EclOutputBlackOilModule : public EclGenericOutputBlackoilModule<GetPropTyp
using ElementIterator = typename GridView::template Codim<0>::Iterator;
using BaseType = EclGenericOutputBlackoilModule<FluidSystem, Scalar>;
using Indices = GetPropType<TypeTag, Properties::Indices>;
using Dir = FaceDir::DirEnum;
enum { conti0EqIdx = Indices::conti0EqIdx };
enum { numPhases = FluidSystem::numPhases };
@ -663,45 +664,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)];
}
}
@ -730,48 +703,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;
@ -937,11 +883,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);

View File

@ -661,6 +661,10 @@ public:
aquiferModel_.endTimeStep();
tracerModel_.endTimeStep();
// Compute flux for output
this->model().linearizer().updateFlowsInfo();
// deal with DRSDT and DRVDT
asImp_().updateCompositionChangeLimits_();
{