ignitionSite.H
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 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ignitionSite
29 
30 Description
31  Foam::ignitionSite
32 
33 SourceFiles
34  ignitionSiteI.H
35  ignitionSite.C
36  ignitionSiteIO.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef ignitionSite_H
41 #define ignitionSite_H
42 
43 #include "vector.H"
44 #include "labelList.H"
45 #include "scalarList.H"
46 #include "autoPtr.H"
47 #include "dictionary.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 class Time;
56 class engineTime;
57 class fvMesh;
58 
59 /*---------------------------------------------------------------------------*\
60  Class ignitionSite Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class ignitionSite
64 {
65  // Private Data
66 
67  const Time& db_;
68  const fvMesh& mesh_;
69 
70  dictionary ignitionSiteDict_;
71 
72  vector location_;
73  scalar diameter_;
74  scalar time_;
75  scalar duration_;
76  scalar strength_;
77 
78  labelList cells_;
79  scalarList cellVolumes_;
80 
81  //- Current time index.
82  // Used during the update for moving meshes
83  mutable label timeIndex_;
84 
85 
86  // Private Member Functions
87 
88  void findIgnitionCells(const fvMesh&);
89 
90 
91 public:
92 
93  // Public Classes
94 
95  //- Read-construction of PtrLists of ignitionSite
96  class iNew
97  {
98  const Time& db_;
99  const fvMesh& mesh_;
100 
101  public:
102 
103  iNew(const Time& db, const fvMesh& mesh)
104  :
105  db_(db),
106  mesh_(mesh)
107  {}
108 
110  {
111  return autoPtr<ignitionSite>::New(is, db_, mesh_);
112  }
113  };
114 
115 
116  // Generated Methods
117 
118  //- Copy construct
119  ignitionSite(const ignitionSite&) = default;
120 
121 
122  // Constructors
123 
124  //- Construct from Istream and database
125  ignitionSite(Istream&, const Time&, const fvMesh&);
126 
127  //- Construct from Istream and engineTime
128  ignitionSite(Istream&, const engineTime&, const fvMesh&);
129 
130  //- Clone
132  {
133  return autoPtr<ignitionSite>::New(*this);
134  }
135 
136 
137  // Member Functions
138 
139  // Access
140 
141  const vector& location() const
142  {
143  return location_;
144  }
145 
146  scalar diameter() const
147  {
148  return diameter_;
149  }
150 
151  scalar time() const
152  {
153  return time_;
154  }
155 
156  scalar duration() const
157  {
158  return duration_;
159  }
160 
161  scalar strength() const
162  {
163  return strength_;
164  }
165 
166  //- Return the ignition cells updated if the mesh moved
167  const labelList& cells() const;
168 
169  const scalarList& cellVolumes() const
170  {
171  return cellVolumes_;
172  }
173 
174 
175  // Check
176 
177  bool igniting() const;
178 
179  bool ignited() const;
180 
181 
182  // Member Operators
183 
184  void operator=(const ignitionSite&);
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::ignitionSite::ignitionSite
ignitionSite(const ignitionSite &)=default
Copy construct.
Foam::ignitionSite::cells
const labelList & cells() const
Return the ignition cells updated if the mesh moved.
Definition: ignitionSite.C:89
Foam::ignitionSite::cellVolumes
const scalarList & cellVolumes() const
Definition: ignitionSite.H:168
Foam::ignitionSite::time
scalar time() const
Definition: ignitionSite.H:150
Foam::ignitionSite::iNew::iNew
iNew(const Time &db, const fvMesh &mesh)
Definition: ignitionSite.H:102
scalarList.H
Foam::ignitionSite
Foam::ignitionSite.
Definition: ignitionSite.H:62
Foam::ignitionSite::clone
autoPtr< ignitionSite > clone() const
Clone.
Definition: ignitionSite.H:130
labelList.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::ignitionSite::strength
scalar strength() const
Definition: ignitionSite.H:160
Foam::ignitionSite::duration
scalar duration() const
Definition: ignitionSite.H:155
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::ignitionSite::ignited
bool ignited() const
Definition: ignitionSite.C:115
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::ignitionSite::diameter
scalar diameter() const
Definition: ignitionSite.H:145
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ignitionSite::iNew
Read-construction of PtrLists of ignitionSite.
Definition: ignitionSite.H:95
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::ignitionSite::iNew::operator()
autoPtr< ignitionSite > operator()(Istream &is) const
Definition: ignitionSite.H:108
Foam::Vector< scalar >
Foam::List< label >
Foam::ignitionSite::operator=
void operator=(const ignitionSite &)
Definition: ignitionSite.C:126
Foam::ignitionSite::igniting
bool igniting() const
Definition: ignitionSite.C:101
dictionary.H
vector.H
Foam::ignitionSite::location
const vector & location() const
Definition: ignitionSite.H:140
autoPtr.H