13#ifndef DUMUX_FREEFLOW_NC_VOLUMEVARIABLES_HH
14#define DUMUX_FREEFLOW_NC_VOLUMEVARIABLES_HH
17#include <dune/common/exceptions.hh>
26template <
class Traits>
32 using Scalar =
typename Traits::PrimaryVariables::value_type;
34 static constexpr bool useMoles = Traits::ModelTraits::useMoles();
35 static constexpr int numFluidComps = ParentType::numFluidComponents();
36 using DiffusionCoefficients =
typename Traits::DiffusionType::DiffusionCoefficientsContainer;
44 using Indices =
typename Traits::ModelTraits::Indices;
55 template<
class ElementSolution,
class Problem,
class Element,
class SubControlVolume>
56 void update(
const ElementSolution &elemSol,
57 const Problem &problem,
58 const Element &element,
59 const SubControlVolume& scv)
61 ParentType::update(elemSol, problem, element, scv);
65 typename FluidSystem::ParameterCache paramCache;
68 auto getDiffusionCoefficient = [&](
int phaseIdx,
int compIIdx,
int compJIdx)
70 return FluidSystem::binaryDiffusionCoefficient(this->
fluidState_,
83 template<
class ElementSolution,
class Problem,
class Element,
class SubControlVolume>
85 const Problem& problem,
86 const Element& element,
87 const SubControlVolume& scv,
91 fluidState.setPressure(0, elemSol[0][Indices::pressureIdx]);
98 Scalar sumFracMinorComp = 0.0;
100 for(
int compIdx = 1; compIdx < ParentType::numFluidComponents(); ++compIdx)
104 Scalar moleOrMassFraction = elemSol[0][Indices::conti0EqIdx+compIdx] + 1.0;
105 moleOrMassFraction = moleOrMassFraction - 1.0;
107 fluidState.setMoleFraction(0, compIdx, moleOrMassFraction);
109 fluidState.setMassFraction(0, compIdx, moleOrMassFraction);
110 sumFracMinorComp += moleOrMassFraction;
113 fluidState.setMoleFraction(0, 0, 1.0 - sumFracMinorComp);
115 fluidState.setMassFraction(0, 0, 1.0 - sumFracMinorComp);
117 typename FluidSystem::ParameterCache paramCache;
130 const Scalar h = ParentType::enthalpy(
fluidState, paramCache);
218 {
return FluidSystem::molarMass(compIdx); }
Definition: freeflow/volumevariables.hh:22
Volume variables for the single-phase, multi-component free-flow model.
Definition: freeflow/compositional/volumevariables.hh:28
Scalar moleFraction(int phaseIdx, int compIdx) const
Returns the mole fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:195
const FluidState & fluidState() const
Return the fluid state of the control volume.
Definition: freeflow/compositional/volumevariables.hh:243
Scalar massFraction(int phaseIdx, int compIdx) const
Returns the mass fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:178
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition: freeflow/compositional/volumevariables.hh:231
Scalar effectiveViscosity() const
Return the effective dynamic viscosity of the fluid within the control volume.
Definition: freeflow/compositional/volumevariables.hh:162
FluidState fluidState_
Definition: freeflow/compositional/volumevariables.hh:247
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/compositional/volumevariables.hh:44
Scalar temperature() const
Return temperature inside the sub-control volume.
Definition: freeflow/compositional/volumevariables.hh:155
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:84
typename Traits::FluidState FluidState
export the fluid state type
Definition: freeflow/compositional/volumevariables.hh:42
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:56
Scalar viscosity(int phaseIdx=0) const
Return the dynamic viscosity of the fluid within the control volume.
Definition: freeflow/compositional/volumevariables.hh:169
Scalar pressure(int phaseIdx=0) const
Return the effective pressure of a given phase within the control volume.
Definition: freeflow/compositional/volumevariables.hh:138
Scalar molarMass(int compIdx) const
Returns the molar mass of a given component.
Definition: freeflow/compositional/volumevariables.hh:217
Scalar moleFraction(int compIdx) const
Returns the mole fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:203
Scalar density(int phaseIdx=0) const
Return the mass density of a given phase within the control volume.
Definition: freeflow/compositional/volumevariables.hh:145
Scalar massFraction(int compIdx) const
Returns the mass fraction of a component in the phase .
Definition: freeflow/compositional/volumevariables.hh:186
DiffusionCoefficients diffCoefficient_
Definition: freeflow/compositional/volumevariables.hh:249
Scalar molarDensity(int phaseIdx=0) const
Returns the mass density of a given phase .
Definition: freeflow/compositional/volumevariables.hh:209
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition: freeflow/compositional/volumevariables.hh:237
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/compositional/volumevariables.hh:40
Scalar averageMolarMass(const int phaseIdx=0) const
Returns the average molar mass of the fluid phase.
Definition: freeflow/compositional/volumevariables.hh:225
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:71
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53