36Foam::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_;
69Foam::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),
115Foam::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();
250 csysPtr_->writeEntry(
os);
253 os.writeEntry(
"bottomPatch", bottomPatch_.name());
254 os.writeEntry(
"poppetPatch", poppetPatch_.name());
255 os.writeEntry(
"stemPatch", stemPatch_.name());
256 os.writeEntry(
"curtainInPortPatch", curtainInPortPatch_.name());
257 os.writeEntry(
"curtainInCylinderPatch", curtainInCylinderPatch_.name());
258 os.writeEntry(
"detachInCylinderPatch", detachInCylinderPatch_.name());
259 os.writeEntry(
"detachInPortPatch", detachInPortPatch_.name());
260 os.writeEntry(
"detachFaces", detachFaces_);
266 os.writeEntry(
"minLift", minLift_);
267 os.writeEntry(
"minTopLayer", minTopLayer_);
268 os.writeEntry(
"maxTopLayer", maxTopLayer_);
269 os.writeEntry(
"minBottomLayer", minBottomLayer_);
270 os.writeEntry(
"maxBottomLayer", maxBottomLayer_);
271 os.writeEntry(
"diameter", diameter_);
void setSize(label n)
Alias for resize().
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
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 maxTopLayer() const
scalar minBottomLayer() const
scalar maxBottomLayer() const
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
scalar diameter() const
Return valve diameter.
const word & name() const
Return name.
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
scalar curLift() const
Return current lift.
const graph & liftProfile() const
Return lift profile.
scalar minTopLayer() const
const labelList & detachFaces() const
Return face labels of detach curtain.
scalar curVelocity() const
Return valve velocity for current time-step.
void writeDict(Ostream &os) const
Write dictionary.
Class to create, store and output qgraph files.
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.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max 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.
List< label > labelList
A List of labels.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
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).