ignitionSite.H
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-2019 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 Class
25  Foam::ignitionSite
26 
27 Description
28  Foam::ignitionSite
29 
30 SourceFiles
31  ignitionSiteI.H
32  ignitionSite.C
33  ignitionSiteIO.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef ignitionSite_H
38 #define ignitionSite_H
39 
40 #include "vector.H"
41 #include "labelList.H"
42 #include "scalarList.H"
43 #include "autoPtr.H"
44 #include "dictionary.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 class Time;
52 class engineTime;
53 class fvMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class ignitionSite Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class ignitionSite
60 {
61  // Private Data
62 
63  const Time& db_;
64  const fvMesh& mesh_;
65 
66  dictionary ignitionSiteDict_;
67 
68  vector location_;
69  scalar diameter_;
70  scalar time_;
71  scalar duration_;
72  scalar strength_;
73 
74  labelList cells_;
75  scalarList cellVolumes_;
76 
77  //- Current time index.
78  // Used during the update for moving meshes
79  mutable label timeIndex_;
80 
81 
82  // Private Member Functions
83 
84  void findIgnitionCells(const fvMesh&);
85 
86 
87 public:
88 
89  // Public classes
90 
91  //- Class used for the read-construction of
92  // PtrLists of ignitionSite
93  class iNew
94  {
95  const Time& db_;
96  const fvMesh& mesh_;
97 
98  public:
99 
100  iNew(const Time& db, const fvMesh& mesh)
101  :
102  db_(db),
103  mesh_(mesh)
104  {}
107  {
108  return autoPtr<ignitionSite>(new ignitionSite(is, db_, mesh_));
109  }
110  };
111 
112 
113  // Constructors
114 
115  //- Construct from Istream and database
116  ignitionSite(Istream&, const Time&, const fvMesh&);
117 
118  //- Construct from Istream and engineTime
119  ignitionSite(Istream&, const engineTime&, const fvMesh&);
120 
121  //- Copy constructor
122  ignitionSite(const ignitionSite&) = default;
123 
124  //- Clone
126  {
127  return autoPtr<ignitionSite>(new ignitionSite(*this));
128  }
129 
130 
131  // Member Functions
132 
133  // Access
135  const vector& location() const
136  {
137  return location_;
138  }
140  scalar diameter() const
141  {
142  return diameter_;
143  }
145  scalar time() const
146  {
147  return time_;
148  }
150  scalar duration() const
151  {
152  return duration_;
153  }
155  scalar strength() const
156  {
157  return strength_;
158  }
159 
160  //- Return the ignition cells updated if the mesh moved
161  const labelList& cells() const;
163  const scalarList& cellVolumes() const
164  {
165  return cellVolumes_;
166  }
167 
168 
169  // Check
170 
171  bool igniting() const;
172 
173  bool ignited() const;
174 
175 
176  // Member Operators
177 
178  void operator=(const ignitionSite&);
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
bool ignited() const
Definition: ignitionSite.C:112
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
ignitionSite(Istream &, const Time &, const fvMesh &)
Construct from Istream and database.
scalar duration() const
Definition: ignitionSite.H:149
scalar diameter() const
Definition: ignitionSite.H:139
An abstract class for the time description of the piston motion.
Definition: engineTime.H:51
const scalarList & cellVolumes() const
Definition: ignitionSite.H:162
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
void operator=(const ignitionSite &)
Definition: ignitionSite.C:123
const vector & location() const
Definition: ignitionSite.H:134
dynamicFvMesh & mesh
const labelList & cells() const
Return the ignition cells updated if the mesh moved.
Definition: ignitionSite.C:86
bool igniting() const
Definition: ignitionSite.C:98
iNew(const Time &db, const fvMesh &mesh)
Definition: ignitionSite.H:99
Foam::ignitionSite.
Definition: ignitionSite.H:58
autoPtr< ignitionSite > operator()(Istream &is) const
Definition: ignitionSite.H:105
scalar time() const
Definition: ignitionSite.H:144
autoPtr< ignitionSite > clone() const
Clone.
Definition: ignitionSite.H:124
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Class used for the read-construction of.
Definition: ignitionSite.H:92
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Namespace for OpenFOAM.
scalar strength() const
Definition: ignitionSite.H:154