From 6fbea5e41f8c5822e235a15fb014efbbcd2e8ea2 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 23 Sep 2020 08:46:49 +0200 Subject: [PATCH] Make a method that invalidate and updates the intensive quantities --- .../common/fvbasediscretization.hh | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index 0f7e001ee..df4cc1f5d 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -765,6 +765,26 @@ public: } } + void invalidateAndUpdateIntensiveQuantities(unsigned timeIdx) const + { + invalidateIntensiveQuantitiesCache(timeIdx); + + // loop over all elements... + ThreadedEntityIterator threadedElemIt(gridView_); +#ifdef _OPENMP +#pragma omp parallel +#endif + { + ElementContext elemCtx(simulator_); + ElementIterator elemIt = threadedElemIt.beginParallel(); + for (; !threadedElemIt.isFinished(elemIt); elemIt = threadedElemIt.increment()) { + const Element& elem = *elemIt; + elemCtx.updatePrimaryStencil(elem); + elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0); + } + } + } + /*! * \brief Move the intensive quantities for a given time index to the back. *