Implementing orbital motion
Hello,
I want to simulate the motion of debris (a cube made of pfacet) and a group of cylinders orbiting around the Earth. To do this, I want to use the Clohessy–Wiltshire equations [1]. I thought I could use the forceEngine, but it appears it can only apply a constant force. The CentralGravityE
Kind regards,
Rohit John
[1] https:/
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Rohit John
- Solved:
- 2020-09-17
- Last query:
- 2020-09-17
- Last reply:
- 2020-09-16
Robert Caulk (rcaulk) said : | #1 |
Hello,
I am a little confused.
>The CentralGravityE
Even if what you say is true (which seems odd to me), why should that prevent you from using CentralGravityE
>I thought I could use the forceEngine, but it appears it can only apply a constant force.
You can change/turn off the applied force at any time step you like.
>FieldApplier looks promising, but how do I use it?
I don't think FieldApplier should be used directly. But I really don't know why you believe it looks promising. Please provide links to everything you reference. What are you reading? Where are you reading it? Otherwise we are just guessing at what you are referring to.
Cheers,
Robert
Janek Kozicki (cosurgi) said : | #2 |
Hi, this is a very nice idea.
If you want the qglviewer camera to follow your debirs you can for example use function https:/
I admit that the class name FieldApplier is very tempting when thinking about gravitational filed. It is a base class for all other *Engines that are supposed to apply some forces: https:/
CentralGravityE
You will need to write your own derived class to do what you want:
> Is there a way to define a force field using a fuction for position. The FieldApplier looks promising, but how do I use it?
Yes, exactly. Derive a class from it and make it apply some defined force field. You can hardcode force field in C++, or use overrideble virtual functions to be able to write function formula inside python: https:/
Janek Kozicki (cosurgi) said : | #3 |
Heh, sorry. I didn't use easier to read refs [1][2][3][4].
[1] https:/
[2] https:/
[3] https:/
[4] https:/
Rohit John (rohitkjohn) said : | #4 |
Hello,
Thanks for your answers
reply to Robert's comments.
> Even if what you say is true (which seems odd to me), why should that prevent you from using CentralGravityE
I want to observe the interaction between the debris and the cylinders. Viewing the motion, compared to tracking states of the bodies, will offer additional insights into the dynamics. I will read the document Janek suggested [1].
-------
>You can change/turn off the applied force at any time step you like.
From what I understood, the forceEngine applies the same force to all bodies in the simulation. I would like to have a force which depends on the position of the bodies. The equations are given here [2].
-------
> I don't think FieldApplier should be used directly. But I really don't know why you believe it looks promising. Please provide links to everything you reference. What are you reading? Where are you reading it?
I read the YADE documentation about fieldApplier [3]. I understood that the gravity fields use FieldApplier. Since there are engines for creating forces directed to an axis(AxialGravi
-------
reply to Janek's comments
> CentralGravityE
That's too bad. I thought it used Newton's gravitational law. If this is the case, I cannot use it.
-------
I do not know how to code a new engine or use c++. Please correct me if I am wrong. Can I add a new function for defining a the forces using the equations from [2] in the GravityEngines.cpp [4], based on the other functions in the file? Are there other files I must modify in addition to this?
Kind regards,
Rohit John
[1] https:/
[2] https:/
[3] https:/
[4] https:/
Janek Kozicki (cosurgi) said : | #5 |
Yeah, CentralGravityE
After you make it work, you should have enough understanding to implement the Clohessy–Wiltshire equations.
However you will need to learn a little about how to code C++. You can start by reading [1][2] and you are welcome to submit merge requests on gitlab, with your NewtonsGravityE
This is a bit more work than you expected at first - I suppose that you wanted to write code in python only.
[1] https:/
[2] https:/
[3] https:/
[4] https:/
Janek Kozicki (cosurgi) said : | #6 |
> Can I add a new function for defining a the forces using the Clohessy–Wiltshire equationsin the GravityEngines.cpp
> based on the other functions in the file? Are there other files I must modify in addition to this?
To learn how to do this, and how it all this code works in general, it is better that first you add class NewtonGravityEngine in files GravityEngines.cpp and GravityEngines.hpp , these two files should be enough for start.
I suppose that the other ones would better end up in ClohessyWiltshi
Rohit John (rohitkjohn) said : | #7 |
Hello,
Thank you Janek for your advice. I shall try this.
Janek Kozicki (cosurgi) said : | #8 |
You are welcome. Don't hesitate to ask again :)
Small fix in previous message: "starting acceleration and position" → of course I meant position and velocity :)