engineTime.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-2017 OpenFOAM Foundation
9 Copyright (C) 2019 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
27Class
28 Foam::engineTime
29
30Description
31 An abstract class for the time description of the piston motion
32
33SourceFiles
34 engineTime.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef engineTime_H
39#define engineTime_H
40
41#include "Time.H"
42#include "IOdictionary.H"
43#include "dimensionedScalar.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class engineTime Declaration
53\*---------------------------------------------------------------------------*/
55class engineTime
56:
57 public Time
58{
59
60protected:
62 const IOdictionary dict_;
63
64
65public:
66
67 //- Runtime type information
68 TypeName("engineTime");
69
70
71 //- Declare runtime constructor selection table
73 (
74 autoPtr,
77 (
78 const word& name,
79 const fileName& rootPath,
80 const fileName& caseName,
81 const fileName& systemName,
82 const fileName& constantName,
83 const fileName& dictName
84 ),
85 (name, rootPath, caseName, systemName, constantName, dictName)
86 );
87
88
89 // Constructors
90
91 //- Construct from objectRegistry arguments
93 (
94 const word& name,
95 const fileName& rootPath,
96 const fileName& caseName,
97 const fileName& systemName = "system",
98 const fileName& constantName = "constant",
99 const fileName& dictName = "engineGeometry"
100 );
101
102
103 // Selector
104
106 (
107 const word& name,
108 const fileName& rootPath,
109 const fileName& caseName,
110 const fileName& systemName = "system",
111 const fileName& constantName = "constant",
112 const fileName& dictName = "engineGeometry"
113 );
114
115
116 //- Destructor
117 virtual ~engineTime() = default;
118
119
120 // Member Functions
121 // Conversion
122
123 //- Calculate the piston position from the engine geometry
124 // and given timr (CA or s)
125 virtual scalar pistonPosition(const scalar theta) const = 0;
126
127
128 // Access
129
130 //- Return the engine geometry dictionary
131 inline const IOdictionary& engineDict() const
132 {
133 return dict_;
134 }
135
136 //- Return current engine time
137 // (value might be expressed in CA or s depending on the model)
138 virtual scalar theta() const = 0;
139
140 //- Return time unit
141 virtual word unit() const = 0;
142
143 //- Return engine time increment
144 // (value might be expressed in CA or s depending on the model)
145 virtual scalar deltaTheta() const = 0;
146
147 //- Return current piston position
149
150 //- Return piston displacement for current time step
152
153 //- Return piston speed for current time step
155
156
157 // Member functions overriding the virtual functions in time
158
159 //- Read the control dictionary and set the write controls etc.
160 virtual void readDict();
161
162
163 // Edit
164
165 //- Read the controlDict and set all the parameters
166 virtual bool read();
167};
168
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172} // End namespace Foam
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
const fileName & caseName() const
Return case name.
Definition: TimePathsI.H:62
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
const fileName & rootPath() const
Return root path.
Definition: TimePathsI.H:50
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const
Return const reference to name.
An abstract class for the time description of the piston motion.
Definition: engineTime.H:57
virtual word unit() const =0
Return time unit.
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: engineTime.C:77
virtual scalar deltaTheta() const =0
Return engine time increment.
const IOdictionary & engineDict() const
Return the engine geometry dictionary.
Definition: engineTime.H:130
const IOdictionary dict_
Definition: engineTime.H:61
virtual scalar theta() const =0
Return current engine time.
virtual ~engineTime()=default
Destructor.
dimensionedScalar pistonDisplacement() const
Return piston displacement for current time step.
Definition: engineTime.C:105
dimensionedScalar pistonPosition() const
Return current piston position.
Definition: engineTime.C:94
declareRunTimeSelectionTable(autoPtr, engineTime, dictionary,(const word &name, const fileName &rootPath, const fileName &caseName, const fileName &systemName, const fileName &constantName, const fileName &dictName),(name, rootPath, caseName, systemName, constantName, dictName))
Declare runtime constructor selection table.
TypeName("engineTime")
Runtime type information.
dimensionedScalar pistonSpeed() const
Return piston speed for current time step.
Definition: engineTime.C:116
virtual bool read()
Read the controlDict and set all the parameters.
Definition: engineTime.C:83
A class for handling file names.
Definition: fileName.H:76
A class for handling words, derived from Foam::string.
Definition: word.H:68
const word dictName("faMeshDefinition")
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73