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_;
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),
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())),
159 minLift_(dict.
lookup<scalar>(
"minLift")),
160 minTopLayer_(dict.
lookup<scalar>(
"minTopLayer")),
161 maxTopLayer_(dict.
lookup<scalar>(
"maxTopLayer")),
162 minBottomLayer_(dict.
lookup<scalar>(
"minBottomLayer")),
163 maxBottomLayer_(dict.
lookup<scalar>(
"maxBottomLayer")),
164 diameter_(dict.
lookup<scalar>(
"diameter"))
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 polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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 > &)
bool isOpen() const
Is the valve open?
const scalarField & y() const
const keyType & name() const
Return name.
engineValve(const word &name, const polyMesh &mesh, 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 graph &liftProfile, const scalar minLift, const scalar minTopLayer, const scalar maxTopLayer, const scalar minBottomLayer, const scalar maxBottomLayer, const scalar diameter)
Construct from components.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void writeDict(Ostream &) const
Write dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Class to create, store and output qgraph files.
scalar curVelocity() const
Return valve velocity for current time-step.
A class for handling words, derived from string.
Interpolates y values from one curve to another with a different x distribution.
scalar deltaTValue() const
Return time step value.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
label index() const
Return index of first matching zone.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const Time & time() const
Return time.
scalar curLift() const
Return current lift.
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual scalar deltaTheta() const =0
Return engine time increment.
void setSize(const label)
Reset size of List.
virtual scalar theta() const =0
Return current engine time.
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...
Mesh consisting of general polyhedral cells.
const coordinateSystem & cs() const
Return coordinate system.
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
const scalarField & x() const
void writeDict(Ostream &, bool subDict=true) const
Write dictionary.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.