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,
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),
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()
virtual const fileName & name() const
Return the name of the stream.
void setSize(const label)
Reset size of List.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Base class for other coordinate system specifications.
A list of keyword definitions, which are a keyword followed by any number of values (e....
bool isOpen() const
Is the valve open?
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.
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
scalar curLift() const
Return current lift.
void writeDict(Ostream &) const
Write dictionary.
scalar curVelocity() const
Return valve velocity for current time-step.
Abstract base class for fvMesh movers.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
To & refCast(From &r)
Reference type cast template function.
Ostream & endl(Ostream &os)
Add newline and flush stream.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
word name(const complex &)
Return a string representation of a complex.