13#ifndef DUMUX_FLUX_PNM_FOURIERS_LAW_HH
14#define DUMUX_FLUX_PNM_FOURIERS_LAW_HH
32template<
class MolecularDiffusionType = Detail::NoDiffusionType>
36 template<
class Problem,
class Element,
class FVElementGeometry,
37 class ElementVolumeVariables,
class ElementFluxVariablesCache>
38 static auto flux(
const Problem& problem,
39 const Element& element,
40 const FVElementGeometry& fvGeometry,
41 const ElementVolumeVariables& elemVolVars,
42 const typename FVElementGeometry::SubControlVolumeFace& scvf,
43 const ElementFluxVariablesCache& elemFluxVarsCache)
45 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
46 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
47 const auto& insideVolVars = elemVolVars[insideScv];
48 const auto& outsideVolVars = elemVolVars[outsideScv];
49 const auto& fluxVarsCache = elemFluxVarsCache[scvf];
51 static constexpr auto numPhases = ElementVolumeVariables::VolumeVariables::numFluidPhases();
52 using Scalar =
typename ElementVolumeVariables::VolumeVariables::PrimaryVariables::value_type;
55 for (
int phaseIdx = 0; phaseIdx < numPhases; phaseIdx++)
57 auto insideThermalConducitivity = insideVolVars.fluidThermalConductivity(phaseIdx);
58 auto outsideThermalConducitivity = outsideVolVars.fluidThermalConductivity(phaseIdx);
60 auto thermalConductivity =
Dumux::harmonicMean(insideThermalConducitivity, outsideThermalConducitivity);
61 auto area = fluxVarsCache.throatCrossSectionalArea(phaseIdx);
64 const Scalar deltaT = insideVolVars.temperature() - outsideVolVars.temperature();
65 const Scalar gradT = deltaT/fluxVarsCache.throatLength();
67 heatflux += thermalConductivity*gradT*area;
69 if constexpr (!std::is_same_v<MolecularDiffusionType, Detail::NoDiffusionType>)
70 heatflux += componentEnthalpyFlux_(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache, phaseIdx);
77 template<
class Problem,
class Element,
class FVElementGeometry,
78 class ElementVolumeVariables,
class ElementFluxVariablesCache>
79 static auto componentEnthalpyFlux_(
const Problem& problem,
80 const Element& element,
81 const FVElementGeometry& fvGeometry,
82 const ElementVolumeVariables& elemVolVars,
83 const typename FVElementGeometry::SubControlVolumeFace& scvf,
84 const ElementFluxVariablesCache& elemFluxVarsCache,
87 using Scalar =
typename ElementVolumeVariables::VolumeVariables::PrimaryVariables::value_type;
88 Scalar heatflux = 0.0;
89 using FluidSystem =
typename ElementVolumeVariables::VolumeVariables::FluidSystem;
90 const auto diffusiveFlux = MolecularDiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf, phaseIdx, elemFluxVarsCache);
91 for (
int compIdx = 0; compIdx < ElementVolumeVariables::VolumeVariables::numFluidComponents(); ++compIdx)
93 const bool insideIsUpstream = diffusiveFlux[compIdx] > 0.0;
94 const auto& upstreamVolVars = insideIsUpstream ? elemVolVars[scvf.insideScvIdx()] : elemVolVars[scvf.outsideScvIdx()];
95 const Scalar componentEnthalpy = FluidSystem::componentEnthalpy(upstreamVolVars.fluidState(), phaseIdx, compIdx);
98 heatflux += diffusiveFlux[compIdx] * componentEnthalpy;
100 heatflux += diffusiveFlux[compIdx] * FluidSystem::molarMass(compIdx) * componentEnthalpy;
constexpr Scalar harmonicMean(Scalar x, Scalar y, Scalar wx=1.0, Scalar wy=1.0) noexcept
Calculate the (weighted) harmonic mean of two scalar values.
Definition: math.hh:57
Define some often used mathematical functions.
Definition: discretization/porenetwork/fvelementgeometry.hh:24
Definition: flux/porenetwork/fourierslaw.hh:24
Specialization of Fourier's Law for the pore-network model.
Definition: flux/porenetwork/fourierslaw.hh:34
static auto flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache)
Definition: flux/porenetwork/fourierslaw.hh:38