Go to the documentation of this file.
55 Foam::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",
86 Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
99 "rigidBodyMotionState",
103 ).typeHeaderOk<IOdictionary>(
true)
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")
135 readEntry(
"rhoInf", 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_;
300 forcesDict.
add(
"type", functionObjects::forces::typeName);
301 forcesDict.
add(
"patches", bodyMeshes_[bi].patches_);
302 forcesDict.
add(
"rhoInf", rhoInf_);
303 forcesDict.
add(
"rho", rhoName_);
307 f.calcForcesMoment();
321 if (cOfGdisplacement_ !=
"none")
323 if (bodyIdCofG_ != -1)
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());
virtual bool read()
Read dynamicMeshDict dictionary.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
A keyword and a list of tokens is an 'entry'.
vectorField pointField
pointField is a vectorField.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
static Vector< scalar > uniform(const scalar &s)
Return a VectorSpace with all elements = s.
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
static word timeName(const scalar t, const int precision=precision_)
streamFormat format() const noexcept
Get the current stream format.
static bool master(const label communicator=worldComm)
Am I the master process.
virtual void solve()
Solve for motion.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Mesh consisting of general polyhedral cells.
label nPoints() const noexcept
Number of mesh points.
scalar deltaTValue() const noexcept
Return time step value.
#define forAll(list, i)
Loop across all elements in list.
A class for handling keywords in dictionaries.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
The IOstreamOption is a simple container for options an IOstream can normally have.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const Type & lookupObject(const word &name, const bool recursive=false) const
virtual bool read()
Read dynamicMeshDict dictionary.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Virtual base class for displacement motion solver.
Macros for easy insertion into run-time selection tables.
Mesh representing a set of points created from polyMesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Calculation of distance to nearest patch for all points.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr scalar pi(M_PI)
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const Time & time() const
Return the top-level database.
static const Vector< scalar > zero
A List with indirect addressing.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write state using stream options.
defineTypeNameAndDebug(combustionModel, 0)
const dimensionSet dimless
Dimensionless.
dimensionedScalar cos(const dimensionedScalar &ds)