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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Application
28  kivaToFoam
29 
30 Group
31  grpMeshConversionUtilities
32 
33 Description
34  Convert a KIVA3v grid to OpenFOAM.
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #include "argList.H"
39 #include "Time.H"
40 #include "polyMesh.H"
41 #include "Fstream.H"
42 #include "cellShape.H"
43 #include "preservePatchTypes.H"
44 #include "emptyPolyPatch.H"
45 #include "wallPolyPatch.H"
46 #include "symmetryPolyPatch.H"
47 #include "wedgePolyPatch.H"
48 #include "oldCyclicPolyPatch.H"
49 #include "unitConversion.H"
50 
51 using namespace Foam;
52 
53 //- Supported KIVA versions
54 enum kivaVersions
55 {
56  kiva3,
57  kiva3v
58 };
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 int main(int argc, char *argv[])
63 {
65  (
66  "Convert a KIVA3v grid to OpenFOAM"
67  );
70  (
71  "file",
72  "name",
73  "Specify alternative input file name - default is otape17"
74  );
76  (
77  "version",
78  "version",
79  "Specify kiva version [kiva3|kiva3v] - default is '3v'"
80  );
82  (
83  "zHeadMin",
84  "scalar",
85  "Minimum z-height for transferring liner faces to cylinder-head"
86  );
87 
88  #include "setRootCase.H"
89  #include "createTime.H"
90 
91  const fileName kivaFileName =
92  args.getOrDefault<fileName>("file", "otape17");
93 
94  kivaVersions kivaVersion = kiva3v;
95  if (args.found("version"))
96  {
97  const word versionName = args["version"];
98 
99  if (versionName == "kiva3")
100  {
101  kivaVersion = kiva3;
102  }
103  else if (versionName == "kiva3v")
104  {
105  kivaVersion = kiva3v;
106  }
107  else
108  {
110  << "KIVA file version " << versionName << " not supported"
111  << exit(FatalError);
112 
113  args.printUsage();
114  FatalError.exit(1);
115  }
116  }
117 
118  const scalar zHeadMin = args.getOrDefault<scalar>("zHeadMin", -GREAT);
119 
120  #include "readKivaGrid.H"
121 
122  Info<< "End\n" << endl;
123 
124  return 0;
125 }
126 
127 
128 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::argList::getOrDefault
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Definition: argListI.H:307
wedgePolyPatch.H
preservePatchTypes.H
preservePatchTypes
wallPolyPatch.H
Foam::argList::addNote
static void addNote(const string &note)
Add extra notes for the usage information.
Definition: argList.C:412
symmetryPolyPatch.H
unitConversion.H
Unit conversion functions.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
polyMesh.H
oldCyclicPolyPatch.H
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
argList.H
Foam::FatalError
error FatalError
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::error::exit
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
Definition: error.C:331
emptyPolyPatch.H
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Time.H
setRootCase.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
readKivaGrid.H
Fstream.H
createTime.H
cellShape.H
Foam::argList::noParallel
static void noParallel()
Remove the parallel options.
Definition: argList.C:510
Foam::argList::addOption
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition: argList.C:335
args
Foam::argList args(argc, argv)
Foam::argList::printUsage
void printUsage(bool full=true) const
Print usage.
Definition: argListHelp.C:366
Foam::argList::found
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:178