Commit 4af64f83 authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[freeflow][compositional] Calculate diffusive fluxes for all components

How these fluxes are used later-on should be treated there.
parent f993e36b
......@@ -68,10 +68,8 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::staggered >
static_assert(ModelTraits::numPhases() == 1, "Only one phase allowed supported!");
enum {
pressureIdx = Indices::pressureIdx,
conti0EqIdx = Indices::conti0EqIdx,
mainCompIdx = Indices::mainCompIdx,
replaceCompEqIdx = Indices::replaceCompEqIdx,
};
public:
......@@ -118,14 +116,8 @@ public:
flux[compIdx] = avgDensity * tij * (insideMoleFraction - outsideMoleFraction);
}
if(!(useMoles && replaceCompEqIdx == mainCompIdx))
{
const Scalar cumulativeFlux = std::accumulate(flux.begin(), flux.end(), 0.0);
flux[mainCompIdx] = - cumulativeFlux;
}
if(useMoles && replaceCompEqIdx <= numComponents)
flux[replaceCompEqIdx] = 0.0;
const Scalar cumulativeFlux = std::accumulate(flux.begin(), flux.end(), 0.0);
flux[mainCompIdx] = - cumulativeFlux;
// Fick's law (for binary systems) states that the net flux of moles within the bulk phase has to be zero:
// If a given amount of molecules A travel into one direction, the same amount of molecules B have to
......@@ -136,13 +128,6 @@ public:
//convert everything to a mass flux
for(int compIdx = 0; compIdx < numComponents; ++compIdx)
flux[compIdx] *= FluidSystem::molarMass(compIdx);
if(replaceCompEqIdx < numComponents)
{
for(int compIdx = 0; compIdx < numComponents; ++compIdx)
flux[replaceCompEqIdx] += (compIdx != replaceCompEqIdx) ? flux[compIdx] : 0.0;
}
}
return flux;
......
......@@ -73,7 +73,6 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethod::staggered >
enum {
pressureIdx = Indices::pressureIdx,
conti0EqIdx = Indices::conti0EqIdx,
replaceCompEqIdx = Indices::replaceCompEqIdx,
};
public:
......@@ -187,9 +186,6 @@ public:
componentFlux[numComponents-1] -=reducedFlux[compIdx];
}
if(useMoles && replaceCompEqIdx <= numComponents)
componentFlux[replaceCompEqIdx] = 0.0;
return componentFlux ;
}
......
......@@ -97,16 +97,17 @@ public:
return density * fraction;
};
flux[eqIdx - Indices::conti0EqIdx] = ParentType::advectiveFluxForCellCenter(elemVolVars, elemFaceVars, scvf, upwindTerm, isOutflow);
flux[compIdx] = ParentType::advectiveFluxForCellCenter(elemVolVars, elemFaceVars, scvf, upwindTerm, isOutflow);
}
flux += MolecularDiffusionType::flux(problem, fvGeometry, elemVolVars, scvf);
// in case one balance is substituted by the total mass balance
if (Indices::replaceCompEqIdx < numComponents)
{
flux[Indices::replaceCompEqIdx] = std::accumulate(flux.begin(), flux.end(), 0.0);
}
flux += MolecularDiffusionType::flux(problem, fvGeometry, elemVolVars, scvf);
return flux;
}
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment