Class AntiprotonClu
- java.lang.Object
-
- edu.rit.clu.antimatter.AntiprotonClu
-
public class AntiprotonClu extends java.lang.ObjectClass AntiprotonClu is a cluster parallel program that calculates the positions of the antiprotons as a function of time. Each antiproton experiences a net repulsive force from all the other antiprotons. Each antiproton also experiences a force due to a magnetic field perpendicular to the plane in which the antiprotons move.Usage: java -Dpj.np=K edu.rit.clu.antimatter.AntiprotonClu seed R dt steps snaps N outfile
The program runs in K parallel processes. Each process writes its own output file. If outfile is specified as "out.dat", for example, then process 0 writes file "out_0.dat", process 1 writes file "out_1.dat", and so on.
The program:
- Initializes a pseudorandom number generator with seed.
- Generates N antiprotons positioned at random in the square from (0.25R,0.25R) to (0.75R,0.75R).
- Sets each antiproton's initial velocity to 0.
- Stores a snapshot of the antiprotons' initial positions in the outfile.
- Performs steps time steps and stores another snapshot of the antiprotons' positions in the outfile. Each time step is dt.
- Repeats Step 5 snaps times. The number of snapshots stored in the outfile is snaps+1.
The computation is performed in parallel in multiple processors. The program measures the computation's running time.
Each process holds the entire position array, one slice of the velocity array, and one slice of the acceleration array. At each time step, each process calculates its own slice of the acceleration array using the entire position array. Each process uses its slice of the acceleration array to update its slices of the velocity and position arrays. Then the processes do an all-gather of the position array slices, so every processor has the complete new position array for the next time step. Each process writes snapshots of its own slice of the position array into the process's own output file.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidmain(java.lang.String[] args)Main program.
-
DMelt 3.0 © DataMelt by jWork.ORG