25#ifndef DUMUX_DISCRETIZATION_BOX_FOURIERS_LAW_NONEQUILIBRIUM_HH
26#define DUMUX_DISCRETIZATION_BOX_FOURIERS_LAW_NONEQUILIBRIUM_HH
28#include <dune/common/fvector.hh>
41template <
class TypeTag,
class DiscretizationMethod>
48template <
class TypeTag>
54 using FVElementGeometry =
typename GridGeometry::LocalView;
55 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
62 using Element =
typename GridView::template Codim<0>::Entity;
64 static constexpr auto numEnergyEqSolid = getPropValue<TypeTag, Properties::NumEnergyEqSolid>();
65 static constexpr auto numEnergyEqFluid = getPropValue<TypeTag, Properties::NumEnergyEqFluid>();
66 static constexpr auto numEnergyEq = numEnergyEqSolid + numEnergyEqFluid;
67 static constexpr auto sPhaseIdx = ModelTraits::numFluidPhases();
74 static Scalar
flux(
const Problem& problem,
75 const Element& element,
76 const FVElementGeometry& fvGeometry,
77 const ElementVolumeVariables& elemVolVars,
78 const SubControlVolumeFace& scvf,
80 const ElementFluxVariablesCache& elemFluxVarsCache)
83 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
84 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
85 const auto& insideVolVars = elemVolVars[insideScv];
86 const auto& outsideVolVars = elemVolVars[outsideScv];
87 const auto computeLambda = [&](
const auto& v){
88 if constexpr (numEnergyEq == 1)
89 return v.effectiveThermalConductivity();
90 else if constexpr (numEnergyEqFluid == 1)
91 return (phaseIdx != sPhaseIdx)
92 ? v.effectiveFluidThermalConductivity()
93 : v.effectiveSolidThermalConductivity();
95 return v.effectivePhaseThermalConductivity(phaseIdx);
98 auto insideLambda = computeLambda(insideVolVars);
99 auto outsideLambda = computeLambda(outsideVolVars);
102 insideLambda *= insideVolVars.extrusionFactor();
103 outsideLambda *= outsideVolVars.extrusionFactor();
106 const auto lambda =
faceTensorAverage(insideLambda, outsideLambda, scvf.unitOuterNormal());
109 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
111 Dune::FieldVector<Scalar, GridView::dimensionworld> gradTemp(0.0);
112 for (
auto&& scv : scvs(fvGeometry))
115 if (phaseIdx < numEnergyEqFluid)
116 gradTemp.axpy(elemVolVars[scv].temperatureFluid(phaseIdx), fluxVarsCache.gradN(scv.indexInElement()));
118 gradTemp.axpy(elemVolVars[scv].temperatureSolid(), fluxVarsCache.gradN(scv.indexInElement()));
122 return -1.0*
vtmv(scvf.unitOuterNormal(), lambda, gradTemp)*Extrusion::area(scvf);
Define some often used mathematical functions.
Helper classes to compute the integration elements.
The available discretization methods in Dumux.
A free function to average a Tensor at an interface.
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition: math.hh:863
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:177
Scalar faceTensorAverage(const Scalar T1, const Scalar T2, const Dune::FieldVector< Scalar, dim > &normal)
Average of a discontinuous scalar field at discontinuity interface (for compatibility reasons with th...
Definition: facetensoraverage.hh:41
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
Definition: box/fourierslawnonequilibrium.hh:42
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElementFluxVariablesCache &elemFluxVarsCache)
Returns the heat flux within a fluid or solid phase (in J/s) across the given sub-control volume face...
Definition: box/fourierslawnonequilibrium.hh:74
Declares all properties used in Dumux.