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]);
87 scalar lambda = 1/sum1mw;
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",
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))
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());
312 for (
label i=0; i<nIter; i++)
332 forcesDict.
add(
"type", functionObjects::forces::typeName);
333 forcesDict.
add(
"patches", bodyMeshes_[bi].patches_);
334 forcesDict.
add(
"rhoInf", rhoInf_);
335 forcesDict.
add(
"rho", rhoName_);
357 status(bodyMeshes_[bi].bodyID_);
365 if (bodyMeshes_.
size() == 1)
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])
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 " 484 if (bodyMeshes_.
size() == 1)
487 if (bodyMeshes_[0].weight_[pointi] > 1 - small)
504 bodyMeshes_[0].weight_[pointi]
505 ).invTransformPoint(points[pointi]);
516 average(transforms0, weights(pointi, w))
517 .invTransformPoint(points0[pointi]);
541 "rigidBodyMotionState",
554 dict.regIOobject::writeObject
558 mesh().time().writeCompression(),
void newTime()
Store the motion state at the beginning of the time-step.
Template class for intrusive linked lists.
virtual vector momentEff() const
Return the total moment.
void append(T *)
Append an element at the end of the list.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
pointVectorField pointDisplacement_
Point motion field.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual bool write() const
Write motion state information for restart.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Templated form of IOobject providing type information for file reading and header type checking...
void size(const label)
Override size to be inconsistent with allocated storage.
bool hasMotionPoints() const
Has valid preMotionPoints?
const labelList & pointMap() const
Old point map.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void status(const label bodyID) const
Report the status of the motion of the given body.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
static bool master(const label communicator=0)
Am I the master process.
bool foundObject(const word &name) const
Is the named Type found?
const word & keyword() const
Return keyword.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
virtual vector forceEff() const
Return the total force.
const dimensionSet dimless
label nBodies() const
Return the number of bodies in the model (bodies().size())
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
const rigidBodyModelState & state() const
Return the motion state.
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
Septernion class used to perform translations and rotations in 3D space.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
~rigidBodyMeshMotion()
Destructor.
Macros for easy insertion into run-time selection tables.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
virtual bool write() const
Write points0 if the mesh topology changed.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
virtual const pointField & points() const
Return raw points.
Mesh representing a set of points created from polyMesh.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Templated function that returns the corresponding 1 (one).
pointVectorField & pointDisplacement()
Return reference to the point motion displacement field.
Six degree of freedom motion for a rigid body.
stressControl lookup("compactNormalStress") >> compactNormalStress
dimensionedScalar cos(const dimensionedScalar &ds)
virtual void solve()
Solve for motion.
Pre-declare SubField and related Field type.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
void write(dictionary &dict) const
Write to dictionary.
Calculation of distance to nearest patch for all points.
scalar deltaTValue() const
Return time step value.
const Type & value() const
Return const reference to value.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const labelList & reversePointMap() const
Reverse point map.
virtual void calcForcesMoment()
Calculate the forces and moments.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
static const septernion I
rigidBodyMeshMotion(const word &name, const polyMesh &, const dictionary &dict)
Construct from polyMesh and dictionary.
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
const Mesh & mesh() const
Return mesh.
void solve(const scalar t, const scalar deltaT, const scalarField &tau, const Field< spatialVector > &fx)
Integrate velocities, orientation and position.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
const pointField & preMotionPoints() const
Pre-motion point positions.
static pointMesh & New(polyMesh &mesh)
virtual void rename(const word &newName)
Rename.
label nDoF() const
Return the number of degrees of freedom of the model.
const vector & g() const
Return the acceleration due to gravity.
label size() const
Return the number of elements in the UPtrList.
timeIOdictionary derived from IOdictionary with globalFile set false to enable writing to processor t...
writeOption writeOpt() const
label timeIndex() const
Return current time index.
static const versionNumber currentVersion
Current version number.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
label bodyID(const word &name) const
Return the ID of the body with the given name.
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
Mesh consisting of general polyhedral cells.
pointVectorField points0_
Starting points.
List< wordRe > wordReList
A List of wordRe (word or regular expression)
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
const polyMesh & mesh() const
Return reference to mesh.
A class for managing temporary objects.
spatialTransform transform0(const label bodyID) const
Return the transformation of bodyID relative to the initial time.
vector transformPoint(const vector &v) const
Transform the given coordinate point.
pointField & points0()
Return reference to the reference field.
displacementMotionSolver(const word &name, const polyMesh &, const dictionary &, const word &type)
Construct from mesh and dictionary.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
bool report() const
Return the report Switch.
bool checkIn()
Add object to registry.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
static const Vector< scalar > zero
static autoPtr< Function1< Type > > New(const word &name, const dictionary &dict)
Selector.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.