36 namespace functionObjects
53 Foam::functionObjects::rigidBodyPoints::motion()
const
55 const fvMeshMovers::motionSolver& mover =
56 refCast<const fvMeshMovers::motionSolver>(
mesh_.
mover());
58 return (refCast<const RBD::rigidBodyMotion>(mover.motion()));
90 angleUnits_ =
dict.lookupOrDefault<
word>(
"angleUnits",
"radians");
92 dict.lookup(
"body") >> body_;
95 names_.setSize(pointsTable.
size());
96 points_.setSize(pointsTable.
size());
101 names_[i] = iter.key();
102 points_[i++] = iter();
113 writeHeader(this->files()[i],
"Body point motion");
114 writeHeaderValue(this->files()[i],
"Body", body_);
115 writeHeaderValue(this->files()[i],
"Point", points_[i]);
116 writeHeaderValue(this->files()[i],
"Angle Units", angleUnits_);
117 writeCommented(this->files()[i],
"Time");
119 this->files()[i]<<
tab
121 <<
"Linear velocity" <<
tab
122 <<
"Angular velocity" <<
tab
123 <<
"Linear acceleration" <<
tab
124 <<
"Angular acceleration" <<
endl;
146 const vector p(motion.
p(bodyID, points_[i]));
151 vector angularAcceleration(a.
w());
153 if (angleUnits_ ==
"degrees")
155 angularVelocity.
x() =
radToDeg(angularVelocity.
x());
156 angularVelocity.
y() =
radToDeg(angularVelocity.
y());
157 angularVelocity.
z() =
radToDeg(angularVelocity.
z());
159 angularAcceleration.
x() =
radToDeg(angularAcceleration.
x());
160 angularAcceleration.
y() =
radToDeg(angularAcceleration.
y());
161 angularAcceleration.
z() =
radToDeg(angularAcceleration.
z());
164 writeTime(files()[i]);
169 << angularVelocity <<
tab
171 << angularAcceleration <<
endl;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
An STL-conforming hash table.
label size() const
Return number of elements in table.
const spatialVector & v(const label i) const
Return the spatial velocity of the bodies.
spatialVector a(const label bodyID, const vector &p) const
Return the acceleration of the given point on the given body.
vector p(const label bodyID, const vector &p) const
Return the current position of the given point on the given body.
label bodyID(const word &name) const
Return the ID of the body with the given name.
Six degree of freedom motion for a rigid body.
Vector< Cmpt > w() const
Return the angular part of the spatial vector as a vector.
Vector< Cmpt > l() const
Return the linear part of the spatial vector as a vector.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Abstract base-class for Time/database functionObjects.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
virtual bool write()
Write function.
virtual bool read(const dictionary &)
Read optional controls.
Writes the position, linear and angular velocities and accelerations of a list of points on a body sp...
rigidBodyPoints(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual void writeFileHeader(const label i=0)
overloaded writeFileHeader from writeFile
virtual bool execute()
Execute, currently does nothing.
virtual bool write()
Write the rigidBodyPoints.
virtual ~rigidBodyPoints()
Destructor.
virtual bool read(const dictionary &)
Read the rigidBodyPoints data.
const fvMeshMover & mover() const
Return the mover function class.
A class for handling words, derived from string.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
void writeHeader(std::ostream &, const bool isBinary, const std::string &title)
Write header.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
word name(const complex &)
Return a string representation of a complex.
Unit conversion functions.