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")),
122 ramp_(
Function1<scalar>::NewIfPresent(
"ramp", coeffDict())),
125 if (rhoName_ ==
"rhoInf")
127 readEntry(
"rhoInf", rhoInf_);
132 for (
const entry& dEntry : bodiesDict)
134 const keyType& bodyName = dEntry.keyword();
137 if (bodyDict.
found(
"patches"))
139 const label bodyID = model_.bodyID(bodyName);
144 <<
"Body " << bodyName
145 <<
" has been merged with another body"
146 " and cannot be assigned a set of patches"
179 /(bodyMeshes_[bi].do_ - bodyMeshes_[bi].di_),
211 return points0() + pointDisplacement_.primitiveField();
222 <<
"The number of points in the mesh seems to have changed." <<
endl
223 <<
"In constant/polyMesh there are " <<
points0().size()
224 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
229 if (curTimeIndex_ != this->db().time().
timeIndex())
232 curTimeIndex_ = this->db().time().timeIndex();
235 const scalar ramp = (ramp_ ? ramp_->value(t.
value()) : 1.0);
245 const label nIter(coeffDict().get<label>(
"nIter"));
247 for (label i=0; i<nIter; i++)
260 const label nIter(coeffDict().getOrDefault<label>(
"nIter", 1));
262 for (label i=0; i<nIter; i++)
268 const label bodyID = bodyMeshes_[bi].bodyID_;
271 forcesDict.
add(
"type", functionObjects::forces::typeName);
272 forcesDict.
add(
"patches", bodyMeshes_[bi].patches_);
273 forcesDict.
add(
"rhoInf", rhoInf_);
274 forcesDict.
add(
"rho", rhoName_);
278 f.calcForcesMoment();
297 model_.status(bodyMeshes_[bi].bodyID_);
302 if (bodyMeshes_.size() == 1)
304 pointDisplacement_.primitiveFieldRef() = model_.transformPoints
306 bodyMeshes_[0].bodyID_,
307 bodyMeshes_[0].weight_,
317 bodyIDs[bi] = bodyMeshes_[bi].bodyID_;
318 weights[bi] = &bodyMeshes_[bi].weight_;
321 pointDisplacement_.primitiveFieldRef() =
328 pointDisplacement_.mesh()
329 ).constrainDisplacement(pointDisplacement_);
346 "rigidBodyMotionState",
356 model_.state().write(
dict);
357 return dict.regIOobject::writeObject(streamOpt, valid);
365 model_.read(coeffDict());
virtual bool read()
Read dynamicMeshDict dictionary.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
A keyword and a list of tokens is an 'entry'.
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,...
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
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.
#define forAll(list, i)
Loop across all elements in list.
A class for handling keywords in dictionaries.
Generic templated field type.
word name(const complex &c)
Return string representation of complex.
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)
scalar deltaTValue() const
Return time step value.
label nPoints() const
Number of mesh points.
const Time & time() const
Return the top-level database.
static const Vector< Cmpt > zero
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)
dimensionedScalar cos(const dimensionedScalar &ds)