25#ifndef DUMUX_DISCRETIZATION_CC_TPFA_DISPERSION_FLUX_HH
26#define DUMUX_DISCRETIZATION_CC_TPFA_DISPERSION_FLUX_HH
28#include <dune/common/fvector.hh>
29#include <dune/common/fmatrix.hh>
42template<
class TypeTag,
class DiscretizationMethod, ReferenceSystemFormulation referenceSystem>
43class DispersionFluxImplementation;
49template <
class TypeTag, ReferenceSystemFormulation referenceSystem>
57 using FVElementGeometry =
typename GridGeometry::LocalView;
58 using SubControlVolume =
typename GridGeometry::SubControlVolume;
59 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
68 using Element =
typename GridView::template Codim<0>::Entity;
70 using Indices =
typename ModelTraits::Indices;
72 enum { dim = GridView::dimension} ;
73 enum { dimWorld = GridView::dimensionworld} ;
76 numPhases = ModelTraits::numFluidPhases(),
77 numComponents = ModelTraits::numFluidComponents()
80 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
81 using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
82 using HeatFluxScalar = Scalar;
90 {
return referenceSystem; }
99 const Element& element,
100 const FVElementGeometry& fvGeometry,
101 const ElementVolumeVariables& elemVolVars,
102 const SubControlVolumeFace& scvf,
104 const ElementFluxVariablesCache& elemFluxVarsCache)
106 if (scvf.numOutsideScvs() > 1 )
107 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for conforming grids.");
108 if (!stationaryVelocityField)
109 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for problems with stationary velocity fields");
111 ComponentFluxVector componentFlux(0.0);
112 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
113 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
116 const auto rhoOutside =
massOrMolarDensity(outsideVolVars, referenceSystem, phaseIdx);
117 const Scalar rho = 0.5*(rhoInside + rhoOutside);
119 for (
int compIdx = 0; compIdx < numComponents; compIdx++)
121 const auto& dispersionTensor =
122 ModelTraits::CompositionalDispersionModel::compositionalDispersionTensor(problem, scvf, fvGeometry,
123 elemVolVars, elemFluxVarsCache,
125 const auto dij =
computeTpfaTransmissibility(scvf, fvGeometry.scv(scvf.insideScvIdx()), dispersionTensor, insideVolVars.extrusionFactor());
127 const auto xInside =
massOrMoleFraction(insideVolVars, referenceSystem, phaseIdx, compIdx);
128 const auto xOutide =
massOrMoleFraction(outsideVolVars, referenceSystem, phaseIdx, compIdx);
130 componentFlux[compIdx] = (rho * (xInside-xOutide) * dij) * scvf.area();
132 return componentFlux;
140 const Element& element,
141 const FVElementGeometry& fvGeometry,
142 const ElementVolumeVariables& elemVolVars,
143 const SubControlVolumeFace& scvf,
145 const ElementFluxVariablesCache& elemFluxVarsCache)
147 if (scvf.numOutsideScvs() > 1 )
148 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for conforming grids.");
149 if (!stationaryVelocityField)
150 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for problems with stationary velocity fields");
152 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
153 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
155 const auto& dispersionTensor =
156 ModelTraits::ThermalDispersionModel::thermalDispersionTensor(problem, scvf, fvGeometry,
157 elemVolVars, elemFluxVarsCache,
159 const auto dij =
computeTpfaTransmissibility(scvf, fvGeometry.scv(scvf.insideScvIdx()), dispersionTensor, insideVolVars.extrusionFactor());
162 const auto tInside = insideVolVars.temperature();
163 const auto tOutside = outsideVolVars.temperature();
166 return (tInside-tOutside) * dij * scvf.area();
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...
Tensor::field_type computeTpfaTransmissibility(const SubControlVolumeFace &scvf, const SubControlVolume &scv, const Tensor &T, typename SubControlVolume::Traits::Scalar extrusionFactor)
Free function to evaluate the Tpfa transmissibility associated with the flux (in the form of flux = T...
Definition: tpfa/computetransmissibility.hh:47
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
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
Definition: box/dispersionflux.hh:42
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: cctpfa/dispersionflux.hh:98
static constexpr ReferenceSystemFormulation referenceSystemFormulation()
Definition: cctpfa/dispersionflux.hh:89
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: cctpfa/dispersionflux.hh:139
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.
Free functions to evaluate the transmissibilities associated with flux evaluations across sub-control...