Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

Monday, 12 March 2018

Magnetization vs Time (FIG 8.7)

The exact value of the magnetization of a material at a given point of time is uncertain due to the random nature of the spins. This can be demonstrated by plotting the Magnetization as a function of time for a varying range of temperatures. In this Ising Model simulation a 10 x 10 lattice configuration is used with 1000 Monte Carlo sweeps for each temperature point. The time is not real time but solely a product of the Monte Carlo method, this means that one unit of time is one sweep through the entire lattice or one Monte Carlo sweep. This gives each spin the opportunity to flip during each time step. [1]

The beginning temperature is set to 1.5 and the result of which can be seen in Figure 1. The magnetization of the lattice is in the ferromagnetic state which is to be expected at this low temperature. There are a couple of instances in time where the magnetization drops  but these are fairly rare occurrences and just a small fluctuation due to the random nature in the Monte Carlo calculation. For the most part however all the spins are aligned and the lattice is in a ferromagnetic state.
Figure 1. Magnetization vs Time for T = 1.5
When the temperature is slightly increased to 2 as can be seen in figure 2. The fluctuations have increased significantly but the material is still in a ferromagnetic state. The average value of the magnetism has dropped to around to a magnetization value of roughly 0.9. The importance of the increase in fluctuations as they signal that the model is approaching a second order phase transition known as the critical point [1]. This point is sensitive to minor changes in the magnetic field or temperature. This will be shown even clearer when the temperature is raised closer to the Curie temperature.
Figure 2. Magnetization vs Time for T = 2
When this temperature is raised further to 2.25 the fluctuations are much larger and the system fluctuates around ± 0.8. The Curie temperature is 2.27 so the value the simulation is at is very close to that resulting in changes in phase from ferromagnetic to paramagnetic at certain instances of time. This is shown below in figure 3.
Figure 3. Magnetization vs Time for T = 2.25
In figure 4 the temperature is raised to 4 and the fluctuations have decreased and are situated approximately at M = ±0.2. The temperature is now above 2.27 and the system is now in the paragmagnetic state.
Figure 4. Magnetization vs Time for T = 4

The results achieved validated up by the the results found in Giordanos book In figure 5 & 6. The fluctuations due to the random nature of the Ising Model show it is difficult to predict the exact magnetization at a given temperature. However it is possible to get a good idea of what level of magnetization at a given temperature.
Figure 5. Magnetization vs Time from Computational physics by Giordano for T = 1.5 & T = 2

Figure 6. Magnetization vs Time from Computational physics by Giordano for T = 2.25 & T = 4


Friday, 23 February 2018

Magnetization and energy versus temperature (FIG 8.8 & 8.9)


The main ingredient of the Ising model is the energy of a pair of spins. The spin can only contain 2 possible values, up or down (+1 or -1). The Ising model tells us on each bond between spins the energy of the bonds is minimized when the 2 spins are aligned. It gives ability to display the phase transition of the material from ferromagnetic to paramagnetic. [1]
Figure 1 – Spin arrangement of ferromagnetic material (left) paramagnetic material (right)

Theory

For example, if we take Iron, at low temperatures (low depending on the characteristics of the material) the spins will be pointing in the same direction and the sample is said to be ferromagnetic. As the temperature is increased some spins begin to flip until the critical temperature is reached which is known as the curie temperature (which differs for different materials). At this point the spin orientation is random and the sample is now paramagnetic. A spin si can only be one of two values ±1. Each of these spins interacts with its nearest neighbour. A simple Ising model assumes an interaction only between nearest neighbours so that the energy of the system can be described as: [1, 4, 5]
Equation 1. energy of the system

<ij> is the sum over all pairs of nearest neighbours spins and j is known as the exchange constant and is assumed to be positive, The probability of finding the system in any particular state is:
Equation 2. he probability of finding the system in any particular state

Where  kB = Boltzmann constant, Eα is the energy of state α, and T is the temperature. The measure of Magnetization of the system is Mα which is the sum of values for sj multiplied by Pα


Equation 3. Magnetization of the system

Using these equations, it is possible to simulate a basic 2D Ising model. This model works by cycling through a number of defined temperature points within a set range. At each temperature point the Monte Carlo method is applied. This means that at every temperature point the simulation is run a set amount of times. The data from the simulation is then added together and divided by the number of simulations ran at that temperature point. This is done as the phase spins are random in nature as it is a quantum phenomenon. The simulation takes an initialised 10x10 lattice (2D Array) that is initially ferromagnetic (+1 in each cell) and cycles through each cell. At each cell Equation 1 is applied. If the value of the equation 1 is less than 0 then the spin is flipped (+1 to -1 or vice versa). If the value is greater than 0 than Equation 2 is applied. If the value of Equation 2 is greater than a randomly generated +1 or -1 then the spin is flipped. [1,4]
Equation 4. Energy per spin using Monte Carlo 

The spontaneous magnetization is calculated by applying Equation 3 for each MC sweep. And again, dividing by the number of MC sweeps × number of cells in array.


Results


Figure 2 below shows the change of spins with an increase in temperature for a 100 x 100 lattice. A snapshot is taken at a given at each temperature from 1 to 5 in steps of 0.1. The temperature at each stage is below on the x - axis individual squares represent a spin with Red = +1, Blue = -1
Figure 2. 100 x 100 lattice 
It can be seen at T = 1 all spins are +1 meaning that all spins are aligned and the material is ferromagnetic. As the temperature rises between 1-2 a small amount of random spins begin to flip around the lattice but revert back to +1. once T > 2 the amount of spins that begin to flip begin increasing until it reaches the curie temperature of roughly T = 2.3 where there is a dramatic increase. From T > 2.3 the spins are randomly flipped in groups.  The number of +1 and -1 spins throughout the material are now roughly equal and the material is now paramagnetic.

The simulations for magnetism and energy can be seen below. The simulations where run twice to show the random variations. The first simulation is shown in blue and the second simulation shown in red.

The Magnetization of the system can be seen in Figure 3. At T = 1 the magnetization is 1 and slowly drops off until it reaches the curie temperature. There is a clear drop off in magnetization at the curie temperature region which shows the phase change. After this point the magnetization hovers around zero. This can be seen in Figure 3 and is validated in Figure 4.

Figure 3. Simulated spontaneous magnetization as a function of temperature
Figure 4. Spontaneous magnetization as a function of temperature from Giordano (Fig 8.8 ) [1]
The energy of the system can be seen to rise as the phase changes, with the transition at the curie temperature. The Simulated thermal average of the energy per spin versus temperature can be seen in figure 5. and validated in figure 6.

Figure 5. Simulated thermal average of the energy per spin versus temperature
Figure 6. thermal average of the energy per spin versus temperature from Giordano (Fig 8.9) [1]

Monday, 19 February 2018

Specific heat per spin (FIG 8.10)

The specific heat per spin is calculated according to the fluctuation-dissipation theorem:


Equation 1. fluctuation-dissipation theorem
Where T is the temperature at a given point, Kb is the Boltzmann’s constant and (ΔE)^2 is the total energy variance and can be calculated as follows: 

Equation 2. total energy variance
Where < E >^2 is the average energy level and < E^2 > is the average squared energy level:


Figure 1. Specific heat simulated
Figure 2. Specific heat computational physics by Giordano (Fig 8.10) [1]



Saturday, 17 February 2018

correlation functions (8.11 )

The correlation function shows the relationship between a specific a spin S0 and its neighbors Si the function can be described as :

 The program cycles through each spin in a 20 x 20 lattice. for each spin at a given point S0, the average values of its neighbors Si are multiplied together. To start Si is = 1 so the neighbors are the immediate spins nearest to s0. This goes through all the way to i = 10/ The results of which can be seen below for varying temperatures. 

Figure 1 - Correlation Function simulated

Figure 2 - Correlation Function from Computational Physics by Giordano (Fig 8.11) [1]