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();
256 os.
writeEntry(
"curtainInPortPatch", curtainInPortPatch_.name());
257 os.
writeEntry(
"curtainInCylinderPatch", curtainInCylinderPatch_.name());
258 os.
writeEntry(
"detachInCylinderPatch", detachInCylinderPatch_.name());
259 os.
writeEntry(
"detachInPortPatch", detachInPortPatch_.name());
void setSize(const label n)
Alias for resize()
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & endEntry()
Write end entry (';') followed by newline.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Base class for coordinate system specification, the default coordinate system type is cartesian .
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
An abstract class for the time description of the piston motion.
bool isOpen() const
Is the valve open?
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.
scalar curVelocity() const
Return valve velocity for current time-step.
void writeDict(Ostream &os) const
Write dictionary.
A class for handling keywords in dictionaries.
Mesh consisting of general polyhedral cells.
Lookup type of boundary radiation properties.
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
Interpolates y values from one curve to another with a different x distribution.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
constexpr char nl
The newline '\n' character (0x0a)