14#ifndef DUMUX_FLUX_MAXWELLSTEFAN_DIFFUSION_COEFFICIENTS_HH
15#define DUMUX_FLUX_MAXWELLSTEFAN_DIFFUSION_COEFFICIENTS_HH
31template <
class Scalar,
int numPhases,
int numComponents>
35 template<
class DiffCoeffFunc>
36 void update(
const DiffCoeffFunc& computeDiffCoeff)
38 for (
int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
39 for (
int compIIdx = 0; compIIdx < numComponents; ++compIIdx)
40 for (
int compJIdx = compIIdx+1; compJIdx < numComponents; ++compJIdx)
41 diffCoeff_[getIndex_(phaseIdx, compIIdx, compJIdx)]
42 = computeDiffCoeff(phaseIdx, compIIdx, compJIdx);
45 Scalar
operator() (
int phaseIdx,
int compIIdx,
int compJIdx)
const
47 sortComponentIndices_(compIIdx, compJIdx);
48 assert(compIIdx != compJIdx);
49 return diffCoeff_[getIndex_(phaseIdx, compIIdx, compJIdx)];
63 std::array<Scalar, (numPhases * ((numComponents * (numComponents - 1)) / 2))> diffCoeff_;
76 constexpr int getIndex_(
int phaseIdx,
int compIIdx,
int compJIdx)
const
78 return phaseIdx * ((numComponents * (numComponents - 1)) / 2)
79 + compIIdx * numComponents
80 - ((compIIdx * (compIIdx + 1)) / 2)
81 + compJIdx - (compIIdx +1);
84 void sortComponentIndices_(
int& compIIdx,
int& compJIdx)
const
85 {
if (compIIdx > compJIdx) std::swap(compIIdx, compJIdx); }
Container storing the diffusion coefficients required by the Maxwell- Stefan diffusion law....
Definition: maxwellstefandiffusioncoefficients.hh:33
void update(const DiffCoeffFunc &computeDiffCoeff)
Definition: maxwellstefandiffusioncoefficients.hh:36
Scalar operator()(int phaseIdx, int compIIdx, int compJIdx) const
Definition: maxwellstefandiffusioncoefficients.hh:45