24#ifndef DUMUX_DISCRETIZATION_CC_MPFA_FOURIERS_LAW_HH
25#define DUMUX_DISCRETIZATION_CC_MPFA_FOURIERS_LAW_HH
27#include <dune/common/dynvector.hh>
28#include <dune/common/dynmatrix.hh>
36template<
class TypeTag,
class DiscretizationMethod>
37class FouriersLawImplementation;
43template <
class TypeTag>
49 using Element =
typename GridView::template Codim<0>::Entity;
51 static constexpr int dim = GridView::dimension;
52 static constexpr int dimWorld = GridView::dimensionworld;
55 using FVElementGeometry =
typename GridGeometry::LocalView;
56 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
62 class MpfaFouriersLawCacheFiller
67 template<
class FluxVariablesCacheFiller>
68 static void fill(FluxVariablesCache& scvfFluxVarsCache,
69 const Problem& problem,
70 const Element& element,
71 const FVElementGeometry& fvGeometry,
72 const ElementVolumeVariables& elemVolVars,
73 const SubControlVolumeFace& scvf,
74 const FluxVariablesCacheFiller& fluxVarsCacheFiller)
77 if (fvGeometry.gridGeometry().vertexUsesSecondaryInteractionVolume(scvf.vertexIndex()))
78 scvfFluxVarsCache.updateHeatConduction(fluxVarsCacheFiller.secondaryInteractionVolume(),
79 fluxVarsCacheFiller.secondaryIvLocalFaceData(),
80 fluxVarsCacheFiller.secondaryIvDataHandle());
82 scvfFluxVarsCache.updateHeatConduction(fluxVarsCacheFiller.primaryInteractionVolume(),
83 fluxVarsCacheFiller.primaryIvLocalFaceData(),
84 fluxVarsCacheFiller.primaryIvDataHandle());
89 class MpfaFouriersLawCache
92 using Stencil =
typename DualGridNodalIndexSet::NodalGridStencilType;
94 static constexpr bool considerSecondaryIVs = GridGeometry::MpfaHelper::considerSecondaryIVs();
95 using PrimaryDataHandle =
typename ElementFluxVarsCache::PrimaryIvDataHandle::HeatConductionHandle;
96 using SecondaryDataHandle =
typename ElementFluxVarsCache::SecondaryIvDataHandle::HeatConductionHandle;
99 template<
bool doSecondary = cons
iderSecondaryIVs, std::enable_if_t<doSecondary,
int> = 0 >
100 void setHandlePointer_(
const SecondaryDataHandle& dataHandle)
101 { secondaryHandlePtr_ = &dataHandle; }
104 void setHandlePointer_(
const PrimaryDataHandle& dataHandle)
105 { primaryHandlePtr_ = &dataHandle; }
109 using Filler = MpfaFouriersLawCacheFiller;
119 template<
class IV,
class LocalFaceData,
class DataHandle>
120 void updateHeatConduction(
const IV& iv,
121 const LocalFaceData& localFaceData,
122 const DataHandle& dataHandle)
124 switchFluxSign_ = localFaceData.isOutsideFace();
125 stencil_ = &iv.stencil();
126 setHandlePointer_(dataHandle.heatConductionHandle());
130 const Stencil& heatConductionStencil()
const {
return *stencil_; }
133 const PrimaryDataHandle& heatConductionPrimaryDataHandle()
const {
return *primaryHandlePtr_; }
134 const SecondaryDataHandle& heatConductionSecondaryDataHandle()
const {
return *secondaryHandlePtr_; }
137 bool heatConductionSwitchFluxSign()
const {
return switchFluxSign_; }
140 bool switchFluxSign_;
143 const PrimaryDataHandle* primaryHandlePtr_;
144 const SecondaryDataHandle* secondaryHandlePtr_;
147 const Stencil* stencil_;
165 static Scalar
flux(
const Problem& problem,
166 const Element& element,
167 const FVElementGeometry& fvGeometry,
168 const ElementVolumeVariables& elemVolVars,
169 const SubControlVolumeFace& scvf,
170 const ElementFluxVarsCache& elemFluxVarsCache)
172 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
175 if (fluxVarsCache.usesSecondaryIv())
176 return flux_(problem, fluxVarsCache, fluxVarsCache.heatConductionSecondaryDataHandle());
178 return flux_(problem, fluxVarsCache, fluxVarsCache.heatConductionPrimaryDataHandle());
182 template<
class Problem,
class FluxVarsCache,
class DataHandle >
183 static Scalar flux_(
const Problem& problem,
184 const FluxVarsCache& cache,
185 const DataHandle& dataHandle)
187 const bool switchSign = cache.heatConductionSwitchFluxSign();
189 const auto localFaceIdx = cache.ivLocalFaceIndex();
190 const auto idxInOutside = cache.indexInOutsideFaces();
191 const auto& Tj = dataHandle.uj();
192 const auto& tij = dim == dimWorld ? dataHandle.T()[localFaceIdx]
193 : (!switchSign ? dataHandle.T()[localFaceIdx]
194 : dataHandle.tijOutside()[localFaceIdx][idxInOutside]);
195 Scalar scvfFlux = tij*Tj;
The available discretization methods in Dumux.
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
forward declaration of the method-specific implementation
Definition: flux/box/fourierslaw.hh:38
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVarsCache &elemFluxVarsCache)
Returns the heat flux within the porous medium (in J/s) across the given sub-control volume face.
Definition: flux/ccmpfa/fourierslaw.hh:165
MpfaFouriersLawCache Cache
Definition: flux/ccmpfa/fourierslaw.hh:156
Declares all properties used in Dumux.