FreeFOAM The Cross-Platform CFD Toolkit
kivaToFoam.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  kivaToFoam
26 
27 Description
28  Converts a KIVA3v grid to FOAM format
29 
30 Usage
31 
32  - kivaToFoam [OPTIONS]
33 
34  @param -zHeadMin <scalar>\n
35  Minimum cylinder-head height.
36 
37  @param -file <kiva file>\n
38  Use a different kiva file from otape17.
39 
40  @param -version <kiva version>\n
41  Specify kiva version.
42 
43  @param -case <dir>\n
44  Case directory.
45 
46  @param -help \n
47  Display help message.
48 
49  @param -doc \n
50  Display Doxygen API documentation page for this application.
51 
52  @param -srcDoc \n
53  Display Doxygen source documentation page for this application.
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #include <OpenFOAM/argList.H>
58 #include <OpenFOAM/Time.H>
59 #include <OpenFOAM/polyMesh.H>
60 #include <OpenFOAM/IFstream.H>
61 #include <OpenFOAM/OFstream.H>
62 #include <OpenFOAM/cellShape.H>
63 #include <OpenFOAM/cellModeller.H>
66 #include <OpenFOAM/wallPolyPatch.H>
71 
72 using namespace Foam;
73 
74 // Supported KIVA versions
75 enum kivaVersions
76 {
77  kiva3,
78  kiva3v
79 };
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 // Main program:
83 
84 int main(int argc, char *argv[])
85 {
87  argList::validOptions.insert("file", "fileName");
88  argList::validOptions.insert("version", "[kiva3|kiva3v]");
89  argList::validOptions.insert("zHeadMin", "scalar");
90 
91 # include <OpenFOAM/setRootCase.H>
92 # include <OpenFOAM/createTime.H>
93 
94  fileName kivaFileName("otape17");
95  if (args.optionFound("file"))
96  {
97  kivaFileName = args.option("file");
98  }
99 
100  kivaVersions kivaVersion = kiva3v;
101  if (args.optionFound("version"))
102  {
103  word kivaVersionName = args.option("version");
104 
105  if (kivaVersionName == "kiva3")
106  {
107  kivaVersion = kiva3;
108  }
109  else if (kivaVersionName == "kiva3v")
110  {
111  kivaVersion = kiva3v;
112  }
113  else
114  {
115  FatalErrorIn("main(int argc, char *argv[])")
116  << "KIVA file version " << kivaVersionName << " not supported"
117  << exit(FatalError);
118 
119  args.printUsage();
120 
121  FatalError.exit(1);
122  }
123  }
124 
125  scalar zHeadMin = -GREAT;
126  args.optionReadIfPresent("zHeadMin", zHeadMin);
127 
128 # include "readKivaGrid.H"
129 
130  Info << "End\n" << endl;
131 
132  return 0;
133 }
134 
135 
136 // ************************ vim: set sw=4 sts=4 et: ************************ //