crankConnectingRodMotion.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) 2024-2026 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::Function1s::crankConnectingRodMotion
26 
27 Description
28  Crank and connecting-rod motion function for piston engines etc.
29 
30  \c value returns the current piston position as a function of
31  the crank-angle in degrees.
32 
33  Usage:
34  \verbatim
35  <name>
36  {
37  type crankConnectingRodMotion;
38 
39  conRodLength 0.2;
40  stroke 0.12;
41  }
42  \endverbatim
43 
44 See also
45  Foam::Function1
46 
47 SourceFiles
48  crankConnectingRodMotionI.H
49  crankConnectingRodMotion.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef crankConnectingRodMotion_H
54 #define crankConnectingRodMotion_H
55 
56 #include "Function1.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 namespace Function1s
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class crankConnectingRodMotion Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 :
71  public Function1<scalar>
72 {
73  // Private data
74 
75  //- Connecting-rod length
76  const scalar conRodLength_;
77 
78  //- Stroke
79  const scalar stroke_;
80 
81 
82 public:
83 
84  // Runtime type information
85  TypeName("crankConnectingRodMotion");
86 
87 
88  // Constructors
89 
90  //- Construct from name and dictionary
92  (
93  const word& name,
94  const unitSets& units,
95  const dictionary& dict
96  );
97 
98  //- Construct and return a clone
99  virtual tmp<Function1<scalar>> clone() const
100  {
101  return tmp<Function1<scalar>>
102  (
103  new crankConnectingRodMotion(*this)
104  );
105  }
106 
107 
108  //- Destructor
109  virtual ~crankConnectingRodMotion();
110 
111 
112  // Member Functions
113 
114  //- Return position for crank-angle theta in deg
115  virtual inline scalar value(const scalar theta) const;
116 
117  //- Not implemented
118  virtual inline tmp<Field<scalar>> value(const scalarField&) const;
119 
120  //- Not implemented
121  virtual inline scalar integral
122  (
123  const scalar,
124  const scalar
125  ) const;
126 
127  //- Not implemented
128  virtual inline tmp<Field<scalar>> integral
129  (
130  const scalarField&,
131  const scalarField&
132  ) const;
133 
134 
135  //- Write data to dictionary stream
136  virtual void write(Ostream& os, const unitSets& units) const;
137 
138 
139  // Member Operators
140 
141  //- Disallow default bitwise assignment
142  void operator=(const crankConnectingRodMotion&) = delete;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Function1s
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #ifdef NoRepository
154  #include "crankConnectingRodMotionI.H"
155 #endif
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Run-time selectable general function of one variable.
Definition: Function1.H:62
const word & name() const
Return the name of the entry.
Definition: Function1.C:78
Crank and connecting-rod motion function for piston engines etc.
crankConnectingRodMotion(const word &name, const unitSets &units, const dictionary &dict)
Construct from name and dictionary.
virtual tmp< Function1< scalar > > clone() const
Construct and return a clone.
virtual scalar value(const scalar theta) const
Return position for crank-angle theta in deg.
virtual void write(Ostream &os, const unitSets &units) const
Write data to dictionary stream.
void operator=(const crankConnectingRodMotion &)=delete
Disallow default bitwise assignment.
TypeName("crankConnectingRodMotion")
virtual scalar integral(const scalar, const scalar) const
Not implemented.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
dictionary dict
Struct containing two unitSets for use in converting both the argument and the value of a Function1.