[S0025] Generate a multi-layer coating mesh for the specified part

 

The multi-layer coating mesh function automatically generates a layered mesh on the surface of a region in a 2D analysis. It is used when accounting for magnetic or non-magnetic thin films (coatings) that coats wires.
Regardless of the cross-section geometry (round, square, stranded, etc.), the mesh is generated with a uniform thickness for each wire.
Furthermore, material properties can be set for each layer.
This script sets two layers of multi-layer coating mesh and the material properties for each layer.

Preconditions

  • One or more 2D analysis study has been created.
    This script runs on the active magnetic field analysis study in the project tree.
  • Materials to be set for coating layers have been registered in the study.
  • The part set for setting the multi-layer coating has been created and its title is known.

Script Function

  • Set the multi-layer coating to the part set named "CoilSet".
  • Set two coating layers (layer names are Group 1 and Group 2 from the outer side).
  • Set the parameters for each coating layer.
    Group 1
     Thickness: 0.01
     Material: Copper
     Mesh divisions: 5
    Group 2
     Thickness: 0.005
     Material: TRANSFORMER_FILM
     Mesh divisions: 2
  • Set the eddy currents of the Group1 layer: Copper to be allowed.
# 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/


app = designer.GetApplication()


def createMeshCondLayerCoating(meshCtrl, tgtSet, meshPropParamArray):
    """Add a coating to the mesh"""
    meshCond = meshCtrl.CreateCondition(u"LayerCoating", u"cond01")
    meshCond.AddSet(tgtSet, 0)
    meshCond.RemoveSubCondition(0)

    # Coating layer property settings
    for idx, meshPropParam in enumerate(meshPropParamArray, 1):
        meshSubCond = meshCond.CreateSubCondition(u"LayerCoatingData", u"Group {}".format(idx))
        meshSubCond.SetValue(u"Thickness", meshPropParam[u"Thickness"])
        meshSubCond.SetValue(u"Division", meshPropParam[u"Division"])
        meshSubCond.SetMaterialByName(u"CoatingMaterial", meshPropParam[u"material"])
        material = meshSubCond.GetMaterial(u"CoatingMaterial")
        material.SetValue(u"EddyCurrentCalculation", meshPropParam[u"eddyCurrentFlag"])

setNm = u"CoilSet"
tgtSet = app.GetCurrentModel().GetSetList().GetSet(setNm)
meshCtrl = app.GetCurrentStudy().GetMeshControl()
meshPropParamArray = [{u"Thickness" : 0.01, u"Division" : 5, u"material" : u"Copper", u"eddyCurrentFlag" : "AllowEddyCurrent"},
                      {u"Thickness" : 0.005, u"Division" : 2, u"material" : u"TRANSFORMER_FILM", u"eddyCurrentFlag" : "NoEddyCurrent"}]
createMeshCondLayerCoating(meshCtrl, tgtSet, meshPropParamArray)

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