Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Application
28 kivaToFoam
29
30Group
31 grpMeshConversionUtilities
32
33Description
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
51using namespace Foam;
52
53//- Supported KIVA versions
54enum kivaVersions
55{
56 kiva3,
57 kiva3v
58};
59
60// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62int 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// ************************************************************************* //
static void noParallel()
Remove the parallel options.
Definition argList.C:599
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:400
static void addNote(const string &note)
Add extra notes for the usage information.
Definition argList.C:477
A class for handling file names.
Definition fileName.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
preservePatchTypes
Foam::argList args(argc, argv)
Unit conversion functions.