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;
63 using ElementFluxVariablesCache =
typename GridFluxVariablesCache::LocalView;
64 using FluxVarCache =
typename GridFluxVariablesCache::FluxVariablesCache;
69 using Element =
typename GridView::template Codim<0>::Entity;
71 using Indices =
typename ModelTraits::Indices;
73 enum { dim = GridView::dimension} ;
74 enum { dimWorld = GridView::dimensionworld} ;
77 numPhases = ModelTraits::numFluidPhases(),
78 numComponents = ModelTraits::numFluidComponents()
81 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
82 using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
83 using HeatFluxScalar = Scalar;
91 {
return referenceSystem; }
100 const Element& element,
101 const FVElementGeometry& fvGeometry,
102 const ElementVolumeVariables& elemVolVars,
103 const SubControlVolumeFace& scvf,
105 const ElementFluxVariablesCache& elemFluxVarsCache)
107 if (scvf.numOutsideScvs() > 1 )
108 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for conforming grids.");
109 if (!stationaryVelocityField)
110 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for problems with stationary velocity fields");
112 ComponentFluxVector componentFlux(0.0);
113 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
114 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
117 const auto rhoOutside =
massOrMolarDensity(outsideVolVars, referenceSystem, phaseIdx);
118 const Scalar rho = 0.5*(rhoInside + rhoOutside);
120 for (
int compIdx = 0; compIdx < numComponents; compIdx++)
122 const auto& dispersionTensor =
123 ModelTraits::CompositionalDispersionModel::compositionalDispersionTensor(problem, scvf, fvGeometry,
124 elemVolVars, elemFluxVarsCache,
126 const auto dij =
computeTpfaTransmissibility(fvGeometry, scvf, fvGeometry.scv(scvf.insideScvIdx()), dispersionTensor, insideVolVars.extrusionFactor());
128 const auto xInside =
massOrMoleFraction(insideVolVars, referenceSystem, phaseIdx, compIdx);
129 const auto xOutide =
massOrMoleFraction(outsideVolVars, referenceSystem, phaseIdx, compIdx);
131 componentFlux[compIdx] = (rho * (xInside-xOutide) * dij) * scvf.area();
133 return componentFlux;
141 const Element& element,
142 const FVElementGeometry& fvGeometry,
143 const ElementVolumeVariables& elemVolVars,
144 const SubControlVolumeFace& scvf,
146 const ElementFluxVariablesCache& elemFluxVarsCache)
148 if (scvf.numOutsideScvs() > 1 )
149 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for conforming grids.");
150 if (!stationaryVelocityField)
151 DUNE_THROW(Dune::NotImplemented,
"\n Dispersion using ccTPFA is only implemented for problems with stationary velocity fields");
153 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
154 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
156 const auto& dispersionTensor =
157 ModelTraits::ThermalDispersionModel::thermalDispersionTensor(problem, scvf, fvGeometry,
158 elemVolVars, elemFluxVarsCache,
160 const auto dij =
computeTpfaTransmissibility(scvf, fvGeometry.scv(scvf.insideScvIdx()), dispersionTensor, insideVolVars.extrusionFactor());
163 const auto tInside = insideVolVars.temperature();
164 const auto tOutside = outsideVolVars.temperature();
167 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:48
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
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:251
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
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:99
static constexpr ReferenceSystemFormulation referenceSystemFormulation()
Definition: cctpfa/dispersionflux.hh:90
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:140
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...