51 conRodLength_(
"conRodLength",
dimLength, meshCoeffs_),
53 stroke_(
"stroke",
dimLength, meshCoeffs_),
54 clearance_(
"clearance",
dimLength, meshCoeffs_),
57 cylinderHeadIndex_(-1),
58 deckHeight_(
"deckHeight",
dimLength, great),
59 pistonPosition_(
"pistonPosition",
dimLength, -great)
61 bool foundPiston =
false;
62 bool foundLiner =
false;
63 bool foundCylinderHead =
false;
80 foundCylinderHead =
true;
91 <<
"cannot find piston patch"
98 <<
"cannot find liner patch"
102 if (!foundCylinderHead)
105 <<
"cannot find cylinderHead patch"
154 return mesh().time().userTimeValue();
160 return mesh().time().timeToUserTime(mesh().time().deltaTValue());
171 conRodLength_.value()
172 + stroke_.value()/2.0
179 sqr(conRodLength_.value())
192 pistonPosition(theta())
201 "pistonDisplacement",
203 pistonPosition(theta() - deltaTheta()) - pistonPosition().value()
214 pistonDisplacement().value()/(mesh().time().deltaTValue() + vSmall)
#define forAll(list, i)
Loop across all elements in list.
label size() const
Return the number of elements in the UPtrList.
const Type & value() const
Return const reference to value.
Abstract base class for fvMesh movers.
fvMesh & mesh()
Return the fvMesh.
Basic mesh motion specifically for engines.
virtual scalar theta() const
Return current crank-angle.
virtual ~engine()
Destructor.
dimensionedScalar pistonDisplacement() const
Return piston displacement for current time step.
dimensionedScalar deckHeight_
virtual scalar deltaTheta() const
Return crank-angle increment.
dimensionedScalar pistonPosition() const
Return current piston position.
dimensionedScalar pistonPosition_
dimensionedScalar pistonSpeed() const
Return piston speed for current time step.
engine(fvMesh &mesh)
Construct from fvMesh.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
An abstract class for the user time description.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineTypeNameAndDebug(none, 0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
To & refCast(From &r)
Reference type cast template function.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sin(const dimensionedScalar &ds)
const dimensionSet dimLength
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensionedScalar sqrt(const dimensionedScalar &ds)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimVelocity
dimensionedScalar cos(const dimensionedScalar &ds)
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Unit conversion functions.