Commit 0bf45031 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

Merge branch 'fix/stokesdarcy-couplingdata-maxwellstefan' into 'master'

[fix][multidomain][stokesdarcy] change molar mass of outside components to...

See merge request !1895
parents 9d38bd5a 63375579
...@@ -937,15 +937,15 @@ protected: ...@@ -937,15 +937,15 @@ protected:
/*! /*!
* \brief Returns the molecular diffusion coefficient within the free flow domain. * \brief Returns the molecular diffusion coefficient within the free flow domain.
*/ */
Scalar diffusionCoefficientMS_(const VolumeVariables<stokesIdx>& volVars, int phaseIdx, int compIIdx, int compJIdx) const Scalar diffusionCoefficientMS_(const VolumeVariables<stokesIdx>& volVars, int phaseIdx, int compKIdx, int compLIdx) const
{ {
return volVars.effectiveDiffusivity(compIIdx, compJIdx); return volVars.effectiveDiffusivity(compKIdx, compLIdx);
} }
/*! /*!
* \brief Returns the effective diffusion coefficient within the porous medium. * \brief Returns the effective diffusion coefficient within the porous medium.
*/ */
Scalar diffusionCoefficientMS_(const VolumeVariables<darcyIdx>& volVars, int phaseIdx, int compIIdx, int compJIdx) const Scalar diffusionCoefficientMS_(const VolumeVariables<darcyIdx>& volVars, int phaseIdx, int compKIdx, int compLIdx) const
{ {
using EffDiffModel = GetPropType<SubDomainTypeTag<darcyIdx>, Properties::EffectiveDiffusivityModel>; using EffDiffModel = GetPropType<SubDomainTypeTag<darcyIdx>, Properties::EffectiveDiffusivityModel>;
auto fluidState = volVars.fluidState(); auto fluidState = volVars.fluidState();
...@@ -954,8 +954,8 @@ protected: ...@@ -954,8 +954,8 @@ protected:
auto diffCoeff = FluidSystem<darcyIdx>::binaryDiffusionCoefficient(fluidState, auto diffCoeff = FluidSystem<darcyIdx>::binaryDiffusionCoefficient(fluidState,
paramCache, paramCache,
phaseIdx, phaseIdx,
compIIdx, compKIdx,
compJIdx); compLIdx);
return EffDiffModel::effectiveDiffusivity(volVars.porosity(), return EffDiffModel::effectiveDiffusivity(volVars.porosity(),
volVars.saturation(phaseIdx), volVars.saturation(phaseIdx),
diffCoeff); diffCoeff);
...@@ -1010,67 +1010,67 @@ protected: ...@@ -1010,67 +1010,67 @@ protected:
moleFracOutside[domainICompIdx] = xOutside; moleFracOutside[domainICompIdx] = xOutside;
} }
//now we have to do the tpfa: J_i = -J_j which leads to: J_i = -rho_i Bi^-1 omegai(x*-xi) with x* = (omegai rho_i Bi^-1 + omegaj rho_j Bj^-1)^-1 (xi omegai rho_i Bi^-1 + xj omegaj rho_j Bj^-1) with i inside and j outside //now we have to do the tpfa: J_i = -J_j which leads to: J_i = -rho_i Bi^-1 omegai(x*-xi) with x* = (omegai rho_i Bi^-1 + omegaj rho_j Bj^-1)^-1 (xi omegai rho_i Bi^-1 + xj omegaj rho_j Bj^-1) with i inside and j outside.
//first set up the matrices containing the diffusion coefficients and mole fractions //first set up the matrices containing the binary diffusion coefficients and mole fractions
//inside matrix //inside matrix. KIdx and LIdx are the indices for the k and l-th component, N for the n-th component
for (int compIIdx = 0; compIIdx < numComponents-1; compIIdx++) for (int compKIdx = 0; compKIdx < numComponents-1; compKIdx++)
{ {
const int domainICompIIdx = couplingCompIdx(domainI, compIIdx); const int domainICompKIdx = couplingCompIdx(domainI, compKIdx);
const Scalar xi = volVarsI.moleFraction(couplingPhaseIdx(domainI), domainICompIIdx); const Scalar xk = volVarsI.moleFraction(couplingPhaseIdx(domainI), domainICompKIdx);
const Scalar avgMolarMass = volVarsI.averageMolarMass(couplingPhaseIdx(domainI)); const Scalar avgMolarMass = volVarsI.averageMolarMass(couplingPhaseIdx(domainI));
const Scalar Mn = FluidSystem<i>::molarMass(numComponents-1); const Scalar Mn = FluidSystem<i>::molarMass(numComponents-1);
const Scalar tin = diffusionCoefficientMS_(volVarsI, couplingPhaseIdx(domainI), domainICompIIdx, couplingCompIdx(domainI, numComponents-1)); const Scalar tkn = diffusionCoefficientMS_(volVarsI, couplingPhaseIdx(domainI), domainICompKIdx, couplingCompIdx(domainI, numComponents-1));
// set the entries of the diffusion matrix of the diagonal // set the entries of the diffusion matrix of the diagonal
reducedDiffusionMatrixInside[domainICompIIdx][domainICompIIdx] += xi*avgMolarMass/(tin*Mn); reducedDiffusionMatrixInside[domainICompKIdx][domainICompKIdx] += xk*avgMolarMass/(tkn*Mn);
for (int compJIdx = 0; compJIdx < numComponents; compJIdx++) for (int compLIdx = 0; compLIdx < numComponents; compLIdx++)
{ {
const int domainICompJIdx = couplingCompIdx(domainI, compJIdx); const int domainICompLIdx = couplingCompIdx(domainI, compLIdx);
// we don't want to calculate e.g. water in water diffusion // we don't want to calculate e.g. water in water diffusion
if (domainICompIIdx == domainICompJIdx) if (domainICompKIdx == domainICompLIdx)
continue; continue;
const Scalar xj = volVarsI.moleFraction(couplingPhaseIdx(domainI), domainICompJIdx); const Scalar xl = volVarsI.moleFraction(couplingPhaseIdx(domainI), domainICompLIdx);
const Scalar Mi = FluidSystem<i>::molarMass(domainICompIIdx); const Scalar Mk = FluidSystem<i>::molarMass(domainICompKIdx);
const Scalar Mj = FluidSystem<i>::molarMass(domainICompJIdx); const Scalar Ml = FluidSystem<i>::molarMass(domainICompLIdx);
const Scalar tij = diffusionCoefficientMS_(volVarsI, couplingPhaseIdx(domainI), domainICompIIdx, domainICompJIdx); const Scalar tkl = diffusionCoefficientMS_(volVarsI, couplingPhaseIdx(domainI), domainICompKIdx, domainICompLIdx);
reducedDiffusionMatrixInside[domainICompIIdx][domainICompIIdx] += xj*avgMolarMass/(tij*Mi); reducedDiffusionMatrixInside[domainICompKIdx][domainICompKIdx] += xl*avgMolarMass/(tkl*Mk);
reducedDiffusionMatrixInside[domainICompIIdx][domainICompJIdx] += xi*(avgMolarMass/(tin*Mn) - avgMolarMass/(tij*Mj)); reducedDiffusionMatrixInside[domainICompKIdx][domainICompLIdx] += xk*(avgMolarMass/(tkn*Mn) - avgMolarMass/(tkl*Ml));
} }
} }
//outside matrix //outside matrix
for (int compIIdx = 0; compIIdx < numComponents-1; compIIdx++) for (int compKIdx = 0; compKIdx < numComponents-1; compKIdx++)
{ {
const int domainJCompIIdx = couplingCompIdx(domainJ, compIIdx); const int domainJCompKIdx = couplingCompIdx(domainJ, compKIdx);
const int domainICompIIdx = couplingCompIdx(domainI, compIIdx); const int domainICompKIdx = couplingCompIdx(domainI, compKIdx);
const Scalar xi = volVarsJ.moleFraction(couplingPhaseIdx(domainJ), domainJCompIIdx); const Scalar xk = volVarsJ.moleFraction(couplingPhaseIdx(domainJ), domainJCompKIdx);
const Scalar avgMolarMass = volVarsJ.averageMolarMass(couplingPhaseIdx(domainJ)); const Scalar avgMolarMass = volVarsJ.averageMolarMass(couplingPhaseIdx(domainJ));
const Scalar Mn = FluidSystem<i>::molarMass(numComponents-1); const Scalar Mn = FluidSystem<j>::molarMass(numComponents-1);
const Scalar tin = diffusionCoefficientMS_(volVarsJ, couplingPhaseIdx(domainJ), domainJCompIIdx, couplingCompIdx(domainJ, numComponents-1)); const Scalar tkn = diffusionCoefficientMS_(volVarsJ, couplingPhaseIdx(domainJ), domainJCompKIdx, couplingCompIdx(domainJ, numComponents-1));
// set the entries of the diffusion matrix of the diagonal // set the entries of the diffusion matrix of the diagonal
reducedDiffusionMatrixOutside[domainICompIIdx][domainICompIIdx] += xi*avgMolarMass/(tin*Mn); reducedDiffusionMatrixOutside[domainICompKIdx][domainICompKIdx] += xk*avgMolarMass/(tkn*Mn);
for (int compJIdx = 0; compJIdx < numComponents; compJIdx++) for (int compLIdx = 0; compLIdx < numComponents; compLIdx++)
{ {
const int domainJCompJIdx = couplingCompIdx(domainJ, compJIdx); const int domainJCompLIdx = couplingCompIdx(domainJ, compLIdx);
const int domainICompJIdx = couplingCompIdx(domainI, compJIdx); const int domainICompLIdx = couplingCompIdx(domainI, compLIdx);
// we don't want to calculate e.g. water in water diffusion // we don't want to calculate e.g. water in water diffusion
if (domainJCompJIdx == domainJCompIIdx) if (domainJCompLIdx == domainJCompKIdx)
continue; continue;
const Scalar xj = volVarsJ.moleFraction(couplingPhaseIdx(domainJ), domainJCompJIdx); const Scalar xl = volVarsJ.moleFraction(couplingPhaseIdx(domainJ), domainJCompLIdx);
const Scalar Mi = FluidSystem<i>::molarMass(domainJCompIIdx); const Scalar Mk = FluidSystem<j>::molarMass(domainJCompKIdx);
const Scalar Mj = FluidSystem<i>::molarMass(domainJCompJIdx); const Scalar Ml = FluidSystem<j>::molarMass(domainJCompLIdx);
const Scalar tij = diffusionCoefficientMS_(volVarsJ, couplingPhaseIdx(domainJ), domainJCompIIdx, domainJCompJIdx); const Scalar tkl = diffusionCoefficientMS_(volVarsJ, couplingPhaseIdx(domainJ), domainJCompKIdx, domainJCompLIdx);
reducedDiffusionMatrixOutside[domainICompIIdx][domainICompIIdx] += xj*avgMolarMass/(tij*Mi); reducedDiffusionMatrixOutside[domainICompKIdx][domainICompKIdx] += xl*avgMolarMass/(tkl*Mk);
reducedDiffusionMatrixOutside[domainICompIIdx][domainICompJIdx] += xi*(avgMolarMass/(tin*Mn) - avgMolarMass/(tij*Mj)); reducedDiffusionMatrixOutside[domainICompKIdx][domainICompLIdx] += xk*(avgMolarMass/(tkn*Mn) - avgMolarMass/(tkl*Ml));
} }
} }
......
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