FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

kivaToFoam.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Application
00025     kivaToFoam
00026 
00027 Description
00028     Converts a KIVA3v grid to FOAM format
00029 
00030 Usage
00031 
00032     - kivaToFoam [OPTIONS]
00033 
00034     @param -zHeadMin <scalar>\n
00035     Minimum cylinder-head height.
00036 
00037     @param -file <kiva file>\n
00038     Use a different kiva file from otape17.
00039 
00040     @param -version <kiva version>\n
00041     Specify kiva version.
00042 
00043     @param -case <dir>\n
00044     Case directory.
00045 
00046     @param -help \n
00047     Display help message.
00048 
00049     @param -doc \n
00050     Display Doxygen API documentation page for this application.
00051 
00052     @param -srcDoc \n
00053     Display Doxygen source documentation page for this application.
00054 
00055 \*---------------------------------------------------------------------------*/
00056 
00057 #include <OpenFOAM/argList.H>
00058 #include <OpenFOAM/Time.H>
00059 #include <OpenFOAM/polyMesh.H>
00060 #include <OpenFOAM/IFstream.H>
00061 #include <OpenFOAM/OFstream.H>
00062 #include <OpenFOAM/cellShape.H>
00063 #include <OpenFOAM/cellModeller.H>
00064 #include <OpenFOAM/preservePatchTypes.H>
00065 #include <OpenFOAM/emptyPolyPatch.H>
00066 #include <OpenFOAM/wallPolyPatch.H>
00067 #include <OpenFOAM/symmetryPolyPatch.H>
00068 #include <OpenFOAM/wedgePolyPatch.H>
00069 #include <OpenFOAM/cyclicPolyPatch.H>
00070 #include <OpenFOAM/mathematicalConstants.H>
00071 
00072 using namespace Foam;
00073 
00074 // Supported KIVA versions
00075 enum kivaVersions
00076 {
00077     kiva3,
00078     kiva3v
00079 };
00080 
00081 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00082 // Main program:
00083 
00084 int main(int argc, char *argv[])
00085 {
00086     argList::noParallel();
00087     argList::validOptions.insert("file", "fileName");
00088     argList::validOptions.insert("version", "[kiva3|kiva3v]");
00089     argList::validOptions.insert("zHeadMin", "scalar");
00090 
00091 #   include <OpenFOAM/setRootCase.H>
00092 #   include <OpenFOAM/createTime.H>
00093 
00094     fileName kivaFileName("otape17");
00095     if (args.optionFound("file"))
00096     {
00097         kivaFileName = args.option("file");
00098     }
00099 
00100     kivaVersions kivaVersion = kiva3v;
00101     if (args.optionFound("version"))
00102     {
00103         word kivaVersionName = args.option("version");
00104 
00105         if (kivaVersionName == "kiva3")
00106         {
00107             kivaVersion = kiva3;
00108         }
00109         else if (kivaVersionName == "kiva3v")
00110         {
00111             kivaVersion = kiva3v;
00112         }
00113         else
00114         {
00115             FatalErrorIn("main(int argc, char *argv[])")
00116                 << "KIVA file version " << kivaVersionName << " not supported"
00117                 << exit(FatalError);
00118 
00119             args.printUsage();
00120 
00121             FatalError.exit(1);
00122         }
00123     }
00124 
00125     scalar zHeadMin = -GREAT;
00126     args.optionReadIfPresent("zHeadMin", zHeadMin);
00127 
00128 #   include "readKivaGrid.H"
00129 
00130     Info << "End\n" << endl;
00131 
00132     return 0;
00133 }
00134 
00135 
00136 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines