diff --git a/dumux/freeflow/compositional/staggered/fluxvariables.hh b/dumux/freeflow/compositional/staggered/fluxvariables.hh
index 3eab6b5ab0b9ef06d1e1c349a7b8b5bc7c64bc32..e4267068b1dc98afbef13d237e73bf00601991c4 100644
--- a/dumux/freeflow/compositional/staggered/fluxvariables.hh
+++ b/dumux/freeflow/compositional/staggered/fluxvariables.hh
@@ -75,7 +75,7 @@ public:
 
         const auto diffusiveFluxes = MolecularDiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
 
-        auto referenceSystemFormulation = MolecularDiffusionType::referenceSystemFormulation();
+        static constexpr auto referenceSystemFormulation = MolecularDiffusionType::referenceSystemFormulation();
 
         for (int compIdx = 0; compIdx < numComponents; ++compIdx)
         {
diff --git a/dumux/porousmediumflow/3p3c/localresidual.hh b/dumux/porousmediumflow/3p3c/localresidual.hh
index 2f73b36642c0d65777e170d1bb61d4a9f38f6e68..32622fcbcd4e2d31d23d0a0b65d867faa33e45a0 100644
--- a/dumux/porousmediumflow/3p3c/localresidual.hh
+++ b/dumux/porousmediumflow/3p3c/localresidual.hh
@@ -135,7 +135,7 @@ public:
     {
         FluxVariables fluxVars;
         fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
-        auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
+        static constexpr auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
 
         // get upwind weights into local scope
         NumEqVector flux(0.0);
diff --git a/dumux/porousmediumflow/3pwateroil/localresidual.hh b/dumux/porousmediumflow/3pwateroil/localresidual.hh
index 097be1fd4cb0800882cb9294a5f20436cf8ac0db..a19c731c5a39d089ed5a5c3ec3a57cde49f37489 100644
--- a/dumux/porousmediumflow/3pwateroil/localresidual.hh
+++ b/dumux/porousmediumflow/3pwateroil/localresidual.hh
@@ -171,7 +171,7 @@ public:
         EnergyLocalResidual::heatConductionFlux(flux, fluxVars);
 
         // diffusive fluxes
-        auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
+        static constexpr auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
         const auto diffusionFluxesWPhase = fluxVars.molecularDiffusionFlux(wPhaseIdx);
         Scalar jNW = diffusionFluxesWPhase[nCompIdx];
         // check for the reference system and adapt units of the diffusive flux accordingly.
diff --git a/dumux/porousmediumflow/compositional/localresidual.hh b/dumux/porousmediumflow/compositional/localresidual.hh
index 9ad1fa80fc7cbdcdb581e09e30a1fc613e78169e..5cb6815bcb61149e9f0274fc5d7bb2a60d105999 100644
--- a/dumux/porousmediumflow/compositional/localresidual.hh
+++ b/dumux/porousmediumflow/compositional/localresidual.hh
@@ -143,7 +143,7 @@ public:
     {
         FluxVariables fluxVars;
         fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
-        auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
+        static constexpr auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
         // get upwind weights into local scope
         NumEqVector flux(0.0);
 
diff --git a/dumux/porousmediumflow/tracer/localresidual.hh b/dumux/porousmediumflow/tracer/localresidual.hh
index 783a777c36ef8b97f138e1fdaa5d03737491e062..e4d9a455dd38f3d66c9eda4e8a2bc1c32cc56d28 100644
--- a/dumux/porousmediumflow/tracer/localresidual.hh
+++ b/dumux/porousmediumflow/tracer/localresidual.hh
@@ -126,7 +126,7 @@ public:
         NumEqVector flux(0.0);
         const auto diffusiveFluxes = fluxVars.molecularDiffusionFlux(phaseIdx);
 
-        auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
+        static constexpr auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
         // formulation with mole balances
         if (useMoles)
         {
@@ -248,7 +248,7 @@ public:
         const auto advDerivIJ = volFlux*rho(outsideVolVars)*outsideWeight;
 
         // diffusive term
-        const auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
+        static constexpr auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
         const auto& fluxCache = elemFluxVarsCache[scvf];
         const Scalar rhoInside = massOrMolarDensity(insideVolVars, referenceSystemFormulation, phaseIdx);
         const Scalar rhoOutside = massOrMolarDensity(outsideVolVars, referenceSystemFormulation, phaseIdx);
@@ -307,7 +307,7 @@ public:
         const auto advDerivIJ = volFlux*rho(outsideVolVars)*outsideWeight;
 
         // diffusive term
-        auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
+        static constexpr auto referenceSystemFormulation = FluxVariables::MolecularDiffusionType::referenceSystemFormulation();
         using DiffusionType = GetPropType<T, Properties::MolecularDiffusionType>;
         const auto ti = DiffusionType::calculateTransmissibilities(problem,
                                                                    element,