Motivation
A one-dimensional 180-degree domain wall provides an analytical reference solution for testing exchange, uniaxial anisotropy, boundary constraints, and energy minimisation.
For a sufficiently long sample, the equilibrium domain-wall profile is known analytically. The numerical equilibrium state can therefore be compared directly with the expected magnetisation profile and domain-wall width.
Physical model
Consider a one-dimensional magnetic system along the (x)-axis with exchange energy density
$$w_{\mathrm{ex}}
=
A
\left|
\frac{d\mathbf{m}}{dx}
\right|^2$$
and uniaxial anisotropy along the (z)-axis,
$$w_{\mathrm{a}}
=
K
\left(1-m_z^2\right).$$
The magnetisation is constrained to form a 180-degree wall between the two domains,
$$\mathbf{m}(0)=\mathbf{e}_z,
\qquad
\mathbf{m}(L)=-\mathbf{e}_z.$$
Assuming rotation in the (yz)-plane,
$$\mathbf{m}(x)
=
\begin{bmatrix}
0\\\
\sin\theta(x)\\\
\cos\theta(x)
\end{bmatrix},$$
the equilibrium equation is
$$2A\frac{d^2\theta}{dx^2}
=
K\sin(2\theta).$$
For an isolated wall centred at (x_0), the analytical solution is
$$m_x(x)=0,$$
$$m_y(x)
=
\mathrm{sech}
\left(
\frac{x-x_0}{\Delta}
\right),$$
and
$$m_z(x)
=
-\tanh
\left(
\frac{x-x_0}{\Delta}
\right),$$
where the domain-wall width parameter is
$$\Delta
=
\sqrt{\frac{A}{K}}.$$
Proposed test setup
A one-dimensional mesh can be used with exchange and uniaxial anisotropy only.
import numpy as np
import discretisedfield as df
import micromagneticmodel as mm
import oommfc as oc
Ms = 1.4e6
A = 30e-12
K = 520e3
length = 100e-9
cell = 1e-9
x0 = length / 2
region = df.Region(
p1=(0, 0, 0),
p2=(length, cell, cell),
)
mesh = df.Mesh(
region=region,
cell=(cell, cell, cell),
)
system = mm.System(name="domain_wall_profile")
system.energy = (
mm.Exchange(A=A)
+ mm.UniaxialAnisotropy(K=K, u=(0, 0, 1))
)
system.m = df.Field(
mesh,
nvdim=3,
value=initial_m,
norm=Ms,
)
The initial state should contain a continuous transition between (+\mathbf{e}_z) and (-\mathbf{e}_z). The end cells should be fixed to preserve the 180-degree wall during relaxation.
For example,
def initial_m(pos):
x = pos[0]
mz = 1.0 - 2.0 * x / length
my = np.sqrt(max(0.0, 1.0 - mz**2))
return (0.0, my, mz)
The system can then be relaxed using an energy-minimisation driver or strongly damped time evolution.
Analytical reference implementation
import numpy as np
def analytical_domain_wall(x, x0, A, K):
"""Return the analytical 180-degree domain-wall profile."""
x = np.asarray(x, dtype=float)
delta = np.sqrt(A / K)
u = (x - x0) / delta
mx = np.zeros_like(x)
my = 1.0 / np.cosh(u)
mz = -np.tanh(u)
return np.column_stack((mx, my, mz))
For the proposed parameters,
which gives approximately
$$\Delta \approx 7.60\,\mathrm{nm}.$$
Primary assertion
After relaxation, the normalised numerical magnetisation should be compared with the analytical profile:
m_exact = analytical_domain_wall(
x=x_coordinates,
x0=x0,
A=A,
K=K,
)
np.testing.assert_allclose(
m_simulated,
m_exact,
rtol=...,
atol=...,
)
The comparison may exclude a small number of cells at both ends because the analytical expression describes an isolated wall on an infinite domain, whereas the numerical model uses a finite interval with pinned boundary values.
A component-wise error can also be used:
error_my = np.max(
np.abs(m_simulated[:, 1] - m_exact[:, 1])
)
error_mz = np.max(
np.abs(m_simulated[:, 2] - m_exact[:, 2])
)
Additional checks
The following properties can be tested independently:
$$m_x(x)\approx0,$$
$$m_y(x_0)\approx1,
\qquad
m_z(x_0)\approx0,$$
$$m_z(x_0-\xi)
\approx
-m_z(x_0+\xi),$$
and
$$m_y(x_0-\xi)
\approx
m_y(x_0+\xi).$$
The wall width can also be extracted from the slope at its centre:
$$\left.
\frac{dm_z}{dx}
\right|_{x=x_0}
=
-\frac{1}{\Delta}.$$
Therefore,
$$\Delta_{\mathrm{sim}}
=
-
\left[
\left.
\frac{dm_z}{dx}
\right|_{x=x_0}
\right]^{-1}$$
can be compared with
$$\Delta
=
\sqrt{\frac{A}{K}}.$$
Suggested parameterisation
The test can be parametrised over several exchange and anisotropy values while keeping the mesh resolution sufficiently smaller than the wall width:
$$\Delta x \ll \sqrt{\frac{A}{K}}.$$
This checks whether the simulated wall width follows the expected scaling,
$$\Delta\propto\sqrt{A},
\qquad
\Delta\propto K^{-1/2}.$$
Expected value
This test would validate:
- the exchange energy term;
- uniaxial anisotropy;
- the relative scaling of exchange and anisotropy;
- fixed boundary regions;
- the relaxation or minimisation driver;
- the spatial discretisation of magnetisation gradients;
- and recovery of an analytical equilibrium profile.
Unlike tests that only check whether relaxation converges, this scenario compares the complete spatial magnetisation profile with a known analytical solution.
Motivation
A one-dimensional 180-degree domain wall provides an analytical reference solution for testing exchange, uniaxial anisotropy, boundary constraints, and energy minimisation.
For a sufficiently long sample, the equilibrium domain-wall profile is known analytically. The numerical equilibrium state can therefore be compared directly with the expected magnetisation profile and domain-wall width.
Physical model
Consider a one-dimensional magnetic system along the (x)-axis with exchange energy density
and uniaxial anisotropy along the (z)-axis,
The magnetisation is constrained to form a 180-degree wall between the two domains,
Assuming rotation in the (yz)-plane,
the equilibrium equation is
For an isolated wall centred at (x_0), the analytical solution is
and
where the domain-wall width parameter is
Proposed test setup
A one-dimensional mesh can be used with exchange and uniaxial anisotropy only.
The initial state should contain a continuous transition between (+\mathbf{e}_z) and (-\mathbf{e}_z). The end cells should be fixed to preserve the 180-degree wall during relaxation.
For example,
The system can then be relaxed using an energy-minimisation driver or strongly damped time evolution.
Analytical reference implementation
For the proposed parameters,
which gives approximately
Primary assertion
After relaxation, the normalised numerical magnetisation should be compared with the analytical profile:
The comparison may exclude a small number of cells at both ends because the analytical expression describes an isolated wall on an infinite domain, whereas the numerical model uses a finite interval with pinned boundary values.
A component-wise error can also be used:
Additional checks
The following properties can be tested independently:
and
The wall width can also be extracted from the slope at its centre:
Therefore,
can be compared with
Suggested parameterisation
The test can be parametrised over several exchange and anisotropy values while keeping the mesh resolution sufficiently smaller than the wall width:
This checks whether the simulated wall width follows the expected scaling,
Expected value
This test would validate:
Unlike tests that only check whether relaxation converges, this scenario compares the complete spatial magnetisation profile with a known analytical solution.