00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 surfaceDisplacementPointPatchVectorField 00026 00027 Description 00028 Displacement fixed by projection onto triSurface. 00029 Use in a displacement fvMotionSolver 00030 as a bc on the pointDisplacement field. 00031 00032 Calculates the projection onto the surface according 00033 to the projectMode 00034 - NEAREST : nearest 00035 - POINTNORMAL : intersection with point normal 00036 - FIXEDNORMAL : intersection with fixed vector 00037 00038 This displacement is then clipped with the specified velocity * deltaT. 00039 00040 Optionally (intersection only) removes a component ("wedgePlane") to 00041 stay in 2D. 00042 00043 Needs: 00044 - geometry : dictionary with searchableSurfaces. (usually 00045 triSurfaceMeshes in constant/triSurface) 00046 - projectMode : see above 00047 - projectDirection : if projectMode = fixedNormal 00048 - wedgePlane : -1 or component to knock out of intersection normal 00049 - frozenPointsZone : empty or name of pointZone containing points 00050 that do not move 00051 00052 SourceFiles 00053 surfaceDisplacementPointPatchVectorField.C 00054 00055 \*---------------------------------------------------------------------------*/ 00056 00057 #ifndef surfaceDisplacementPointPatchVectorField_H 00058 #define surfaceDisplacementPointPatchVectorField_H 00059 00060 #include <OpenFOAM/pointPatchFields.H> 00061 #include <OpenFOAM/fixedValuePointPatchFields.H> 00062 #include <meshTools/searchableSurfaces.H> 00063 #include <OpenFOAM/Switch.H> 00064 00065 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00066 00067 namespace Foam 00068 { 00069 00070 /*---------------------------------------------------------------------------*\ 00071 Class surfaceDisplacementPointPatchVectorField Declaration 00072 \*---------------------------------------------------------------------------*/ 00073 00074 class surfaceDisplacementPointPatchVectorField 00075 : 00076 public fixedValuePointPatchVectorField 00077 { 00078 00079 public: 00080 00081 // Public data types 00082 00083 enum projectMode 00084 { 00085 NEAREST, 00086 POINTNORMAL, 00087 FIXEDNORMAL 00088 }; 00089 00090 private: 00091 00092 // Private data 00093 00094 //- project mode names 00095 static const NamedEnum<projectMode, 3> projectModeNames_; 00096 00097 //- Maximum velocity 00098 const vector velocity_; 00099 00100 //- names of surfaces 00101 const dictionary surfacesDict_; 00102 00103 //- How to project/project onto surface 00104 const projectMode projectMode_; 00105 00106 //- direction to project 00107 const vector projectDir_; 00108 00109 //- plane for 2D wedge case or -1. 00110 const label wedgePlane_; 00111 00112 //- pointZone with frozen points 00113 const word frozenPointsZone_; 00114 00115 //- Demand driven: surface to project 00116 mutable autoPtr<searchableSurfaces> surfacesPtr_; 00117 00118 00119 // Private Member Functions 00120 00121 //- Calculate displacement (w.r.t. points0()) to project onto surface 00122 void calcProjection(vectorField& displacement) const; 00123 00124 00125 //- Disallow default bitwise assignment 00126 void operator=(const surfaceDisplacementPointPatchVectorField&); 00127 00128 public: 00129 00130 //- Runtime type information 00131 TypeName("surfaceDisplacement"); 00132 00133 00134 // Constructors 00135 00136 //- Construct from patch and internal field 00137 surfaceDisplacementPointPatchVectorField 00138 ( 00139 const pointPatch&, 00140 const DimensionedField<vector, pointMesh>& 00141 ); 00142 00143 //- Construct from patch, internal field and dictionary 00144 surfaceDisplacementPointPatchVectorField 00145 ( 00146 const pointPatch&, 00147 const DimensionedField<vector, pointMesh>&, 00148 const dictionary& 00149 ); 00150 00151 //- Construct by mapping given patchField<vector> onto a new patch 00152 surfaceDisplacementPointPatchVectorField 00153 ( 00154 const surfaceDisplacementPointPatchVectorField&, 00155 const pointPatch&, 00156 const DimensionedField<vector, pointMesh>&, 00157 const pointPatchFieldMapper& 00158 ); 00159 00160 //- Construct as copy 00161 surfaceDisplacementPointPatchVectorField 00162 ( 00163 const surfaceDisplacementPointPatchVectorField& 00164 ); 00165 00166 //- Construct and return a clone 00167 virtual autoPtr<pointPatchVectorField> clone() const 00168 { 00169 return autoPtr<pointPatchVectorField> 00170 ( 00171 new surfaceDisplacementPointPatchVectorField 00172 ( 00173 *this 00174 ) 00175 ); 00176 } 00177 00178 //- Construct as copy setting internal field reference 00179 surfaceDisplacementPointPatchVectorField 00180 ( 00181 const surfaceDisplacementPointPatchVectorField&, 00182 const DimensionedField<vector, pointMesh>& 00183 ); 00184 00185 //- Construct and return a clone setting internal field reference 00186 virtual autoPtr<pointPatchVectorField> clone 00187 ( 00188 const DimensionedField<vector, pointMesh>& iF 00189 ) const 00190 { 00191 return autoPtr<pointPatchVectorField> 00192 ( 00193 new surfaceDisplacementPointPatchVectorField 00194 ( 00195 *this, 00196 iF 00197 ) 00198 ); 00199 } 00200 00201 // Member Functions 00202 00203 //- Surface to follow. Demand loads surfaceNames. 00204 const searchableSurfaces& surfaces() const; 00205 00206 //- Update the coefficients associated with the patch field 00207 virtual void updateCoeffs(); 00208 00209 //- Write 00210 virtual void write(Ostream&) const; 00211 }; 00212 00213 00214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00215 00216 } // End namespace Foam 00217 00218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00219 00220 #endif 00221 00222 // ************************ vim: set sw=4 sts=4 et: ************************ //