Use templates to choose threephase approach.

This commit is contained in:
Atgeirr Flø Rasmussen committed 2025-09-02 17:12:22 +02:00
1 parent 5d0d73ebcf
commit dd23bfbc3f
2 files changed
+13 -5

No files matched your search

@@ -290,6 +290,7 @@ public:
this->updateRelpermAndPressures(problem, priVars, globalSpaceIdx, timeIdx, elemCtx.linearizationType());
}
template <class ...Args>
void updateRelpermAndPressures(const Problem& problem,
const PrimaryVariables& priVars,
const unsigned globalSpaceIdx,
@@ -309,9 +310,10 @@ public:
problem.updateRelperms(mobility_, dirMob_, fluidState_, globalSpaceIdx);
// now we compute all phase pressures
std::array<Evaluation, numPhases> pC;
using EvalArr = std::array<Evaluation, numPhases>;
EvalArr pC;
const auto& materialParams = problem.materialLawParams(globalSpaceIdx);
MaterialLaw::capillaryPressures(pC, materialParams, fluidState_);
MaterialLaw::template capillaryPressures<EvalArr, FluidState, Args...>(pC, materialParams, fluidState_);
// scaling the capillary pressure due to salt precipitation
if constexpr (enableBrine) {
@@ -632,13 +634,15 @@ public:
/*!
* \copydoc IntensiveQuantities::update
*/
template <class ...Args>
void update(const ElementContext& elemCtx, unsigned dofIdx, unsigned timeIdx)
{
ParentType::update(elemCtx, dofIdx, timeIdx);
const auto& problem = elemCtx.problem();
const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
const unsigned globalSpaceIdx = elemCtx.globalSpaceIndex(dofIdx, timeIdx);
updateCommonPart(problem, priVars, globalSpaceIdx, timeIdx);
updateCommonPart<Args...>(problem, priVars, globalSpaceIdx, timeIdx);
updatePorosity(elemCtx, dofIdx, timeIdx);
@@ -692,6 +696,7 @@ public:
}
}
template <class ...Args>
void update(const Problem& problem, const PrimaryVariables& priVars, const unsigned globalSpaceIdx, const unsigned timeIdx)
{
// This is the version of update() that does not use any ElementContext.
@@ -707,7 +712,7 @@ public:
static_assert(!enableDispersion);
this->extrusionFactor_ = 1.0;// to avoid fixing parent update
updateCommonPart(problem, priVars, globalSpaceIdx, timeIdx);
updateCommonPart<Args...>(problem, priVars, globalSpaceIdx, timeIdx);
// Porosity requires separate calls so this can be instantiated with ReservoirProblem from the examples/ directory.
updatePorosity(problem, priVars, globalSpaceIdx, timeIdx);
@@ -715,6 +720,7 @@ public:
}
// This function updated the parts that are common to the IntensiveQuantities regardless of extensions used.
template <class ...Args>
void updateCommonPart(const Problem& problem, const PrimaryVariables& priVars, const unsigned globalSpaceIdx, const unsigned timeIdx)
{
OPM_TIMEBLOCK_LOCAL(blackoilIntensiveQuanititiesUpdate);
@@ -726,7 +732,7 @@ public:
updateTempSalt(problem, priVars, globalSpaceIdx, timeIdx, linearizationType);
updateSaturations(priVars, timeIdx, linearizationType);
updateRelpermAndPressures(problem, priVars, globalSpaceIdx, timeIdx, linearizationType);
updateRelpermAndPressures<Args...>(problem, priVars, globalSpaceIdx, timeIdx, linearizationType);
// update extBO parameters
if constexpr (enableExtbo) {
+2
View File
@@ -75,6 +75,8 @@ public:
ThreadManager::maxThreads())
{
}
// using Dispatch = EclMultiplexerDispatch<EclMultiplexerApproach::Default>;
// dofVars_[dofIdx].intensiveQuantities[timeIdx].template update<Dispatch>(/*context=*/asImp_(), dofIdx, timeIdx);
void invalidateAndUpdateIntensiveQuantities(unsigned timeIdx) const
{