freePiston.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) 2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::freePiston
28 
29 Description
30  In case of free pistons, the piston position is determined by a user-defined
31  position according to time.
32 
33  The piston trajectory is specified in \c constant/engineGeometry using a
34  table or a separated file. The position is relative to the cylinder head,
35  i.e. decreasing when compressing.
36 
37  For example,
38  \verbatim
39  pistonPositionTime table ( (0 0.13) (0.020 0.03) );
40  \endverbatim
41 
42  or with a tableFile
43  \verbatim
44  pistonPositionTime tableFile;
45  pistonPositionTimeCoeffs
46  {
47  fileName "data";
48  outOfBounds clamp;
49  interpolationScheme linear;
50  }
51  \endverbatim
52 
53 SourceFiles
54  freePiston.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef freePiston_H
59 #define freePiston_H
60 
61 #include "engineTime.H"
62 #include "dictionary.H"
63 #include "dimensionedScalar.H"
64 #include "Function1.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class freePiston Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class freePiston
76 :
77  public engineTime
78 {
79  // Private data
80 
81  autoPtr<Function1<scalar>> pistonPositionTime_;
82 
83 
84  // Private Member Functions
85 
86  //- No copy construct
87  freePiston(const freePiston&) = delete;
88 
89  //- No copy assignment
90  void operator=(const freePiston&) = delete;
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("freePiston");
97 
98 
99  // Constructors
100 
101  //- Construct from objectRegistry arguments
102  freePiston
103  (
104  const word& name,
105  const fileName& rootPath,
106  const fileName& caseName,
107  const fileName& systemName = "system",
108  const fileName& constantName = "constant",
109  const fileName& dictName = "engineGeometry"
110  );
111 
112  //- Destructor
113  virtual ~freePiston() = default;
114 
115 
116  // Member Functions
117 
118  // Conversion
119 
120  //- Calculate the piston position from the engine geometry
121  // and given crank angle.
122  scalar pistonPosition(const scalar theta) const;
123 
124 
125  // Access
126 
127  //- Return current engine time
128  virtual scalar theta() const;
129 
130  //- Return time unit
131  virtual word unit() const;
132 
133  //- Return engine time increment
134  virtual scalar deltaTheta() const;
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
Foam::TimePaths::rootPath
const fileName & rootPath() const
Return root path.
Definition: TimePathsI.H:42
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Function1.H
Foam::freePiston
In case of free pistons, the piston position is determined by a user-defined position according to ti...
Definition: freePiston.H:74
Foam::freePiston::theta
virtual scalar theta() const
Return current engine time.
Definition: freePiston.C:69
dictName
const word dictName("blockMeshDict")
Foam::dimensioned< scalar >::name
const word & name() const
Return const reference to name.
Definition: dimensionedType.C:406
Foam::TimePaths::caseName
const fileName & caseName() const
Return case name.
Definition: TimePathsI.H:54
Foam::freePiston::unit
virtual word unit() const
Return time unit.
Definition: freePiston.C:75
Foam::engineTime
An abstract class for the time description of the piston motion.
Definition: engineTime.H:54
Foam::freePiston::~freePiston
virtual ~freePiston()=default
Destructor.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
dimensionedScalar.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::freePiston::deltaTheta
virtual scalar deltaTheta() const
Return engine time increment.
Definition: freePiston.C:81
engineTime.H
dictionary.H
Foam::freePiston::TypeName
TypeName("freePiston")
Runtime type information.
Foam::engineTime::pistonPosition
dimensionedScalar pistonPosition() const
Return current piston position.
Definition: engineTime.C:94