move assignment of Flores data to FlowsContainer

This commit is contained in:
Arne Morten Kvarving committed 2025-02-18 09:53:37 +01:00
1 parent 095f560a62
commit 2cead48a34
3 files changed
+34 -38

No files matched your search

+21
View File
@@ -211,6 +211,27 @@ allocate(const std::size_t bufferSize,
}
}
template<class FluidSystem>
void FlowsContainer<FluidSystem>::
assignFlores(const unsigned globalDofIdx,
const int faceId,
const unsigned nncId,
const Scalar gas,
const Scalar oil,
const Scalar water)
{
if (faceId >= 0) {
assignToVec<gasCompIdx>(this->flores_[faceId], globalDofIdx, gas);
assignToVec<oilCompIdx>(this->flores_[faceId], globalDofIdx, oil);
assignToVec<waterCompIdx>(this->flores_[faceId], globalDofIdx, water);
}
else if (faceId == -2) {
assignToNnc<gasCompIdx>(this->floresn_, nncId, gas);
assignToNnc<oilCompIdx>(this->floresn_, nncId, oil);
assignToNnc<waterCompIdx>(this->floresn_, nncId, water);
}
}
template<class FluidSystem>
void FlowsContainer<FluidSystem>::
assignFlows(const unsigned globalDofIdx,
+7
View File
@@ -60,6 +60,13 @@ public:
const bool allocRestart,
std::map<std::string, int>& rstKeywords);
void assignFlores(const unsigned globalDofIdx,
const int faceId,
const unsigned nncId,
const Scalar gas,
const Scalar oil,
const Scalar water);
void assignFlows(const unsigned globalDofIdx,
const int faceId,
const unsigned nncId,
+6 -38
View File
@@ -690,44 +690,12 @@ public:
const auto& floresInf = problem.model().linearizer().getFloresInfo();
auto floresInfos = floresInf[globalDofIdx];
for (const auto& floresInfo : floresInfos) {
if (floresInfo.faceId >= 0) {
if constexpr (gas_idx >= 0) {
if (!this->flowsC_.flores_[floresInfo.faceId][gasCompIdx].empty()) {
this->flowsC_.flores_[floresInfo.faceId][gasCompIdx][globalDofIdx]
= floresInfo.flow[gas_idx];
}
}
if constexpr (oil_idx >= 0) {
if (!this->flowsC_.flores_[floresInfo.faceId][oilCompIdx].empty()) {
this->flowsC_.flores_[floresInfo.faceId][oilCompIdx][globalDofIdx]
= floresInfo.flow[oil_idx];
}
}
if constexpr (water_idx >= 0) {
if (!this->flowsC_.flores_[floresInfo.faceId][waterCompIdx].empty()) {
this->flowsC_.flores_[floresInfo.faceId][waterCompIdx][globalDofIdx]
= floresInfo.flow[water_idx];
}
}
}
if (floresInfo.faceId == -2) {
if (!this->flowsC_.floresn_[gasCompIdx].indices.empty()) {
this->flowsC_.floresn_[gasCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->flowsC_.floresn_[gasCompIdx].values[floresInfo.nncId]
= floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)];
}
if (!this->flowsC_.floresn_[oilCompIdx].indices.empty()) {
this->flowsC_.floresn_[oilCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->flowsC_.floresn_[oilCompIdx].values[floresInfo.nncId]
= floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)];
}
if (!this->flowsC_.floresn_[waterCompIdx].indices.empty()) {
this->flowsC_.floresn_[waterCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->flowsC_.floresn_[waterCompIdx].values[floresInfo.nncId]
= floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)];
}
}
this->flowsC_.assignFlores(globalDofIdx,
floresInfo.faceId,
floresInfo.nncId,
value_or_zero<gas_idx>(floresInfo.flow),
value_or_zero<oil_idx>(floresInfo.flow),
value_or_zero<water_idx>(floresInfo.flow));
}
}
}