FreeFOAM The Cross-Platform CFD Toolkit
foamToGMV.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Application
25  foamToGMV
26 
27 Description
28  Translates foam output to GMV readable files.
29 
30  A free post-processor with available binaries from
31  http://www-xdiv.lanl.gov/XCM/gmv/
32 
33 Usage
34 
35  - foamToGMV [OPTIONS]
36 
37  @param -case <dir>\n
38  Case directory.
39 
40  @param -parallel \n
41  Run in parallel.
42 
43  @param -help \n
44  Display help message.
45 
46  @param -doc \n
47  Display Doxygen API documentation page for this application.
48 
49  @param -srcDoc \n
50  Display Doxygen source documentation page for this application.
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #include <finiteVolume/fvCFD.H>
55 #include <OpenFOAM/OFstream.H>
56 #include <OpenFOAM/instantList.H>
57 #include <OpenFOAM/IOobjectList.H>
58 #include "itoa.H"
59 #include <lagrangian/Cloud.H>
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 // Main program:
65 
66 int main(int argc, char *argv[])
67 {
68  const label nTypes = 4;
69  const word fieldTypes[] =
70  {
71  "volScalarField",
72  "volVectorField",
73  "surfaceScalarField",
74  cloud::prefix
75  };
76 
77 # include <OpenFOAM/setRootCase.H>
78 
79 # include <OpenFOAM/createTime.H>
80 # include <OpenFOAM/createMesh.H>
81 
83 
84  // get the available time-steps
85  instantList TimeList = runTime.times();
86  Info << TimeList << endl;
87  label nTimes = TimeList.size();
88 
89  for(label n=1; n < nTimes; n++)
90  {
91  if (TimeList[n].value() > startTime)
92  {
93  Info << "Time = " << TimeList[n].value() << nl;
94 
95  // Set Time
96  runTime.setTime(TimeList[n], n);
97  word CurTime = runTime.timeName();
98 
99  IOobjectList objects(mesh, runTime.timeName());
100 
101 # include "moveMesh.H"
102 
103  // set the filename of the GMV file
104  fileName gmvFileName = "plotGMV." + itoa(n);
105  OFstream gmvFile(args.rootPath()/args.caseName()/gmvFileName);
106 
107 # include "gmvOutputHeader.H"
108 # include "gmvOutput.H"
109 # include "gmvOutputTail.H"
110  }
111  }
112 
113  Info<< "\nEnd\n" << endl;
114 
115  return 0;
116 }
117 
118 
119 // ************************ vim: set sw=4 sts=4 et: ************************ //