#!/usr/bin/env python # coding: utf-8 # # Simulation at finite temperature # # ## `Xf_ThermHeunEvolver` # # tutorial comming soon # # ## `Xf_ThermSpinXferEvolver` # # tutorial comming soon # # ## `UHH_ThetaEvolver` # # This tutorial demonstrates the use of the `UHH_ThetaEvolver` for simulations at finite temperature (based on the example mif file published as part of the relevant OOMMF extension). # In[1]: import discretisedfield as df import micromagneticmodel as mm import oommfc as mc # We define the system object and specify the temperature 60K. # In[2]: system = mm.System(name="thetaevolve", T=60) # The simulation is done on a square geometry. The magnetisation is initialised uniformly pointing in x direction. # In[3]: mesh = df.Mesh(p1=(0, 0, 0), p2=(1e-7, 1e-7, 1e-9), cell=(1e-9, 1e-9, 1e-9)) system.m = df.Field(mesh, nvdim=3, value=(1, 0, 0), norm=1700e3) # In[4]: system.m.sel("z").resample(n=(20, 20)).mpl() # In[5]: system.dynamics = mm.Damping(alpha=0.1) + mm.Precession(gamma0=mm.consts.gamma0) system.dynamics # In[6]: system.energy = mm.Exchange(A=1e-12) # We must explicitely specify the correct evolver and specify the timestep. For more details on how to specify this timestep as well as other available options please refer to the official documentation of the OOMMF extension available at http://www.nanoscience.de/group_r/stm-spstm/projects/temperature/download.shtml. # In[7]: evolver = mc.UHH_ThetaEvolver(fixed_timestep=2e-13) # We can now use the previously defined evolver as input for the time driver. # In[8]: td = mc.TimeDriver(evolver=evolver) # We drive the system for 0.5 ns and store the output in 50 steps. # In[9]: td.drive(system, t=5e-10, n=50) # We can now plot the magnetisation after time driving. # In[10]: system.m.sel("z").resample(n=(20, 20)).mpl() # Information about the individual steps is available from the table object. # In[11]: system.table.data.head() # We can plot the average magnetisation as a function of time. # In[12]: system.table.data.plot(x="t", y=["mx", "my", "mz"], grid=True);