Saturday, February 16, 2013

Dark Matter Simulation Step 1


Today, we finished the interactive button pressing projectile motion simulation (which surprisingly only took about ten minutes) and posted on our website. http://www.sos.siena.edu/~mbellis/ew_processing/final_projectile.html

You can click on the button on the upper-right corner and stop the ball. Place the mouse on the ball to see the location of the ball. One thing you'll have to be aware of is that Processing's coordinate system is different than the ordinary coordinating system (see figure below).
So when you are looking at the location make sure to find the relative position based on the starting point's location. 

The next thing we did was to start making the Dark Matter Simulation!!! (a moment I've been waiting for so long!)
Dr. Bellis wants me to start with making the sun rotate around the center of the Milky Way Galaxy which I represented as a circle in the middle. It was perplexing at first because I did not have any experience on making circular motion before.  Dr. Bellis gave me a hint.. that is: the equation of a circle r^2=x^2+y^2 and I related it to x=rcos(theta) and y=rsin(theta) which I can use for the center of the circle as it moves. To create motion I have to increase the theta as time goes by so the code I made was x=rcos(theta+t*0.1) and similarly with y-coordinate. As for the "r" I made it a float (variable) so that we can modify it whenever we want.
I also added a few increasing transparency circles in the simulation to show the density of the stars in the Galaxy. 
Orange= Sun, Black= Center of the Galaxy

Code:
int windowHeight= 800;
int windowWidth= 800;

float radius= 20;
float t=0.0; 
float x0= 32;
float y0= 32;
float theta=3.142/6;


float meters2pixels= 10;
float pixels2meters= 1/meters2pixels;
int frameRateSpeed= 30;


void setup() {
    size(windowWidth, windowHeight);  
    noStroke();     
    frameRate(frameRateSpeed);   
}

void draw() { 
    
    background(255);  
    float g= 9.8;
    float x=cos(theta+t*.5)*radius+x0;
    float y=sin(theta+t*.5)*radius+y0;
    float ellipse_width=20;
    float ellipse_height=20;
    
    x = meters2pixels*x;
    y = meters2pixels*y;
    
    
    ellipseMode(CENTER);
    fill(230);
    ellipse(320,320,500,500);
    fill(200);
    ellipse(320,320,250,250);
    fill(150);
    ellipse(320,320,120,120);
    fill(0);
    ellipse(320,320,20,20);
    fill(240,127,70);
    ellipse(x,y,ellipse_width,ellipse_height);
    
    PFont f;
    f = createFont("Microsoft Sans Serif", 16, true);
    textFont (f, 24);
    
   fill (182,132,222); 
    String time_text = "time: "+nf(t,1,2);
   text (time_text, 10, 580);
   fill (83,130,229);
   textFont (f,18);
   text("Center of Galaxy", 260,360);


    t= t+(1.0/frameRateSpeed);
    
   
   if (t>400)
   { 
     t= 0;
   }
   if (y>=windowHeight)
   {t=0;}
  
   
}


The next meeting I'll add Earth to our simulation which will rotate around the sun while the sun rotates around the center of the universe.

Because I finished this step early I asked Dr. Bellis about Higgs Boson and the Higgs Mechanism that I read on a website (http://case.ntu.edu.tw/blog/?p=12593#more-12593 ==in Chinese). During our conversation I learned that he was involved in the experiment. The Higgs Boson was found recently by CERN (a large particle physics lab) using the LHC (Large Electron-Positron Collider, so big that it goes across the border of France and Switzerland-underground 27km circumference). It was really interesting to me because the LHC uses the same idea behind PET scan which is a scan used for detecting blood flow in brain (which I just read about a day ago for Neuroscience class). The machine shoots out a position (e+) which is an anti-matter, when it collides with an electron (e-) the collision produces two protons (p+) that shoot out in opposite directions. The circular machine then detects the protons that hit the wall and form a graph/image from the impacts it receive. For PET scan, the patient injects a radioactive substance (collides with positron and shoots out proton) in their blood so when there is more blood flow in a particular area in the brain, the PET scan can sense it. 

LHC and the route the particles travel

LHC air view
A PET scan for brain imaging 



2 comments:

  1. Yvonne, I really like all of the pictures you include in every post, because I think it really helps me get a visual of exactly what you are doing so I can follow along better. It's really cool how you can use a computer program to simulate so many different things, like a ball dropping or the rotation of the earth and sun in our galaxy. In our meeting, you seemed to really grasp how the simulations work and the meaning behind the functions you put into the codes, which is amazing since you have never done computer programming before!

    ReplyDelete
  2. Yvonne, great simulation. Never has stopping and starting a ball in space been so fun!

    I am impressed that you are moving through your exercises so quickly. You are proving to be an fast and efficient learner. This bodes well for your work on dark matter.

    A suggestion: make your URL links live so your readers can just click them.

    ReplyDelete