FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

enstrophy.C

Go to the documentation of this file.
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     enstrophy
00026 
00027 Description
00028     Calculates and writes the enstrophy of the velocity field U.
00029 
00030     The -noWrite option just outputs the max/min values without writing the
00031     field.
00032 
00033 Usage
00034 
00035     - enstrophy [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 enstrophy" << endl;
00095         volScalarField enstrophy
00096         (
00097             IOobject
00098             (
00099                 "enstrophy",
00100                 runTime.timeName(),
00101                 mesh,
00102                 IOobject::NO_READ
00103             ),
00104             0.5*magSqr(fvc::curl(U))
00105         );
00106 
00107         Info<< "enstrophy(U) max/min : "
00108             << max(enstrophy).value() << " "
00109             << min(enstrophy).value() << endl;
00110 
00111         if (writeResults)
00112         {
00113             enstrophy.write();
00114         }
00115     }
00116     else
00117     {
00118         Info<< "    No U" << endl;
00119     }
00120 
00121     Info<< "\nEnd\n" << endl;
00122 }
00123 
00124 
00125 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines