Motivation
A finite one-dimensional 180-degree domain wall in an applied field provides a semi-analytical reference solution for testing exchange, uniaxial anisotropy, Zeeman energy, boundary constraints, and energy minimisation.
Unlike the zero-field wall, an applied field along the easy axis makes the equilibrium profile asymmetric on a finite interval. The numerical equilibrium state can therefore be compared with a more sensitive reference profile than the isolated hyperbolic-tangent wall.
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,$$
uniaxial anisotropy along the $z$-axis,
$$w_{\mathrm{a}}
=
K
\left(1-m_z^2\right),$$
and a Zeeman contribution from a field parallel to the easy axis,
$$w_{\mathrm{z}}
=
-\mu_0 M_s H_z m_z.$$
The magnetisation is constrained to form a 180-degree wall between pinned end states,
$$\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 finite-domain problem can be written in reduced coordinates
$$\xi
=
\frac{x-x_0}{\Delta},
\qquad
\Delta
=
\sqrt{\frac{A}{K}},$$
on the interval
$$\xi\in[-w,w],$$
with a reduced field parameter $b$. In these variables the first integral can be written in the form
$$\left(\frac{d\theta}{d\xi}\right)^2
=
a
+\sin^2\theta
+2b\sin^2\frac{\theta}{2},
\qquad b\ge0,$$
or equivalently
$$\left(\frac{d\theta}{d\xi}\right)^2
=
a
+\sin^2\theta
-2b\cos^2\frac{\theta}{2},
\qquad b \lt 0.$$
The integration constant $a$ is determined by the finite-length constraint.
Proposed test setup
A one-dimensional mesh can be used with exchange, uniaxial anisotropy, and a Zeeman field along the easy axis.
import numpy as np
import discretisedfield as df
import micromagneticmodel as mm
import oommfc as oc
Ms = 1.4e6
A = 30e-12
K = 520e3
delta = np.sqrt(A / K)
w = 2.0
length = 2 * w * delta
cell = length / 100
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="finite_zeeman_domain_wall")
H = (0, 0, Hz)
system.energy = (
mm.Exchange(A=A)
+ mm.UniaxialAnisotropy(K=K, u=(0, 0, 1))
+ mm.Zeeman(H=H)
)
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.
Semi-analytical reference implementation
The reference profile is obtained by solving the scalar finite-length condition for $a$,
$$\int_0^\pi
\frac{d\theta}
{\sqrt{
a+\sin^2\theta+2b\sin^2(\theta/2)
}}
=
2w,
\qquad b\ge0,$$
or
$$\int_0^\pi
\frac{d\theta}
{\sqrt{
a+\sin^2\theta-2b\cos^2(\theta/2)
}}
=
2w,
\qquad b \lt 0.$$
After $a$ has been found, the reference profile is defined implicitly by
$$\xi(\theta)
=
\int_\theta^\pi
\frac{dt}
{\sqrt{
a+\sin^2t+2b\sin^2(t/2)
}}
-w,
\qquad b\ge0,$$
or
$$\xi(\theta)
=
\int_\theta^\pi
\frac{dt}
{\sqrt{
a+\sin^2t-2b\cos^2(t/2)
}}
-w,
\qquad b \lt 0.$$
The magnetisation components are then
$$m_x(\xi)=0,
\qquad
m_y(\xi)=\sin\theta(\xi),
\qquad
m_z(\xi)=\cos\theta(\xi).$$
A local prototype implementation is available in:
python/domain_wall_case3_finite_zeeman.py
For the dimensionless reference parameters used in the prototype,
the scalar solve gives approximately
$$a \approx 4.790005\times10^{-2}.$$
Primary assertion
After relaxation, the normalised numerical magnetisation should be compared with the semi-analytical finite-field profile:
m_exact = finite_zeeman_domain_wall(
x=x_coordinates,
x0=x0,
delta=delta,
w=w,
b=b,
)
np.testing.assert_allclose(
m_simulated,
m_exact,
rtol=...,
atol=...,
)
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])
)
For a coarse 51-point finite-difference prototype, the maximum profile errors are already on the order of $10^{-3}$ to $10^{-2}$. A production Ubermag test can use a finer mesh and choose tolerances based on the numerical driver and discretisation.
Additional checks
The following properties can be tested independently:
$$m_x(x)\approx0,$$
$$\mathbf{m}(0)\approx\mathbf{e}_z,
\qquad
\mathbf{m}(L)\approx-\mathbf{e}_z,$$
and
$$\lVert\mathbf{m}(x)\rVert\approx1.$$
The field-biased wall is not generally symmetric, so this test should not assert the zero-field relations
$$m_z(x_0-\xi)\approx-m_z(x_0+\xi),
\qquad
m_y(x_0-\xi)\approx m_y(x_0+\xi).$$
Instead, the asymmetric spatial profile should be compared directly with the semi-analytical reference.
Expected value
This test would validate:
- the exchange energy term;
- uniaxial anisotropy;
- the Zeeman energy term;
- fixed boundary regions;
- relaxation or minimisation in an asymmetric finite-domain wall;
- conversion between physical and reduced domain-wall coordinates;
- and recovery of a semi-analytical equilibrium profile beyond the standard hyperbolic-tangent wall.
This scenario extends the basic 180-degree domain-wall benchmark by checking a field-distorted finite wall with a quantitative reference solution.
Motivation
A finite one-dimensional 180-degree domain wall in an applied field provides a semi-analytical reference solution for testing exchange, uniaxial anisotropy, Zeeman energy, boundary constraints, and energy minimisation.
Unlike the zero-field wall, an applied field along the easy axis makes the equilibrium profile asymmetric on a finite interval. The numerical equilibrium state can therefore be compared with a more sensitive reference profile than the isolated hyperbolic-tangent wall.
Physical model
Consider a one-dimensional magnetic system along the$x$ -axis with exchange energy density
uniaxial anisotropy along the$z$ -axis,
and a Zeeman contribution from a field parallel to the easy axis,
The magnetisation is constrained to form a 180-degree wall between pinned end states,
Assuming rotation in the$yz$ -plane,
the finite-domain problem can be written in reduced coordinates
on the interval
with a reduced field parameter$b$ . In these variables the first integral can be written in the form
or equivalently
The integration constant$a$ is determined by the finite-length constraint.
Proposed test setup
A one-dimensional mesh can be used with exchange, uniaxial anisotropy, and a Zeeman field along the easy axis.
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.
Semi-analytical reference implementation
The reference profile is obtained by solving the scalar finite-length condition for$a$ ,
or
After$a$ has been found, the reference profile is defined implicitly by
or
The magnetisation components are then
A local prototype implementation is available in:
For the dimensionless reference parameters used in the prototype,
the scalar solve gives approximately
Primary assertion
After relaxation, the normalised numerical magnetisation should be compared with the semi-analytical finite-field profile:
A component-wise error can also be used:
For a coarse 51-point finite-difference prototype, the maximum profile errors are already on the order of$10^{-3}$ to $10^{-2}$ . A production Ubermag test can use a finer mesh and choose tolerances based on the numerical driver and discretisation.
Additional checks
The following properties can be tested independently:
and
The field-biased wall is not generally symmetric, so this test should not assert the zero-field relations
Instead, the asymmetric spatial profile should be compared directly with the semi-analytical reference.
Expected value
This test would validate:
This scenario extends the basic 180-degree domain-wall benchmark by checking a field-distorted finite wall with a quantitative reference solution.