The Halbach array is a magnetization pattern that periodically rotates the magnetization direction.
It has the characteristic of maximizing the magnetic field strength in a specific direction.
JMAG-Designer provides the function to set the Halbach array as the magnetization pattern for permanent magnets and magnetization materials.
This script sets a parallel pattern (circular Halbach array) to permanent magnets arranged in the circumferential direction.
Preconditions
- One or more magnetic field analysis study has been created.
This script runs on the active magnetic field analysis study in the project tree. - The name of the part to which the permanent magnet or magnetizing material will be assigned is known.
- Halbach array magnetization pattern is available in JMAG-Designer v25.0 and later.
Script Function
- Assign permanent magnet material to the part named Rotor/Magnet.
- Set magnetization pattern to parallel pattern (circular Halbach array).
- Set magnetization direction parameters.
- Set number of poles, angle from reference axis, number of divisions per pole and strong magnetic field.
# Copyright (c) 2026 JSOL CORPORATION
#
# This script is released under the MIT License.
# See the full license text at:
# https://www.jmag-international.com/scriptlibrary/jmag_script_library_mit/
def setHalbachArrayMagnetizationPattern(study, partName, properties):
"""Set a Halbach array for the permanent magnet magnetization pattern"""
study.SetMaterialByName(partName, properties["material_name"])
material = study.GetMaterial(partName)
material.SetOriginXYZ(0, 0, 0)
# Reference axis direction
material.SetDirectionXYZ(1, 0, 0)
material.SetPattern(properties["pattern"])
material.SetValue(u"Poles", properties["poles"])
material.SetValue(u"StartAngle", properties["start_angle"])
material.SetValue(u"DivisionPerPole", properties["division_per_pole"])
material.SetValue(u"StrongSide", properties["strong_side"])
material.SetOrientation(False) # False = Inward
partName = u"Rotor/Magnet"
magnetProperty = {
"material_name": u"Reversible/NdFeB_Br=1.4(T)",
"pattern": u"ParallelCircularHalbachArray",
"poles": 8,
"start_angle": 22.5,
"division_per_pole": 5,
"strong_side": u"Internal",
}
app = designer.GetApplication()
study = app.GetCurrentStudy()
setHalbachArrayMagnetizationPattern(study, partName, magnetProperty)


