Energy conserving

16 views
Skip to first unread message

Ognen Kapetanoski

unread,
Jul 11, 2012, 9:54:33 PM7/11/12
to open...@googlegroups.com
I've download the latest changes from the repository and while I was trying to make some plots, I've revelead a couple of issues.

Although I have solved the other problems, there is one that I just can not find.

It is regarding the energy conserving of the particles, i.e. a particle can go far outside the simulation size. I have seen this in the plots and I was suprise to see that when the particles bounce from the bottom they do not just "bounce", they go under, i.e. they have negative y - coordinate. 

But the thing that I am curios about is that when I have done some plots between 26.04 - 01.05 this problem did not exist.

I have also attached two plots where you can see what I mean. One plot is done between 26.04 - 01.05 and the other yesterday (11.07).

I have tried to find the problem in the boundary classes, but as much as I have seen the history of commits there were a lot of changes there.

The deviations in the 0.4 version are not so big, but in the latest updates that I have done yesterday they are even bigger.

Anyone for idea?
01.05.JPG
26.04.JPG

Jan Kis

unread,
Jul 12, 2012, 6:27:25 AM7/12/12
to open...@googlegroups.com
Hi Ognen,

to understand the problem better - you are saying that the particle can go far outside the simulation area.
1) Does it ever come back?
2) Does this happen under both boundary conditions or only under hardwall boundaries?
3) You named your graphs 01.05.JPG and 26.04.JPG so it is not very clear which one did you make yesterday?
4) I am sorry for my lack of knowledge but what exactly does the graph show on the x and y axis?

Although I have solved the other problems, there is one that I just can not find.
If you fixed some bugs then please issue a pull request which corrects those bugs. 

Cheers,
Jan

Ognen Kapetanoski

unread,
Jul 12, 2012, 7:03:07 AM7/12/12
to open...@googlegroups.com
Hey Jan,
so to answer your questions:

1). Just observe the simulation with a very small frame rate. You can
also observe "one particle in gravity" with the "Semi implicit Euler"
algorithm and you will see that the particle goes down under, i.e. it
decreases its velocity and vanishes. For the normal simulation the
particles come back, but they go to much "into the wall". To make
things clearer, I am attaching another picture from the simulation.
Observe the particle in the bottom right corner;

2). I have just test under the hardwall boundary conditions, for the
periodic conditions does not exists this kind of problem;

3). The graph named 01.05 it is from yesterday, sorry, my mistake, it
should be named 11.07, and the graph named 26.04 was from before, i.e.
in the period between 26.04 and 01.05 (I wanted to name them after the
dates);

4). On the plot you can see that particles are going under the
horizontal line named "x/[px]" in the plot. This line represent all
the points on the graph with zero y - coordinate (y = 0). All the
points above that line have a positive y - coordinate and all the
points under have a negative y - coordinate. A particle muss not have
a negative y - coordinate, i.e. that means that a particle goes out of
the simulation area.

The other bugs that I have fixed are just a minor thing for the
writing function, so it does not affect the simulation at all and I
will make a pull request for it, but I was kind of busy trying to find
the problem with the boundaries. :-)

Cheers,
Ognen


2012/7/12 Jan Kis <jano...@gmail.com>:
Simulation_picture.JPG

Jan Kis

unread,
Jul 13, 2012, 10:34:44 AM7/13/12
to open...@googlegroups.com
After a skype with Ognen we concluded that there are two issues / questions which we believe are now resolved but maybe the rest of you will differ; therefore, I attach the questions and answers below.

To recapitulate the set up, we are talking about hardwall boundary conditions under "Single particle in gravity" experiment with Semi-implicit Euler particle solver (although the question 1 applies to the hardwall boundaries in general).

1) Why are the particles in the current version going constantly below the y = 0 line and only then they are bounced off? (this is not happening in the version 0.4)

This is happening because in the version 0.4 we checked for particle's circumference to be outside of the simulation area. In the current version we check particle's center to be outside of the simulation area, hence the y position smaller than 0. 

(I needed to change the position check because I separated the code which checks the particle to be outside of the simulation area from the application of the boundaries. As a consequence, the checking of the particle's position is now the same for any kind of boundary. I was thinking that the hardwall boundaries allow the particle to go out of the simulation area anyway, so it should not be much of a difference if we check the particle's position at its center instead of its circumference) 

2) Why is the particle disappearing below the y = 0 line? (this is also happening in the version 0.4)

This happens in my opinion due to the imperfection of the Semi-implicit Euler algorithm and due to the fact that the hardwall boundaries never correct the particle's position. The algorithm always sets a little lower speed than the real speed. Consequently, as the speed gets smaller we can change it to positive speed by the hardwall boundary but nevertheless, in the solver we always update the speed based on the gravity which can cause the speed to be again negative. As a result, the particle never comes back but gets deeper and deeper.

I am not really sure whether there is something we should do about this. As correct solution seems to me to check whether the particle is not a second time in a row outside of the simulation area and if it is then manually correct its position?

Cheers,
Jan 

Andreas Ipp

unread,
Jul 13, 2012, 10:54:27 AM7/13/12
to open...@googlegroups.com
Just a quick reply:



1) Why are the particles in the current version going constantly below the y = 0 line and only then they are bounced off? (this is not happening in the version 0.4)

This is happening because in the version 0.4 we checked for particle's circumference to be outside of the simulation area. In the current version we check particle's center to be outside of the simulation area, hence the y position smaller than 0. 

Oh, I didn't notice this change. This is dangerous, because if one thinks of "large" particles, then definitely the previous implementation was "more correct" than the current one (although both are not perfect). Think of two balls of different size sitting on a table. The larger ball will have the center above the smaller ball.
(of course, for small particles or if all particles are of equal size, as it the case now, the change will not matter much)


2) Why is the particle disappearing below the y = 0 line? (this is also happening in the version 0.4)

This happens in my opinion due to the imperfection of the Semi-implicit Euler algorithm and due to the fact that the hardwall boundaries never correct the particle's position. 

The correct thing to do would be to also change the particle's position. But this has to be done very carefully, in order to preserve the energy of the particle in an external potential (for example, if the particle is in a gravity field, the particle should become slower as its position is moved upward). One should calculate the point of collision with the wall and determine from that the new position and velocity after the collision.

Since this is a project on its own, I would leave this to some future student and not care about this right now.

I think there is a reason why most scientists prefer the periodic boundary conditions - they involve far less headache...

At least, it should not be too difficult to use the particle's radius for the collision check - or would it?
(again, if it looks difficult, first concentrate on the periodic boundary conditions)

(also for Ognen's plots, I would prefer forces that don't require collision with the wall, like the spring force, because the hardwall boundary can change things a lot).

Cheers,
Andreas

Jan Kis

unread,
Jul 17, 2012, 2:43:44 PM7/17/12
to open...@googlegroups.com
Hi guys,

I repaired the hardwall boundaries to use the particle's radius when detecting whether the particle is outside of the simulation area.
I issued a pull request with the correction (https://github.com/openpixi/openpixi/pull/31).

Cheers,
Jan
Reply all
Reply to author
Forward
0 new messages