00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 Application 00025 deformedGeom 00026 00027 Description 00028 Deforms a polyMesh using a displacement field U and a scaling factor 00029 supplied as an argument. 00030 00031 Usage 00032 00033 - deformedGeom [OPTIONS] <scaling factor> 00034 00035 @param <scaling factor> \n 00036 @todo Detailed description of argument. 00037 00038 @param -case <dir>\n 00039 Case directory. 00040 00041 @param -parallel \n 00042 Run in parallel. 00043 00044 @param -help \n 00045 Display help message. 00046 00047 @param -doc \n 00048 Display Doxygen API documentation page for this application. 00049 00050 @param -srcDoc \n 00051 Display Doxygen source documentation page for this application. 00052 00053 \*---------------------------------------------------------------------------*/ 00054 00055 #include <OpenFOAM/argList.H> 00056 #include <finiteVolume/fvMesh.H> 00057 #include <OpenFOAM/pointFields.H> 00058 #include <OpenFOAM/IStringStream.H> 00059 #include <finiteVolume/volPointInterpolation.H> 00060 00061 using namespace Foam; 00062 00063 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00064 00065 int main(int argc, char *argv[]) 00066 { 00067 argList::validArgs.append("scaling factor"); 00068 00069 # include <OpenFOAM/setRootCase.H> 00070 00071 scalar scaleFactor(readScalar(IStringStream(args.additionalArgs()[0])())); 00072 00073 # include <OpenFOAM/createTime.H> 00074 # include <OpenFOAM/createMesh.H> 00075 00076 volPointInterpolation pInterp(mesh); 00077 00078 // Get times list 00079 instantList Times = runTime.times(); 00080 00081 pointField zeroPoints(mesh.points()); 00082 00083 // skip "constant" time 00084 for (label timeI = 1; timeI < Times.size(); ++timeI) 00085 { 00086 runTime.setTime(Times[timeI], timeI); 00087 00088 Info<< "Time = " << runTime.timeName() << endl; 00089 00090 IOobject Uheader 00091 ( 00092 "U", 00093 runTime.timeName(), 00094 mesh, 00095 IOobject::MUST_READ 00096 ); 00097 00098 // Check U exists 00099 if (Uheader.headerOk()) 00100 { 00101 Info<< " Reading U" << endl; 00102 volVectorField U(Uheader, mesh); 00103 00104 pointField newPoints = 00105 zeroPoints 00106 + scaleFactor*pInterp.interpolate(U)().internalField(); 00107 00108 mesh.polyMesh::movePoints(newPoints); 00109 00110 mesh.write(); 00111 } 00112 else 00113 { 00114 Info<< " No U" << endl; 00115 } 00116 00117 Info<< endl; 00118 } 00119 00120 Info<< "End\n" << endl; 00121 00122 return 0; 00123 } 00124 00125 00126 // ************************ vim: set sw=4 sts=4 et: ************************ //