Spatially dependent uniaxial anisotropy#
In this notebook, an example is given for a spatially varying uniaxial anisotropy. To demonstrate it, we will use a nanotube (with R=30 nm and r=20 nm outer and inner radii) and set a radial uniaxial anisotropy with constant magnitude. Any other material parametes can be made spatially dependent, it isn’t restricted to the uniaxial anisotropy.
[1]:
import tetrax as tx
sample = tx.Sample(
tx.geometries.waveguide.tube(20, 30, 3),
name='tube_radial_uanis'
)
In the following we set a radial uniaxial anisotropy using the tx.vectorfields.radial(sample.xyz,1) function:
[2]:
sample.material["Ku1"] = 1e6 #J/m^3
sample.material["e_u"] = tx.vectorfields.radial(sample.xyz,1)
sample.show(sample.material["e_u"].value)
/Users/attilak/micromag/tetrax-tests/fresh_environement_test/venv/lib/python3.13/site-packages/traittypes/traittypes.py:97: UserWarning: Given trait value dtype "float32" does not match required type "float32". A coerced copy has been created.
warnings.warn(
[2]:

By initializing the tube in a transversally magnetized state, one will observe the stabilization of a two-domain state, by the radial anisotropy, with radial domains and Néel walls between them. This example is a perfect example for the usage of the LLG based dynamic relaxation, which will follow the preliminary nergy minimization.
[3]:
sample.mag = (0, 1, .1)
relaxation = tx.experiments.relax(sample,
set_initial_on_failure=False,
tolerance=1e-11)
if relaxation.was_success is False:
relax_dyn = tx.experiments.relax_dynamic(sample, tolerance=1e-10)
Minimizing energy in using 'L-BFGS-B' (tolerance 1e-11) ...
energy length density: -8.604699660646469e-10 J/m, <mag.x> = 0.15, <mag.y> = 0.77, <mag.z> = -0.00
Failure. Returning last iteration step.
Minimizing torque with over-damped LLG (alpha=1, tolerance=1e-10) ...
t = 4.0205874505712437e-10 (s), dm/dt = 1330852.6056958192 [Hz], <mag.x> = 0.16, <mag.y> = 0.77, <mag.z> = 0.000
Success!
[4]:
sample.show()
/Users/attilak/micromag/tetrax-tests/fresh_environement_test/venv/lib/python3.13/site-packages/traittypes/traittypes.py:97: UserWarning: Given trait value dtype "float32" does not match required type "float32". A coerced copy has been created.
warnings.warn(
[4]:
