57 using Element =
typename GridView::template Codim<0>::Entity;
58 using ElementIterator =
typename GridView::template Codim<0>::Iterator;
67 static constexpr bool gridIsUnchanging =
68 std::is_same_v<GetPropType<TypeTag, Properties::Grid>, Dune::CpGrid>;
73 , element_chunks_(this->gridView_,
74 Dune::Partitions::all,
79 void invalidateAndUpdateIntensiveQuantities(
unsigned timeIdx)
const
81 this->invalidateIntensiveQuantitiesCache(
timeIdx);
82 OPM_BEGIN_PARALLEL_TRY_CATCH();
83 if constexpr (gridIsUnchanging) {
85#pragma omp parallel for
87 for (
const auto&
chunk : element_chunks_) {
88 ElementContext elemCtx(this->simulator_);
90 elemCtx.updatePrimaryStencil(
elem);
91 elemCtx.updatePrimaryIntensiveQuantities(
timeIdx);
96 ElementContext elemCtx(this->simulator_);
98 elemCtx.updatePrimaryStencil(
elem);
99 elemCtx.updatePrimaryIntensiveQuantities(
timeIdx);
102 OPM_END_PARALLEL_TRY_CATCH(
"InvalideAndUpdateIntensiveQuantities: state error",
103 this->simulator_.vanguard().grid().comm());
106 void invalidateAndUpdateIntensiveQuantitiesOverlap(
unsigned timeIdx)
const
110 OPM_BEGIN_PARALLEL_TRY_CATCH()
115 ElementContext elemCtx(this->simulator_);
118 if (
elemIt->partitionType() != Dune::OverlapEntity) {
122 elemCtx.updatePrimaryStencil(
elem);
124 const std::size_t numPrimaryDof = elemCtx.numPrimaryDof(
timeIdx);
125 for (
unsigned dofIdx = 0; dofIdx < numPrimaryDof; ++dofIdx) {
130 elemCtx.updatePrimaryIntensiveQuantities(0);
133 OPM_END_PARALLEL_TRY_CATCH(
"InvalideAndUpdateIntensiveQuantitiesOverlap: state error",
134 this->simulator_.vanguard().grid().comm());
137 template <
class Gr
idSubDomain>
147 ElementContext elemCtx(this->simulator_);
150 if (
elemIt->partitionType() != Dune::InteriorEntity) {
154 elemCtx.updatePrimaryStencil(
elem);
156 const std::size_t numPrimaryDof = elemCtx.numPrimaryDof(
timeIdx);
157 for (
unsigned dofIdx = 0; dofIdx < numPrimaryDof; ++dofIdx) {
162 elemCtx.updatePrimaryIntensiveQuantities(0);
178 ParentType::updateFailed();
179 invalidateAndUpdateIntensiveQuantities(0);
183 const IntensiveQuantities& intensiveQuantities(
unsigned globalIdx,
unsigned timeIdx)
const
185 if (!this->enableIntensiveQuantityCache_) {
187 "Run without intensive quantites not enabled: "
188 "Use --enable-intensive-quantity=true");
190 const auto*
intquant = this->cachedIntensiveQuantities(globalIdx,
timeIdx);
192 OPM_THROW(std::logic_error,
"Intensive quantites need to be updated in code");
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:235