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, DiscretizationMethod discMethod>
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_;
164 static Scalar
flux(
const Problem& problem,
165 const Element& element,
166 const FVElementGeometry& fvGeometry,
167 const ElementVolumeVariables& elemVolVars,
168 const SubControlVolumeFace& scvf,
169 const ElementFluxVarsCache& elemFluxVarsCache)
171 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
174 if (fluxVarsCache.usesSecondaryIv())
175 return flux_(problem, fluxVarsCache, fluxVarsCache.heatConductionSecondaryDataHandle());
177 return flux_(problem, fluxVarsCache, fluxVarsCache.heatConductionPrimaryDataHandle());
181 template<
class Problem,
class FluxVarsCache,
class DataHandle >
182 static Scalar flux_(
const Problem& problem,
183 const FluxVarsCache& cache,
184 const DataHandle& dataHandle)
186 const bool switchSign = cache.heatConductionSwitchFluxSign();
188 const auto localFaceIdx = cache.ivLocalFaceIndex();
189 const auto idxInOutside = cache.indexInOutsideFaces();
190 const auto& Tj = dataHandle.uj();
191 const auto& tij = dim == dimWorld ? dataHandle.T()[localFaceIdx]
192 : (!switchSign ? dataHandle.T()[localFaceIdx]
193 : dataHandle.tijOutside()[localFaceIdx][idxInOutside]);
194 Scalar scvfFlux = tij*Tj;
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
forward declaration of the method-specific implementation
Definition: flux/fourierslaw.hh:37
MpfaFouriersLawCache Cache
Definition: flux/ccmpfa/fourierslaw.hh:155
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:164
Declares all properties used in Dumux.