engineTime.C
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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "engineTime.H"
30
31// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32
33namespace Foam
34{
37}
38
39
40// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41
43(
44 const word& name,
45 const fileName& rootPath,
46 const fileName& caseName,
47 const fileName& systemName,
48 const fileName& constantName,
49 const fileName& dictName
50)
51:
52 Time
53 (
54 name,
55 rootPath,
56 caseName,
57 systemName,
58 constantName
59 ),
60 dict_
61 (
63 (
64 "engineGeometry",
65 constant(),
66 *this,
67 IOobject::MUST_READ_IF_MODIFIED,
68 IOobject::NO_WRITE,
69 false
70 )
71 )
72{}
73
74
75// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76
78{
80}
81
82
84{
85 if (Time::read())
86 {
87 return true;
88 }
89
90 return false;
91}
92
93
95{
97 (
98 "pistonPosition",
100 pistonPosition(theta())
101 );
102}
103
104
106{
107 return dimensionedScalar
108 (
109 "pistonDisplacement",
110 dimLength,
111 pistonPosition(theta() - deltaTheta()) - pistonPosition().value()
112 );
113}
114
115
117{
118 return dimensionedScalar
119 (
120 "pistonSpeed",
122 pistonDisplacement().value()/(deltaTValue() + VSMALL)
123 );
124}
125
126
127// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: TimeIO.C:90
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:442
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
An abstract class for the time description of the piston motion.
Definition: engineTime.H:57
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: engineTime.C:77
dimensionedScalar pistonDisplacement() const
Return piston displacement for current time step.
Definition: engineTime.C:105
dimensionedScalar pistonPosition() const
Return current piston position.
Definition: engineTime.C:94
dimensionedScalar pistonSpeed() const
Return piston speed for current time step.
Definition: engineTime.C:116
virtual bool read()
Read the controlDict and set all the parameters.
Definition: engineTime.C:83
A class for handling file names.
Definition: fileName.H:76
constant condensation/saturation model.
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
const word dictName("faMeshDefinition")
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
const dimensionSet dimVelocity
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.