Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update magnetoelasticfield.cu #324

Merged
merged 1 commit into from
Apr 6, 2023
Merged

Update magnetoelasticfield.cu #324

merged 1 commit into from
Apr 6, 2023

Conversation

marcrovi
Copy link
Contributor

@marcrovi marcrovi commented Mar 22, 2023

The magnetoelastic energy is written as:

$$ E_{me} = B_1(E_{xx}m_{x}^2 + E_{yy}m_{y}^2 + E_{zz}m_{z}^2) + 2B_2(E_{xy}m_{x}m_{y}+E_{xz}m_{x}m_{z}+E_{yz}m_{y}m_{z}) $$

And the effective field is: $B_{me} = -\nabla_{m} E_{me}$
Therefore, for example, the effective field in $m_x$ would be:

$$ B_{me}^x = -2B_1 E_{xx}m_x + 2B_2( E_{xy}my + E_{xz} m_z) $$

The article: https://doi.org/10.12688/openreseurope.13302.1 on page 4, equation 3, explains how the model is implemented and in this GitHub link you can find the code: https://github.com/Fredericvdv/Magnetoelasticity_MuMax3/blob/eeb112dff216a4ae3267fc27fe67aa0e7ada6423/cuda/magnetoelasticfield.cu

In this repository effective field terms are calculated correctly:

            Bx[I] += -2.0f*(B1*m.x*Exx + B2*(m.y*Exy + m.z*Exz));
	    By[I] += -2.0f*(B1*m.y*Eyy + B2*(m.x*Eyx + m.z*Eyz));
	    Bz[I] += -2.0f*(B1*m.z*Ezz + B2*(m.x*Ezx + m.y*Ezy)); 

Where the 2.0f is multiplied by both B1 and B2.
However, in the MuMax3 repository, I found:

	    Bx[I] += -(2.0f*B1*m.x*Exx + B2*(m.y*Exy + m.z*Exz));
	    By[I] += -(2.0f*B1*m.y*Eyy + B2*(m.x*Eyx + m.z*Eyz));
	    Bz[I] += -(2.0f*B1*m.z*Ezz + B2*(m.x*Ezx + m.y*Ezy));

The parenthesis should be after the 2.0f.

This Pull Request is to address this issue.

Fixing the magnetoelastic effective field. B2 should also be multiplied by 2.
@JLeliaert
Copy link
Contributor

Closes #323

Well spotted. Thanks for fixing this!

@JLeliaert JLeliaert merged commit db86efa into mumax:master Apr 6, 2023
@JonathanMaes JonathanMaes mentioned this pull request Oct 14, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants