From dd746cabfbcf9a88c6c3abbcf24811f8c2d98879 Mon Sep 17 00:00:00 2001 From: Thomas Fetzer <thomas.fetzer@iws.uni-stuttgart.de> Date: Thu, 22 Mar 2018 16:48:37 +0100 Subject: [PATCH] [freeflow] Remove unnecessary phaseIdx as function arguments --- .../staggered/freeflow/fickslaw.hh | 9 +-- .../staggered/freeflow/maxwellstefanslaw.hh | 8 +- .../freeflow/navierstokes/volumevariables.hh | 78 +++++++++---------- .../navierstokesnc/staggered/fluxvariables.hh | 3 +- .../navierstokesnc/staggered/localresidual.hh | 5 +- .../navierstokesnc/volumevariables.hh | 56 ++++++------- .../navierstokesnc/vtkoutputfields.hh | 6 +- dumux/freeflow/rans/volumevariables.hh | 3 - dumux/freeflow/ransnc/volumevariables.hh | 8 +- .../navierstokesnc/msfreeflowtestproblem.hh | 13 ++-- 10 files changed, 89 insertions(+), 100 deletions(-) diff --git a/dumux/discretization/staggered/freeflow/fickslaw.hh b/dumux/discretization/staggered/freeflow/fickslaw.hh index 7589cc0537..749733adf4 100644 --- a/dumux/discretization/staggered/freeflow/fickslaw.hh +++ b/dumux/discretization/staggered/freeflow/fickslaw.hh @@ -63,7 +63,6 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::staggered > using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits); static constexpr int numComponents = ModelTraits::numComponents(); - static constexpr int phaseIdx = Indices::phaseIdx; static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); static_assert(ModelTraits::numPhases() == 1, "Only one phase allowed supported!"); @@ -112,11 +111,11 @@ public: } const Scalar tij = transmissibility_(problem, fvGeometry, elemVolVars, scvf, compIdx); - const Scalar insideMoleFraction = insideVolVars.moleFraction(phaseIdx, compIdx); + const Scalar insideMoleFraction = insideVolVars.moleFraction(compIdx); const Scalar outsideMolarDensity = scvf.boundary() ? insideVolVars.molarDensity() : outsideVolVars.molarDensity(); const Scalar avgDensity = 0.5*(insideMolarDensity + outsideMolarDensity); - const Scalar outsideMoleFraction = outsideVolVars.moleFraction(phaseIdx, compIdx); + const Scalar outsideMoleFraction = outsideVolVars.moleFraction(compIdx); flux[compIdx] = avgDensity * tij * (insideMoleFraction - outsideMoleFraction); } @@ -161,7 +160,7 @@ public: const auto& insideVolVars = elemVolVars[insideScv]; const Scalar insideDistance = (insideScv.dofPosition() - scvf.ipGlobal()).two_norm(); - const Scalar insideD = insideVolVars.effectiveDiffusivity(phaseIdx, compIdx); + const Scalar insideD = insideVolVars.effectiveDiffusivity(compIdx); const Scalar ti = calculateOmega_(insideDistance, insideD, 1.0); if(scvf.boundary()) @@ -171,7 +170,7 @@ public: const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx()); const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()]; const Scalar outsideDistance = (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(); - const Scalar outsideD = outsideVolVars.effectiveDiffusivity(phaseIdx, compIdx); + const Scalar outsideD = outsideVolVars.effectiveDiffusivity(compIdx); const Scalar tj = calculateOmega_(outsideDistance, outsideD, 1.0); tij = scvf.area()*(ti * tj)/(ti + tj); diff --git a/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh b/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh index 124aaec012..458db31ec3 100644 --- a/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh +++ b/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh @@ -109,9 +109,9 @@ public: for (int compIdx = 0; compIdx < numComponents-1; compIdx++) { //calculate x_inside - const auto xInside = insideVolVars.moleFraction(phaseIdx, compIdx); + const auto xInside = insideVolVars.moleFraction(compIdx); //calculate outside molefraction with the respective transmissibility - const auto xOutside = outsideVolVars.moleFraction(phaseIdx, compIdx); + const auto xOutside = outsideVolVars.moleFraction(compIdx); moleFracInside[compIdx] = xInside; moleFracOutside[compIdx] = xOutside; @@ -218,7 +218,7 @@ private: for (int compIIdx = 0; compIIdx < numComponents-1; compIIdx++) { - const auto xi = volVars.moleFraction(phaseIdx, compIIdx); + const auto xi = volVars.moleFraction(compIIdx); //calculate diffusivity for i,numComponents auto fluidState = volVars.fluidState(); @@ -237,7 +237,7 @@ private: if (compkIdx == compIIdx) continue; - const auto xk = volVars.moleFraction(phaseIdx, compkIdx); + const auto xk = volVars.moleFraction(compkIdx); Scalar tik = FluidSystem::binaryDiffusionCoefficient(fluidState, paramCache, phaseIdx, diff --git a/dumux/freeflow/navierstokes/volumevariables.hh b/dumux/freeflow/navierstokes/volumevariables.hh index 82290cb5f5..251a932a90 100644 --- a/dumux/freeflow/navierstokes/volumevariables.hh +++ b/dumux/freeflow/navierstokes/volumevariables.hh @@ -58,7 +58,7 @@ class NavierStokesVolumeVariablesImplementation<TypeTag, false> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - static const int defaultPhaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); + static const int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); public: @@ -82,7 +82,7 @@ public: extrusionFactor_ = problem.extrusionFactor(element, scv, elemSol); completeFluidState(elemSol, problem, element, scv, fluidState_); - }; + } /*! * \brief Returns the primary variables at the dof associated with a given scv. @@ -105,21 +105,21 @@ public: const Scalar t = problem.temperatureAtPos(scv.dofPosition()); fluidState.setTemperature(t); - fluidState.setPressure(defaultPhaseIdx, elemSol[0][Indices::pressureIdx]); + fluidState.setPressure(phaseIdx, elemSol[0][Indices::pressureIdx]); // saturation in a single phase is always 1 and thus redundant // to set. But since we use the fluid state shared by the // immiscible multi-phase models, so we have to set it here... - fluidState.setSaturation(defaultPhaseIdx, 1.0); + fluidState.setSaturation(phaseIdx, 1.0); typename FluidSystem::ParameterCache paramCache; - paramCache.updatePhase(fluidState, defaultPhaseIdx); + paramCache.updatePhase(fluidState, phaseIdx); - Scalar value = FluidSystem::density(fluidState, paramCache, defaultPhaseIdx); - fluidState.setDensity(defaultPhaseIdx, value); + Scalar value = FluidSystem::density(fluidState, paramCache, phaseIdx); + fluidState.setDensity(phaseIdx, value); - value = FluidSystem::viscosity(fluidState, paramCache, defaultPhaseIdx); - fluidState.setViscosity(defaultPhaseIdx, value); + value = FluidSystem::viscosity(fluidState, paramCache, phaseIdx); + fluidState.setViscosity(phaseIdx, value); } /*! @@ -148,47 +148,47 @@ public: * \brief Return the effective pressure \f$\mathrm{[Pa]}\f$ of a given phase within * the control volume. */ - Scalar pressure(int phaseIdx = 0) const - { return fluidState_.pressure(defaultPhaseIdx); } + Scalar pressure() const + { return fluidState_.pressure(phaseIdx); } /*! * \brief Return the mass density \f$\mathrm{[kg/m^3]}\f$ of a given phase within the * control volume. */ - Scalar density(int phaseIdx = 0) const - { return fluidState_.density(defaultPhaseIdx); } + Scalar density() const + { return fluidState_.density(phaseIdx); } /*! * \brief Returns the mass density of a given phase within the * control volume. */ - Scalar molarDensity(int phaseIdx = 0) const + Scalar molarDensity() const { - return fluidState_.molarDensity(defaultPhaseIdx); + return fluidState_.molarDensity(phaseIdx); } /*! * \brief Returns the molar mass of a given phase within the * control volume. */ - Scalar molarMass(int phaseIdx = 0) const + Scalar molarMass() const { - return fluidState_.averageMolarMass(defaultPhaseIdx); + return fluidState_.averageMolarMass(phaseIdx); } /*! * \brief Return the dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the * control volume. */ - Scalar viscosity(int phaseIdx = 0) const - { return fluidState_.viscosity(defaultPhaseIdx); } + Scalar viscosity() const + { return fluidState_.viscosity(phaseIdx); } /*! * \brief Return the effective dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the * control volume. */ - Scalar effectiveViscosity(int phaseIdx = 0) const - { return viscosity(defaultPhaseIdx); } + Scalar effectiveViscosity() const + { return viscosity(); } /*! * \brief Return the fluid state of the control volume. @@ -210,8 +210,7 @@ public: //! This is needed for completing the fluid state template<class FluidState, class ParameterCache> static Scalar enthalpy(const FluidState& fluidState, - const ParameterCache& paramCache, - const int defaultPhaseIdx) + const ParameterCache& paramCache) { return 0; } @@ -239,7 +238,7 @@ class NavierStokesVolumeVariablesImplementation<TypeTag, true> using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - static const int defaultPhaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); + static const int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); static const int temperatureIdx = Indices::temperatureIdx; @@ -278,25 +277,25 @@ public: FluidState& fluidState) { fluidState.setTemperature(elemSol[0][Indices::temperatureIdx]); - fluidState.setPressure(defaultPhaseIdx, elemSol[0][Indices::pressureIdx]); + fluidState.setPressure(phaseIdx, elemSol[0][Indices::pressureIdx]); // saturation in a single phase is always 1 and thus redundant // to set. But since we use the fluid state shared by the // immiscible multi-phase models, so we have to set it here... - fluidState.setSaturation(defaultPhaseIdx, 1.0); + fluidState.setSaturation(phaseIdx, 1.0); typename FluidSystem::ParameterCache paramCache; - paramCache.updatePhase(fluidState, defaultPhaseIdx); + paramCache.updatePhase(fluidState, phaseIdx); - Scalar value = FluidSystem::density(fluidState, paramCache, defaultPhaseIdx); - fluidState.setDensity(defaultPhaseIdx, value); + Scalar value = FluidSystem::density(fluidState, paramCache, phaseIdx); + fluidState.setDensity(phaseIdx, value); - value = FluidSystem::viscosity(fluidState, paramCache, defaultPhaseIdx); - fluidState.setViscosity(defaultPhaseIdx, value); + value = FluidSystem::viscosity(fluidState, paramCache, phaseIdx); + fluidState.setViscosity(phaseIdx, value); // compute and set the enthalpy - value = FluidSystem::enthalpy(fluidState, paramCache, defaultPhaseIdx); - fluidState.setEnthalpy(defaultPhaseIdx, value); + value = FluidSystem::enthalpy(fluidState, paramCache, phaseIdx); + fluidState.setEnthalpy(phaseIdx, value); } /*! @@ -304,28 +303,28 @@ public: * sub-control volume. */ Scalar internalEnergy() const - { return this->fluidState_.internalEnergy(defaultPhaseIdx); } + { return this->fluidState_.internalEnergy(phaseIdx); } /*! * \brief Returns the total enthalpy of the fluid phase in the sub-control * volume. */ Scalar enthalpy() const - { return this->fluidState_.enthalpy(defaultPhaseIdx); } + { return this->fluidState_.enthalpy(phaseIdx); } /*! * \brief Return the specific isobaric heat capacity \f$\mathrm{[J/(kg*K)]}\f$ * in the sub-control volume. */ Scalar heatCapacity() const - { return FluidSystem::heatCapacity(this->fluidState_, defaultPhaseIdx); } + { return FluidSystem::heatCapacity(this->fluidState_, phaseIdx); } /*! * \brief Returns the thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ * of the fluid phase in the sub-control volume. */ Scalar thermalConductivity() const - { return FluidSystem::thermalConductivity(this->fluidState_, defaultPhaseIdx); } + { return FluidSystem::thermalConductivity(this->fluidState_, phaseIdx); } //! The temperature is a primary variable for non-isothermal models using ParentType::temperature; @@ -342,10 +341,9 @@ public: //! This is needed for completing the fluid state template<class FluidState, class ParameterCache> static Scalar enthalpy(const FluidState& fluidState, - const ParameterCache& paramCache, - const int defaultPhaseIdx) + const ParameterCache& paramCache) { - return FluidSystem::enthalpy(fluidState, paramCache, defaultPhaseIdx); + return FluidSystem::enthalpy(fluidState, paramCache, phaseIdx); } }; diff --git a/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh b/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh index be9954fd9e..517f3aa0f4 100644 --- a/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh @@ -64,7 +64,6 @@ class NavierStokesNCFluxVariablesImpl<TypeTag, DiscretizationMethod::staggered> // The index of the component balance equation that gets replaced with the total mass balance static const int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx); - static const int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); using ParentType = NavierStokesFluxVariables<TypeTag>; @@ -101,7 +100,7 @@ public: auto upwindTerm = [compIdx](const auto& volVars) { const auto density = useMoles ? volVars.molarDensity() : volVars.density(); - const auto fraction = useMoles ? volVars.moleFraction(phaseIdx, compIdx) : volVars.massFraction(phaseIdx, compIdx); + const auto fraction = useMoles ? volVars.moleFraction(compIdx) : volVars.massFraction(compIdx); return density * fraction; }; diff --git a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh index 2ad8e090ea..9cd326e89b 100644 --- a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh @@ -60,7 +60,6 @@ class NavierStokesNCResidualImpl<TypeTag, DiscretizationMethod::staggered> enum { conti0EqIdx = Indices::conti0EqIdx, - phaseIdx = Indices::phaseIdx, // The index of the component balance equation // that gets replaced with the total mass balance @@ -91,7 +90,7 @@ public: { const int eqIdx = conti0EqIdx + compIdx; - const Scalar massOrMoleFraction = useMoles ? volVars.moleFraction(phaseIdx, compIdx) : volVars.massFraction(phaseIdx, compIdx); + const Scalar massOrMoleFraction = useMoles ? volVars.moleFraction(compIdx) : volVars.massFraction(compIdx); const Scalar s = density * massOrMoleFraction; if (eqIdx != replaceCompEqIdx) @@ -131,7 +130,7 @@ protected: if(eqIdx != conti0EqIdx && bcTypes.isDirichletCell(eqIdx)) { const auto& insideVolVars = elemVolVars[insideScv]; - const Scalar massOrMoleFraction = useMoles ? insideVolVars.moleFraction(phaseIdx, compIdx) : insideVolVars.massFraction(phaseIdx, compIdx); + const Scalar massOrMoleFraction = useMoles ? insideVolVars.moleFraction(compIdx) : insideVolVars.massFraction(compIdx); residual[eqIdx] = massOrMoleFraction - problem.dirichletAtPos(insideScv.center())[eqIdx]; } } diff --git a/dumux/freeflow/navierstokesnc/volumevariables.hh b/dumux/freeflow/navierstokesnc/volumevariables.hh index 8d278c5e63..f1794e7b33 100644 --- a/dumux/freeflow/navierstokesnc/volumevariables.hh +++ b/dumux/freeflow/navierstokesnc/volumevariables.hh @@ -83,16 +83,15 @@ public: completeFluidState(elemSol, problem, element, scv, this->fluidState_); - typename FluidSystem::ParameterCache paramCache; paramCache.updateAll(this->fluidState_); - int compIIdx = phaseIdx; + int compIIdx = mainCompIdx; for (unsigned int compJIdx = 0; compJIdx < numComponents; ++compJIdx) { // binary diffusion coefficents if(compIIdx!= compJIdx) { - setDiffusionCoefficient_(phaseIdx, compJIdx, + setDiffusionCoefficient_(compJIdx, FluidSystem::binaryDiffusionCoefficient(this->fluidState_, paramCache, phaseIdx, @@ -152,7 +151,7 @@ public: fluidState.setViscosity(phaseIdx, value); // compute and set the enthalpy - const Scalar h = ParentType::enthalpy(fluidState, paramCache, phaseIdx); + const Scalar h = ParentType::enthalpy(fluidState, paramCache); fluidState.setEnthalpy(phaseIdx, h); } @@ -160,58 +159,54 @@ public: /*! * \brief Returns the mass fraction of a component in the phase \f$\mathrm{[-]}\f$ * - * \param pIdx the index of the fluid phase * \param compIdx the index of the component */ - Scalar massFraction(int pIdx, int compIdx) const + Scalar massFraction(int compIdx) const { - assert(pIdx == phaseIdx); - return this->fluidState_.massFraction(pIdx, compIdx); + return this->fluidState_.massFraction(phaseIdx, compIdx); } /*! * \brief Returns the mole fraction of a component in the phase \f$\mathrm{[-]}\f$ * - * \param pIdx the index of the fluid phase * \param compIdx the index of the component */ - Scalar moleFraction(int pIdx, int compIdx) const + Scalar moleFraction(int compIdx) const { - assert(pIdx == phaseIdx); - return this->fluidState_.moleFraction(pIdx, compIdx); + return this->fluidState_.moleFraction(phaseIdx, compIdx); } /*! * \brief Returns the mass density of a given phase \f$\mathrm{[kg/m^3]}\f$ - * - * \param pIdx the index of the fluid phase */ - Scalar molarDensity(int pIdx = phaseIdx) const + Scalar molarDensity() const { - assert(pIdx == phaseIdx); - return this->fluidState_.molarDensity(pIdx); + return this->fluidState_.molarDensity(phaseIdx); } /*! * \brief Returns the diffusion coefficient \f$\mathrm{[m^2/s]}\f$ + * + * \param compIdx the index of the component */ - Scalar diffusionCoefficient(int pIdx, int compIdx) const + Scalar diffusionCoefficient(int compIdx) const { - assert(pIdx == phaseIdx); - if (compIdx < pIdx) - return diffCoefficient_[pIdx][compIdx]; - else if (compIdx > pIdx) - return diffCoefficient_[pIdx][compIdx-1]; + if (compIdx < phaseIdx) + return diffCoefficient_[phaseIdx][compIdx]; + else if (compIdx > phaseIdx) + return diffCoefficient_[phaseIdx][compIdx-1]; else DUNE_THROW(Dune::InvalidStateException, "Diffusion coefficient called for phaseIdx = compIdx"); } /*! * \brief Returns the effective diffusion coefficient \f$\mathrm{[m^2/s]}\f$ + * + * \param compIdx the index of the component */ - Scalar effectiveDiffusivity(int pIdx, int compIdx) const + Scalar effectiveDiffusivity(int compIdx) const { - return diffusionCoefficient(pIdx, compIdx); + return diffusionCoefficient(compIdx); } protected: @@ -222,13 +217,12 @@ protected: const Implementation &asImp_() const { return *static_cast<const Implementation*>(this); } - void setDiffusionCoefficient_(int pIdx, int compIdx, Scalar d) + void setDiffusionCoefficient_(int compIdx, Scalar d) { - assert(pIdx == phaseIdx); - if (compIdx < pIdx) - diffCoefficient_[pIdx][compIdx] = std::move(d); - else if (compIdx > pIdx) - diffCoefficient_[pIdx][compIdx-1] = std::move(d); + if (compIdx < phaseIdx) + diffCoefficient_[phaseIdx][compIdx] = std::move(d); + else if (compIdx > phaseIdx) + diffCoefficient_[phaseIdx][compIdx-1] = std::move(d); else DUNE_THROW(Dune::InvalidStateException, "Diffusion coefficient for phaseIdx = compIdx doesn't exist"); } diff --git a/dumux/freeflow/navierstokesnc/vtkoutputfields.hh b/dumux/freeflow/navierstokesnc/vtkoutputfields.hh index 17b358608a..38beefd905 100644 --- a/dumux/freeflow/navierstokesnc/vtkoutputfields.hh +++ b/dumux/freeflow/navierstokesnc/vtkoutputfields.hh @@ -47,11 +47,11 @@ public: for (int j = 0; j < FluidSystem::numComponents; ++j) { - vtk.addVolumeVariable([j](const auto& v){ return v.massFraction(phaseIdx,j); }, "X^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx)); - vtk.addVolumeVariable([j](const auto& v){ return v.moleFraction(phaseIdx,j); }, "x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx)); + vtk.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, "X^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx)); + vtk.addVolumeVariable([j](const auto& v){ return v.moleFraction(j); }, "x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx)); if (j != phaseIdx) { - vtk.addVolumeVariable([j](const auto& v){ return v.diffusionCoefficient(phaseIdx,j); }, "D^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx)); + vtk.addVolumeVariable([j](const auto& v){ return v.diffusionCoefficient(j); }, "D^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx)); } } } diff --git a/dumux/freeflow/rans/volumevariables.hh b/dumux/freeflow/rans/volumevariables.hh index 566476a288..4dedf42143 100644 --- a/dumux/freeflow/rans/volumevariables.hh +++ b/dumux/freeflow/rans/volumevariables.hh @@ -70,8 +70,6 @@ class RANSVolumeVariablesImplementation<TypeTag, false> using DimVector = Dune::FieldVector<Scalar, dimWorld>; using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>; - static const int defaultPhaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); - public: using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); @@ -236,7 +234,6 @@ class RANSVolumeVariablesImplementation<TypeTag, true> using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - static const int defaultPhaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); // static const int temperatureIdx = Indices::temperatureIdx; public: diff --git a/dumux/freeflow/ransnc/volumevariables.hh b/dumux/freeflow/ransnc/volumevariables.hh index deaae3e27d..a823af3a9e 100644 --- a/dumux/freeflow/ransnc/volumevariables.hh +++ b/dumux/freeflow/ransnc/volumevariables.hh @@ -51,6 +51,8 @@ class RANSNCVolumeVariables using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; + static constexpr auto phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); + public: /*! @@ -91,10 +93,12 @@ public: /*! * \brief Returns the effective diffusion coefficient \f$\mathrm{[m^2/s]}\f$ + * + * \param compIdx the index of the component */ - Scalar effectiveDiffusivity(int pIdx, int compIdx) const + Scalar effectiveDiffusivity(int compIdx) const { - return ParentTypeCompositional::diffusionCoefficient(pIdx, compIdx) + return ParentTypeCompositional::diffusionCoefficient(compIdx) + eddyDiffusivity(); } diff --git a/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh b/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh index 2aeed8aed3..81d9a8e69a 100644 --- a/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh +++ b/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh @@ -253,17 +253,16 @@ public: if (globalPos[0] < 0.5) { - x_co2_left += elemVolVars[scv].moleFraction(0,2); - - x_n2_left += elemVolVars[scv].moleFraction(0,1); - x_h2_left += elemVolVars[scv].moleFraction(0,0); + x_co2_left += elemVolVars[scv].moleFraction(FluidSystem::CO2Idx); + x_n2_left += elemVolVars[scv].moleFraction(FluidSystem::N2Idx); + x_h2_left += elemVolVars[scv].moleFraction(FluidSystem::H2Idx); i +=1; } else { - x_co2_right += elemVolVars[scv].moleFraction(0,2); - x_n2_right += elemVolVars[scv].moleFraction(0,1); - x_h2_right += elemVolVars[scv].moleFraction(0,0); + x_co2_right += elemVolVars[scv].moleFraction(FluidSystem::CO2Idx); + x_n2_right += elemVolVars[scv].moleFraction(FluidSystem::N2Idx); + x_h2_right += elemVolVars[scv].moleFraction(FluidSystem::H2Idx); j +=1; } -- GitLab