OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

foamToGMV.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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026     Translates foam output to GMV readable files.
00027 
00028     A free post-processor with available binaries from
00029     http://www-xdiv.lanl.gov/XCM/gmv/
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 #include "fvCFD.H"
00034 #include "OFstream.H"
00035 #include "instantList.H"
00036 #include "IOobjectList.H"
00037 #include "itoa.H"
00038 #include "Cloud.H"
00039 #include "passiveParticle.H"
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 // Main program:
00044 
00045 int main(int argc, char *argv[])
00046 {
00047     const label nTypes = 4;
00048     const word fieldTypes[] =
00049     {
00050         "volScalarField",
00051         "volVectorField",
00052         "surfaceScalarField",
00053         cloud::prefix
00054     };
00055 
00056 #   include "setRootCase.H"
00057 
00058 #   include "createTime.H"
00059 #   include "createMesh.H"
00060 
00061 #   include "readConversionProperties.H"
00062 
00063     // get the available time-steps
00064     instantList TimeList = runTime.times();
00065     Info << TimeList << endl;
00066     label nTimes = TimeList.size();
00067 
00068     for(label n=1; n < nTimes; n++)
00069     {
00070         if (TimeList[n].value() > startTime)
00071         {
00072             Info << "Time = " << TimeList[n].value() << nl;
00073 
00074             // Set Time
00075             runTime.setTime(TimeList[n], n);
00076             word CurTime = runTime.timeName();
00077 
00078             IOobjectList objects(mesh, runTime.timeName());
00079 
00080 #           include "moveMesh.H"
00081 
00082             // set the filename of the GMV file
00083             fileName gmvFileName = "plotGMV." + itoa(n);
00084             OFstream gmvFile(args.rootPath()/args.caseName()/gmvFileName);
00085 
00086 #           include "gmvOutputHeader.H"
00087 #           include "gmvOutput.H"
00088 #           include "gmvOutputTail.H"
00089         }
00090     }
00091 
00092     Info<< "\nEnd\n" << endl;
00093 
00094     return 0;
00095 }
00096 
00097 
00098 // ************************************************************************* //
00099 
Copyright © 2000-2009 OpenCFD Ltd