Physics 6730 Assignment 11

In this assignment you will gain some experience with parallel computing with a Monte Carlo simulation of the two-dimensional Ising model. Please see the class notes for MPI , PBS , and the Ising model.

For each of the following exercises create the specified files with your answer(s). Submit your homework using the course submit utility.


Exercise 1 Understanding the code

The nearly completed code is in ~p6730/examples/a11. Please look at the code and answer the following questions in a file ising_code.txt.
  1. If we were simulating a 128 x 128 lattice on 8 processors, what would be the x and y lattice dimensions on each processor?
  2. What is the purpose of the arrays spinL and spinR?
  3. The algorithm uses checkerboarding to avoid possible directional biases. In this scheme, all the "red" sites are updated, then all the "black" sites, then all the "red" sites again, etc. What are the checkerboard values for the sites (x,y) = (0,0), (0,1), (13,15)?
  4. Explain the logic used in the update subprogram for summing the spins of the neighbors of a given site (x,y) on a given node.


Exercise 2 Completing the code

Complete the code according to instructions in the code file. Write a Makefile to go with it. Hand in the completed files ising2d.cc and Makefile.

Exercise 3 Checking the code

A test input file testin and output file testout are provided for checking your code. The testout file was generated on TWO nodes. Write a PBS job script ising.pbs for running your job in batch mode on two processors, submit the job for batch processing, and compare the output with the testout file. Hand in the PBS job script file.

Exercise 4 Critical temperature for the Ising system

Estimate the critical (Curie) temperature for the Ising system numerically. The exact answer due to Onsager is
   Tc = 1/beta = 2/log(1 + sqrt(2)) = 2.269.
To locate the critical temperature, run the simulation on lattices of size 256 x 256 and measure the average spin for a series of beta values and a small magnetic field (h < .0005). Plot the spin with statistical errors as a function of magnetic field and find the inflection point (where the slope reaches a maximum). This is your estimate of the critical beta value. For better statistics the average spin should be computed as an average of a dozen or so measurements. For example, run for several thousand sweeps, measuring every 100 sweeps, and take the average of the last couple dozen measurements. This strategy gives the system time to reach thermal equilibrium before proceeding to make a measurement.

Hand in a table of your results giving beta, mean spin, and standard deviation of the mean in a file ising.txt.


Exercise 4. Optional. Visualization.

Peter Young at UC Santa Cruz displays an interesting Java applet originally by Bernd Nottelmann. Try writing out the Ising spins from each node and then using a separate scalar code and our ppm.h utilities to generate .ppm files showing the distribution of up and down spins. You will need to convert the 1's and -1's to gray scale values (white and black should work fine.)
This page is maintained by:
Carleton DeTar Mail Form
Last modified 16 April 2004