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-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 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 with a tableFile
41  \verbatim
42  pistonPositionTime tableFile;
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  // Private Member Functions
83 
84  //- Disallow default bitwise copy construct
85  freePiston(const freePiston&);
86 
87  //- Disallow default bitwise assignment
88  void operator=(const freePiston&);
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("freePiston");
95 
96 
97  // Constructors
98 
99  //- Construct from objectRegistry arguments
100  freePiston
101  (
102  const word& name,
103  const fileName& rootPath,
104  const fileName& caseName,
105  const fileName& systemName = "system",
106  const fileName& constantName = "constant",
107  const fileName& dictName = "engineGeometry"
108  );
109 
110  //- Destructor
111  virtual ~freePiston()
112  {}
113 
114 
115  // Member Functions
116 
117  // Conversion
118 
119  //- Calculate the piston position from the engine geometry
120  // and given crank angle.
121  scalar pistonPosition(const scalar theta) const;
122 
123 
124  // Access
125 
126  //- Return current engine time
127  virtual scalar theta() const;
128 
129  //- Return time unit
130  virtual word unit() const;
131 
132  //- Return engine time increment
133  virtual scalar deltaTheta() const;
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:69
dimensionedScalar pistonPosition() const
Return current piston position.
Definition: engineTime.C:93
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: Time.H:260
const word dictName("particleTrackDict")
virtual ~freePiston()
Destructor.
Definition: freePiston.H:110
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.
Namespace for OpenFOAM.
const fileName & rootPath() const
Return root path.
Definition: Time.H:254