engineTime.C
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-2018 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 \*---------------------------------------------------------------------------*/
25 
26 #include "engineTime.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(engineTime, 0);
33  defineRunTimeSelectionTable(engineTime, dictionary);
34 }
35 
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const word& name,
42  const fileName& rootPath,
43  const fileName& caseName,
44  const fileName& systemName,
45  const fileName& constantName,
46  const fileName& dictName
47 )
48 :
49  Time
50  (
51  name,
52  rootPath,
53  caseName,
54  systemName,
55  constantName
56  ),
57  dict_
58  (
59  IOobject
60  (
61  "engineGeometry",
62  constant(),
63  *this,
66  false
67  )
68  )
69 {}
70 
71 
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 
75 {
77 }
78 
79 
81 {
82  if (Time::read())
83  {
84  return true;
85  }
86  else
87  {
88  return false;
89  }
90 }
91 
92 
94 {
95  return dimensionedScalar
96  (
97  "pistonPosition",
98  dimLength,
99  pistonPosition(theta())
100  );
101 }
102 
103 
105 {
106  return dimensionedScalar
107  (
108  "pistonDisplacement",
109  dimLength,
110  pistonPosition(theta() - deltaTheta()) - pistonPosition().value()
111  );
112 }
113 
114 
116 {
117  return dimensionedScalar
118  (
119  "pistonSpeed",
120  dimVelocity,
121  pistonDisplacement().value()/(deltaTValue() + vSmall)
122  );
123 }
124 
125 
126 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:69
virtual bool read()
Read the controlDict and set all the parameters.
Definition: engineTime.C:80
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: engineTime.C:74
dimensionedScalar pistonPosition() const
Return current piston position.
Definition: engineTime.C:93
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
A class for handling words, derived from string.
Definition: word.H:59
engineTime(const word &name, const fileName &rootPath, const fileName &caseName, const fileName &systemName="system", const fileName &constantName="constant", const fileName &dictName="engineGeometry")
Construct from objectRegistry arguments.
Definition: engineTime.C:40
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: TimeIO.C:35
defineTypeNameAndDebug(combustionModel, 0)
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:431
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar pistonSpeed() const
Return piston speed for current time step.
Definition: engineTime.C:115
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.
dimensionedScalar pistonDisplacement() const
Return piston displacement for current time step.
Definition: engineTime.C:104
const dimensionSet dimVelocity