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 -------------------------------------------------------------------------------
11 License
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 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(engineTime, 0);
36  defineRunTimeSelectionTable(engineTime, dictionary);
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  (
62  IOobject
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 {
96  return dimensionedScalar
97  (
98  "pistonPosition",
99  dimLength,
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",
121  dimVelocity,
122  pistonDisplacement().value()/(deltaTValue() + VSMALL)
123  );
124 }
125 
126 
127 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
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
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
dictName
const word dictName("faMeshDefinition")
Foam::engineTime::pistonSpeed
dimensionedScalar pistonSpeed() const
Return piston speed for current time step.
Definition: engineTime.C:116
Foam::Time::read
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:442
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::engineTime::readDict
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: engineTime.C:77
Foam::Time::readDict
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: TimeIO.C:90
Foam::engineTime::engineTime
engineTime(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: engineTime.C:43
engineTime.H
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::engineTime::read
virtual bool read()
Read the controlDict and set all the parameters.
Definition: engineTime.C:83
constant
constant condensation/saturation model.
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::engineTime::pistonPosition
dimensionedScalar pistonPosition() const
Return current piston position.
Definition: engineTime.C:94
Foam::engineTime::pistonDisplacement
dimensionedScalar pistonDisplacement() const
Return piston displacement for current time step.
Definition: engineTime.C:105