65 static Scalar
flux(
const Problem& problem,
66 const Element& element,
67 const FVElementGeometry& fvGeometry,
68 const ElementVolumeVariables& elemVolVars,
69 const SubControlVolumeFace& scvf,
70 const ElementFluxVarsCache& elemFluxVarCache)
73 if (!scvf.interiorBoundary())
74 return ParentType::flux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarCache);
76 static const Scalar xi = getParamFromGroup<Scalar>(problem.paramGroup(),
"FacetCoupling.Xi", 1.0);
77 if ( !Dune::FloatCmp::eq(xi, 1.0, 1e-6) )
78 DUNE_THROW(Dune::NotImplemented,
"Xi != 1.0 cannot be used with the Box-Facet-Coupling scheme");
81 const auto& fluxVarCache = elemFluxVarCache[scvf];
82 const auto& shapeValues = fluxVarCache.shapeValues();
83 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
84 const auto& insideVolVars = elemVolVars[insideScv];
87 const auto bcTypes = problem.interiorBoundaryTypes(element, scvf);
88 if (bcTypes.hasOnlyNeumann())
91 const auto& facetVolVars = problem.couplingManager().getLowDimVolVars(element, scvf);
95 for (
const auto& scv : scvs(fvGeometry))
96 T += elemVolVars[scv].temperature()*shapeValues[scv.indexInElement()][0];
102 const auto a = facetVolVars.extrusionFactor();
103 auto gradT = scvf.unitOuterNormal();
104 gradT *= dim == dimWorld ? 0.5*a : 0.5*sqrt(a);
105 gradT /= gradT.two_norm2();
106 gradT *= (facetVolVars.temperature() - T);
108 return -1.0*Extrusion::area(fvGeometry, scvf)
109 *insideVolVars.extrusionFactor()
110 *
vtmv(scvf.unitOuterNormal(),
111 facetVolVars.effectiveThermalConductivity(),
116 else if (bcTypes.hasOnlyDirichlet())
119 std::vector<Scalar> temperatures(element.subEntities(dim));
120 for (
const auto& scv : scvs(fvGeometry))
121 temperatures[scv.localDofIndex()] = elemVolVars[scv].temperature();
124 for (
const auto& scvfJ : scvfs(fvGeometry))
125 if (scvfJ.interiorBoundary() && scvfJ.facetIndexInElement() == scvf.facetIndexInElement())
126 temperatures[ fvGeometry.scv(scvfJ.insideScvIdx()).localDofIndex() ]
127 = problem.couplingManager().getLowDimVolVars(element, scvfJ).temperature();
130 Dune::FieldVector<Scalar, dimWorld> gradT(0.0);
131 for (
const auto& scv : scvs(fvGeometry))
132 gradT.axpy(temperatures[scv.localDofIndex()], fluxVarCache.gradN(scv.indexInElement()));
135 return -1.0*Extrusion::area(fvGeometry, scvf)
136 *insideVolVars.extrusionFactor()
137 *
vtmv(scvf.unitOuterNormal(),
138 insideVolVars.effectiveThermalConductivity(),
144 DUNE_THROW(Dune::NotImplemented,
"Mixed boundary types are not supported");