Go to the documentation of this file.
56 Foam::rigidBodyMeshMotion::bodyMesh::bodyMesh
61 const dictionary&
dict
66 patches_(
dict.get<wordRes>(
"patches")),
67 patchSet_(
mesh.boundaryMesh().patchSet(patches_)),
68 di_(
dict.get<scalar>(
"innerDistance")),
69 do_(
dict.get<scalar>(
"outerDistance")),
74 name_ +
".motionScale",
87 Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
100 "rigidBodyMotionState",
104 ).typeHeaderOk<IOdictionary>(
true)
109 "rigidBodyMotionState",
120 test_(coeffDict().getOrDefault(
"test", false)),
122 rhoName_(coeffDict().getOrDefault<
word>(
"rho",
"rho")),
126 if (rhoName_ ==
"rhoInf")
128 readEntry(
"rhoInf", rhoInf_);
131 if (coeffDict().
found(
"ramp"))
142 for (
const entry& dEntry : bodiesDict)
144 const keyType& bodyName = dEntry.keyword();
147 if (bodyDict.
found(
"patches"))
149 const label bodyID = model_.bodyID(bodyName);
154 <<
"Body " << bodyName
155 <<
" has been merged with another body"
156 " and cannot be assigned a set of patches"
189 /(bodyMeshes_[bi].do_ - bodyMeshes_[bi].di_),
221 return points0() + pointDisplacement_.primitiveField();
232 <<
"The number of points in the mesh seems to have changed." <<
endl
233 <<
"In constant/polyMesh there are " <<
points0().size()
234 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
239 if (curTimeIndex_ != this->db().time().
timeIndex())
242 curTimeIndex_ = this->db().time().timeIndex();
245 const scalar ramp = ramp_->value(t.
value());
255 const label nIter(coeffDict().get<label>(
"nIter"));
257 for (label i=0; i<nIter; i++)
270 const label nIter(coeffDict().getOrDefault<label>(
"nIter", 1));
272 for (label i=0; i<nIter; i++)
278 const label bodyID = bodyMeshes_[bi].bodyID_;
281 forcesDict.
add(
"type", functionObjects::forces::typeName);
282 forcesDict.
add(
"patches", bodyMeshes_[bi].patches_);
283 forcesDict.
add(
"rhoInf", rhoInf_);
284 forcesDict.
add(
"rho", rhoName_);
288 f.calcForcesMoment();
307 model_.status(bodyMeshes_[bi].bodyID_);
312 if (bodyMeshes_.size() == 1)
314 pointDisplacement_.primitiveFieldRef() = model_.transformPoints
316 bodyMeshes_[0].bodyID_,
317 bodyMeshes_[0].weight_,
327 bodyIDs[bi] = bodyMeshes_[bi].bodyID_;
328 weights[bi] = &bodyMeshes_[bi].weight_;
331 pointDisplacement_.primitiveFieldRef() =
338 pointDisplacement_.mesh()
339 ).constrainDisplacement(pointDisplacement_);
356 "rigidBodyMotionState",
366 model_.state().write(
dict);
367 return dict.regIOobject::writeObject(streamOpt, valid);
375 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.
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?
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.
Templated function that returns the corresponding 1 (one).
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.
static bool master(const label communicator=0)
Am I the master process.
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< scalar > 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.
static autoPtr< Function1< Type > > New(const word &entryName, const dictionary &dict, const word &redirectType=word::null)
Selector.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write state using stream options.
defineTypeNameAndDebug(combustionModel, 0)
dimensionedScalar cos(const dimensionedScalar &ds)