Numerical integration of a magnetic spin vector in a magnetic field

chaiyar
Messages
4
Reaction score
0

Homework Statement



Hi there, thanks in advance for any help!

I have a first order DE: \frac{\partial \vec{m}}{\partial t} = -\vec{m} \times \vec{h}_{eff} + \alpha \vec{m} \times \frac{\partial \vec{m}}{\partial t} (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 1 person
Thanks for your help TSny, but I'm still a little lost.

I end up with three equations of the form

<br /> <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 /> <br />

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 1 person
Thread 'Need help understanding this figure on energy levels'
This figure is from "Introduction to Quantum Mechanics" by Griffiths (3rd edition). It is available to download. It is from page 142. I am hoping the usual people on this site will give me a hand understanding what is going on in the figure. After the equation (4.50) it says "It is customary to introduce the principal quantum number, ##n##, which simply orders the allowed energies, starting with 1 for the ground state. (see the figure)" I still don't understand the figure :( Here is...
Thread 'Understanding how to "tack on" the time wiggle factor'
The last problem I posted on QM made it into advanced homework help, that is why I am putting it here. I am sorry for any hassle imposed on the moderators by myself. Part (a) is quite easy. We get $$\sigma_1 = 2\lambda, \mathbf{v}_1 = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} \sigma_2 = \lambda, \mathbf{v}_2 = \begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \\ 0 \end{pmatrix} \sigma_3 = -\lambda, \mathbf{v}_3 = \begin{pmatrix} 1/\sqrt{2} \\ -1/\sqrt{2} \\ 0 \end{pmatrix} $$ There are two ways...
Back
Top