[S0010] Set up the automatic meshing property with Method 3: Automatic element size

 

The automatic mesh generation function provides some types of mesh generation method, specifying element size, and element size gradient to generate desired mesh depending on the analysis objective. Additionally, depending on the objective of magnetic field analysis, it’s necessary to consider the mesh modeling of the air region. This script sets up the automatic mesh generation properties for 2D magnetic field analysis using the newest method, Method 3, for automatic element size determination. Method 3 is based on the latest verification and considers both analysis accuracy and reduced number of elements.

Preconditions

  • One or more 2D magnetic field analysis studies with motion have been created.
    This script runs for the active study in the project tree.

Script Function

  • Set the mesh type in the mesh properties to slide mesh and the mesh generation method to Method 3.
  • Turn on automatic element size and automatic density gradient.
  • Turn on automatic slide division.
# 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 setupMeshPropertyToMethod3(study):
    """Set up the automatic mesh generation method using the automatic element size determination feature of Method 3."""
    meshControl = study.GetMeshControl()
    meshControl.SetValue(u"MeshType", "Slide") # "MeshType":Mesh Type
    meshControl.SetValue(u"2dMeshingMethod", "Method3") # "2dMeshingMethod":2D meshing method
    meshControl.SetValue(u"AutoMeshSize", "On") # "AutoMeshSize": Automatic Mesh Size
    meshControl.SetValue(u"AutoAirMeshSize", "On") # "AutoAirMeshSize":automatical air region mesh size
    meshControl.SetValue(u"AutomaticDensityGradient", "On") # "AutomaticDensityGradient":set density gradient automatically
    meshControl.SetValue(u"AutoGapDivision", "On") # "AutoGapDivision":Use automatic slide radial / gap division setting
    meshControl.SetValue(u"AutoDivision", "On") # "AutoDivision":use automatic slide division setting

app = designer.GetApplication()
study = app.GetCurrentStudy()

setupMeshPropertyToMethod3(study)

Download Python source code

How to use script file

Use the JMAG Script Library after reading and agreeing to the following terms of use.

Search Filter

  • All Categories

An engineer's diary
JMAG-Express Online