External forces for rigid body dynamics
Currently the rigidBodyDynamics library only supports springs, dampers and a prescribed rotation. I'd love to see a functionality that allows for an external force restraint. E.g for simulating a rigid body that is being pushed by a certain force. Which might be especially useful for overset simulations. Attached is this restraint, which I'd like to see added to src/rigidBodyDynamics/restraints. The force is time and direction variable via function1. externalForce.zip
Best regards
Stephan
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Link issues together to show that they're related. Learn more.
Activity
- Prashant Sonakar mentioned in issue #1039
mentioned in issue #1039
- Developer
- Prashant Sonakar added feature request label
added feature request label
- Maintainer
Can you test with attached drop-in replacements for rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion?
- syntax is 'force' and 'moment' instead of 'forces' 'moments'
- this moment/force gets applied also in normal mode
There is an error in the provided files
moment = bm.forcePtr_().value(t.value());
should beforce = bm.forcePtr_().value(t.value());
After switching that it works. I have tested it with a single mass oscillator. Attached is the comparison of analytical and numerical solution. It does behave like the patch I provided. validation1.eps
There are two minor differences to my approach:
- The force can't be applied of center and hence produce a moment. Since the moment is specified separately i don't mind though. Might even be more user friendly this way.
- It is not specified under restraints though, which might be more intuitive. Just as a remark.
- Maintainer
Sorry, I overlooked your code. Do you maybe have an example that uses it?
Since it is already possible to include gravity I replaced it for testing by a force vector of mg. The flow and mesh motion boundary conditions are set up in such a way, that only the rigid body solver is active. There are two restraints. A spring and the gravity vector. The ODE is hence: mx''(t)+cx(t) = mg.
Edited by Stephan- Developer
Thanks for the example. We will review this.
- Developer
Unfortunately not yet. Last time I've tested the code as supplied by Mattijs on some rotating body about its CG and other time with offset. As far I remember there were some issues for force being active all the time steps, and hence the velocity was ramping up (whilst it should be equal to r*omega). This could be achieved by using impulse force, but was left as to-do later-on.
Now that you mention the code is validated for a rotor, could you please check if the same is true with code from Mattijs? It would be definitely useful to integrate.
Totally forgot about this one. Yes, both versions do function as intended. And yes if a force is active all the time, the body will be accelerated to an infinite velocity, unless the fluid forces slow it down, or e.g a spring is added as well (see the provided test case). This is however the correct behavior. This came back to my mind, because apparently my implementation was added to the openfoam.org dev version a few days ago by another author, either by copying mine or independently adding the same functionality (https://github.com/OpenFOAM/OpenFOAM-dev/commit/278ba86d7d663e7eaf84eccf2d06f03ccdc1b1d2). Since it is identical to my code and tested I'd suggest adding it in same fashion as in that openfoam version instead of Mattijs version to not confuse the user.