47 rigidBodyMeshMotionSolver,
55 Foam::rigidBodyMeshMotionSolver::bodyMesh::bodyMesh
60 const dictionary&
dict 70 Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver
83 "rigidBodyMotionState",
92 "rigidBodyMotionState",
103 test_(coeffDict().getOrDefault(
"test", false)),
105 rhoName_(coeffDict().getOrDefault<
word>(
"rho",
"rho")),
116 "rigidBodyMotionSolver:meshSolver",
117 mesh.time().constant(),
120 coeffDict().subDict(
"meshSolver")
126 if (rhoName_ ==
"rhoInf")
133 for (
const entry& dEntry : bodiesDict)
135 const keyType& bodyName = dEntry.keyword();
138 if (bodyDict.found(
"patches"))
140 const label bodyID = model_.
bodyID(bodyName);
145 <<
"Body " << bodyName
146 <<
" has been merged with another body" 147 " and cannot be assigned a set of patches" 171 return meshSolverPtr_->curPoints();
179 if (
mesh().
nPoints() != meshSolver_.points0().size())
182 <<
"The number of points in the mesh seems to have changed." <<
endl 183 <<
"In constant/polyMesh there are " << meshSolver_.points0().size()
184 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
189 if (curTimeIndex_ != this->db().time().
timeIndex())
192 curTimeIndex_ = this->db().time().timeIndex();
202 const label nIter(coeffDict().get<label>(
"nIter"));
204 for (label i=0; i<nIter; i++)
211 Field<spatialVector>(model_.nBodies(),
Zero)
217 Field<spatialVector> fx(model_.nBodies(),
Zero);
221 const label bodyID = bodyMeshes_[bi].bodyID_;
224 forcesDict.add(
"type", functionObjects::forces::typeName);
225 forcesDict.add(
"patches", bodyMeshes_[bi].patches_);
226 forcesDict.add(
"rhoInf", rhoInf_);
227 forcesDict.add(
"rho", rhoName_);
228 forcesDict.add(
"CofR", vector::zero);
230 functionObjects::forces
f(
"forces", db(), forcesDict);
231 f.calcForcesMoments();
249 model_.status(bodyMeshes_[bi].bodyID_);
256 for (
const label patchi : bodyMeshes_[bi].patchSet_)
260 meshSolver_.pointDisplacement().boundaryField()[patchi]
261 .patchInternalField(meshSolver_.points0())
264 meshSolver_.pointDisplacement().boundaryFieldRef()[patchi] ==
266 model_.transformPoints
268 bodyMeshes_[bi].bodyID_,
275 meshSolverPtr_->solve();
281 IOstreamOption streamOpt,
282 const bool writeOnProc
292 "rigidBodyMotionState",
302 model_.state().write(
dict);
303 return dict.regIOobject::writeObject(streamOpt, writeOnProc);
311 model_.read(coeffDict());
322 meshSolverPtr_->movePoints(
points);
328 meshSolverPtr_->updateMesh(mpm);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const Type & value() const noexcept
Return const reference to value.
Virtual base class for displacement motion solver.
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...
scalar deltaTValue() const noexcept
Return time step value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UniformDimensionedField< vector > uniformDimensionedVectorField
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
Virtual base class for mesh motion solver.
Ignore writing from objectRegistry::writeObject()
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
const Time & time() const
Return the top-level database.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
dictionary()
Default construct, a top-level empty dictionary.
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...
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write state using stream options.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
virtual bool read()
Read dynamicMeshDict dictionary.
A List of wordRe with additional matching capabilities.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
virtual bool read()
Read dynamicMeshDict dictionary.
defineTypeNameAndDebug(combustionModel, 0)
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
label bodyID(const word &name) const
Return the ID of the body with the given name.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
Mesh consisting of general polyhedral cells.
friend class entry
Declare friendship with the entry class for IO.
const polyMesh & mesh() const
Return reference to mesh.
A class for managing temporary objects.
virtual void solve()
Solve for motion.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Do not request registration (bool: false)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)