Loading...
Searching...
No Matches
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\*---------------------------------------------------------------------------*/
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 IOobject::NO_REGISTER
70 )
71 )
72{}
73
74
75// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
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",
101 );
102}
103
104
106{
107 return dimensionedScalar
108 (
109 "pistonDisplacement",
110 dimLength,
112 );
113}
114
115
117{
118 return dimensionedScalar
119 (
120 "pistonSpeed",
122 pistonDisplacement().value()/(deltaTValue() + VSMALL)
123 );
124}
125
126
127// ************************************************************************* //
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
scalar deltaTValue() const noexcept
Return time step value.
Definition TimeStateI.H:49
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition TimeIO.C:84
const fileName & rootPath() const noexcept
The root path.
Definition TimePathsI.H:66
virtual bool read()
Read control dictionary, update controls and time.
Definition TimeIO.C:434
const fileName & caseName() const noexcept
The case name.
Definition TimePathsI.H:78
Time(const word &ctrlDictName, const argList &args, const bool enableFunctionObjects=true, const bool enableLibs=true, IOobjectOption::readOption rOpt=IOobjectOption::READ_MODIFIED)
Construct from argument list, reading from specified control dictionary name.
Definition TimeI.H:24
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const scalar & value() const noexcept
An abstract class for the time description of the piston motion.
Definition engineTime.H:53
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition engineTime.C:70
virtual scalar deltaTheta() const =0
Return engine time increment.
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:36
const IOdictionary dict_
Definition engineTime.H:57
virtual scalar theta() const =0
Return current engine time.
dimensionedScalar pistonDisplacement() const
Return piston displacement for current time step.
Definition engineTime.C:98
dimensionedScalar pistonPosition() const
Return current piston position.
Definition engineTime.C:87
virtual scalar pistonPosition(const scalar theta) const =0
Calculate the piston position from the engine geometry.
dimensionedScalar pistonSpeed() const
Return piston speed for current time step.
Definition engineTime.C:109
virtual bool read()
Read the controlDict and set all the parameters.
Definition engineTime.C:76
A class for handling file names.
Definition fileName.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
const word dictName("faMeshDefinition")
Different types of constants.
Namespace for OpenFOAM.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
const dimensionSet dimVelocity
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.