Skip to content
Snippets Groups Projects
Commit 7e25d217 authored by Martin Schneider's avatar Martin Schneider
Browse files

[flux][dispersion] Include extrusionFactor in Box dispersion flux

parent c4f9bb0b
No related branches found
No related tags found
1 merge request!3803Fix/tpfa dispersion
Checking pipeline status
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh> #include <dune/common/fmatrix.hh>
#include <dune/common/float_cmp.hh>
#include <dumux/common/math.hh> #include <dumux/common/math.hh>
#include <dumux/common/properties.hh> #include <dumux/common/properties.hh>
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
#include <dumux/discretization/extrusion.hh> #include <dumux/discretization/extrusion.hh>
#include <dumux/flux/traits.hh> #include <dumux/flux/traits.hh>
#include <dumux/flux/referencesystemformulation.hh> #include <dumux/flux/referencesystemformulation.hh>
#include <dumux/flux/facetensoraverage.hh>
namespace Dumux { namespace Dumux {
...@@ -102,13 +104,30 @@ public: ...@@ -102,13 +104,30 @@ public:
rhoMassOrMole += rho * shapeValues[scv.indexInElement()][0]; rhoMassOrMole += rho * shapeValues[scv.indexInElement()][0];
} }
const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
for (int compIdx = 0; compIdx < numComponents; compIdx++) for (int compIdx = 0; compIdx < numComponents; compIdx++)
{ {
// collect the dispersion tensor, the fluxVarsCache and the shape values // collect the dispersion tensor, the fluxVarsCache and the shape values
const auto& dispersionTensor = const auto& dispersionTensor = [&]()
ModelTraits::CompositionalDispersionModel::compositionalDispersionTensor(problem, scvf, fvGeometry, {
elemVolVars, elemFluxVarsCache, const auto& tensor =
phaseIdx, compIdx); ModelTraits::CompositionalDispersionModel::compositionalDispersionTensor(problem, scvf, fvGeometry,
elemVolVars, elemFluxVarsCache,
phaseIdx, compIdx);
if (Dune::FloatCmp::eq(insideVolVars.extrusionFactor(), outsideVolVars.extrusionFactor(), 1e-6))
return insideVolVars.extrusionFactor()*tensor;
else
{
const auto insideTensor = insideVolVars.extrusionFactor() * tensor;
const auto outsideTensor = outsideVolVars.extrusionFactor() * tensor;
// the resulting averaged dispersion tensor
return faceTensorAverage(insideTensor, outsideTensor, scvf.unitOuterNormal());
}
}();
// the mole/mass fraction gradient // the mole/mass fraction gradient
Dune::FieldVector<Scalar, dimWorld> gradX(0.0); Dune::FieldVector<Scalar, dimWorld> gradX(0.0);
...@@ -138,11 +157,29 @@ public: ...@@ -138,11 +157,29 @@ public:
const int phaseIdx, const int phaseIdx,
const ElementFluxVariablesCache& elemFluxVarsCache) const ElementFluxVariablesCache& elemFluxVarsCache)
{ {
const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
// collect the dispersion tensor // collect the dispersion tensor
const auto& dispersionTensor = const auto& dispersionTensor = [&]()
ModelTraits::ThermalDispersionModel::thermalDispersionTensor(problem, scvf, fvGeometry, {
elemVolVars, elemFluxVarsCache, const auto& tensor =
phaseIdx); ModelTraits::ThermalDispersionModel::thermalDispersionTensor(problem, scvf, fvGeometry,
elemVolVars, elemFluxVarsCache,
phaseIdx);
if (Dune::FloatCmp::eq(insideVolVars.extrusionFactor(), outsideVolVars.extrusionFactor(), 1e-6))
return insideVolVars.extrusionFactor()*tensor;
else
{
const auto insideTensor = insideVolVars.extrusionFactor() * tensor;
const auto outsideTensor = outsideVolVars.extrusionFactor() * tensor;
// the resulting averaged dispersion tensor
return faceTensorAverage(insideTensor, outsideTensor, scvf.unitOuterNormal());
}
}();
// compute the temperature gradient with the shape functions // compute the temperature gradient with the shape functions
const auto& fluxVarsCache = elemFluxVarsCache[scvf]; const auto& fluxVarsCache = elemFluxVarsCache[scvf];
Dune::FieldVector<Scalar, GridView::dimensionworld> gradTemp(0.0); Dune::FieldVector<Scalar, GridView::dimensionworld> gradTemp(0.0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment