freePiston.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) 2017-2020 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::freePiston
26 
27 Description
28  In case of free pistons, the piston position is determined by a user-defined
29  position according to time.
30 
31  The piston trajectory is specified in \c constant/engineGeometry using a
32  table or a separated file. The position is relative to the cylinder head,
33  i.e. decreasing when compressing.
34 
35  For example,
36  \verbatim
37  pistonPositionTime table ( (0 0.13) (0.020 0.03) );
38  \endverbatim
39 
40  or from a file
41  \verbatim
42  pistonPositionTime table;
43  pistonPositionTimeCoeffs
44  {
45  file "data";
46  outOfBounds clamp;
47  interpolationScheme linear;
48  }
49  \endverbatim
50 
51 SourceFiles
52  freePiston.C
53 
54 \*---------------------------------------------------------------------------*/
55 
56 #ifndef freePiston_H
57 #define freePiston_H
58 
59 #include "engineTime.H"
60 #include "dictionary.H"
61 #include "dimensionedScalar.H"
62 #include "Function1.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class freePiston Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 class freePiston
74 :
75  public engineTime
76 {
77  // Private Data
78 
79  autoPtr<Function1<scalar>> pistonPositionTime_;
80 
81 
82 public:
83 
84  //- Runtime type information
85  TypeName("freePiston");
86 
87 
88  // Constructors
89 
90  //- Construct from objectRegistry arguments
92  (
93  const word& name,
94  const fileName& rootPath,
95  const fileName& caseName,
96  const fileName& systemName = "system",
97  const fileName& constantName = "constant",
98  const fileName& dictName = "engineGeometry"
99  );
100 
101  //- Disallow default bitwise copy construction
102  freePiston(const freePiston&) = delete;
103 
104 
105  //- Destructor
106  virtual ~freePiston()
107  {}
108 
109 
110  // Member Functions
111 
112  // Conversion
113 
114  //- Calculate the piston position from the engine geometry
115  // and given crank angle.
116  scalar pistonPosition(const scalar theta) const;
117 
118 
119  // Access
120 
121  //- Return current engine time
122  virtual scalar theta() const;
123 
124  //- Return time unit
125  virtual word unit() const;
126 
127  //- Return engine time increment
128  virtual scalar deltaTheta() const;
129 
130 
131  // Member Operators
132 
133  //- Disallow default bitwise assignment
134  void operator=(const freePiston&) = delete;
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
void operator=(const freePiston &)=delete
Disallow default bitwise assignment.
dimensionedScalar pistonPosition() const
Return current piston position.
Definition: engineTime.C:93
freePiston(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: freePiston.C:41
An abstract class for the time description of the piston motion.
Definition: engineTime.H:51
virtual word unit() const
Return time unit.
Definition: freePiston.C:73
In case of free pistons, the piston position is determined by a user-defined position according to ti...
Definition: freePiston.H:72
A class for handling words, derived from string.
Definition: word.H:59
const fileName & caseName() const
Return case name.
Definition: TimePaths.H:107
const fileName & rootPath() const
Return root path.
Definition: TimePaths.H:95
virtual ~freePiston()
Destructor.
Definition: freePiston.H:105
const word & name() const
Return const reference to name.
virtual scalar theta() const
Return current engine time.
Definition: freePiston.C:67
virtual scalar deltaTheta() const
Return engine time increment.
Definition: freePiston.C:79
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
TypeName("freePiston")
Runtime type information.
const word dictName("noiseDict")
Namespace for OpenFOAM.