Commit 6c7ae092 authored by Mark Olesen's avatar Mark Olesen
Browse files

BUG: fractionExpr "0" ignored (fixes #1855)

- incorrect branching logic caused the "0" case to be ignored
parent 7795f32f
......@@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Original code Copyright (C) 2011-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2011-2018 Bernhard Gschaider
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -31,6 +31,7 @@ License
#include "fvMesh.H"
#include "fvPatch.H"
#include "pointMesh.H"
#include "stringOps.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
......@@ -118,7 +119,6 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
else
{
// No gradient expression - same as Zero
if (debug_)
{
Info<< "No gradientExpr" << nl;
......@@ -127,7 +127,14 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
if (dict.readIfPresent("fractionExpr", expr))
{
if (!expr.empty() && expr != "0")
stringOps::inplaceTrim(expr);
if (expr == "0" || expr == "1")
{
// Special cases, handled with more efficiency
fracExpr_ = expr;
}
else if (!expr.empty())
{
if (isPointVal)
{
......@@ -137,11 +144,9 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
fracExpr_ = expressions::exprString(expr, dict);
}
}
else
{
// No fraction expression - same as 1 (one)
// Mixed BC may elect to simply ignore gradient expression
}
// No fraction expression? - defer treatment to inherited BC
// Mixed BC may elect to simply ignore gradient expression
}
}
......
Markdown is supported
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