25#ifndef DUMUX_FLUX_FICKIAN_DIFFUSION_COEFFICIENTS_HH
26#define DUMUX_FLUX_FICKIAN_DIFFUSION_COEFFICIENTS_HH
42template <
class Scalar,
int numPhases,
int numComponents>
46 template<
class DiffCoeffFunc>
47 void update(
const DiffCoeffFunc& computeDiffCoeff)
53 static_assert(numPhases <= numComponents || (numPhases == 3 && numComponents == 2),
54 "This combination of numPhases and numComponents is not supported!");
55 for (
int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
56 for (
int compIIdx = std::min(phaseIdx, numComponents-1), compJIdx = 0; compJIdx < numComponents; ++compJIdx)
57 if (compIIdx != compJIdx)
58 diffCoeff_[getIndex_(phaseIdx, compIIdx, compJIdx)] = computeDiffCoeff(phaseIdx, compIIdx, compJIdx);
61 Scalar
operator() (
int phaseIdx,
int compIIdx,
int compJIdx)
const
63 sortComponentIndices_(phaseIdx, compIIdx, compJIdx);
64 assert(compIIdx != compJIdx);
65 return diffCoeff_[getIndex_(phaseIdx, compIIdx, compJIdx)];
75 std::array<Scalar, numPhases * (numComponents - 1)> diffCoeff_;
88 constexpr int getIndex_(
int phaseIdx,
int compIIdx,
int compJIdx)
const
89 {
return (phaseIdx * (numComponents-1)) + compJIdx -
static_cast<int>(phaseIdx < compJIdx); }
91 void sortComponentIndices_(
int phaseIdx,
int& compIIdx,
int& compJIdx)
const
92 {
if (compIIdx != std::min(phaseIdx, numComponents-1)) std::swap(compIIdx, compJIdx); }
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Container storing the diffusion coefficients required by Fick's law. Uses the minimal possible contai...
Definition: fickiandiffusioncoefficients.hh:44
Scalar operator()(int phaseIdx, int compIIdx, int compJIdx) const
Definition: fickiandiffusioncoefficients.hh:61
void update(const DiffCoeffFunc &computeDiffCoeff)
Definition: fickiandiffusioncoefficients.hh:47