25#ifndef DUMUX_DISCRETIZATION_BOX_DISPERSION_FLUX_HH
26#define DUMUX_DISCRETIZATION_BOX_DISPERSION_FLUX_HH
28#include <dune/common/fvector.hh>
29#include <dune/common/fmatrix.hh>
41template<
class TypeTag,
class DiscretizationMethod, ReferenceSystemFormulation referenceSystem>
48template <
class TypeTag, ReferenceSystemFormulation referenceSystem>
56 using FVElementGeometry =
typename GridGeometry::LocalView;
57 using SubControlVolume =
typename GridGeometry::SubControlVolume;
58 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
67 using Element =
typename GridView::template Codim<0>::Entity;
69 using Indices =
typename ModelTraits::Indices;
71 enum { dim = GridView::dimension} ;
72 enum { dimWorld = GridView::dimensionworld} ;
75 numPhases = ModelTraits::numFluidPhases(),
76 numComponents = ModelTraits::numFluidComponents()
79 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
80 using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
81 using HeatFluxScalar = Scalar;
89 {
return referenceSystem; }
98 const Element& element,
99 const FVElementGeometry& fvGeometry,
100 const ElementVolumeVariables& elemVolVars,
101 const SubControlVolumeFace& scvf,
103 const ElementFluxVariablesCache& elemFluxVarsCache)
105 ComponentFluxVector componentFlux(0.0);
107 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
108 const auto& shapeValues = fluxVarsCache.shapeValues();
111 Scalar rhoMassOrMole(0.0);
112 for (
auto&& scv : scvs(fvGeometry))
115 rhoMassOrMole += rho * shapeValues[scv.indexInElement()][0];
118 for (
int compIdx = 0; compIdx < numComponents; compIdx++)
121 const auto& dispersionTensor =
122 ModelTraits::CompositionalDispersionModel::compositionalDispersionTensor(problem, scvf, fvGeometry,
123 elemVolVars, elemFluxVarsCache,
127 Dune::FieldVector<Scalar, dimWorld> gradX(0.0);
128 for (
auto&& scv : scvs(fvGeometry))
130 const auto x =
massOrMoleFraction(elemVolVars[scv], referenceSystem, phaseIdx, compIdx);
131 gradX.axpy(x, fluxVarsCache.gradN(scv.indexInElement()));
135 componentFlux[compIdx] = -1.0 * rhoMassOrMole *
vtmv(scvf.unitOuterNormal(), dispersionTensor, gradX) * scvf.area();
136 if (BalanceEqOpts::mainComponentIsBalanced(phaseIdx) && !FluidSystem::isTracerFluidSystem())
137 componentFlux[phaseIdx] -= componentFlux[compIdx];
139 return componentFlux;
147 const Element& element,
148 const FVElementGeometry& fvGeometry,
149 const ElementVolumeVariables& elemVolVars,
150 const SubControlVolumeFace& scvf,
152 const ElementFluxVariablesCache& elemFluxVarsCache)
155 const auto& dispersionTensor =
156 ModelTraits::ThermalDispersionModel::thermalDispersionTensor(problem, scvf, fvGeometry,
157 elemVolVars, elemFluxVarsCache,
160 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
161 Dune::FieldVector<Scalar, GridView::dimensionworld> gradTemp(0.0);
162 for (
auto&& scv : scvs(fvGeometry))
163 gradTemp.axpy(elemVolVars[scv].
temperature(), fluxVarsCache.gradN(scv.indexInElement()));
166 return -1.0*
vtmv(scvf.unitOuterNormal(), dispersionTensor, gradTemp)*Extrusion::area(scvf);
Define some often used mathematical functions.
Helper classes to compute the integration elements.
The available discretization methods in Dumux.
The reference frameworks and formulations available for splitting total fluxes into a advective and d...
VolumeVariables::PrimaryVariables::value_type massOrMoleFraction(const VolumeVariables &volVars, ReferenceSystemFormulation referenceSys, const int phaseIdx, const int compIdx)
returns the mass or mole fraction to be used in Fick's law based on the reference system
Definition: referencesystemformulation.hh:66
VolumeVariables::PrimaryVariables::value_type massOrMolarDensity(const VolumeVariables &volVars, ReferenceSystemFormulation referenceSys, const int phaseIdx)
evaluates the density to be used in Fick's law based on the reference system
Definition: referencesystemformulation.hh:55
ReferenceSystemFormulation
The formulations available for Fick's law related to the reference system.
Definition: referencesystemformulation.hh:45
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition: math.hh:863
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:177
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
Definition: box/dispersionflux.hh:42
static constexpr ReferenceSystemFormulation referenceSystemFormulation()
Definition: box/dispersionflux.hh:88
static ComponentFluxVector compositionalDispersionFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElementFluxVariablesCache &elemFluxVarsCache)
Returns the dispersive fluxes of all components within a fluid phase across the given sub-control vol...
Definition: box/dispersionflux.hh:97
static HeatFluxScalar thermalDispersionFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElementFluxVariablesCache &elemFluxVarsCache)
Returns the thermal dispersive flux across the given sub-control volume face.
Definition: box/dispersionflux.hh:146
Traits of a flux variables type.
Definition: flux/traits.hh:44
static constexpr bool hasStationaryVelocityField()
Definition: flux/traits.hh:45
Declares all properties used in Dumux.