mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: do all updateStorageCaches in one call
by looping over the tracer batches. this avoids initializing the element contexts 3 times for each cell
This commit is contained in:
@@ -161,9 +161,7 @@ public:
|
||||
if (this->numTracers()==0)
|
||||
return;
|
||||
|
||||
updateStorageCache(wat_);
|
||||
updateStorageCache(oil_);
|
||||
updateStorageCache(gas_);
|
||||
updateStorageCache();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -384,23 +382,26 @@ protected:
|
||||
Dune::ForwardCommunication);
|
||||
}
|
||||
|
||||
template <class TrRe>
|
||||
void updateStorageCache(TrRe & tr)
|
||||
void updateStorageCache()
|
||||
{
|
||||
if (tr.numTracer() == 0)
|
||||
return;
|
||||
|
||||
tr.concentrationInitial_ = tr.concentration_;
|
||||
for (auto& tr : tbatch) {
|
||||
if (tr.numTracer() != 0)
|
||||
tr.concentrationInitial_ = tr.concentration_;
|
||||
}
|
||||
|
||||
ElementContext elemCtx(simulator_);
|
||||
for (const auto& elem : elements(simulator_.gridView())) {
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
int globalDofIdx = elemCtx.globalSpaceIndex(0, /*timeIdx=*/0);
|
||||
Scalar fVolume;
|
||||
computeVolume_(fVolume, tr.phaseIdx_, elemCtx, 0, /*timeIdx=*/0);
|
||||
for (int tIdx = 0; tIdx < tr.numTracer(); ++tIdx) {
|
||||
tr.storageOfTimeIndex1_[tIdx][globalDofIdx] = fVolume*tr.concentrationInitial_[tIdx][globalDofIdx];
|
||||
for (auto& tr : tbatch) {
|
||||
if (tr.numTracer() == 0)
|
||||
continue;
|
||||
Scalar fVolume;
|
||||
computeVolume_(fVolume, tr.phaseIdx_, elemCtx, 0, /*timeIdx=*/0);
|
||||
for (int tIdx = 0; tIdx < tr.numTracer(); ++tIdx) {
|
||||
tr.storageOfTimeIndex1_[tIdx][globalDofIdx] = fVolume*tr.concentrationInitial_[tIdx][globalDofIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user