OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

ignitionSiteIO.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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "ignitionSite.H"
00028 #include "engineTime.H"
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00036 
00037 ignitionSite::ignitionSite(Istream& is, const Time& db, const fvMesh& mesh)
00038 :
00039     db_(db),
00040     mesh_(mesh),
00041     ignitionSiteDict_(is),
00042     location_(ignitionSiteDict_.lookup("location")),
00043     diameter_(readScalar(ignitionSiteDict_.lookup("diameter"))),
00044     time_
00045     (
00046         db_.userTimeToTime
00047         (
00048             readScalar(ignitionSiteDict_.lookup("start"))
00049         )
00050     ),
00051     duration_
00052     (
00053         db_.userTimeToTime
00054         (
00055             readScalar(ignitionSiteDict_.lookup("duration"))
00056         )
00057     ),
00058     strength_(readScalar(ignitionSiteDict_.lookup("strength"))),
00059     timeIndex_(db_.timeIndex())
00060 {
00061     // Check state of Istream
00062     is.check("ignitionSite::ignitionSite(Istream&)");
00063 
00064     findIgnitionCells(mesh_);
00065 }
00066 
00067 
00068 ignitionSite::ignitionSite
00069 (
00070     Istream& is,
00071     const engineTime& edb,
00072     const fvMesh& mesh
00073 )
00074 :
00075     db_(edb),
00076     mesh_(mesh),
00077     ignitionSiteDict_(is),
00078     location_(ignitionSiteDict_.lookup("location")),
00079     diameter_(readScalar(ignitionSiteDict_.lookup("diameter"))),
00080     time_
00081     (
00082         db_.userTimeToTime
00083         (
00084             edb.degToTime(readScalar(ignitionSiteDict_.lookup("start")))
00085         )
00086     ),
00087     duration_
00088     (
00089         db_.userTimeToTime
00090         (
00091             edb.degToTime(readScalar(ignitionSiteDict_.lookup("duration")))
00092         )
00093     ),
00094     strength_(readScalar(ignitionSiteDict_.lookup("strength"))),
00095     timeIndex_(db_.timeIndex())
00096 {
00097     // Check state of Istream
00098     is.check("ignitionSite::ignitionSite(Istream&)");
00099 
00100     findIgnitionCells(mesh_);
00101 }
00102 
00103 
00104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00105 
00106 } // End namespace Foam
00107 
00108 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd