Motivation
A one-dimensional two-phase 180-degree domain wall provides a semi-analytical reference solution for testing domain-wall relaxation in heterogeneous media.
The standard domain-wall benchmark uses spatially constant material parameters. In contrast, this scenario contains a finite inner phase with different effective anisotropy and field scaling. The equilibrium wall is distorted by the material interfaces, making the test sensitive to spatially varying parameters, interface treatment, and boundary constraints.
Physical model
Consider a one-dimensional magnetic system along the $x$-axis with a 180-degree wall pinned at the ends. The magnetisation is assumed to rotate in the $yz$-plane,
$$\mathbf{m}(x)
=
\begin{bmatrix}
0\\\
\sin\theta(x)\\\
\cos\theta(x)
\end{bmatrix}.$$
The reduced finite interval is
$$\xi\in[-1,1],$$
with an inner phase
$$\lvert\xi\rvert \lt p$$
and outer phases
$$p \lt \lvert\xi\rvert \le 1.$$
The effective reduced field and anisotropy profiles are piecewise constant:
$$b^\ast(\xi)
=
\begin{cases}
b, & p \lt \lvert\xi\rvert \le 1,\\\
\mu b, & \lvert\xi\rvert \lt p.
\end{cases}$$
and
$$k^\ast(\xi)
=
\begin{cases}
k, & p \lt \lvert\xi\rvert \le 1,\\\
\lambda k, & \lvert\xi\rvert \lt p.
\end{cases}$$
The prototype uses
$$\lambda
=
\frac{\mu}{\nu}.$$
The pinned boundary conditions are
$$\mathbf{m}(-1)=-\mathbf{e}_z,
\qquad
\mathbf{m}(1)=\mathbf{e}_z.$$
At the two material interfaces, the semi-analytical construction enforces continuity of $\theta$ and of the first integral through matching conditions between the three regions.
Proposed test setup
A one-dimensional mesh can be used with exchange, uniaxial anisotropy, and Zeeman terms. The anisotropy and field should be spatially varying functions with a central phase of width $2p$.
import numpy as np
import discretisedfield as df
import micromagneticmodel as mm
import oommfc as oc
Ms = 1.4e6
A = 30e-12
K_outer = 520e3
b = 2.0
k = 10.0
mu = 1.1
nu = 4.0
lambda_ = mu / nu
p = 0.5
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),
)
The material profile can be defined by mapping $x$ to the reduced coordinate
$$\xi
=
2\frac{x}{L}-1.$$
For example,
def k_profile(pos):
xi = 2 * pos[0] / length - 1
if abs(xi) < p:
return lambda_ * K_outer
return K_outer
An analogous profile can be used for the applied field magnitude.
At cells lying exactly on the material interface, the original finite-difference prototype uses the arithmetic average of the two neighbouring material values. This detail is important because the semi-analytical reference assumes a continuum interface condition, while a cell-centred discretisation must choose how to represent the discontinuity.
The initial state should contain a continuous transition between the two pinned end states:
def initial_m(pos):
xi = 2 * pos[0] / length - 1
mz = -xi
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 solution is constructed piecewise in the three phases. Let $\theta_1$ and $\theta_2$ be the magnetisation angles at the two material interfaces, and let $a_1$, $a_2$, and $a_3$ be the integration constants in the left, inner, and right regions.
The constants are related by interface regularity conditions:
$$a_2
=
a_1
+k(1-\lambda)\sin^2\theta_1
-b(1-\mu)\cos\theta_1,$$
$$a_3
=
a_2
+k(\lambda-1)\sin^2\theta_2
-b(\mu-1)\cos\theta_2.$$
For $b\ge0$, the unknowns $\theta_1$, $\theta_2$, and $a_1$ are determined by the coupled integral equations
$$p-1
+
\int_{\theta_1}^{\pi}
\frac{d\theta}
{\sqrt{
a_1+k\sin^2\theta+2b\sin^2(\theta/2)
}}
=
0,$$
$$-2p
+
\int_{\theta_2}^{\theta_1}
\frac{d\theta}
{\sqrt{
a_2+\lambda k\sin^2\theta+2\mu b\sin^2(\theta/2)
}}
=
0,$$
and
$$p-1
+
\int_{0}^{\theta_2}
\frac{d\theta}
{\sqrt{
a_3+k\sin^2\theta+2b\sin^2(\theta/2)
}}
=
0.$$
For $b \lt 0$, the corresponding $\sin^2(\theta/2)$ Zeeman terms are replaced by $-\cos^2(\theta/2)$ terms following the same convention as the finite-field domain-wall reference.
After the constants are determined, the magnetisation profile is defined piecewise by
$$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_case5_two_phase.py
For the dimensionless reference parameters
b = 2.0
k = 10.0
mu = 1.1
nu = 4.0
lambda_ = mu / nu
p = 0.5
the coupled solve gives approximately
$$\theta_1 \approx 2.332825,
\qquad
\theta_2 \approx 0.312334,
\qquad
a_1 \approx -2.612151,
\qquad
\lambda = 0.275.$$
Primary assertion
After relaxation, the normalised numerical magnetisation should be compared with the semi-analytical two-phase profile:
m_exact = two_phase_domain_wall(
x=x_coordinates,
b=b,
k=k,
mu=mu,
lambda_=lambda_,
p=p,
)
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 on the order of $10^{-2}$. A production Ubermag test can use a finer mesh and should set tolerances based on the discretisation and interface convention.
Additional checks
The following properties can be tested independently:
$$m_x(\xi)\approx0,$$
$$\mathbf{m}(-1)\approx-\mathbf{e}_z,
\qquad
\mathbf{m}(1)\approx\mathbf{e}_z,$$
$$\lVert\mathbf{m}(\xi)\rVert\approx1,$$
and continuity of the magnetisation at the two interfaces,
$$\mathbf{m}(-p^-)
\approx
\mathbf{m}(-p^+),
\qquad
\mathbf{m}(p^-)
\approx
\mathbf{m}(p^+).$$
The test can also check that the numerical wall is visibly distorted by the central phase rather than matching the homogeneous finite-wall profile.
Expected value
This test would validate:
- spatially varying uniaxial anisotropy;
- spatially varying field or Zeeman scaling;
- fixed boundary regions;
- relaxation or minimisation in a heterogeneous finite-domain wall;
- treatment of material interfaces in a cell-centred discretisation;
- and recovery of a semi-analytical equilibrium profile in a two-phase medium.
Unlike homogeneous domain-wall tests, this scenario checks whether a micromagnetic code reproduces the profile of a wall crossing material interfaces. It is therefore a useful advanced benchmark for heterogeneous media and interface-sensitive discretisation behaviour.
Motivation
A one-dimensional two-phase 180-degree domain wall provides a semi-analytical reference solution for testing domain-wall relaxation in heterogeneous media.
The standard domain-wall benchmark uses spatially constant material parameters. In contrast, this scenario contains a finite inner phase with different effective anisotropy and field scaling. The equilibrium wall is distorted by the material interfaces, making the test sensitive to spatially varying parameters, interface treatment, and boundary constraints.
Physical model
Consider a one-dimensional magnetic system along the$x$ -axis with a 180-degree wall pinned at the ends. The magnetisation is assumed to rotate in the $yz$ -plane,
The reduced finite interval is
with an inner phase
and outer phases
The effective reduced field and anisotropy profiles are piecewise constant:
and
The prototype uses
The pinned boundary conditions are
At the two material interfaces, the semi-analytical construction enforces continuity of$\theta$ and of the first integral through matching conditions between the three regions.
Proposed test setup
A one-dimensional mesh can be used with exchange, uniaxial anisotropy, and Zeeman terms. The anisotropy and field should be spatially varying functions with a central phase of width$2p$ .
The material profile can be defined by mapping$x$ to the reduced coordinate
For example,
An analogous profile can be used for the applied field magnitude.
At cells lying exactly on the material interface, the original finite-difference prototype uses the arithmetic average of the two neighbouring material values. This detail is important because the semi-analytical reference assumes a continuum interface condition, while a cell-centred discretisation must choose how to represent the discontinuity.
The initial state should contain a continuous transition between the two pinned end states:
The system can then be relaxed using an energy-minimisation driver or strongly damped time evolution.
Semi-analytical reference implementation
The solution is constructed piecewise in the three phases. Let$\theta_1$ and $\theta_2$ be the magnetisation angles at the two material interfaces, and let $a_1$ , $a_2$ , and $a_3$ be the integration constants in the left, inner, and right regions.
The constants are related by interface regularity conditions:
For$b\ge0$ , the unknowns $\theta_1$ , $\theta_2$ , and $a_1$ are determined by the coupled integral equations
and
For$b \lt 0$ , the corresponding $\sin^2(\theta/2)$ Zeeman terms are replaced by $-\cos^2(\theta/2)$ terms following the same convention as the finite-field domain-wall reference.
After the constants are determined, the magnetisation profile is defined piecewise by
A local prototype implementation is available in:
For the dimensionless reference parameters
the coupled solve gives approximately
Primary assertion
After relaxation, the normalised numerical magnetisation should be compared with the semi-analytical two-phase profile:
A component-wise error can also be used:
For a coarse 51-point finite-difference prototype, the maximum profile errors are on the order of$10^{-2}$ . A production Ubermag test can use a finer mesh and should set tolerances based on the discretisation and interface convention.
Additional checks
The following properties can be tested independently:
and continuity of the magnetisation at the two interfaces,
The test can also check that the numerical wall is visibly distorted by the central phase rather than matching the homogeneous finite-wall profile.
Expected value
This test would validate:
Unlike homogeneous domain-wall tests, this scenario checks whether a micromagnetic code reproduces the profile of a wall crossing material interfaces. It is therefore a useful advanced benchmark for heterogeneous media and interface-sensitive discretisation behaviour.