30 Foam::scalar Foam::engineValve::adjustCrankAngle(
const scalar theta)
const 32 if (theta < liftProfileStart_)
34 scalar adjustedTheta = theta;
36 while (adjustedTheta < liftProfileStart_)
38 adjustedTheta += liftProfileEnd_ - liftProfileStart_;
43 else if (theta > liftProfileEnd_)
45 scalar adjustedTheta = theta;
47 while (adjustedTheta > liftProfileEnd_)
49 adjustedTheta -= liftProfileEnd_ - liftProfileStart_;
68 const word& bottomPatchName,
69 const word& poppetPatchName,
70 const word& stemPatchName,
71 const word& curtainInPortPatchName,
72 const word& curtainInCylinderPatchName,
73 const word& detachInCylinderPatchName,
74 const word& detachInPortPatchName,
78 const scalar minTopLayer,
79 const scalar maxTopLayer,
80 const scalar minBottomLayer,
81 const scalar maxBottomLayer,
86 meshMover_(refCast<const fvMeshMovers::engine>(meshMover)),
88 bottomPatch_(bottomPatchName, meshMover_.mesh().boundaryMesh()),
89 poppetPatch_(poppetPatchName, meshMover_.mesh().boundaryMesh()),
90 stemPatch_(stemPatchName, meshMover_.mesh().boundaryMesh()),
93 curtainInPortPatchName, meshMover_.mesh().boundaryMesh()
95 curtainInCylinderPatch_
97 curtainInCylinderPatchName, meshMover_.mesh().boundaryMesh()
99 detachInCylinderPatch_
101 detachInCylinderPatchName, meshMover_.mesh().boundaryMesh()
103 detachInPortPatch_(detachInPortPatchName, meshMover_.mesh().boundaryMesh()),
104 detachFaces_(detachFaces),
105 liftProfile_(liftProfile),
106 liftProfileStart_(
min(liftProfile_.
x())),
107 liftProfileEnd_(
max(liftProfile_.
x())),
109 minTopLayer_(minTopLayer),
110 maxTopLayer_(maxTopLayer),
111 minBottomLayer_(minBottomLayer),
112 maxBottomLayer_(maxBottomLayer),
125 meshMover_(refCast<const fvMeshMovers::engine>(meshMover)),
131 dict.
subDict(
"coordinateSystem")
134 bottomPatch_(dict.
lookup(
"bottomPatch"), meshMover_.mesh().boundaryMesh()),
135 poppetPatch_(dict.
lookup(
"poppetPatch"), meshMover_.mesh().boundaryMesh()),
136 stemPatch_(dict.
lookup(
"stemPatch"), meshMover_.mesh().boundaryMesh()),
139 dict.
lookup(
"curtainInPortPatch"),
140 meshMover_.mesh().boundaryMesh()
142 curtainInCylinderPatch_
144 dict.
lookup(
"curtainInCylinderPatch"),
145 meshMover_.mesh().boundaryMesh()
147 detachInCylinderPatch_
149 dict.
lookup(
"detachInCylinderPatch"),
150 meshMover_.mesh().boundaryMesh()
154 dict.
lookup(
"detachInPortPatch"),
155 meshMover_.mesh().boundaryMesh()
157 detachFaces_(dict.
lookup(
"detachFaces")),
158 liftProfile_(
"liftProfile", dict),
159 liftProfileStart_(
min(liftProfile_.
x())),
160 liftProfileEnd_(
max(liftProfile_.
x())),
161 minLift_(dict.
lookup<scalar>(
"minLift")),
162 minTopLayer_(dict.
lookup<scalar>(
"minTopLayer")),
163 maxTopLayer_(dict.
lookup<scalar>(
"maxTopLayer")),
164 minBottomLayer_(dict.
lookup<scalar>(
"minBottomLayer")),
165 maxBottomLayer_(dict.
lookup<scalar>(
"maxBottomLayer")),
166 diameter_(dict.
lookup<scalar>(
"diameter"))
174 return liftProfile_.
value(adjustCrankAngle(theta));
180 return lift(meshMover_.theta()) >= minLift_;
188 lift(meshMover_.theta()),
201 lift(meshMover_.theta() - meshMover_.deltaTheta()),
204 )/(meshMover_.mesh().time().deltaTValue() + vSmall);
213 if (bottomPatch_.
active())
215 mpIDs[nMpIDs] = bottomPatch_.
index();
219 if (poppetPatch_.
active())
221 mpIDs[nMpIDs] = poppetPatch_.
index();
240 <<
"curtainInPortPatch " << curtainInPortPatch_.
name()
242 <<
"curtainInCylinderPatch " << curtainInCylinderPatch_.
name()
244 <<
"detachInCylinderPatch " << detachInCylinderPatch_.
name()
246 <<
"detachInPortPatch " << detachInPortPatch_.
name()
249 <<
"liftProfile " <<
nl << token::BEGIN_BLOCK
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
A list of keyword definitions, which are a keyword followed by any number of values (e...
bool isOpen() const
Is the valve open?
virtual Type value(const scalar x) const
Return Table value as a function of scalar x.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Abstract base class for fvMesh movers.
void writeDict(Ostream &) const
Write dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
scalar curVelocity() const
Return valve velocity for current time-step.
A class for handling words, derived from string.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
label index() const
Return index of first matching zone.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
scalar curLift() const
Return current lift.
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
void setSize(const label)
Reset size of List.
static autoPtr< coordinateSystem > New(const objectRegistry &obr, const dictionary &dict)
Select constructed from dictionary and objectRegistry.
bool active() const
Has the zone been found.
const word & name() const
Return name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const coordinateSystem & cs() const
Return coordinate system.
engineValve(const word &name, const fvMeshMover &meshMover, const autoPtr< coordinateSystem > &valveCS, const word &bottomPatchName, const word &poppetPatchName, const word &stemPatchName, const word &curtainInPortPatchName, const word &curtainInCylinderPatchName, const word &detachInCylinderPatchName, const word &detachInPortPatchName, const labelList &detachFaces, const Function1s::Table< scalar > &liftProfile, const scalar minLift, const scalar minTopLayer, const scalar maxTopLayer, const scalar minBottomLayer, const scalar maxBottomLayer, const scalar diameter)
Construct from components.
const wordRe & name() const
Return name.
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
void writeDict(Ostream &, bool subDict=true) const
Write dictionary.
virtual tmp< scalarField > x() const
Return the reference values.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.