24#ifndef DUMUX_FREEFLOW_NC_STAGGERED_FLUXVARIABLES_HH
25#define DUMUX_FREEFLOW_NC_STAGGERED_FLUXVARIABLES_HH
37template<
class TypeTag, DiscretizationMethod discMethod>
38class FreeflowNCFluxVariablesImpl;
44template<
class TypeTag>
51 using FVElementGeometry =
typename GridGeometry::LocalView;
52 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
53 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
59 static constexpr auto numComponents = ModelTraits::numFluidComponents();
60 static constexpr bool useMoles = ModelTraits::useMoles();
66 template<
class ElementVolumeVariables,
class ElementFaceVariables,
class FluxVariablesCache>
68 const Element& element,
69 const FVElementGeometry& fvGeometry,
70 const ElementVolumeVariables& elemVolVars,
71 const ElementFaceVariables& elemFaceVars,
72 const SubControlVolumeFace& scvf,
73 const FluxVariablesCache& fluxVarsCache)
75 CellCenterPrimaryVariables flux(0.0);
77 const auto diffusiveFluxes = MolecularDiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
79 static constexpr auto referenceSystemFormulation = MolecularDiffusionType::referenceSystemFormulation();
81 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
83 auto upwindTerm = [compIdx](
const auto& volVars)
85 const auto density = useMoles ? volVars.molarDensity() : volVars.density();
86 const auto fraction = useMoles ? volVars.moleFraction(compIdx) : volVars.massFraction(compIdx);
90 flux[compIdx] = ParentType::advectiveFluxForCellCenter(problem, elemVolVars, elemFaceVars, scvf, upwindTerm);
95 flux[compIdx] += useMoles ? diffusiveFluxes[compIdx]/FluidSystem::molarMass(compIdx) : diffusiveFluxes[compIdx];
98 flux[compIdx] += useMoles ? diffusiveFluxes[compIdx] : diffusiveFluxes[compIdx]*FluidSystem::molarMass(compIdx);
100 DUNE_THROW(Dune::NotImplemented,
"other reference systems than mass and molar averaged are not implemented");
104 if (ModelTraits::replaceCompEqIdx() < numComponents)
106 flux[ModelTraits::replaceCompEqIdx()] = std::accumulate(flux.begin(), flux.end(), 0.0);
Base class for the flux variables living on a sub control volume face.
The reference frameworks and formulations available for splitting total fluxes into a advective and d...
The available discretization methods in Dumux.
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Definition: freeflow/compositional/fluxvariables.hh:34
GetPropType< TypeTag, Properties::MolecularDiffusionType > MolecularDiffusionType
Definition: freeflow/compositional/staggered/fluxvariables.hh:61
CellCenterPrimaryVariables computeMassFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf, const FluxVariablesCache &fluxVarsCache)
Computes the flux for the cell center residual.
Definition: freeflow/compositional/staggered/fluxvariables.hh:67
Definition: freeflow/navierstokes/fluxvariables.hh:35
Declares all properties used in Dumux.