Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-17 Thread Janek Kozicki
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Janek Kozicki posted a new comment:
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 :)

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-17 Thread Rohit John
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Status: Open => Solved

Rohit John confirmed that the question is solved:
Hello,

Thank you Janek for your advice. I shall try this.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-16 Thread Janek Kozicki
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Janek Kozicki posted a new comment:
> 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
ClohessyWiltshire.hpp  ClohessyWiltshire.cpp, because they are a bit
more complicated.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-16 Thread Janek Kozicki
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Janek Kozicki posted a new comment:
Yeah, CentralGravityEngine is a really bad name. I don't think it is
used very often in yade so we could rename it to something like
CentralAccelerationEngine. Then you could use that one as the basis for
Newton's gravity and use distance as it should be used :) That would be
a simple start for you. And easy to check - since you work with orbital
mechanics, you should have simple examples at hand with starting
acceleration and position to recreate the Earth-Moon system (or maybe
even the solar system) to check this code. Basically your Newton's
gravity Engine will be extremely similar to CentralGravityEngine (to be
renamed into CentralAccelerationEngine) but you just need to add an
extra line which uses distance instead of doing normalize on that vector
:)

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 NewtonsGravityEngine and the Earth-Moon example
[3][4].

This is a bit more work than you expected at first - I suppose that you
wanted to write code in python only.

[1] https://yade-dem.org/doc/user.html
[2] https://yade-dem.org/doc/prog.html
[3] https://yade-dem.org/doc/installation.html#source-code
[4] https://yade-dem.org/doc/gitrepo.html

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-16 Thread Rohit John
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Status: Needs information => Open

Rohit John gave more information on the question:
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 CentralGravityEngine? There are plenty of ways to "see" motion 
> without physically observing it in a window.

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(AxialGravityEngine) or a body (CentralGravityEngine), I 
assumed that the forces are dependent on the position of the body they act on. 
I do not know how exactly the engine works. I then assumed it would be possible 
to create a function capable of exerting a position dependent force on a body


reply to Janek's comments
> CentralGravityEngine does not depend on distance
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://yade-dem.org/doc/yade.qt.html#yade.qt._GLViewer.center
[2] https://en.wikipedia.org/wiki/Clohessy%E2%80%93Wiltshire_equations
[3] https://yade-dem.org/doc/yade.wrapper.html#fieldapplier
[4] 
https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/common/GravityEngines.cpp#L51

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-16 Thread Janek Kozicki
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Janek Kozicki posted a new comment:
Heh, sorry. I didn't use easier to read refs [1][2][3][4].

[1] https://yade-dem.org/doc/yade.qt.html#yade.qt._GLViewer.center
[2] https://yade-dem.org/doc/yade.wrapper.html#fieldapplier
[3] 
https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/common/GravityEngines.cpp#L51
[4] https://yade-dem.org/doc/prog.html#subclassing-c-types-in-python

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-16 Thread Janek Kozicki
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Janek Kozicki posted a new comment:
Hi, this is a very nice idea.

If you want the qglviewer camera to follow your debirs you can for
example use function https://yade-
dem.org/doc/yade.qt.html#yade.qt._GLViewer.center , I didn't try how it
works when invoked from a python script inside an Engine loop though. I
didn't expect such kind of use for this function. So we might need to
improve it a little bit. Or maybe add some alternative toggle to always
recenter in C++ before a redraw.

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://yade-
dem.org/doc/yade.wrapper.html#fieldapplier

CentralGravityEngine does not depend on distance: https://gitlab.com
/yade-dev/trunk/-/blob/master/pkg/common/GravityEngines.cpp#L51

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://yade-dem.org/doc/prog.html#subclassing-c-types-in-python

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692956]: Implementing orbital motion

2020-09-16 Thread Robert Caulk
Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Status: Open => Needs information

Robert Caulk requested more information:
Hello,

I am a little confused.

>The CentralGravityEngine will not work because the length scale
involved would be of the order of 6000km, so I may not be able to use
the viewer to check the motion

Even if what you say is true (which seems odd to me), why should that
prevent you from using CentralGravityEngine? There are plenty of ways to
"see" motion without physically observing it in a window.

>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

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp