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 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "ignitionSite.H"
30#include "engineTime.H"
31
32// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33
35(
36 Istream& is,
37 const Time& db,
38 const fvMesh& mesh
39)
40:
41 db_(db),
42 mesh_(mesh),
43 ignitionSiteDict_(is),
44 location_(ignitionSiteDict_.get<vector>("location")),
45 diameter_(ignitionSiteDict_.get<scalar>("diameter")),
46 time_
47 (
48 db_.userTimeToTime
49 (
50 ignitionSiteDict_.get<scalar>("start")
51 )
52 ),
53 duration_
54 (
55 db_.userTimeToTime
56 (
57 ignitionSiteDict_.get<scalar>("duration")
58 )
59 ),
60 strength_(ignitionSiteDict_.get<scalar>("strength")),
61 timeIndex_(db_.timeIndex())
62{
63 // Check state of Istream
65
66 findIgnitionCells(mesh_);
67}
68
69
71(
72 Istream& is,
73 const engineTime& edb,
74 const fvMesh& mesh
75)
76:
77 db_(edb),
78 mesh_(mesh),
79 ignitionSiteDict_(is),
80 location_(ignitionSiteDict_.get<vector>("location")),
81 diameter_(ignitionSiteDict_.get<scalar>("diameter")),
82 time_
83 (
84 db_.userTimeToTime
85 (
86 edb.userTimeToTime
87 (
88 ignitionSiteDict_.get<scalar>("start")
89 )
90 )
91 ),
92 duration_
93 (
94 db_.userTimeToTime
95 (
96 edb.userTimeToTime
97 (
98 ignitionSiteDict_.get<scalar>("duration")
99 )
100 )
101 ),
102 strength_(ignitionSiteDict_.get<scalar>("strength")),
103 timeIndex_(db_.timeIndex())
104{
105 // Check state of Istream
107
108 findIgnitionCells(mesh_);
109}
110
111
112// ************************************************************************* //
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
An abstract class for the time description of the piston motion.
Definition: engineTime.H:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Foam::ignitionSite.
Definition: ignitionSite.H:63
dynamicFvMesh & mesh
#define FUNCTION_NAME
label timeIndex
Definition: getTimeIndex.H:30