57 List<septernion> transforms0(bodyMeshes_.
size() + 1);
62 transforms0[bi] = septernion(
transform0(bodyMeshes_[bi].bodyIndex_));
82 w[bi] = bodyMeshes_[bi].weight_[pointi];
83 sum1mw += w[bi]/(1 + small - w[bi]);
93 w[bi] =
lambda*w[bi]/(1 + small - w[bi]);
98 w[bodyMeshes_.size()] = 1 - sumw;
106 Foam::rigidBodyMeshMotion::bodyMesh::bodyMesh
108 const polyMesh& mesh,
111 const dictionary&
dict
117 patchSet_(mesh.boundaryMesh().patchSet(patches_)),
118 di_(
dict.lookup<scalar>(
"innerDistance")),
119 do_(
dict.lookup<scalar>(
"outerDistance")),
124 name_ +
".motionScale",
130 pointMesh::
New(mesh),
149 "rigidBodyMotionState",
158 "rigidBodyMotionState",
169 test_(coeffDict().lookupOrDefault<
Switch>(
"test", false)),
171 rhoName_(coeffDict().lookupOrDefault<
word>(
"rho",
"rho")),
175 if (rhoName_ ==
"rhoInf")
195 if (bodyDict.
found(
"patches"))
202 <<
"Body " << iter().keyword()
203 <<
" has been merged with another body"
204 " and cannot be assigned a set of patches"
229 bodyMeshes_[bi].patchSet_,
234 bodyMeshes_[bi].weight_.primitiveFieldRef() =
251 Type Foam::rigidBodyMeshMotion::bodyMesh::weight
259 min(
max((do_ - pDist)/(do_ - di_), scalar(0)), scalar(1))
281 return points0() + pointDisplacement_.primitiveField();
289 if (mesh().
nPoints() != points0().size())
292 <<
"The number of points in the mesh seems to have changed." <<
endl
293 <<
"In constant/polyMesh there are " << points0().size()
294 <<
" points; in the current mesh there are " << mesh().nPoints()
305 const scalar ramp = ramp_->value(t.
value());
307 if (mesh().foundObject<uniformDimensionedVectorField>(
"g"))
316 label nIter(coeffDict().lookup<label>(
"nIter"));
318 for (
label i=0; i<nIter; i++)
335 const label bodyID = bodyMeshes_[bi].bodyIndex_;
339 functionObjects::forces::typeName,
343 "type", functionObjects::forces::typeName,
344 "patches", bodyMeshes_[bi].patches_,
351 f.calcForcesMoments();
369 status(bodyMeshes_[bi].bodyIndex_);
373 vectorField& pointDisplacement = pointDisplacement_.primitiveFieldRef();
377 if (bodyMeshes_.size() == 1)
379 const label bodyID = bodyMeshes_[0].bodyIndex_;
380 const septernion transform0(this->transform0(bodyID));
381 const scalarField& weight = bodyMeshes_[0].weight_;
386 if (weight[pointi] <= small)
389 else if (weight[pointi] > 1 - small)
391 pointDisplacement[pointi] =
398 pointDisplacement[pointi] =
400 .transformPoint(points0[pointi])
412 pointDisplacement[pointi] =
413 average(transforms0, weights(pointi, w))
414 .transformPoint(points0[pointi])
422 pointDisplacement_.mesh()
438 forAll(newPoints0, pointi)
443 <<
"Cannot determine co-ordinates of introduced vertices."
444 <<
" New vertex " << pointi <<
" at co-ordinate "
452 for (
int iter=0; iter<3; iter++)
460 bodyMeshes_[bi].patchSet_,
467 forAll(newPoints0, pointi)
473 weight[pointi] = bodyMeshes_[bi].weight(pDist[pointi]);
481 forAll(newPoints0, pointi)
487 newPoints0[pointi] = points0_[oldPointi];
492 if (bodyMeshes_.size() == 1)
494 const label bodyID = bodyMeshes_[0].bodyIndex_;
495 const septernion transform0(this->transform0(bodyID));
496 const scalarField& weight = bodyMeshes_[0].weight_;
498 forAll(newPoints0, pointi)
505 if (weight[pointi] <= small)
507 newPoints0[pointi] =
points[pointi];
510 else if (weight[pointi] > 1 - small)
520 .invTransformPoint(
points[pointi]);
530 forAll(newPoints0, pointi)
537 average(transforms0, weights(pointi, w))
538 .invTransformPoint(newPoints0[pointi]);
545 points0_.primitiveFieldRef() = newPoints0;
547 points0_.instance() = mesh().time().name();
557 "rigidBodyMotionState",
558 mesh().time().
name(),
571 &&
dict.regIOobject::writeObject
575 mesh().time().writeCompression(),
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitConversions &units, const dictionary &dict)
Select from dictionary.
Templated function that returns the corresponding 1 (one).
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
Template class for intrusive linked lists.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static const versionNumber currentVersion
Current version number.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
void append(T *)
Append an element at the end of the list.
label bodyIndex(const word &name) const
Return the ID of the body with the given name.
spatialTransform transform0(const label bodyID) const
Return the transformation of bodyID relative to the initial time.
void solve(const scalar t, const scalar deltaT, const scalarField &tau, const Field< spatialVector > &fx)
Integrate velocities, orientation and position.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
label timeIndex() const
Return current time index.
scalar deltaTValue() const
Return time step value.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
label size() const
Return the number of elements in the UPtrList.
A list of keyword definitions, which are a keyword followed by any number of values (e....
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const Type & value() const
Return const reference to value.
Virtual base class for displacement motion solver.
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
Virtual base class for mesh motion solver.
const word & keyword() const
Return keyword.
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
const polyMesh & mesh() const
Return reference to mesh.
const Time & time() const
Return time.
void constrain(PointField< Type > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Calculates the distance to the specified sets of patch and pointZone points or for all points.
Mesh representing a set of points created from polyMesh.
virtual bool write() const
Write points0 if the mesh topology changed.
pointField & points0()
Return reference to the reference field.
Mesh consisting of general polyhedral cells.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
const labelList & pointMap() const
Old point map.
Rigid-body mesh motion solver for fvMesh.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
rigidBodyMeshMotion(const word &name, const polyMesh &, const dictionary &dict)
Construct from polyMesh and dictionary.
virtual bool write() const
Write motion state information for restart.
~rigidBodyMeshMotion()
Destructor.
virtual void solve()
Solve for motion.
Septernion class used to perform translations and rotations in 3D space.
vector invTransformPoint(const vector &v) const
Inverse Transform the given coordinate point.
vector transformPoint(const vector &v) const
Transform the given coordinate point.
static const septernion I
timeIOdictionary derived from IOdictionary with globalFile set false to enable writing to processor t...
A class for managing temporary objects.
Templated form of IOobject providing type information for file reading and header type checking.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar lambda(viscosity->lookup("lambda"))
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimless
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
defineTypeNameAndDebug(combustionModel, 0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
List< wordRe > wordReList
A List of wordRe (word or regular expression)
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
dimensionedScalar cos(const dimensionedScalar &ds)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.