wedgePolyPatch.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "wedgePolyPatch.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "SubField.H"
00030 #include "transform.H"
00031
00032
00033
00034 namespace Foam
00035 {
00036 defineTypeNameAndDebug(wedgePolyPatch, 0);
00037
00038 addToRunTimeSelectionTable(polyPatch, wedgePolyPatch, word);
00039 addToRunTimeSelectionTable(polyPatch, wedgePolyPatch, dictionary);
00040 }
00041
00042
00043
00044 void Foam::wedgePolyPatch::initTransforms()
00045 {
00046 const pointField& points = this->points();
00047
00048 patchNormal_ = operator[](0).normal(points);
00049 patchNormal_ /= mag(patchNormal_);
00050
00051 centreNormal_ =
00052 vector
00053 (
00054 sign(patchNormal_.x())*(max(mag(patchNormal_.x()), 0.5) - 0.5),
00055 sign(patchNormal_.y())*(max(mag(patchNormal_.y()), 0.5) - 0.5),
00056 sign(patchNormal_.z())*(max(mag(patchNormal_.z()), 0.5) - 0.5)
00057 );
00058 centreNormal_ /= mag(centreNormal_);
00059
00060 if
00061 (
00062 mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
00063 < (1 - SMALL)
00064 )
00065 {
00066 FatalErrorIn
00067 (
00068 "wedgePolyPatch::wedgePolyPatch(const polyPatch&, "
00069 "const fvBoundaryMesh&)"
00070 ) << "wedge " << name()
00071 << " centre plane does not align with a coordinate plane by "
00072 << 1
00073 - mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
00074 << exit(FatalError);
00075 }
00076
00077 axis_ = centreNormal_ ^ patchNormal_;
00078 scalar magAxis = mag(axis_);
00079 axis_ /= magAxis;
00080
00081 if (magAxis < SMALL)
00082 {
00083 FatalErrorIn
00084 (
00085 "wedgePolyPatch::initTransforms()"
00086 ) << "wedge " << name()
00087 << " plane aligns with a coordinate plane." << nl
00088 << " The wedge plane should make a small angle (~2.5deg)"
00089 " with the coordinate plane" << nl
00090 << " and the the pair of wedge planes should be symmetric"
00091 << " about the coordinate plane." << nl
00092 << " Normal of face " << 0 << " is " << patchNormal_
00093 << " , implied coordinate plane direction is " << centreNormal_
00094 << exit(FatalError);
00095 }
00096
00097 faceT_ = rotationTensor(centreNormal_, patchNormal_);
00098 cellT_ = faceT_ & faceT_;
00099 }
00100
00101
00102
00103
00104 Foam::wedgePolyPatch::wedgePolyPatch
00105 (
00106 const word& name,
00107 const label size,
00108 const label start,
00109 const label index,
00110 const polyBoundaryMesh& bm
00111 )
00112 :
00113 polyPatch(name, size, start, index, bm)
00114 {
00115 initTransforms();
00116 }
00117
00118
00119 Foam::wedgePolyPatch::wedgePolyPatch
00120 (
00121 const word& name,
00122 const dictionary& dict,
00123 const label index,
00124 const polyBoundaryMesh& bm
00125 )
00126 :
00127 polyPatch(name, dict, index, bm)
00128 {
00129 initTransforms();
00130 }
00131
00132
00133 Foam::wedgePolyPatch::wedgePolyPatch
00134 (
00135 const wedgePolyPatch& pp,
00136 const polyBoundaryMesh& bm
00137 )
00138 :
00139 polyPatch(pp, bm)
00140 {
00141 initTransforms();
00142 }
00143
00144
00145 Foam::wedgePolyPatch::wedgePolyPatch
00146 (
00147 const wedgePolyPatch& pp,
00148 const polyBoundaryMesh& bm,
00149 const label index,
00150 const label newSize,
00151 const label newStart
00152 )
00153 :
00154 polyPatch(pp, bm, index, newSize, newStart)
00155 {
00156 initTransforms();
00157 }
00158
00159
00160
Copyright © 2000-2009 OpenCFD Ltd