Numerical integration of a magnetic spin vector in a magnetic field

  • Thread starter chaiyar
  • Start date
  • #1
4
0

Homework Statement



Hi there, thanks in advance for any help!

I have a first order DE: [tex] \frac{\partial \vec{m}}{\partial t} = -\vec{m} \times \vec{h}_{eff} + \alpha \vec{m} \times \frac{\partial \vec{m}}{\partial t}[/tex] (a scaled Landau-Lifshitz-Gilbert equation)

where m is a magnetism vector, alpha is a damping factor and h is an effective uniform magnetic field.

I'm trying to numerically integrate it with the Euler method to get a precession of the spin vector around the h vector.

So far I've integrated the first term but the second, damping term I can't see how to translate into code.. (in C++)

So essentially what I've done is assumed the magnetic field to be aligned in the z-direction, and written
Code:
for(i=1 ; i<=tmax ; i++) {

					mx = mx + h * -my;
					my = my + h *  mx;
					t = t + h;
for the first term, where mx is the x-component of the m vector etc. and h is the timestep, and I need to add the damping term onto the end.

Considering the x-component first, presumably the derivative in the damping term has to be put down as m_x as well, but what direction is the other m vector to be taken in?

Sorry if that's not very well asked, but thanks a lot for any help!
 
Last edited:

Answers and Replies

  • #2
TSny
Homework Helper
Gold Member
13,159
3,458
Hello, chaiyar.

If you write out the DE for each component (x, y, z), you will get three equations that are linear in ##\dot{m_x}, \dot{m_y}, \dot{m_z}##, where the dot denotes time derivative.

Algebraically solving these simultaneously for ##\dot{m_x}, \dot{m_y}, \dot{m_z}##, you can get equations of the form

##\dot{m_x} = f_1(m_x, m_y, m_z)##
##\dot{m_y} = f_2(m_x, m_y, m_z)##
##\dot{m_z} = f_3(m_x, m_y, m_z)##

for certain functions ##f_1, f_2, f_3## .

Then you can use these equations with the Euler method to step forward in time.
 
  • #3
4
0
Thanks for your help TSny, but I'm still a little lost.

I end up with three equations of the form

[tex]

\dot{m}_x = f_1 (m_y,m_z,\dot{m}_y,\dot{m}_z) \\
\dot{m}_y = f_2 (m_x,m_z,\dot{m}_x,\dot{m}_z) \\
\dot{m}_z = f_3 (m_x,m_y,\dot{m}_x,\dot{m}_y) \\

[/tex]

but I don't see how to incorporate the time derivatives into the program.. Do I have to take the equations further to get rid of the derivatives by using Lagrange multipliers or something like that?

Thanks again!
 
  • #4
6,054
391
You have three equations that are linear in ## \dot{m}_i ##, so you always can convert them to ## \dot{m}_i = f(...) ##, where the right hand side is independent of ## \dot{m}_i ##.
 

Related Threads on Numerical integration of a magnetic spin vector in a magnetic field

Replies
13
Views
2K
Replies
12
Views
7K
  • Last Post
Replies
0
Views
3K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
1
Views
3K
Replies
1
Views
592
Replies
4
Views
5K
Replies
3
Views
1K
  • Last Post
Replies
2
Views
1K
Replies
26
Views
1K
Top