54 initialPoints_(
p.localPoints()),
74 rhoName_(
dict.getOrDefault<
word>(
"rho",
"rho")),
79 if (rhoName_ ==
"rhoInf")
81 dict.readEntry(
"rhoInf", rhoInf_);
84 if (
dict.readIfPresent(
"g", g_))
89 if (!
dict.found(
"value"))
94 if (
dict.found(
"initialPoints"))
100 initialPoints_ =
p.localPoints();
108 const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf,
110 const DimensionedField<vector, pointMesh>& iF,
111 const pointPatchFieldMapper& mapper
114 fixedValuePointPatchField<
vector>(ptf,
p, iF, mapper),
115 motion_(ptf.motion_),
116 initialPoints_(ptf.initialPoints_, mapper),
117 rhoInf_(ptf.rhoInf_),
118 rhoName_(ptf.rhoName_),
119 lookupGravity_(ptf.lookupGravity_),
133 motion_(ptf.motion_),
134 initialPoints_(ptf.initialPoints_),
135 rhoInf_(ptf.rhoInf_),
136 rhoName_(ptf.rhoName_),
137 lookupGravity_(ptf.lookupGravity_),
163 refCast<const sixDoFRigidBodyDisplacementPointPatchVectorField>(ptf);
167 initialPoints_.
rmap(sDoFptf.initialPoints_, addr);
178 if (lookupGravity_ < 0)
180 if (
db().time().foundObject<uniformDimensionedVectorField>(
"g"))
182 if (lookupGravity_ == -2)
185 <<
"Specifying the value of g in this boundary condition " 186 <<
"when g is available from the database is considered " 187 <<
"a fatal error to avoid the possibility of inconsistency" 202 const Time& t =
mesh.time();
203 const pointPatch& ptPatch = this->
patch();
206 bool firstIter =
false;
207 if (curTimeIndex_ != t.timeIndex())
210 curTimeIndex_ = t.timeIndex();
214 dictionary forcesDict;
216 forcesDict.add(
"type", functionObjects::forces::typeName);
217 forcesDict.add(
"patches",
wordList(1, ptPatch.name()));
218 forcesDict.add(
"rhoInf", rhoInf_);
219 forcesDict.add(
"rho", rhoName_);
222 functionObjects::forces
f(
"forces",
db(), forcesDict);
224 f.calcForcesMoments();
228 if (lookupGravity_ == 1)
242 ramp*(
f.forceEff() + motion_.
mass()*g_),
261 os.writeEntry(
"rho", rhoName_);
263 if (rhoName_ ==
"rhoInf")
265 os.writeEntry(
"rhoInf", rhoInf_);
268 if (lookupGravity_ == 0 || lookupGravity_ == -2)
270 os.writeEntry(
"g", g_);
286 sixDoFRigidBodyDisplacementPointPatchVectorField
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...
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void write(Ostream &) const
Write.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UniformDimensionedField< vector > uniformDimensionedVectorField
const pointPatch & patch() const noexcept
Return the patch.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
sixDoFRigidBodyDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
const point & centreOfRotation() const
Return the current centre of rotation.
Foam::pointPatchFieldMapper.
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
point transform(const point &initialPoints) const
Transform the given initial state point by the current motion.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Macros for easy insertion into run-time selection tables.
vector momentArm() const
Return the current momentArm.
friend Ostream & operator(Ostream &, const Field< vector > &)
A class for handling words, derived from Foam::string.
virtual void rmap(const pointPatchField< vector > &, const labelList &)
Reverse map the given pointPatchField onto this pointPatchField.
const Time & time() const noexcept
Return time registry.
Foam::sixDoFRigidBodyDisplacementPointPatchVectorField.
bool updated() const noexcept
True if the boundary condition has already been updated.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
const objectRegistry & db() const
The associated objectRegistry.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const uniformDimensionedVectorField & g
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
void newTime()
Store the motion state at the beginning of the time-step.
pointPatchField< vector > pointPatchVectorField
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
virtual void write(Ostream &) const
Write.
List< word > wordList
A List of words.
virtual void write(Ostream &) const
Write.
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Basic pointPatch represents a set of points from the mesh.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
scalar mass() const
Return the mass.
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
void update(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Symplectic integration of velocities, orientation and position.
const DimensionedField< vector, pointMesh > & internalField() const noexcept
Return dimensioned internal field reference.
static constexpr const zero Zero
Global zero (0)