77 static Scalar
flux(
const Problem& problem,
78 const Element& element,
79 const FVElementGeometry& fvGeometry,
80 const ElementVolumeVariables& elemVolVars,
81 const SubControlVolumeFace& scvf,
82 const ElementFluxVarsCache& elemFluxVarCache)
85 if (!scvf.interiorBoundary())
86 return ParentType::flux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarCache);
89 if ( !Dune::FloatCmp::eq(xi, 1.0, 1e-6) )
90 DUNE_THROW(Dune::NotImplemented,
"Xi != 1.0 cannot be used with the Box-Facet-Coupling scheme");
93 const auto& fluxVarCache = elemFluxVarCache[scvf];
94 const auto& shapeValues = fluxVarCache.shapeValues();
95 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
96 const auto& insideVolVars = elemVolVars[insideScv];
99 const auto bcTypes = problem.interiorBoundaryTypes(element, scvf);
100 if (bcTypes.hasOnlyNeumann())
103 const auto& facetVolVars = problem.couplingManager().getLowDimVolVars(element, scvf);
107 for (
const auto& scv : scvs(fvGeometry))
108 T += elemVolVars[scv].temperature()*shapeValues[scv.indexInElement()][0];
114 const auto a = facetVolVars.extrusionFactor();
115 auto gradT = scvf.unitOuterNormal();
116 gradT *= dim == dimWorld ? 0.5*a : 0.5*sqrt(a);
117 gradT /= gradT.two_norm2();
118 gradT *= (facetVolVars.temperature() - T);
120 return -1.0*Extrusion::area(scvf)
121 *insideVolVars.extrusionFactor()
122 *
vtmv(scvf.unitOuterNormal(),
123 facetVolVars.effectiveThermalConductivity(),
128 else if (bcTypes.hasOnlyDirichlet())
131 std::vector<Scalar> temperatures(element.subEntities(dim));
132 for (
const auto& scv : scvs(fvGeometry))
133 temperatures[scv.localDofIndex()] = elemVolVars[scv].temperature();
136 for (
const auto& scvfJ : scvfs(fvGeometry))
137 if (scvfJ.interiorBoundary() && scvfJ.facetIndexInElement() == scvf.facetIndexInElement())
138 temperatures[ fvGeometry.scv(scvfJ.insideScvIdx()).localDofIndex() ]
139 = problem.couplingManager().getLowDimVolVars(element, scvfJ).temperature();
142 Dune::FieldVector<Scalar, dimWorld> gradT(0.0);
143 for (
const auto& scv : scvs(fvGeometry))
144 gradT.axpy(temperatures[scv.localDofIndex()], fluxVarCache.gradN(scv.indexInElement()));
147 return -1.0*Extrusion::area(scvf)
148 *insideVolVars.extrusionFactor()
149 *
vtmv(scvf.unitOuterNormal(),
150 insideVolVars.effectiveThermalConductivity(),
156 DUNE_THROW(Dune::NotImplemented,
"Mixed boundary types are not supported");