A new rigid body restraint that can be used with fvOption
Functionality to add/problem to solve
Creating a restraint in rigid body simulations that utilizes calculated values from an fvOption. The concept is to acquire force and moment values from any fvOption and easily apply them as external forces and moments. While the same functionality can be achieved by reading/writing to a dictionary, I believe this feature request will make it more elegant.
Target audience
Ship Hydrodynamics, Offshore Wind Platforms etc.
Proposal
Any ideas/suggestions are welcomed.
Inside dynamicMeshDict, the user should define the new type of restraint as follows:
restraints
{
force1 // Any name
{
type bodyForceMoment; // Just a suggestion :smile:
body aMasslessBody1; // massless body
// location (-3.386 0 0.21); // not required anymore since it will use massless bodies CoG
fvOptionsName virtualDisk1; // Name of the fvOption object, as specified in the fvOptions dictionary
}
force2 // Any name
{
type bodyForceMoment;
body aMasslessBody2; // massless body
fvOptionsName virtualDisk2; // Name of the fvOption object, as specified in the fvOptions dictionary
}
}
What should this bodyForceMoment restraint do?
- It should create a pointer to the fvOptions residing inside the object registry with the specified fvOptionsName in the restrained sub-dictionary.
- It should obtain the total force and moment from any fvOptions.
- Getting these values is also another unclear issue, but I suggest adding getForce and getMoment methods to the fvOptions. These methods should return the parameters corresponding to the total force and the total moment.
Finally, the restraint function may look like the following:
void Foam::RBD::restraints::bodyForceMoment::restrain
(
scalarField& tau,
Field<spatialVector>& fx,
const rigidBodyModelState& state
) const
{
// Create a pointer in bodyForceMoment constructor to fvOptions.
// Let's call it fvOptPtr
const vector force = fvOptPtr->getForce(); // Using the suggested method to get the force
const vector moment= fvOptPtr->getMoment(); // Using the suggested method to get the moment
// Accumulate the force for the restrained body
fx[bodyIndex_] += spatialVector(moment, force);
}
For this implementation, I don't know how to create a pointer to the fvOption object from the object registry. If someone can help me with this, I am ready to implement everything.