Commit 397c2064 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[staggered][navierstokes] Rename outerNormalScalar() to directionSign()

* can be either -1 or 1, depending on the face's orientation
parent d6f2abcd
......@@ -210,7 +210,8 @@ public:
return normalInPosCoordDir_;
}
Scalar outerNormalScalar() const
//! Returns the sign of the unit outer normal's vector
Scalar directionSign() const
{
return outerNormalScalar_;
}
......
......@@ -101,7 +101,7 @@ public:
bool isOutflow = false)
{
const Scalar velocity = elemFaceVars[scvf].velocitySelf();
const bool insideIsUpstream = sign(scvf.outerNormalScalar()) == sign(velocity);
const bool insideIsUpstream = scvf.directionSign() == sign(velocity);
static const Scalar upWindWeight = getParamFromGroup<Scalar>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Implicit.UpwindWeight");
const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
......@@ -112,7 +112,7 @@ public:
const Scalar flux = (upWindWeight * upwindTerm(upstreamVolVars) +
(1.0 - upWindWeight) * upwindTerm(downstreamVolVars))
* velocity * scvf.area() * sign(scvf.outerNormalScalar());
* velocity * scvf.area() * scvf.directionSign();
return flux;
}
......@@ -216,7 +216,7 @@ public:
{
// advective part
const Scalar vAvg = (velocitySelf + velocityOpposite) * 0.5;
const Scalar vUp = (sign(scvf.outerNormalScalar()) == sign(vAvg)) ? velocityOpposite : velocitySelf;
const Scalar vUp = (scvf.directionSign() == sign(vAvg)) ? velocityOpposite : velocitySelf;
normalFlux += vAvg * vUp * insideVolVars.density();
}
......@@ -229,17 +229,17 @@ public:
normalFlux -= insideVolVars.viscosity() * 2.0 * deltaV/deltaX;
// account for the orientation of the face
const Scalar sgn = -1.0 * sign(scvf.outerNormalScalar());
const Scalar sgn = -1.0 * scvf.directionSign();
Scalar result = normalFlux * sgn * scvf.area();
// treat outflow conditions
if(navierStokes && scvf.boundary())
{
const auto& upVolVars = (sign(scvf.outerNormalScalar()) == sign(velocitySelf)) ?
const auto& upVolVars = (scvf.directionSign() == sign(velocitySelf)) ?
elemVolVars[insideScvIdx] : elemVolVars[scvf.outsideScvIdx()] ;
result += velocitySelf * velocitySelf * upVolVars.density() * sign(scvf.outerNormalScalar()) * scvf.area() ;
result += velocitySelf * velocitySelf * upVolVars.density() * scvf.directionSign() * scvf.area() ;
}
return result;
}
......@@ -302,7 +302,7 @@ private:
const auto insideScvIdx = normalFace.insideScvIdx();
const auto outsideScvIdx = normalFace.outsideScvIdx();
const bool innerElementIsUpstream = ( sign(normalFace.outerNormalScalar()) == sign(transportingVelocity) );
const bool innerElementIsUpstream = ( normalFace.directionSign() == sign(transportingVelocity) );
const auto& upVolVars = innerElementIsUpstream ? elemVolVars[insideScvIdx] : elemVolVars[outsideScvIdx];
......@@ -311,9 +311,8 @@ private:
faceVars.velocityParallel(localSubFaceIdx);
const Scalar momentum = upVolVars.density() * transportedVelocity;
const int sgn = sign(normalFace.outerNormalScalar());
return transportingVelocity * momentum * sgn * normalFace.area() * 0.5;
return transportingVelocity * momentum * normalFace.directionSign() * normalFace.area() * 0.5;
}
FacePrimaryVariables computeDiffusivePartOfTangentialMomentumFlux_(const Problem& problem,
......@@ -358,8 +357,7 @@ private:
const Scalar parallelDerivative = parallelDeltaV / scvf.pairData(localSubFaceIdx).parallelDistance;
tangentialDiffusiveFlux -= muAvg * parallelDerivative;
const Scalar sgn = sign(normalFace.outerNormalScalar());
return tangentialDiffusiveFlux * sgn * normalFace.area() * 0.5;
return tangentialDiffusiveFlux * normalFace.directionSign() * normalFace.area() * 0.5;
}
};
......
......@@ -373,13 +373,13 @@ private:
const Scalar deltaP = normalizePressure ? problem.initialAtPos(scvf.center())[pressureIdx] : 0.0;
Scalar result = (insideVolVars.pressure() - deltaP) * scvf.area() * -1.0 * sign(scvf.outerNormalScalar());
Scalar result = (insideVolVars.pressure() - deltaP) * scvf.area() * -1.0 * scvf.directionSign();
// treat outflow BCs
if(scvf.boundary())
{
const Scalar pressure = problem.dirichlet(element, scvf)[pressureIdx] - deltaP;
result += pressure * scvf.area() * sign(scvf.outerNormalScalar());
result += pressure * scvf.area() * scvf.directionSign();
}
return result;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment