55Foam::rigidBodyMeshMotion::bodyMesh::bodyMesh
60 const dictionary&
dict
65 patches_(
dict.get<wordRes>(
"patches")),
66 patchSet_(
mesh.boundaryMesh().patchSet(patches_)),
67 di_(
dict.get<scalar>(
"innerDistance")),
68 do_(
dict.get<scalar>(
"outerDistance")),
73 name_ +
".motionScale",
81 dimensionedScalar(dimless, Zero)
99 "rigidBodyMotionState",
108 "rigidBodyMotionState",
119 test_(coeffDict().getOrDefault(
"test", false)),
121 rhoName_(coeffDict().getOrDefault<
word>(
"rho",
"rho")),
129 coeffDict().getOrDefault<
word>(
"cOfGdisplacement",
"none")
131 bodyIdCofG_(coeffDict().getOrDefault<label>(
"bodyIdCofG", -1))
133 if (rhoName_ ==
"rhoInf")
140 for (
const entry& dEntry : bodiesDict)
142 const keyType& bodyName = dEntry.keyword();
145 if (bodyDict.
found(
"patches"))
147 const label bodyID = model_.
bodyID(bodyName);
152 <<
"Body " << bodyName
153 <<
" has been merged with another body"
154 " and cannot be assigned a set of patches"
187 /(bodyMeshes_[bi].do_ - bodyMeshes_[bi].di_),
233 return ttransformedPts;
245 <<
"The number of points in the mesh seems to have changed." <<
endl
246 <<
"In constant/polyMesh there are " <<
points0().
size()
247 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
252 if (curTimeIndex_ != this->db().time().
timeIndex())
255 curTimeIndex_ = this->db().time().timeIndex();
258 const scalar ramp = (ramp_ ? ramp_->value(t.
value()) : 1.0);
267 if (bodyIdCofG_ != -1)
269 oldPos = model_.cCofR(bodyIdCofG_);
274 const label nIter(coeffDict().get<label>(
"nIter"));
276 for (label i=0; i<nIter; i++)
289 const label nIter(coeffDict().getOrDefault<label>(
"nIter", 1));
291 for (label i=0; i<nIter; i++)
297 const label bodyID = bodyMeshes_[bi].bodyID_;
301 forcesDict.
add(
"patches", bodyMeshes_[bi].patches_);
302 forcesDict.
add(
"rhoInf", rhoInf_);
303 forcesDict.
add(
"rho", rhoName_);
307 f.calcForcesMoments();
321 if (cOfGdisplacement_ !=
"none")
323 if (bodyIdCofG_ != -1)
327 db().time().foundObject<uniformDimensionedVectorField>
339 disp.
value() += model_.cCofR(bodyIdCofG_) - oldPos;
345 <<
"CofGdisplacement is different to none." <<
endl
346 <<
"The model needs the entry body reference Id: bodyIdCofG."
356 model_.status(bodyMeshes_[bi].bodyID_);
361 if (bodyMeshes_.size() == 1)
363 pointDisplacement_.primitiveFieldRef() = model_.transformPoints
365 bodyMeshes_[0].bodyID_,
366 bodyMeshes_[0].weight_,
376 bodyIDs[bi] = bodyMeshes_[bi].bodyID_;
377 weights[bi] = &bodyMeshes_[bi].weight_;
380 pointDisplacement_.primitiveFieldRef() =
387 pointDisplacement_.mesh()
388 ).constrainDisplacement(pointDisplacement_);
405 "rigidBodyMotionState",
415 model_.state().write(
dict);
416 return dict.regIOobject::writeObject(streamOpt, valid);
424 model_.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.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
The IOstreamOption is a simple container for options an IOstream can normally have.
streamFormat format() const noexcept
Get the current stream format.
void append(T *ptr)
Append an element to the end of the list.
virtual bool read()
Re-read model coefficients if they have changed.
label bodyID(const word &name) const
Return the ID of the body with the given name.
scalar deltaTValue() const noexcept
Return time step value.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const Type & value() const
Return const reference to value.
Virtual base class for displacement motion solver.
A keyword and a list of tokens is an 'entry'.
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.
A class for handling keywords in dictionaries.
Virtual base class for mesh motion solver.
const polyMesh & mesh() const
Return reference to mesh.
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
const Type & lookupObject(const word &name, const bool recursive=false) const
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.
Rigid-body mesh motion solver for fvMesh.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write state using stream options.
virtual void solve()
Solve for motion.
virtual bool read()
Read dynamicMeshDict dictionary.
splitCell * master() const
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#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.
vectorField pointField
pointField is a vectorField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
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)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar cos(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
static const char *const typeName
The type name used in ensight case files.
A non-counting (dummy) refCount.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))