FMR simulations

26 views
Skip to first unread message

Nikita Lobanov

unread,
Sep 26, 2024, 9:47:56 AM9/26/24
to Boris Computational Spintronics
Hi Serban,
1) I tried modeling the FMR for Py with different cell size in the z direction. I noticed that at 5 nm and 10 nm the plots are almost identical, but at 2 nm there are strong differences. How can this be explained?

from NetSocks import NSClient
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
import scipy.fftpack

#setup communication with server
ns = NSClient(); ns.configure(True)


########################################
#Setup    
out_of_plane = True

#cutoff frequency (Hz)
fc = 50e9
#time step for saving magnetisation (s) : determined by Nyquist criterion from cutoff frequency
time_step = (0.5 / fc)
#total time to simulate; increasing this gives you more frequency points in the transform
total_time = 10e-9
#Field and excitation field strength
He = 1000
H0 = 1000e3


l, w, t =400e-9, 400e-9, 20e-9
cellx = 10e-9
celly = 10e-9
cellz = 5e-9

FM = ns.Material('Py',[0, 0, 0, l, w, t], [cellx, celly, cellz])
FM.modules(['Zeeman', 'demag', 'exchange', 'transport'])

if out_of_plane:
    FM.setangle(0, 0)
else:
    FM.setangle(90, 90)


output_file = 'fmr_peak.txt'
ns.dp_newfile(output_file)  

ns.equationconstants('H0', H0)
#define the equation constants
#Excitation field (A/m)
ns.equationconstants('He', He)
#f cutoff (Hz)
ns.equationconstants('fc', fc)
#sinc pulse center (s)
ns.equationconstants('t0', total_time / 2)

#useful constants
Ms = FM.param.Ms.setparam()

ns.setsavedata(output_file, ['<M>', FM], ['time'])

#this type of simulations needs to be run using a fixed time-step method so the magnetisation data is saved precisely at the sampling points
#RK4 is good for this type of work, just set a low enough time-step
ns.setode('LLG', 'RK4')
#make sure the time-step divides the sampling time
ns.setdt(500e-15)

ns.cuda(1)

########################################
#setup sinc pulse using a formula
if out_of_plane:
    ns.Hequation(['supermesh', 'He * sinc(2*PI*fc*(t-t0)), 0, H0', 'time', total_time, 'time', time_step])

else:
    ns.Hequation(['supermesh', 'He * sinc(2*PI*fc*(t-t0)), H0, 0', 'time', total_time, 'time', time_step])


#Analyse

#get 2D list as position along horizontal, time along vertical
Mav = ns.Get_Data_Columns(ns.savedatafile())
Mx = [row[0]/Ms for row in Mav]

#2D fft
fourier_data = np.fft.fftshift(np.abs(sp.fftpack.fft(Mx))**2)

#get value ranges
freq_len = len(fourier_data)
freq = sp.fftpack.fftfreq(freq_len, time_step)

#extract result from fourier data in a plottable form
result = fourier_data[int(freq_len/2):freq_len]


plt.axes(xlabel = 'f (Hz)', ylabel = 'FMR Signal (a.u.)', title = f'cellsize:{cellx}, {celly}, {cellz}')
plt.plot(freq[0:len(result)], result, '.')
plt.show()


2) I was also interested to see the effect of the spin Hall effect on the interface and I tried adding a Pt layer, but I got nan values in the calculations. I would be glad to hear what I am doing wrong.

from NetSocks import NSClient
from NetSocks import Shape
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
import scipy.fftpack

#setup communication with server
ns = NSClient(); ns.configure(True)


########################################
#Setup    

#set to False to simulate in-plane FMR
out_of_plane = True

#cutoff frequency (Hz)
fc = 50e9
#time step for saving magnetisation (s) : determined by Nyquist criterion from cutoff frequency
time_step = (0.5 / fc)
#total time to simulate; increasing this gives you more frequency points in the transform
total_time = 10e-9
#Field and excitation field strength
He = 1000
H0 = 1000e3


l, w, t =400e-9, 400e-9, 20e-9
cellx = 10e-9
celly = 10e-9
cellz = 5e-9

FM = ns.Material('Py',[0, 0, 0, l, w, t], [cellx, celly, cellz])
FM.modules(['Zeeman', 'demag', 'exchange', 'transport'])
FM.param.ts_eff = 0
FM.param.tsi_eff = 1
FM.param.pump_eff = 0

if out_of_plane:
    FM.setangle(0, 0)
else:
    FM.setangle(90, 90)

Pt = ns.Conductor([0, 0, t, l, w, t + 20e-9], [10e-9, 10e-9, 5e-9])
Pt.modules(['transport'])
Pt.param.elC = 7e6
Pt.param.l_sf = 1.4e-9
Pt.param.SHA = 0.1
Pt.param.iSHA = 0

ns.setdefaultelectrodes()
ns.setpotential(1e-2)


output_file = 'fmr_peak.txt'
ns.dp_newfile(output_file)  

ns.equationconstants('H0', H0)
#define the equation constants
#Excitation field (A/m)
ns.equationconstants('He', He)
#f cutoff (Hz)
ns.equationconstants('fc', fc)
#sinc pulse center (s)
ns.equationconstants('t0', total_time / 2)

#useful constants
Ms = FM.param.Ms.setparam()

ns.setsavedata(output_file, ['<M>', FM], ['time'])

#this type of simulations needs to be run using a fixed time-step method so the magnetisation data is saved precisely at the sampling points
#RK4 is good for this type of work, just set a low enough time-step
ns.setode('LLG-SA', 'RK4')
#make sure the time-step divides the sampling time
ns.setdt(500e-15)

ns.cuda(1)

########################################
#setup sinc pulse using a formula
if out_of_plane:
    ns.Hequation(['supermesh', 'He * sinc(2*PI*fc*(t-t0)), 0, H0', 'time', total_time, 'time', time_step])

else:
    ns.Hequation(['supermesh', 'He * sinc(2*PI*fc*(t-t0)), H0, 0', 'time', total_time, 'time', time_step])


#Analyse

#get 2D list as position along horizontal, time along vertical
Mav = ns.Get_Data_Columns(ns.savedatafile())
Mx = [row[0]/Ms for row in Mav]

#2D fft
fourier_data = np.fft.fftshift(np.abs(sp.fftpack.fft(Mx))**2)

#get value ranges
freq_len = len(fourier_data)
freq = sp.fftpack.fftfreq(freq_len, time_step)

#extract result from fourier data in a plottable form
result = fourier_data[int(freq_len/2):freq_len]


plt.axes(xlabel = 'f (Hz)', ylabel = 'FMR Signal (a.u.)', title = f'cellsize:{cellx}, {celly}, {cellz}')
plt.plot(freq[0:len(result)], result, '.')
plt.show()


Greetings,
Nikita
10nm_10nm_2nm.png
10nm_10nm_10nm.png
10nm_10nm_5nm.png

Serban Lepadatu

unread,
Sep 29, 2024, 3:12:31 AM9/29/24
to Boris Computational Spintronics
Hi Nikita,

If you reduce the cellsize you also need to reduce the timestep as a smaller one will be required for convergence.

For the SHE simulation it looks like the electric cellsize is far too large. There will be large gradients in the spin accumulation, so especially the z cellsize needs to be smaller, both in the Pt and Py layers. For Py you need to set the electric cellsize separately from the magnetic solver one, using the ecellsize command. I suggest a maximum of 1 nm in the z direction, the in-plane cellsize likely needs to be smaller too.

Regards,
Serban

Reply all
Reply to author
Forward
0 new messages