26#ifndef DUMUX_FLUX_MAXWELLSTEFAN_DIFFUSION_COEFFICIENTS_HH
27#define DUMUX_FLUX_MAXWELLSTEFAN_DIFFUSION_COEFFICIENTS_HH
43template <
class Scalar,
int numPhases,
int numComponents>
47 template<
class DiffCoeffFunc>
48 void update(
const DiffCoeffFunc& computeDiffCoeff)
50 for (
int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
51 for (
int compIIdx = 0; compIIdx < numComponents; ++compIIdx)
52 for (
int compJIdx = compIIdx+1; compJIdx < numComponents; ++compJIdx)
53 diffCoeff_[getIndex_(phaseIdx, compIIdx, compJIdx)]
54 = computeDiffCoeff(phaseIdx, compIIdx, compJIdx);
57 Scalar
operator() (
int phaseIdx,
int compIIdx,
int compJIdx)
const
59 sortComponentIndices_(compIIdx, compJIdx);
60 assert(compIIdx != compJIdx);
61 return diffCoeff_[getIndex_(phaseIdx, compIIdx, compJIdx)];
75 std::array<Scalar, (numPhases * ((numComponents * (numComponents - 1)) / 2))> diffCoeff_;
88 constexpr int getIndex_(
int phaseIdx,
int compIIdx,
int compJIdx)
const
90 return phaseIdx * ((numComponents * (numComponents - 1)) / 2)
91 + compIIdx * numComponents
92 - ((compIIdx * (compIIdx + 1)) / 2)
93 + compJIdx - (compIIdx +1);
96 void sortComponentIndices_(
int& compIIdx,
int& compJIdx)
const
97 {
if (compIIdx > compJIdx) std::swap(compIIdx, compJIdx); }
Container storing the diffusion coefficients required by the Maxwell- Stefan diffusion law....
Definition: maxwellstefandiffusioncoefficients.hh:45
void update(const DiffCoeffFunc &computeDiffCoeff)
Definition: maxwellstefandiffusioncoefficients.hh:48
Scalar operator()(int phaseIdx, int compIIdx, int compJIdx) const
Definition: maxwellstefandiffusioncoefficients.hh:57