ignitionSiteIO.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-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "ignitionSite.H"
29 #include "engineTime.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 (
35  Istream& is,
36  const Time& db,
37  const fvMesh& mesh
38 )
39 :
40  db_(db),
41  mesh_(mesh),
42  ignitionSiteDict_(is),
43  location_(ignitionSiteDict_.lookup("location")),
44  diameter_(ignitionSiteDict_.get<scalar>("diameter")),
45  time_
46  (
47  db_.userTimeToTime
48  (
49  ignitionSiteDict_.get<scalar>("start")
50  )
51  ),
52  duration_
53  (
54  db_.userTimeToTime
55  (
56  ignitionSiteDict_.get<scalar>("duration")
57  )
58  ),
59  strength_(ignitionSiteDict_.get<scalar>("strength")),
60  timeIndex_(db_.timeIndex())
61 {
62  // Check state of Istream
63  is.check(FUNCTION_NAME);
64 
65  findIgnitionCells(mesh_);
66 }
67 
68 
70 (
71  Istream& is,
72  const engineTime& edb,
73  const fvMesh& mesh
74 )
75 :
76  db_(edb),
77  mesh_(mesh),
78  ignitionSiteDict_(is),
79  location_(ignitionSiteDict_.lookup("location")),
80  diameter_(ignitionSiteDict_.get<scalar>("diameter")),
81  time_
82  (
83  db_.userTimeToTime
84  (
85  edb.userTimeToTime
86  (
87  ignitionSiteDict_.get<scalar>("start")
88  )
89  )
90  ),
91  duration_
92  (
93  db_.userTimeToTime
94  (
95  edb.userTimeToTime
96  (
97  ignitionSiteDict_.get<scalar>("duration")
98  )
99  )
100  ),
101  strength_(ignitionSiteDict_.get<scalar>("strength")),
102  timeIndex_(db_.timeIndex())
103 {
104  // Check state of Istream
105  is.check(FUNCTION_NAME);
106 
107  findIgnitionCells(mesh_);
108 }
109 
110 
111 // ************************************************************************* //
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
ignitionSite.H
Foam::TimeState::userTimeToTime
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Definition: TimeState.C:49
Foam::ignitionSite::ignitionSite
ignitionSite(Istream &, const Time &, const fvMesh &)
Construct from Istream and database.
Definition: ignitionSiteIO.C:34
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:51
Foam::engineTime
An abstract class for the time description of the piston motion.
Definition: engineTime.H:54
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
engineTime.H
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:261