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_;
158 static Scalar
flux(
const Problem& problem,
159 const Element& element,
160 const FVElementGeometry& fvGeometry,
161 const ElementVolumeVariables& elemVolVars,
162 const SubControlVolumeFace& scvf,
163 const ElementFluxVarsCache& elemFluxVarsCache)
165 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
168 if (fluxVarsCache.usesSecondaryIv())
169 return flux_(problem, fluxVarsCache, fluxVarsCache.heatConductionSecondaryDataHandle());
171 return flux_(problem, fluxVarsCache, fluxVarsCache.heatConductionPrimaryDataHandle());
175 template<
class Problem,
class FluxVarsCache,
class DataHandle >
176 static Scalar flux_(
const Problem& problem,
177 const FluxVarsCache& cache,
178 const DataHandle& dataHandle)
180 const bool switchSign = cache.heatConductionSwitchFluxSign();
182 const auto localFaceIdx = cache.ivLocalFaceIndex();
183 const auto idxInOutside = cache.indexInOutsideFaces();
184 const auto& Tj = dataHandle.uj();
185 const auto& tij = dim == dimWorld ? dataHandle.T()[localFaceIdx]
186 : (!switchSign ? dataHandle.T()[localFaceIdx]
187 : dataHandle.tijOutside()[localFaceIdx][idxInOutside]);
188 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)
Compute the conductive flux across an scvf.
Definition: flux/ccmpfa/fourierslaw.hh:158
Declares all properties used in Dumux.