NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: lookang on November 13, 2009, 05:04:23 pm



Title: how to simulate flow of particles in a wire?
Post by: lookang on November 13, 2009, 05:04:23 pm
how to simulate flow of particles in a wire?

i analyze the method used here
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=912.0

say for the loop wire
 
Code:
if(x2[j] else if(x2[j]>a-D*i)x2[j]-=D;

is used to trick the human eyes by telling when to disappear n appear a distance + or -D away.

i actually ran into some bug.
the codes works when the variables "lengthx" is 1.5 which is the same as your "D". perfect synchronization, the particles disappear n appear together of the visual effect of particle flow is achieved.

but when i create a slider, and move it,
the particles, dynamically re position but the spacing is funny, not equal.

the resultant new effect is not realistic enough to "trick" to human eye.

any tips for me to explore? my source is attached :)




Title: Re: how to simulate flow of particles in a wire?
Post by: lookang on November 13, 2009, 05:22:25 pm
not to worry!
i fixed it! ;D

i changed the initialization page to
Code:
for(int i=0;i y1[i]=-lengthz/2+lengthz/n*i; // AD
 y3[i]=lengthz/2-lengthz/n*i; // BC
 x2[i]=a-lengthx/n*i; //AB
 x4[i]=a-lengthx/n*i; // DC
}

which then when the slider is moved
action
added
"
Code:
_initialize();
setparam ();

no problem now!!! cool!

really learnt a lot of (problem solving skills & critical thinking) from analyzing, making sense, remixing the virtual lab to suit my design ideas of how to finer customized the virtual lab.
fantastic pedagogy for learning problem solving skills & critical thinking ;D

my physics knowledge comes alive in the java applet. cool way to assess my learning by portfolio like what prof wolfgang is doing i think.


Title: Re: how to simulate flow of particles in a wire?
Post by: Fu-Kwun Hwang on November 13, 2009, 08:10:35 pm
Great! You are making it better and better.  :D


Title: how to simulate flow of particles in a wire
Post by: Femida on March 10, 2015, 04:03:46 am
To fill a blank?