Skip to content
Snippets Groups Projects
Commit db32a283 authored by Katharina Heck's avatar Katharina Heck
Browse files

[box] reuse gradN from fluxvarscache

parent 70b50ab5
No related branches found
No related tags found
1 merge request!1006Cleanup/maxwellstefan
...@@ -92,20 +92,15 @@ public: ...@@ -92,20 +92,15 @@ public:
// evaluate gradX at integration point and interpolate density // evaluate gradX at integration point and interpolate density
const auto& fluxVarsCache = elemFluxVarsCache[scvf]; const auto& fluxVarsCache = elemFluxVarsCache[scvf];
const auto& jacInvT = fluxVarsCache.jacInvT();
const auto& shapeJacobian = fluxVarsCache.shapeJacobian();
const auto& shapeValues = fluxVarsCache.shapeValues(); const auto& shapeValues = fluxVarsCache.shapeValues();
Scalar rho(0.0); Scalar rho(0.0);
std::vector<GlobalPosition> gradN(fvGeometry.numScv());
for (auto&& scv : scvs(fvGeometry)) for (auto&& scv : scvs(fvGeometry))
{ {
const auto& volVars = elemVolVars[scv]; const auto& volVars = elemVolVars[scv];
// density interpolation // density interpolation
rho += volVars.molarDensity(phaseIdx)*shapeValues[scv.indexInElement()][0]; rho += volVars.molarDensity(phaseIdx)*shapeValues[scv.indexInElement()][0];
// the ansatz function gradient
jacInvT.mv(shapeJacobian[scv.localDofIndex()][0], gradN[scv.indexInElement()]);
//interpolate the mole fraction for the diffusion matrix //interpolate the mole fraction for the diffusion matrix
for (int compIdx = 0; compIdx < numComponents; compIdx++) for (int compIdx = 0; compIdx < numComponents; compIdx++)
...@@ -114,7 +109,7 @@ public: ...@@ -114,7 +109,7 @@ public:
} }
} }
reducedDiffusionMatrix = setupMSMatrix_(problem, element, fvGeometry, elemVolVars, scvf, phaseIdx, moleFrac); reducedDiffusionMatrix = setupMSMatrix_(problem, element, fvGeometry, elemVolVars, scvf, phaseIdx, moleFrac);
for (int compIdx = 0; compIdx < numComponents-1; compIdx++) for (int compIdx = 0; compIdx < numComponents-1; compIdx++)
{ {
...@@ -124,7 +119,7 @@ public: ...@@ -124,7 +119,7 @@ public:
const auto& volVars = elemVolVars[scv]; const auto& volVars = elemVolVars[scv];
// the mole/mass fraction gradient // the mole/mass fraction gradient
gradX.axpy(volVars.moleFraction(phaseIdx, compIdx), gradN[scv.indexInElement()]); gradX.axpy(volVars.moleFraction(phaseIdx, compIdx), fluxVarsCache.gradN(scv.indexInElement()));
} }
normalX[compIdx] = gradX *scvf.unitOuterNormal(); normalX[compIdx] = gradX *scvf.unitOuterNormal();
...@@ -132,11 +127,10 @@ public: ...@@ -132,11 +127,10 @@ public:
reducedDiffusionMatrix.solve(reducedFlux,normalX); reducedDiffusionMatrix.solve(reducedFlux,normalX);
reducedFlux *= -1.0*rho*scvf.area(); reducedFlux *= -1.0*rho*scvf.area();
for (int compIdx = 0; compIdx < numComponents-1; compIdx++) for (int compIdx = 0; compIdx < numComponents-1; compIdx++)
{ {
componentFlux[compIdx] = reducedFlux[compIdx]; componentFlux[compIdx] = reducedFlux[compIdx];
componentFlux[numComponents-1] -= reducedFlux[compIdx]; componentFlux[numComponents-1] -= reducedFlux[compIdx];
} }
return componentFlux ; return componentFlux ;
} }
...@@ -144,12 +138,12 @@ public: ...@@ -144,12 +138,12 @@ public:
private: private:
static ReducedComponentMatrix setupMSMatrix_(const Problem& problem, static ReducedComponentMatrix setupMSMatrix_(const Problem& problem,
const Element& element, const Element& element,
const FVElementGeometry& fvGeometry, const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars, const ElementVolumeVariables& elemVolVars,
const SubControlVolumeFace& scvf, const SubControlVolumeFace& scvf,
const int phaseIdx, const int phaseIdx,
const ComponentFluxVector moleFrac) const ComponentFluxVector moleFrac)
{ {
ReducedComponentMatrix reducedDiffusionMatrix(0.0); ReducedComponentMatrix reducedDiffusionMatrix(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