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 pointZones_(
dict.lookupOrDefault(
"pointZones",
wordReList::null())),
119 pointZoneSet_(
mesh.pointZones().zoneSet(pointZones_)),
120 di_(
dict.lookup<scalar>(
"innerDistance")),
121 do_(
dict.lookup<scalar>(
"outerDistance")),
126 name_ +
".motionScale",
151 "rigidBodyMotionState",
160 "rigidBodyMotionState",
171 test_(
dict.lookupOrDefault<
Switch>(
"test", false)),
172 nIter_(test_ ?
dict.lookup<
label>(
"nIter") : 0),
174 rhoName_(
dict.lookupOrDefault<
word>(
"rho",
"rho")),
178 if (rhoName_ ==
"rhoInf")
180 rhoInf_ =
dict.lookup<scalar>(
"rhoInf");
183 if (
dict.found(
"ramp"))
198 if (bodyDict.
found(
"patches"))
205 <<
"Body " << iter().keyword()
206 <<
" has been merged with another body"
207 " and cannot be assigned a set of patches"
232 bodyMeshes_[bi].patchSet_,
233 bodyMeshes_[bi].pointZoneSet_,
238 bodyMeshes_[bi].weight_.primitiveFieldRef() =
255 Type Foam::rigidBodyMeshMotion::bodyMesh::weight
263 min(
max((do_ - pDist)/(do_ - di_), scalar(0)), scalar(1))
285 return points0() + pointDisplacement_.primitiveField();
296 <<
"The number of points in the mesh seems to have changed." <<
endl
297 <<
"In constant/polyMesh there are " << points0().size()
298 <<
" points; in the current mesh there are " <<
mesh().
nPoints()
309 const scalar ramp = ramp_->value(t.
value());
311 if (
mesh().foundObject<uniformDimensionedVectorField>(
"g"))
320 for (
label i=0; i<nIter_; i++)
337 const label bodyID = bodyMeshes_[bi].bodyIndex_;
341 functionObjects::forces::typeName,
345 "type", functionObjects::forces::typeName,
346 "patches", bodyMeshes_[bi].patches_,
353 f.calcForcesMoments();
371 status(bodyMeshes_[bi].bodyIndex_);
375 vectorField& pointDisplacement = pointDisplacement_.primitiveFieldRef();
379 if (bodyMeshes_.size() == 1)
381 const label bodyID = bodyMeshes_[0].bodyIndex_;
382 const septernion transform0(this->transform0(bodyID));
383 const scalarField& weight = bodyMeshes_[0].weight_;
388 if (weight[pointi] <= small)
391 else if (weight[pointi] > 1 - small)
393 pointDisplacement[pointi] =
400 pointDisplacement[pointi] =
402 .transformPoint(points0[pointi])
414 pointDisplacement[pointi] =
415 average(transforms0, weights(pointi, w))
416 .transformPoint(points0[pointi])
424 pointDisplacement_.mesh()
440 forAll(newPoints0, pointi)
445 <<
"Cannot determine co-ordinates of introduced vertices."
446 <<
" New vertex " << pointi <<
" at co-ordinate "
454 for (
int iter=0; iter<3; iter++)
462 bodyMeshes_[bi].patchSet_,
463 bodyMeshes_[bi].pointZoneSet_,
470 forAll(newPoints0, pointi)
476 weight[pointi] = bodyMeshes_[bi].weight(pDist[pointi]);
484 forAll(newPoints0, pointi)
490 newPoints0[pointi] = points0_[oldPointi];
495 if (bodyMeshes_.size() == 1)
497 const label bodyID = bodyMeshes_[0].bodyIndex_;
498 const septernion transform0(this->transform0(bodyID));
499 const scalarField& weight = bodyMeshes_[0].weight_;
501 forAll(newPoints0, pointi)
508 if (weight[pointi] <= small)
510 newPoints0[pointi] =
points[pointi];
513 else if (weight[pointi] > 1 - small)
523 .invTransformPoint(
points[pointi]);
533 forAll(newPoints0, pointi)
540 average(transforms0, weights(pointi, w))
541 .invTransformPoint(newPoints0[pointi]);
548 points0_.primitiveFieldRef() = newPoints0;
560 "rigidBodyMotionState",
574 &&
dict.regIOobject::writeObject
578 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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
static std::tuple< const Entries &... > entries(const Entries &...)
Construct an entries tuple from which to make a dictionary.
const Type & value() const
Return const reference to value.
const word & name() const
Return const reference to name.
Virtual base class for displacement motion solver.
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
const Time & time() const
Return the top-level database.
Virtual base class for mesh motion solver.
const word & keyword() const
Return keyword.
const polyMesh & mesh() const
Return reference to mesh.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
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.
virtual const pointField & points() const
Return raw points.
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.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#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.
const dimensionSet dimless
dimensioned< Type > average(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
List< wordRe > wordReList
A List of wordRe (word or regular expression)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.