NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/  September 23, 2019, 08:10:57 am  Welcome, Guest. Please login or register.Did you miss your activation email? 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length Home Help Search Login Register
An interaction between two opposites produces a unique outcome. ..."Jules Henri Poincare(1854-1912, One of France's greatest mathematicians)"
 Pages:    Go Down Author Topic: particle model for solid/liquid/gas states  (Read 92829 times) 0 Members and 2 Guests are viewing this topic. Click to toggle author information(expand message area).
Fu-Kwun Hwang
Hero Member      Offline

Posts: 3082   « Embed this message on: November 04, 2005, 09:10:02 am » posted from:Taipei,T'ai-pei,Taiwan Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME

Matter can be either in solid,liquid or gas state due to the change in temperature.
This is an animation of particle model for such situation.
Because we need to add enough particles and calculated all the interactions between any two particles. the animation is a slow motion to illustrate a real situation.

You can change the gravity and Temperature of the system. You can also drag any one of the green box to change the volume of the container.

A smaller attraction force between particle was assumed: F(r)=-k/r for 2D simulation (equilibrium to 1/r2 for 3D).

The initial state is g=10.0 and T=250K. Wait for a few minutes, you will find something similar to the following image, similar to a solid state. Particles are located at nearly fixed locations. If you increase the temperature , you might found the system change to liquid state. The particles try to fill the lower part of the container. There are still attracted to each other and particle can moving around. If you increase to even higher temperature, you will find the system change to gas state. Particles try to fill the whole volume of the container. Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME Logged
lookang
Hero Member      Offline

Posts: 1792 http://weelookang.blogspot.com  « Embed this message Reply #1 on: February 20, 2009, 12:27:21 pm » posted from:Singapore,,Singapore Hi Prof,

what mathematical model equation is this using.

is there any wikipedia page on the mathematical equations used?
some how the equations used in EJS xml doesnt look like
http://en.wikipedia.org/wiki/Kinetic_theory

i am looking at

initialisation:
int n2=(int)Math.sqrt(n);
double dx=(xr-xl)/n2,dy=range/n2;
for(int i=0;i<n;i++){
x=xl2+ (i%n2)*dx+size*1.5;
y=ymin+dy*((i/n2))+size;
// x=(xr-xl-R)*(Math.random()-0.5);
// y=range*(Math.random()-0.5);
}
setV();
_view.getElement("Trace").reset();

evolution:
dvx/dt = (getF(i,x,y)-b*vx)/m
dvy/dt = (getF(i,y,x)-b*vy)/m-g

fixed:
double v,cta;
for(int i=0;i<n;i++){
if(x>xr){
x=2*xr-x;
vx=-rr*vx;
}else if(x  x=2*xl-x;
vx=-rr*vx;
}
if(y>ymax){
y=2*ymax-y;
vy=-vy;
}else if(y  y=2*ymin+size-y;
vy=-rr*vy;
}
v=Math.sqrt(vx*vx+vy*vy);
if(v<vmin){
cta=Math.PI*2*Math.random();
vx=vmin*2*Math.cos(cta);
vy=vmin*2*Math.sin(cta);
}
}
x0=x[n2];
y0=y[n2];
ymin2=ymin;

custom:
public void setVmin(){
b=0.2*(1.-(T-T0)/(Tmax-T0));
vmin=Math.sqrt((T-T0)/Tk);
if(vmin>vmax/2)vmin=vmax/2.;
}

double r,dx,dy,f,f2;
public double getF (int id,double x[],double y[]) {
f=0.;
for(int i=0;i<n;i++){
if(i!=id){
dx=x[id]-x; dy=y-y[id];
r=Math.sqrt(dx*dx+dy*dy);
//  if(r>R3)f2=0.;
//  else if(r>R) f2=F0*(1.5-0.5*r/R)/r;
if(r>R)f2=F0*R/r;
else f2=F0+(R-r)*(Fmax-F0)/R;
//  f2=F0*R/r;
//  if(r  f+=f2*dx/r;
}
}
return f/n;
} Logged
Fu-Kwun Hwang
Hero Member      Offline

Posts: 3082   « Embed this message Reply #2 on: February 20, 2009, 01:04:15 pm » posted from:Taipei,T'ai-pei,Taiwan Code:
public double getF (int id,double x[],double y[]) {
f=0.;
for(int i=0;i<n;i++){
if(i!=id){
dx=x[id]-x[i]; dy=y[i]-y[id];
r=Math.sqrt(dx*dx+dy*dy);
//  if(r>R3)f2=0.;
//  else if(r>R) f2=F0*(1.5-0.5*r/R)/r;
if(r>R)f2=F0*R/r;
else f2=F0+(R-r)*(Fmax-F0)/R;
//  f2=F0*R/r;
//  if(r  f+=f2*dx/r;
}
}
return f/n;
}

I have tested the above code with different models. (some lines has been removed, some are just comment out!)
As far as I can remembered: I did tried with Lennard-Jones potential , but I did not get a good result. (did not find the good parameter space values for the simulation).
You can tried with different model by yourself. This is the beauty of using EJS to build and test you own model.

The above code assume F(r)=-Fo/r; in the vector r direction.
Then, the x component is calculated as Fx(r)=F(r)*x/r=-Fo*x/r2; (similar for Fy(r)=F(r)*y/r;)
Actually, this is  Columb's Law in 2D.
For Columb's Law in 3D: The formula is the famous F(r)=-F0/r2;

You can understand the above relations with Gauss Law. The model assume space is uniform.
In 3D: The surface area at r is 4*π*r2 so  force is proportional to  r-2 (or 1/r2).
In 2D: The surface area at r is 2*π*r so  force is proportional to  r-1 (or 1/r).
Just like the B field at distance r from a straight current line is proportional to 1/r; Logged
 Pages:    Go Up
An interaction between two opposites produces a unique outcome. ..."Jules Henri Poincare(1854-1912, One of France's greatest mathematicians)"
 Related Topics Subject Started by Replies Views Last post   particle model of liquid in a container (microscopic) misc Fu-Kwun Hwang 4 29400 June 01, 2010, 11:13:56 pm by ahmedelshfie   particle model for solid/liquid/gas states in 3D Thermodynamics Fu-Kwun Hwang 3 67528 February 20, 2019, 12:38:21 pm by earopper  Ejs Open Source Particle model for solid liquid gas states by Fu-Kwun Hwang Collaborative Community of EJS lookang 10 18724 March 04, 2010, 11:19:43 am by housefull  Particle model for solid liquid gas thermodynamics ahmedelshfie 9 9284 April 06, 2010, 09:58:33 am by Fu-Kwun Hwang  particle model of liquid in a container (microscopic) misc ahmedelshfie 0 5055 June 01, 2010, 06:18:05 pm by ahmedelshfie
Page created in 0.089 seconds with 22 queries. since 2011/06/15