freePiston.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "freePiston.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(freePiston, 0);
34  addToRunTimeSelectionTable(engineTime, freePiston, dictionary);
35 }
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
41 (
42  const word& name,
43  const fileName& rootPath,
44  const fileName& caseName,
45  const fileName& systemName,
46  const fileName& constantName,
47  const fileName& dictName
48 )
49 :
51  (
52  name,
53  rootPath,
54  caseName,
55  systemName,
56  constantName
57  ),
58  pistonPositionTime_
59  (
60  Function1<scalar>::New("pistonPositionTime", dict_)
61  )
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
67 Foam::scalar Foam::freePiston::theta() const
68 {
69  return value();
70 }
71 
72 
74 {
75  return " s";
76 }
77 
78 
79 Foam::scalar Foam::freePiston::deltaTheta() const
80 {
81  return deltaTValue();
82 }
83 
84 
85 Foam::scalar Foam::freePiston::pistonPosition(const scalar theta) const
86 {
87  return pistonPositionTime_->value(theta);
88 }
89 
90 
91 // ************************************************************************* //
Run-time selectable general function of one variable.
Definition: Function1.H:52
A class for handling file names.
Definition: fileName.H:79
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
Macros for easy insertion into run-time selection tables.
A class for handling words, derived from string.
Definition: word.H:59
const Type & value() const
Return const reference to value.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual scalar theta() const
Return current engine time.
Definition: freePiston.C:67
virtual scalar deltaTheta() const
Return engine time increment.
Definition: freePiston.C:79
Namespace for OpenFOAM.