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 vorticity 00026 00027 Description 00028 Calculates and writes the vorticity of velocity field U. 00029 00030 The -noWrite option just outputs the max/min values without writing 00031 the field. 00032 00033 Usage 00034 00035 - vorticity [OPTIONS] 00036 00037 @param -noWrite \n 00038 Suppress output to files. 00039 00040 @param -dict <dictionary name>\n 00041 Use named dictionary instead of system/controlDict. 00042 00043 @param -noZero \n 00044 Ignore timestep 0. 00045 00046 @param -constant \n 00047 Include the constant directory. 00048 00049 @param -time <time>\n 00050 Apply only to specific time. 00051 00052 @param -latestTime \n 00053 Only apply to latest time step. 00054 00055 @param -case <dir>\n 00056 Case directory. 00057 00058 @param -parallel \n 00059 Run in parallel. 00060 00061 @param -help \n 00062 Display help message. 00063 00064 @param -doc \n 00065 Display Doxygen API documentation page for this application. 00066 00067 @param -srcDoc \n 00068 Display Doxygen source documentation page for this application. 00069 00070 \*---------------------------------------------------------------------------*/ 00071 00072 #include <postCalc/calc.H> 00073 #include <finiteVolume/fvc.H> 00074 00075 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00076 00077 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) 00078 { 00079 bool writeResults = !args.optionFound("noWrite"); 00080 00081 IOobject Uheader 00082 ( 00083 "U", 00084 runTime.timeName(), 00085 mesh, 00086 IOobject::MUST_READ 00087 ); 00088 00089 if (Uheader.headerOk()) 00090 { 00091 Info<< " Reading U" << endl; 00092 volVectorField U(Uheader, mesh); 00093 00094 Info<< " Calculating vorticity" << endl; 00095 volVectorField vorticity 00096 ( 00097 IOobject 00098 ( 00099 "vorticity", 00100 runTime.timeName(), 00101 mesh, 00102 IOobject::NO_READ 00103 ), 00104 fvc::curl(U) 00105 ); 00106 00107 volScalarField magVorticity 00108 ( 00109 IOobject 00110 ( 00111 "magVorticity", 00112 runTime.timeName(), 00113 mesh, 00114 IOobject::NO_READ 00115 ), 00116 mag(vorticity) 00117 ); 00118 00119 Info<< "vorticity max/min : " 00120 << max(magVorticity).value() << " " 00121 << min(magVorticity).value() << endl; 00122 00123 if (writeResults) 00124 { 00125 vorticity.write(); 00126 magVorticity.write(); 00127 } 00128 } 00129 else 00130 { 00131 Info<< " No U" << endl; 00132 } 00133 00134 Info<< "\nEnd\n" << endl; 00135 } 00136 00137 00138 // ************************ vim: set sw=4 sts=4 et: ************************ //