mumax / 3

GPU-accelerated micromagnetic simulator
Other
447 stars 150 forks source link

Magnetoelastic effective field equation is missing a 2*B2 #323

Open marcrovi opened 1 year ago

marcrovi commented 1 year ago

The magnetoelastic energy is written as:

$$ E_{me} = B1(E{xx}m{x}^2 + E{yy}m{y}^2 + E{zz}m_{z}^2) + 2B2(E{xy}m{x}m{y}+E{xz}m{x}m{z}+E{yz}m{y}m{z}) $$

And the effective field is: $\mu0 h{me} = -\nabla{m} E{me}$ Therefore, for example, the effective field in $m_x$ would be:

$$ h_{me}^x = -2B1 E{xx}m_x + 2B2( E{xy}my + E_{xz} m_z) $$

The article: https://doi.org/10.12688/openreseurope.13302.1 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

The effective field terms are:

            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 multiplied both B1 and B2. 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.

I did a Pull Request to address this issue.