Skip to content
Snippets Groups Projects
Commit 8e76a3ee authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[momentum][fluxhelper] Adapt to changes in fluxvars

parent 48ad92e3
No related branches found
No related tags found
1 merge request!2830Test 3D with new staggered freeflow model
......@@ -127,28 +127,39 @@ struct NavierStokesMomentumBoundaryFluxHelper
const auto& orthogonalScvf = fvGeometry.lateralOrthogonalScvf(scvf);
const auto innerTransportingVelocity = elemVolVars[orthogonalScvf.insideScvIdx()].velocity();
if (scvf.boundary())
static const bool useOldScheme = getParam<bool>("FreeFlow.UseOldTransportingVelocity", true); // TODO how to deprecate?
if (useOldScheme)
{
if (const auto bcTypes = problem.boundaryTypes(element, scvf); bcTypes.isDirichlet(scvf.normalAxis()))
return problem.dirichlet(element, scvf)[scvf.normalAxis()];
if (scvf.boundary())
{
if (problem.boundaryTypes(element, scvf).isDirichlet(scvf.normalAxis()))
return problem.dirichlet(element, scvf)[scvf.normalAxis()];
}
else
return
innerTransportingVelocity; // fallback
return innerTransportingVelocity;
}
else
// use the Dirichlet velocity as transporting velocity if the lateral face is on a Dirichlet boundary
if (scvf.boundary())
{
static const bool useOldScheme = getParam<bool>("FreeFlow.UseOldTransportingVelocity", true); // TODO how to deprecate?
if (useOldScheme)
return innerTransportingVelocity;
if (problem.boundaryTypes(element, scvf).isDirichlet(scvf.normalAxis()))
return 0.5*(problem.dirichlet(element, scvf)[scvf.normalAxis()] + innerTransportingVelocity);
}
if (orthogonalScvf.boundary())
{
if (problem.boundaryTypes(element, orthogonalScvf).isDirichlet(scvf.normalAxis()))
return 0.5*(problem.dirichlet(element, scvf)[scvf.normalAxis()] + innerTransportingVelocity);
else
{
// average the transporting velocity by weighting with the scv volumes
const auto insideVolume = fvGeometry.scv(orthogonalScvf.insideScvIdx()).volume();
const auto outsideVolume = fvGeometry.scv(orthogonalScvf.outsideScvIdx()).volume();
const auto outerTransportingVelocity = elemVolVars[orthogonalScvf.outsideScvIdx()].velocity();
return (insideVolume*innerTransportingVelocity + outsideVolume*outerTransportingVelocity) / (insideVolume + outsideVolume);
}
return innerTransportingVelocity; // fallback value, should actually never be called
}
// average the transporting velocity by weighting with the scv volumes
const auto insideVolume = fvGeometry.scv(orthogonalScvf.insideScvIdx()).volume();
const auto outsideVolume = fvGeometry.scv(orthogonalScvf.outsideScvIdx()).volume();
const auto outerTransportingVelocity = elemVolVars[orthogonalScvf.outsideScvIdx()].velocity();
return (insideVolume*innerTransportingVelocity + outsideVolume*outerTransportingVelocity) / (insideVolume + outsideVolume);
}();
// lateral face normal to boundary (integration point touches boundary)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment