All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kivaToFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
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 OpenFOAM format.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "argList.H"
33 #include "Time.H"
34 #include "polyMesh.H"
35 #include "IFstream.H"
36 #include "OFstream.H"
37 #include "cellShape.H"
38 #include "cellModeller.H"
39 #include "preservePatchTypes.H"
40 #include "emptyPolyPatch.H"
41 #include "wallPolyPatch.H"
42 #include "symmetryPolyPatch.H"
43 #include "wedgePolyPatch.H"
44 #include "mergedCyclicPolyPatch.H"
45 #include "polyMeshUnMergeCyclics.H"
46 
47 using namespace Foam;
48 
49 //- Supported KIVA versions
50 enum kivaVersions
51 {
52  kiva3,
53  kiva3v
54 };
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 int main(int argc, char *argv[])
59 {
62  (
63  "file",
64  "name",
65  "specify alternative input file name - default is otape17"
66  );
68  (
69  "version",
70  "version",
71  "specify kiva version [kiva3|kiva3v] - default is '3v'"
72  );
74  (
75  "zHeadMin",
76  "scalar",
77  "minimum z-height for transferring liner faces to cylinder-head"
78  );
79 
80  #include "setRootCase.H"
82 
83  const fileName kivaFileName =
84  args.optionLookupOrDefault<fileName>("file", "otape17");
85 
86  kivaVersions kivaVersion = kiva3v;
87  if (args.optionFound("version"))
88  {
89  const word versionName = args["version"];
90 
91  if (versionName == "kiva3")
92  {
93  kivaVersion = kiva3;
94  }
95  else if (versionName == "kiva3v")
96  {
97  kivaVersion = kiva3v;
98  }
99  else
100  {
101  args.printUsage();
102 
104  << "KIVA file version " << versionName << " not supported"
105  << exit(FatalError);
106  }
107  }
108 
109  scalar zHeadMin = -great;
110  args.optionReadIfPresent("zHeadMin", zHeadMin);
111 
112  #include "readKivaGrid.H"
113 
114  Info<< "End\n" << endl;
115 
116  return 0;
117 }
118 
119 
120 // ************************************************************************* //
static void addOption(const word &opt, const string &param="", const string &usage="")
Add to an option to validOptions with usage information.
Definition: argList.C:128
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:114
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:204
static void noParallel()
Remove the parallel options.
Definition: argList.C:175
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
Definition: argListI.H:243
void printUsage() const
Print usage.
Definition: argList.C:1238
A class for handling file names.
Definition: fileName.H:82
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
int main(int argc, char *argv[])
Definition: financialFoam.C:44
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
error FatalError
preservePatchTypes
Foam::argList args(argc, argv)