55Foam::sixDoFRigidBodyMotionSolver::sixDoFRigidBodyMotionSolver
67 "sixDoFRigidBodyMotionState",
76 "sixDoFRigidBodyMotionState",
88 patches_(coeffDict().get<
wordRes>(
"patches")),
90 di_(coeffDict().get<scalar>(
"innerDistance")),
91 do_(coeffDict().get<scalar>(
"outerDistance")),
92 test_(coeffDict().getOrDefault(
"test", false)),
94 rhoName_(coeffDict().getOrDefault<
word>(
"rho",
"rho")),
110 cOfGdisplacement_(coeffDict().getOrDefault<
word>(
"cOfGdisplacement",
"none"))
112 if (rhoName_ ==
"rhoInf")
123 pointPatchDist pDist(pMesh, patchSet_,
points0());
131 (do_ - pDist.primitiveField())/(do_ - di_),
171 points0() + pointDisplacement_.primitiveField()
177 auto& transformedPts = ttransformedPts.ref();
182 return ttransformedPts;
196 <<
"The number of points in the mesh seems to have changed." <<
endl
197 <<
"In constant/polyMesh there are " <<
points0().
size()
198 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
203 bool firstIter =
false;
204 if (curTimeIndex_ != this->db().time().
timeIndex())
207 curTimeIndex_ = this->db().time().timeIndex();
213 if (db().time().foundObject<uniformDimensionedVectorField>(
"g"))
219 coeffDict().readIfPresent(
"g",
g);
223 const scalar ramp = 1.0;
230 ramp*(motion_.mass()*
g.
value()),
231 ramp*(motion_.mass()*(motion_.momentArm() ^
g.
value())),
240 forcesDict.
add(
"type", functionObjects::forces::typeName);
241 forcesDict.add(
"patches", patches_);
242 forcesDict.add(
"rhoInf", rhoInf_);
243 forcesDict.add(
"rho", rhoName_);
244 forcesDict.add(
"CofR", motion_.centreOfRotation());
246 vector oldPos = motion_.centreOfRotation();
250 f.calcForcesMoments();
255 ramp*(
f.forceEff() + motion_.mass()*
g.
value()),
259 + motion_.mass()*(motion_.momentArm() ^
g.
value())
265 if (cOfGdisplacement_ !=
"none")
269 db().time().foundObject<uniformDimensionedVectorField>
281 disp += (motion_.centreOfRotation() - oldPos);
287 pointDisplacement_.primitiveFieldRef() =
301 const bool writeOnProc
308 "sixDoFRigidBodyMotionState",
318 motion_.state().write(
dict);
319 return dict.regIOobject::writeObject(streamOpt, writeOnProc);
327 motion_.read(coeffDict());
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const uniformDimensionedVectorField & g
label size() const noexcept
The number of elements in list.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Time & time() const noexcept
Return Time associated with the objectRegistry.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
const objectRegistry & db() const noexcept
Return the local objectRegistry.
A simple container for options an IOstream can normally have.
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
scalar deltaTValue() const noexcept
Return time step value.
scalar deltaT0Value() const noexcept
Return old time step value.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
const Type & value() const noexcept
Return const reference to value.
Virtual base class for displacement motion solver.
displacementMotionSolver(const displacementMotionSolver &)=delete
No copy construct.
pointVectorField pointDisplacement_
Point motion field.
static autoPtr< displacementMotionSolver > New(const word &solverTypeName, const polyMesh &, const IOdictionary &, const pointVectorField &pointDisplacement, const pointIOField &points0)
Select constructed from polyMesh, dictionary and components.
Computes forces and moments over a given list of patches by integrating pressure and viscous forces a...
const Time & time() const
Return the top-level database.
Virtual base class for mesh motion solver.
const polyMesh & mesh() const
Return reference to mesh.
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
virtual bool read()
Read dynamicMeshDict dictionary.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Mesh representing a set of points created from polyMesh.
Calculation of distance to nearest patch for all points.
pointField & points0() noexcept
Return reference to the reference ('0') pointField.
Mesh consisting of general polyhedral cells.
label nPoints() const noexcept
Number of mesh points.
6-DoF solid-body mesh motion solver for an fvMesh.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write state using stream options.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
const sixDoFRigidBodyMotion & motion() const
Return the six DoF motion object.
virtual void solve()
Solve for motion.
virtual bool read()
Read dynamicMeshDict dictionary.
Six degree of freedom motion for a rigid body.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
const labelList & pointIDs() const noexcept
The point ids (for cell set/zone subset).
bool moveAllCells() const noexcept
Move all cells?
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr scalar pi(M_PI)
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.
const dimensionSet dimless
Dimensionless.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
UniformDimensionedField< vector > uniformDimensionedVectorField
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0).
const dimensionSet dimAcceleration
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER)))