Numerical integration of a magnetic spin vector in a magnetic field

Click For Summary

Homework Help Overview

The discussion revolves around the numerical integration of a first-order differential equation related to the dynamics of a magnetic spin vector in a magnetic field, specifically using the Euler method. The equation involves the magnetism vector and its interaction with an effective magnetic field, including a damping term.

Discussion Character

  • Exploratory, Mathematical reasoning, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the formulation of the differential equation for each component of the magnetism vector and the challenges in incorporating the damping term into the numerical integration code. There are inquiries about how to express the time derivatives in the programming context and whether additional mathematical techniques, such as Lagrange multipliers, are necessary.

Discussion Status

Some participants have provided algebraic insights into rewriting the equations for numerical integration, while others express uncertainty about implementing these equations in code. There is an ongoing exploration of how to handle the time derivatives and the structure of the equations.

Contextual Notes

Participants are working under the constraints of a specific numerical method (Euler method) and are grappling with the complexities introduced by the damping term in the differential equation.

chaiyar
Messages
4
Reaction score
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:
Physics news on Phys.org
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.
 
  • Like
Likes   Reactions: 1 person
Thanks for your help TSny, but I'm still a little lost.

I end up with three equations of the form

[tex] <br /> \dot{m}_x = f_1 (m_y,m_z,\dot{m}_y,\dot{m}_z) \\<br /> \dot{m}_y = f_2 (m_x,m_z,\dot{m}_x,\dot{m}_z) \\<br /> \dot{m}_z = f_3 (m_x,m_y,\dot{m}_x,\dot{m}_y) \\<br /> [/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!
 
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 ##.
 
  • Like
Likes   Reactions: 1 person

Similar threads

Replies
12
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K