diff --git a/src/finiteVolume/expressions/patch/patchExprDriver.H b/src/finiteVolume/expressions/patch/patchExprDriver.H index 51a2c5fb23..39c263ad78 100644 --- a/src/finiteVolume/expressions/patch/patchExprDriver.H +++ b/src/finiteVolume/expressions/patch/patchExprDriver.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -41,7 +41,8 @@ Description area | The face area magnitudes | 0 | weightAverage| Area weighted average | 1 | weightSum | Area weighted sum | 1 | - face | The face areaNormal vectors | 0 | + face | The face area normal vectors | 0 | + normal | The face unit normal vectors | 0 | point | A point-field point value | 1 | faceToPoint | Interpolate face values onto points | 1 | pointToFace | Interpolate point values onto faces | 1 | @@ -293,6 +294,9 @@ public: //- The face areas with their vector direction [Sf] - (swak = face) tmp field_areaNormal() const; + //- The face unit normal direction [nf] - (expression: normal) + tmp field_unitNormal() const; + //- The patch point locations - (swak = pts) tmp field_pointField() const; diff --git a/src/finiteVolume/expressions/patch/patchExprDriverFields.C b/src/finiteVolume/expressions/patch/patchExprDriverFields.C index be14a62288..2b1326b9fc 100644 --- a/src/finiteVolume/expressions/patch/patchExprDriverFields.C +++ b/src/finiteVolume/expressions/patch/patchExprDriverFields.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -167,6 +167,13 @@ Foam::expressions::patchExpr::parseDriver::field_areaNormal() const } +Foam::tmp +Foam::expressions::patchExpr::parseDriver::field_unitNormal() const +{ + return patch_.nf(); +} + + Foam::tmp Foam::expressions::patchExpr::parseDriver::field_pointField() const { diff --git a/src/finiteVolume/expressions/patch/patchExprLemonParser.h b/src/finiteVolume/expressions/patch/patchExprLemonParser.h index 72b8c2ba49..5a8fb9497e 100644 --- a/src/finiteVolume/expressions/patch/patchExprLemonParser.h +++ b/src/finiteVolume/expressions/patch/patchExprLemonParser.h @@ -90,36 +90,37 @@ #define TOK_FACE_ZONE 90 #define TOK_FACE_AREA 91 #define TOK_FACE_EXPR 92 -#define TOK_WEIGHT_AVERAGE 93 -#define TOK_WEIGHT_SUM 94 -#define TOK_POINT_EXPR 95 -#define TOK_PSCALAR_ID 96 -#define TOK_PVECTOR_ID 97 -#define TOK_PSPH_TENSOR_ID 98 -#define TOK_PSYM_TENSOR_ID 99 -#define TOK_PTENSOR_ID 100 -#define TOK_PBOOL_ID 101 -#define TOK_POINTS 102 -#define TOK_MAG 103 -#define TOK_MAGSQR 104 -#define TOK_VECTOR 105 -#define TOK_TENSOR 106 -#define TOK_SYM_TENSOR 107 -#define TOK_SPH_TENSOR 108 -#define TOK_CMPT_X 109 -#define TOK_CMPT_Y 110 -#define TOK_CMPT_Z 111 -#define TOK_CMPT_XX 112 -#define TOK_CMPT_XY 113 -#define TOK_CMPT_XZ 114 -#define TOK_CMPT_YX 115 -#define TOK_CMPT_YY 116 -#define TOK_CMPT_YZ 117 -#define TOK_CMPT_ZX 118 -#define TOK_CMPT_ZY 119 -#define TOK_CMPT_ZZ 120 -#define TOK_CMPT_II 121 -#define TOK_TRANSPOSE 122 -#define TOK_DIAG 123 -#define TOK_POINT_TO_FACE 124 -#define TOK_FACE_TO_POINT 125 +#define TOK_FACE_NORMAL 93 +#define TOK_WEIGHT_AVERAGE 94 +#define TOK_WEIGHT_SUM 95 +#define TOK_POINT_EXPR 96 +#define TOK_PSCALAR_ID 97 +#define TOK_PVECTOR_ID 98 +#define TOK_PSPH_TENSOR_ID 99 +#define TOK_PSYM_TENSOR_ID 100 +#define TOK_PTENSOR_ID 101 +#define TOK_PBOOL_ID 102 +#define TOK_POINTS 103 +#define TOK_MAG 104 +#define TOK_MAGSQR 105 +#define TOK_VECTOR 106 +#define TOK_TENSOR 107 +#define TOK_SYM_TENSOR 108 +#define TOK_SPH_TENSOR 109 +#define TOK_CMPT_X 110 +#define TOK_CMPT_Y 111 +#define TOK_CMPT_Z 112 +#define TOK_CMPT_XX 113 +#define TOK_CMPT_XY 114 +#define TOK_CMPT_XZ 115 +#define TOK_CMPT_YX 116 +#define TOK_CMPT_YY 117 +#define TOK_CMPT_YZ 118 +#define TOK_CMPT_ZX 119 +#define TOK_CMPT_ZY 120 +#define TOK_CMPT_ZZ 121 +#define TOK_CMPT_II 122 +#define TOK_TRANSPOSE 123 +#define TOK_DIAG 124 +#define TOK_POINT_TO_FACE 125 +#define TOK_FACE_TO_POINT 126 diff --git a/src/finiteVolume/expressions/patch/patchExprLemonParserMacros.m4 b/src/finiteVolume/expressions/patch/patchExprLemonParserMacros.m4 index afbd594b45..050dfe56ab 100644 --- a/src/finiteVolume/expressions/patch/patchExprLemonParserMacros.m4 +++ b/src/finiteVolume/expressions/patch/patchExprLemonParserMacros.m4 @@ -6,7 +6,7 @@ divert(-1)dnl # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2019-2021 OpenCFD Ltd. +# Copyright (C) 2019-2023 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -79,6 +79,7 @@ dnl rule_driver_nullary(_scalar_, FACE_AREA, field_faceArea)dnl rule_driver_nullary(_vector_, POS, field_faceCentre)dnl FACE_CENTRE rule_driver_nullary(_vector_, FACE_EXPR, field_areaNormal)dnl +rule_driver_nullary(_vector_, FACE_NORMAL, field_unitNormal)dnl dnl rule_driver_inplace_unary(_scalar_, WEIGHT_AVERAGE, areaAverage)dnl rule_driver_inplace_unary(_vector_, WEIGHT_AVERAGE, areaAverage)dnl diff --git a/src/finiteVolume/expressions/patch/patchExprScanner.cc b/src/finiteVolume/expressions/patch/patchExprScanner.cc index 3a6ffe9f1b..dba217e972 100644 --- a/src/finiteVolume/expressions/patch/patchExprScanner.cc +++ b/src/finiteVolume/expressions/patch/patchExprScanner.cc @@ -7,7 +7,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,7 +36,6 @@ Description #include "patchExprLemonParser.h" #include "patchExprParser.H" #include "Enum.H" -//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -159,6 +158,7 @@ static const Enum funcTokenEnums TOKEN_PAIR("faceToPoint", FACE_TO_POINT), TOKEN_PAIR("pointToFace", POINT_TO_FACE), + TOKEN_PAIR("normal", FACE_NORMAL), // Face unitNormal TOKEN_PAIR("area", FACE_AREA), TOKEN_PAIR("pts", POINTS), }); diff --git a/src/finiteVolume/expressions/patch/patchExprScanner.rl b/src/finiteVolume/expressions/patch/patchExprScanner.rl index 6e9fa3ea4d..0ad865709c 100644 --- a/src/finiteVolume/expressions/patch/patchExprScanner.rl +++ b/src/finiteVolume/expressions/patch/patchExprScanner.rl @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,7 +34,6 @@ Description #include "patchExprLemonParser.h" #include "patchExprParser.H" #include "Enum.H" -//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -157,6 +156,7 @@ static const Enum funcTokenEnums TOKEN_PAIR("faceToPoint", FACE_TO_POINT), TOKEN_PAIR("pointToFace", POINT_TO_FACE), + TOKEN_PAIR("normal", FACE_NORMAL), // Face unitNormal TOKEN_PAIR("area", FACE_AREA), TOKEN_PAIR("pts", POINTS), });