32 Foam::scalar Foam::engineValve::adjustCrankAngle(
const scalar theta)
const 34 if (theta < liftProfileStart_)
36 scalar adjustedTheta = theta;
38 while (adjustedTheta < liftProfileStart_)
40 adjustedTheta += liftProfileEnd_ - liftProfileStart_;
45 else if (theta > liftProfileEnd_)
47 scalar adjustedTheta = theta;
49 while (adjustedTheta > liftProfileEnd_)
51 adjustedTheta -= liftProfileEnd_ - liftProfileStart_;
70 const word& bottomPatchName,
71 const word& poppetPatchName,
72 const word& stemPatchName,
73 const word& curtainInPortPatchName,
74 const word& curtainInCylinderPatchName,
75 const word& detachInCylinderPatchName,
76 const word& detachInPortPatchName,
80 const scalar minTopLayer,
81 const scalar maxTopLayer,
82 const scalar minBottomLayer,
83 const scalar maxBottomLayer,
89 engineDB_(refCast<const engineTime>(mesh.
time())),
94 curtainInPortPatch_(curtainInPortPatchName, mesh.
boundaryMesh()),
95 curtainInCylinderPatch_(curtainInCylinderPatchName, mesh.
boundaryMesh()),
96 detachInCylinderPatch_(detachInCylinderPatchName, mesh.
boundaryMesh()),
97 detachInPortPatch_(detachInPortPatchName, mesh.
boundaryMesh()),
98 detachFaces_(detachFaces),
99 liftProfile_(liftProfile),
100 liftProfileStart_(
min(liftProfile_.
x())),
101 liftProfileEnd_(
max(liftProfile_.
x())),
103 minTopLayer_(minTopLayer),
104 maxTopLayer_(maxTopLayer),
105 minBottomLayer_(minBottomLayer),
106 maxBottomLayer_(maxBottomLayer),
120 engineDB_(refCast<const engineTime>(mesh_.
time())),
126 dict.
subDict(
"coordinateSystem")
134 dict.
lookup(
"curtainInPortPatch"),
137 curtainInCylinderPatch_
139 dict.
lookup(
"curtainInCylinderPatch"),
142 detachInCylinderPatch_
144 dict.
lookup(
"detachInCylinderPatch"),
149 dict.
lookup(
"detachInPortPatch"),
152 detachFaces_(dict.
lookup(
"detachFaces")),
153 liftProfile_(
"liftProfile", dict),
154 liftProfileStart_(
min(liftProfile_.
x())),
155 liftProfileEnd_(
max(liftProfile_.
x())),
156 minLift_(dict.
lookup<scalar>(
"minLift")),
157 minTopLayer_(dict.
lookup<scalar>(
"minTopLayer")),
158 maxTopLayer_(dict.
lookup<scalar>(
"maxTopLayer")),
159 minBottomLayer_(dict.
lookup<scalar>(
"minBottomLayer")),
160 maxBottomLayer_(dict.
lookup<scalar>(
"maxBottomLayer")),
161 diameter_(dict.
lookup<scalar>(
"diameter"))
169 return liftProfile_.
value(adjustCrankAngle(theta));
175 return lift(engineDB_.
theta()) >= minLift_;
208 if (bottomPatch_.
active())
210 mpIDs[nMpIDs] = bottomPatch_.
index();
214 if (poppetPatch_.
active())
216 mpIDs[nMpIDs] = poppetPatch_.
index();
235 <<
"curtainInPortPatch " << curtainInPortPatch_.
name()
237 <<
"curtainInCylinderPatch " << curtainInCylinderPatch_.
name()
239 <<
"detachInCylinderPatch " << detachInCylinderPatch_.
name()
241 <<
"detachInPortPatch " << detachInPortPatch_.
name()
244 <<
"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?
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.
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 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.
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.
scalar deltaTValue() const
Return time step value.
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.
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.