33 Foam::scalar Foam::engineValve::adjustCrankAngle(
const scalar theta)
const 35 if (theta < liftProfileStart_)
37 scalar adjustedTheta = theta;
39 while (adjustedTheta < liftProfileStart_)
41 adjustedTheta += liftProfileEnd_ - liftProfileStart_;
46 else if (theta > liftProfileEnd_)
48 scalar adjustedTheta = theta;
50 while (adjustedTheta > liftProfileEnd_)
52 adjustedTheta -= liftProfileEnd_ - liftProfileStart_;
67 Foam::engineValve::engineValve
72 const word& bottomPatchName,
73 const word& poppetPatchName,
74 const word& stemPatchName,
75 const word& curtainInPortPatchName,
76 const word& curtainInCylinderPatchName,
77 const word& detachInCylinderPatchName,
78 const word& detachInPortPatchName,
80 const graph& liftProfile,
82 const scalar minTopLayer,
83 const scalar maxTopLayer,
84 const scalar minBottomLayer,
85 const scalar maxBottomLayer,
91 engineDB_(refCast<const engineTime>(mesh.
time())),
96 curtainInPortPatch_(curtainInPortPatchName, mesh.
boundaryMesh()),
97 curtainInCylinderPatch_(curtainInCylinderPatchName, mesh.
boundaryMesh()),
98 detachInCylinderPatch_(detachInCylinderPatchName, mesh.
boundaryMesh()),
99 detachInPortPatch_(detachInPortPatchName, mesh.
boundaryMesh()),
100 detachFaces_(detachFaces),
101 liftProfile_(liftProfile),
102 liftProfileStart_(
min(liftProfile_.
x())),
103 liftProfileEnd_(
max(liftProfile_.
x())),
105 minTopLayer_(minTopLayer),
106 maxTopLayer_(maxTopLayer),
107 minBottomLayer_(minBottomLayer),
108 maxBottomLayer_(maxBottomLayer),
114 Foam::engineValve::engineValve
123 engineDB_(refCast<const engineTime>(mesh_.
time())),
129 dict.
subDict(
"coordinateSystem")
137 dict.
lookup(
"curtainInPortPatch"),
140 curtainInCylinderPatch_
142 dict.
lookup(
"curtainInCylinderPatch"),
145 detachInCylinderPatch_
147 dict.
lookup(
"detachInCylinderPatch"),
152 dict.
lookup(
"detachInPortPatch"),
155 detachFaces_(dict.
lookup(
"detachFaces")),
156 liftProfile_(
"theta",
"lift", name_, dict.
lookup(
"liftProfile")),
157 liftProfileStart_(
min(liftProfile_.
x())),
158 liftProfileEnd_(
max(liftProfile_.
x())),
177 adjustCrankAngle(theta),
186 return lift(engineDB_.
theta()) >= minLift_;
219 if (bottomPatch_.
active())
221 mpIDs[nMpIDs] = bottomPatch_.
index();
225 if (poppetPatch_.
active())
227 mpIDs[nMpIDs] = poppetPatch_.
index();
246 <<
"curtainInPortPatch " << curtainInPortPatch_.
name()
248 <<
"curtainInCylinderPatch " << curtainInCylinderPatch_.
name()
250 <<
"detachInCylinderPatch " << detachInCylinderPatch_.
name()
252 <<
"detachInPortPatch " << detachInPortPatch_.
name()
255 <<
"liftProfile " <<
nl << token::BEGIN_BLOCK
const Time & time() const
Return time.
void writeDict(Ostream &) const
Write dictionary.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const keyType & name() const
Return name.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void writeDict(Ostream &, bool subDict=true) const
Write dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const coordinateSystem & cs() const
Return coordinate system.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
label index() const
Return index of first matching zone.
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
Class to create, store and output qgraph files.
const scalarField & x() const
A class for handling words, derived from string.
Interpolates y values from one curve to another with a different x distribution.
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
bool isOpen() const
Is the valve open?
An Ostream is an abstract base class for all output systems (streams, files, token lists...
scalar curLift() const
Return current lift.
scalar deltaTValue() const
Return time step value.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
scalar curVelocity() const
Return valve velocity for current time-step.
void setSize(const label)
Reset size of List.
static autoPtr< coordinateSystem > New(const objectRegistry &obr, const dictionary &dict)
Select constructed from dictionary and objectRegistry.
scalar theta() const
Return current crank-angle.
scalar deltaTheta() const
Return crank-angle increment.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Mesh consisting of general polyhedral cells.
const word & name() const
Return name.
bool active() const
Has the zone been found.
const scalarField & y() const
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.