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 @@ ...@@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Original code Copyright (C) 2011-2018 Bernhard Gschaider Copyright (C) 2011-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -31,6 +31,7 @@ License ...@@ -31,6 +31,7 @@ License
#include "fvMesh.H" #include "fvMesh.H"
#include "fvPatch.H" #include "fvPatch.H"
#include "pointMesh.H" #include "pointMesh.H"
#include "stringOps.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
...@@ -118,7 +119,6 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase ...@@ -118,7 +119,6 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
else else
{ {
// No gradient expression - same as Zero // No gradient expression - same as Zero
if (debug_) if (debug_)
{ {
Info<< "No gradientExpr" << nl; Info<< "No gradientExpr" << nl;
...@@ -127,7 +127,14 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase ...@@ -127,7 +127,14 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
if (dict.readIfPresent("fractionExpr", expr)) 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) if (isPointVal)
{ {
...@@ -137,12 +144,10 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase ...@@ -137,12 +144,10 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
fracExpr_ = expressions::exprString(expr, dict); fracExpr_ = expressions::exprString(expr, dict);
} }
} }
else
{ // No fraction expression? - defer treatment to inherited BC
// No fraction expression - same as 1 (one)
// Mixed BC may elect to simply ignore gradient expression // Mixed BC may elect to simply ignore gradient expression
} }
}
} }
......
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