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  or
42  \verbatim
43  pistonPositionTime
44  {
45  type table;
46  file "<constant>/pistonPosition.dat";
47  outOfBounds clamp;
48  interpolationScheme linear;
49  }
50  \endverbatim
51 
52 SourceFiles
53  freePiston.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef freePiston_H
58 #define freePiston_H
59 
60 #include "engineTime.H"
61 #include "dictionary.H"
62 #include "dimensionedScalar.H"
63 #include "Function1.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class freePiston Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 class freePiston
75 :
76  public engineTime
77 {
78  // Private Data
79 
80  autoPtr<Function1<scalar>> pistonPositionTime_;
81 
82 
83  // Private Member Functions
84 
85  //- No copy construct
86  freePiston(const freePiston&) = delete;
87 
88  //- No copy assignment
89  void operator=(const freePiston&) = delete;
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("freePiston");
96 
97 
98  // Constructors
99 
100  //- Construct from objectRegistry arguments
101  freePiston
102  (
103  const word& name,
104  const fileName& rootPath,
105  const fileName& caseName,
106  const fileName& systemName = "system",
107  const fileName& constantName = "constant",
108  const fileName& dictName = "engineGeometry"
109  );
110 
111  //- Destructor
112  virtual ~freePiston() = default;
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 // ************************************************************************* //
Foam::TimePaths::rootPath
const fileName & rootPath() const
Return root path.
Definition: TimePathsI.H:50
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
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:73
dictName
const word dictName("faMeshDefinition")
Foam::freePiston::theta
virtual scalar theta() const
Return current engine time.
Definition: freePiston.C:69
Foam::dimensioned::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:62
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