From a57d04fde59d4cbe1b5a3d307ecaf3dcb5113a17 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 8 Dec 2023 16:49:48 +0100 Subject: [PATCH 1/3] support source term from deck (SOURCE) --- ebos/eclproblem.hh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 59e4b34da..5114e6024 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -1407,6 +1407,34 @@ public: if (enableAquifers_) aquiferModel_.addToSource(rate, globalDofIdx, timeIdx); + // Add source term from deck + const auto& sourceprop = this->simulator().vanguard().schedule()[this->episodeIndex()].sourceprop(); + if (sourceprop.size() > 0) { + std::array ijk; + this->simulator().vanguard().cartesianCoordinate(globalDofIdx, ijk); + RateVector massRate(0.0); + if ( FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) { + massRate[Indices::canonicalToActiveComponentIndex(oilCompIdx)] = sourceprop.rate({ijk, SourceComponent::OIL}) / this->model().dofTotalVolume(globalDofIdx); + } + if ( FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { + massRate[Indices::canonicalToActiveComponentIndex(gasCompIdx)] = sourceprop.rate({ijk, SourceComponent::GAS}) / this->model().dofTotalVolume(globalDofIdx); + } + if ( FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { + massRate[Indices::canonicalToActiveComponentIndex(waterCompIdx)] = sourceprop.rate({ijk, SourceComponent::WATER}) / this->model().dofTotalVolume(globalDofIdx); + } + if constexpr (enableSolvent) { + massRate[Indices::solventSaturationIdx] = sourceprop.rate({ijk, SourceComponent::SOLVENT}) / this->model().dofTotalVolume(globalDofIdx); + } + const int pvtRegionIdx = this->pvtRegionIndex(globalDofIdx); + rate.setMassRate(massRate, pvtRegionIdx); + if constexpr (enablePolymer) { + rate[Indices::polymerConcentrationIdx] = sourceprop.rate({ijk, SourceComponent::POLYMER}) / this->model().dofTotalVolume(globalDofIdx); + } + if constexpr (enableEnergy) { + rate[Indices::contiEnergyEqIdx] = sourceprop.hrate(ijk) / this->model().dofTotalVolume(globalDofIdx); + } + } + // if requested, compensate systematic mass loss for cells which were "well // behaved" in the last time step // Note that we don't allow for drift compensation if there are no active wells. From 84902e1aedb10eae864775f270399815c0254ba1 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 21 Dec 2023 12:29:33 +0100 Subject: [PATCH 2/3] rename sourceprop to source --- ebos/eclproblem.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 5114e6024..5f398b77e 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -1408,30 +1408,30 @@ public: aquiferModel_.addToSource(rate, globalDofIdx, timeIdx); // Add source term from deck - const auto& sourceprop = this->simulator().vanguard().schedule()[this->episodeIndex()].sourceprop(); - if (sourceprop.size() > 0) { + const auto& source = this->simulator().vanguard().schedule()[this->episodeIndex()].source(); + if (source.size() > 0) { std::array ijk; this->simulator().vanguard().cartesianCoordinate(globalDofIdx, ijk); RateVector massRate(0.0); if ( FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) { - massRate[Indices::canonicalToActiveComponentIndex(oilCompIdx)] = sourceprop.rate({ijk, SourceComponent::OIL}) / this->model().dofTotalVolume(globalDofIdx); + massRate[Indices::canonicalToActiveComponentIndex(oilCompIdx)] = source.rate({ijk, SourceComponent::OIL}) / this->model().dofTotalVolume(globalDofIdx); } if ( FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { - massRate[Indices::canonicalToActiveComponentIndex(gasCompIdx)] = sourceprop.rate({ijk, SourceComponent::GAS}) / this->model().dofTotalVolume(globalDofIdx); + massRate[Indices::canonicalToActiveComponentIndex(gasCompIdx)] = source.rate({ijk, SourceComponent::GAS}) / this->model().dofTotalVolume(globalDofIdx); } if ( FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { - massRate[Indices::canonicalToActiveComponentIndex(waterCompIdx)] = sourceprop.rate({ijk, SourceComponent::WATER}) / this->model().dofTotalVolume(globalDofIdx); + massRate[Indices::canonicalToActiveComponentIndex(waterCompIdx)] = source.rate({ijk, SourceComponent::WATER}) / this->model().dofTotalVolume(globalDofIdx); } if constexpr (enableSolvent) { - massRate[Indices::solventSaturationIdx] = sourceprop.rate({ijk, SourceComponent::SOLVENT}) / this->model().dofTotalVolume(globalDofIdx); + massRate[Indices::solventSaturationIdx] = source.rate({ijk, SourceComponent::SOLVENT}) / this->model().dofTotalVolume(globalDofIdx); } const int pvtRegionIdx = this->pvtRegionIndex(globalDofIdx); rate.setMassRate(massRate, pvtRegionIdx); if constexpr (enablePolymer) { - rate[Indices::polymerConcentrationIdx] = sourceprop.rate({ijk, SourceComponent::POLYMER}) / this->model().dofTotalVolume(globalDofIdx); + rate[Indices::polymerConcentrationIdx] = source.rate({ijk, SourceComponent::POLYMER}) / this->model().dofTotalVolume(globalDofIdx); } if constexpr (enableEnergy) { - rate[Indices::contiEnergyEqIdx] = sourceprop.hrate(ijk) / this->model().dofTotalVolume(globalDofIdx); + rate[Indices::contiEnergyEqIdx] = source.hrate(ijk) / this->model().dofTotalVolume(globalDofIdx); } } From 16a80fc2931148764941743931cd9308959624b7 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 22 Dec 2023 10:59:09 +0100 Subject: [PATCH 3/3] add source to parallel serialization --- tests/test_ParallelSerialization.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_ParallelSerialization.cpp b/tests/test_ParallelSerialization.cpp index 1b90eb07a..f5e8d9c8f 100644 --- a/tests/test_ParallelSerialization.cpp +++ b/tests/test_ParallelSerialization.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -281,6 +282,7 @@ TEST_FOR_TYPE(SkprpolyTable) TEST_FOR_TYPE(SkprwatTable) TEST_FOR_TYPE(SICD) TEST_FOR_TYPE(SolventDensityTable) +TEST_FOR_TYPE(Source) TEST_FOR_TYPE(SummaryConfig) TEST_FOR_TYPE(SummaryConfigNode) TEST_FOR_TYPE(SummaryState)