From 2eff8dd2db0a406d156b8fe3aca814ca9fab7912 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Tue, 17 Jul 2012 16:47:15 +0100 Subject: [PATCH] ENH: wedge patch - moved vector normalisation after error check --- .../constraint/wedge/wedgePolyPatch.C | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C index 35b18aaf699..6223661b815 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,33 +58,25 @@ void Foam::wedgePolyPatch::initTransforms() ); centreNormal_ /= mag(centreNormal_); - if - ( - mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z()) - < (1 - SMALL) - ) + const scalar cnCmptSum = + centreNormal_.x() + centreNormal_.y() + centreNormal_.z(); + + if (mag(cnCmptSum) < (1 - SMALL)) { - FatalErrorIn - ( - "wedgePolyPatch::wedgePolyPatch(const polyPatch&, " - "const fvBoundaryMesh&)" - ) << "wedge " << name() + FatalErrorIn("wedgePolyPatch::initTransforms()") + << "wedge " << name() << " centre plane does not align with a coordinate plane by " - << 1 - - mag(centreNormal_.x()+centreNormal_.y()+centreNormal_.z()) + << 1 - mag(cnCmptSum) << exit(FatalError); } axis_ = centreNormal_ ^ patchNormal_; scalar magAxis = mag(axis_); - axis_ /= magAxis; if (magAxis < SMALL) { - FatalErrorIn - ( - "wedgePolyPatch::initTransforms()" - ) << "wedge " << name() + FatalErrorIn("wedgePolyPatch::initTransforms()") + << "wedge " << name() << " plane aligns with a coordinate plane." << nl << " The wedge plane should make a small angle (~2.5deg)" " with the coordinate plane" << nl @@ -95,6 +87,8 @@ void Foam::wedgePolyPatch::initTransforms() << exit(FatalError); } + axis_ /= magAxis; + faceT_ = rotationTensor(centreNormal_, patchNormal_); cellT_ = faceT_ & faceT_; } -- GitLab