25#ifndef DUMUX_FREEFLOW_NC_VOLUMEVARIABLES_HH
26#define DUMUX_FREEFLOW_NC_VOLUMEVARIABLES_HH
29#include <dune/common/exceptions.hh>
38template <
class Traits>
44 using Scalar =
typename Traits::PrimaryVariables::value_type;
46 static constexpr bool useMoles = Traits::ModelTraits::useMoles();
47 static constexpr int numFluidComps = ParentType::numFluidComponents();
48 using DiffusionCoefficients =
typename Traits::DiffusionType::DiffusionCoefficientsContainer;
56 using Indices =
typename Traits::ModelTraits::Indices;
67 template<
class ElementSolution,
class Problem,
class Element,
class SubControlVolume>
68 void update(
const ElementSolution &elemSol,
69 const Problem &problem,
70 const Element &element,
71 const SubControlVolume& scv)
73 ParentType::update(elemSol, problem, element, scv);
77 typename FluidSystem::ParameterCache paramCache;
80 auto getDiffusionCoefficient = [&](
int phaseIdx,
int compIIdx,
int compJIdx)
82 return FluidSystem::binaryDiffusionCoefficient(this->
fluidState_,
95 template<
class ElementSolution,
class Problem,
class Element,
class SubControlVolume>
97 const Problem& problem,
98 const Element& element,
99 const SubControlVolume& scv,
103 fluidState.setPressure(0, elemSol[0][Indices::pressureIdx]);
110 Scalar sumFracMinorComp = 0.0;
112 for(
int compIdx = 1; compIdx < ParentType::numFluidComponents(); ++compIdx)
116 Scalar moleOrMassFraction = elemSol[0][Indices::conti0EqIdx+compIdx] + 1.0;
117 moleOrMassFraction = moleOrMassFraction - 1.0;
119 fluidState.setMoleFraction(0, compIdx, moleOrMassFraction);
121 fluidState.setMassFraction(0, compIdx, moleOrMassFraction);
122 sumFracMinorComp += moleOrMassFraction;
125 fluidState.setMoleFraction(0, 0, 1.0 - sumFracMinorComp);
127 fluidState.setMassFraction(0, 0, 1.0 - sumFracMinorComp);
129 typename FluidSystem::ParameterCache paramCache;
142 const Scalar h = ParentType::enthalpy(
fluidState, paramCache);
230 {
return FluidSystem::molarMass(compIdx); }
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:83
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Volume variables for the single-phase, multi-component free-flow model.
Definition: freeflow/compositional/volumevariables.hh:40
Scalar moleFraction(int phaseIdx, int compIdx) const
Returns the mole fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:207
const FluidState & fluidState() const
Return the fluid state of the control volume.
Definition: freeflow/compositional/volumevariables.hh:255
Scalar massFraction(int phaseIdx, int compIdx) const
Returns the mass fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:190
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition: freeflow/compositional/volumevariables.hh:243
Scalar effectiveViscosity() const
Return the effective dynamic viscosity of the fluid within the control volume.
Definition: freeflow/compositional/volumevariables.hh:174
FluidState fluidState_
Definition: freeflow/compositional/volumevariables.hh:259
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/compositional/volumevariables.hh:56
Scalar temperature() const
Return temperature inside the sub-control volume.
Definition: freeflow/compositional/volumevariables.hh:167
static void completeFluidState(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv, FluidState &fluidState)
Update the fluid state.
Definition: freeflow/compositional/volumevariables.hh:96
typename Traits::FluidState FluidState
export the fluid state type
Definition: freeflow/compositional/volumevariables.hh:54
void update(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: freeflow/compositional/volumevariables.hh:68
Scalar viscosity(int phaseIdx=0) const
Return the dynamic viscosity of the fluid within the control volume.
Definition: freeflow/compositional/volumevariables.hh:181
Scalar pressure(int phaseIdx=0) const
Return the effective pressure of a given phase within the control volume.
Definition: freeflow/compositional/volumevariables.hh:150
Scalar molarMass(int compIdx) const
Returns the molar mass of a given component.
Definition: freeflow/compositional/volumevariables.hh:229
Scalar moleFraction(int compIdx) const
Returns the mole fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:215
Scalar density(int phaseIdx=0) const
Return the mass density of a given phase within the control volume.
Definition: freeflow/compositional/volumevariables.hh:157
Scalar massFraction(int compIdx) const
Returns the mass fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:198
DiffusionCoefficients diffCoefficient_
Definition: freeflow/compositional/volumevariables.hh:261
Scalar molarDensity(int phaseIdx=0) const
Returns the mass density of a given phase .
Definition: freeflow/compositional/volumevariables.hh:221
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition: freeflow/compositional/volumevariables.hh:249
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/compositional/volumevariables.hh:52
Scalar averageMolarMass(const int phaseIdx=0) const
Returns the average molar mass of the fluid phase.
Definition: freeflow/compositional/volumevariables.hh:237
Definition: freeflow/volumevariables.hh:34