57 List<septernion> transforms0(bodyMeshes_.
size() + 1);
62 transforms0[bi] = septernion(
transform0(bodyMeshes_[bi].bodyID_));
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"
228 bodyMeshes_[bi].weight_.primitiveFieldRef() =
245 Type Foam::rigidBodyMeshMotion::bodyMesh::weight
253 min(
max((do_ - pDist)/(do_ - di_), scalar(0)), scalar(1))
275 return points0() + pointDisplacement_.primitiveField();
283 if (mesh().
nPoints() != points0().size())
286 <<
"The number of points in the mesh seems to have changed." <<
endl
287 <<
"In constant/polyMesh there are " << points0().size()
288 <<
" points; in the current mesh there are " << mesh().nPoints()
299 const scalar ramp = ramp_->value(t.
value());
301 if (mesh().foundObject<uniformDimensionedVectorField>(
"g"))
310 label nIter(coeffDict().lookup<label>(
"nIter"));
312 for (
label i=0; i<nIter; i++)
329 const label bodyID = bodyMeshes_[bi].bodyID_;
332 forcesDict.
add(
"type", functionObjects::forces::typeName);
333 forcesDict.
add(
"patches", bodyMeshes_[bi].patches_);
334 forcesDict.
add(
"rhoInf", rhoInf_);
335 forcesDict.
add(
"rho", rhoName_);
339 f.calcForcesMoment();
357 status(bodyMeshes_[bi].bodyID_);
361 vectorField& pointDisplacement = pointDisplacement_.primitiveFieldRef();
365 if (bodyMeshes_.size() == 1)
367 const septernion transform0(this->transform0(bodyMeshes_[0].bodyID_));
368 const scalarField& weight = bodyMeshes_[0].weight_;
373 if (weight[pointi] > small)
376 if (weight[pointi] > 1 - small)
378 pointDisplacement[pointi] =
385 pointDisplacement[pointi] =
387 .transformPoint(points0[pointi])
400 pointDisplacement[pointi] =
401 average(transforms0, weights(pointi, w))
402 .transformPoint(points0[pointi])
410 pointDisplacement_.mesh()
433 for (
int iter=0; iter<3; iter++)
441 bodyMeshes_[bi].patchSet_,
455 weight[pointi] = bodyMeshes_[bi].weight(pDist[pointi]);
461 <<
"Cannot determine co-ordinates "
462 "of introduced vertices."
463 <<
" New vertex " << pointi <<
" at co-ordinate "
480 points0[pointi] = points0_[pointi];
484 if (bodyMeshes_.size() == 1)
487 if (bodyMeshes_[0].weight_[pointi] > 1 - small)
490 transform0(bodyMeshes_[0].bodyID_).inv()
491 .transformPoint(
points[pointi]);
502 transform0(bodyMeshes_[0].bodyID_)
504 bodyMeshes_[0].weight_[pointi]
505 ).invTransformPoint(
points[pointi]);
516 average(transforms0, weights(pointi, w))
517 .invTransformPoint(points0[pointi]);
525 points0_.transfer(points0);
528 points0_.rename(
"points0");
530 points0_.instance() = mesh().time().name();
541 "rigidBodyMotionState",
542 mesh().time().
name(),
554 dict.regIOobject::writeObject
558 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 polyMesh &mesh)
static autoPtr< Function1< Type > > New(const word &name, const dictionary &dict)
Selector.
Templated function that returns the corresponding 1 (one).
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal 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 bodyID(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 add(entry *, bool mergeEntry=false)
Add a new entry.
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),.
Mesh representing a set of points created from polyMesh.
Calculation of distance to nearest patch for all points.
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 pointField & preMotionPoints() const
Pre-motion point positions.
const labelList & reversePointMap() const
Reverse point map.
const labelList & pointMap() const
Old point map.
bool hasMotionPoints() const
Has valid preMotionPoints?
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 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)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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.
word name(const complex &)
Return a string representation of a complex.
dimensionedScalar cos(const dimensionedScalar &ds)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)