Documentation

Docs / Scripting API

Mesh rules#

prj.mesh adds rules that make the starting mesh finer on a selection. The solver's adaptive refinement does the rest (see Adaptive meshing). Rules only refine: a rule never makes the mesh coarser, and one whose object was deleted is skipped with a warning.

Each method takes faces= (one face or a list) or objects= (an Object or a list), and an optional name (default Length1, SkinDepth1, ...).

Method Does
length_on(max_length, faces=None, objects=None, name=None) Caps the surface triangles on the faces (or every face of the objects)
length_inside(max_length, objects, name=None) Caps the elements inside the objects; a non-model object is a refinement region
skin_depth(faces=None, objects=None, layers=2, max_length=None, skin_depth=None, name=None) Layers of elements under conductor surfaces, sized by the skin depth (given, or from the material at the solution frequency); only for conductors meshed inside
surface_approximation(faces=None, objects=None, max_deviation=None, normal_deviation_deg=15.0, max_length=None, name=None) How closely the mesh follows curved faces
Call
prj.mesh.names() list[str]
prj.mesh["Length1"] The rule
del prj.mesh["Length1"] Remove it
prj.mesh.length_on("0.2mm", objects=[trace], name="TraceEdges")
region = prj.modeler.box("Refine", size=(4, 4, 2), origin=(-2, -2, 0))
region.model = False
prj.mesh.length_inside("0.3mm", objects=[region])

Global settings (elements per wavelength, size limits, uniform refinements) are on the setup: see Setups and solving.