36 Foam::scalar Foam::engineValve::adjustCrankAngle(
const scalar theta)
const 38 if (theta < liftProfileStart_)
40 scalar adjustedTheta = theta;
42 while (adjustedTheta < liftProfileStart_)
44 adjustedTheta += liftProfileEnd_ - liftProfileStart_;
49 else if (theta > liftProfileEnd_)
51 scalar adjustedTheta = theta;
53 while (adjustedTheta > liftProfileEnd_)
55 adjustedTheta -= liftProfileEnd_ - liftProfileStart_;
69 Foam::engineValve::engineValve
73 const autoPtr<coordinateSystem>& valveCS,
74 const word& bottomPatchName,
75 const word& poppetPatchName,
76 const word& stemPatchName,
77 const word& curtainInPortPatchName,
78 const word& curtainInCylinderPatchName,
79 const word& detachInCylinderPatchName,
80 const word& detachInPortPatchName,
82 const graph& liftProfile,
84 const scalar minTopLayer,
85 const scalar maxTopLayer,
86 const scalar minBottomLayer,
87 const scalar maxBottomLayer,
94 csysPtr_(valveCS.clone()),
95 bottomPatch_(bottomPatchName,
mesh.boundaryMesh()),
96 poppetPatch_(poppetPatchName,
mesh.boundaryMesh()),
97 stemPatch_(stemPatchName,
mesh.boundaryMesh()),
98 curtainInPortPatch_(curtainInPortPatchName,
mesh.boundaryMesh()),
99 curtainInCylinderPatch_(curtainInCylinderPatchName,
mesh.boundaryMesh()),
100 detachInCylinderPatch_(detachInCylinderPatchName,
mesh.boundaryMesh()),
101 detachInPortPatch_(detachInPortPatchName,
mesh.boundaryMesh()),
102 detachFaces_(detachFaces),
103 liftProfile_(liftProfile),
104 liftProfileStart_(
min(liftProfile_.
x())),
105 liftProfileEnd_(
max(liftProfile_.
x())),
107 minTopLayer_(minTopLayer),
108 maxTopLayer_(maxTopLayer),
109 minBottomLayer_(minBottomLayer),
110 maxBottomLayer_(maxBottomLayer),
115 Foam::engineValve::engineValve
149 curtainInCylinderPatch_
154 detachInCylinderPatch_
165 liftProfile_(
"theta",
"lift", name_,
dict.
lookup(
"liftProfile")),
166 liftProfileStart_(
min(liftProfile_.
x())),
167 liftProfileEnd_(
max(liftProfile_.
x())),
168 minLift_(
dict.
get<scalar>(
"minLift")),
169 minTopLayer_(
dict.
get<scalar>(
"minTopLayer")),
170 maxTopLayer_(
dict.
get<scalar>(
"maxTopLayer")),
171 minBottomLayer_(
dict.
get<scalar>(
"minBottomLayer")),
172 maxBottomLayer_(
dict.
get<scalar>(
"maxBottomLayer")),
173 diameter_(
dict.
get<scalar>(
"diameter"))
183 adjustCrankAngle(theta),
192 return lift(engineDB_.theta()) >= minLift_;
200 lift(engineDB_.theta()),
213 lift(engineDB_.theta() - engineDB_.deltaTheta()),
216 )/(engineDB_.deltaTValue() + VSMALL);
225 if (bottomPatch_.active())
227 mpIDs[nMpIDs] = bottomPatch_.index();
231 if (poppetPatch_.active())
233 mpIDs[nMpIDs] = poppetPatch_.index();
249 csysPtr_->writeEntry(
os);
255 <<
"curtainInPortPatch " << curtainInPortPatch_.name()
257 <<
"curtainInCylinderPatch " << curtainInCylinderPatch_.name()
259 <<
"detachInCylinderPatch " << detachInCylinderPatch_.name()
261 <<
"detachInPortPatch " << detachInPortPatch_.name()
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Begin block [isseparator].
Base class for coordinate system specification, the default coordinate system type is cartesian ...
A class for handling keywords in dictionaries.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
bool isOpen() const
Is the valve open?
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Type & refCast(U &obj)
A dynamic_cast (for references) that generates FatalError on failed casts, uses the virtual type() me...
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Lookup type of boundary radiation properties.
An abstract class for the time description of the piston motion.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
scalar curVelocity() const
Return valve velocity for current time-step.
A class for handling words, derived from Foam::string.
Interpolates y values from one curve to another with a different x distribution.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
scalar curLift() const
Return current lift.
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
virtual const fileName & name() const
Read/write access to the name of the stream.
void writeDict(Ostream &os) const
Write dictionary.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.