mymesh.improvement.NodeSpringSmoothing#

mymesh.improvement.NodeSpringSmoothing(M, Stiffness=1, Forces=None, Displacements=None, options={})[source]#

Perform node spring smoothing, with or without mesh deformation. Uses the node spring analogy [Blo00] to redistribute nodes and achieve equilibrium. If Forces and/or Displacements are prescribed, this an be used to deform a mesh while keeping nodes spread apart.

Note

Element inversions aren’t strictly prevented and may result from large deformations.

Parameters:
  • M (mymesh.mesh) – Mesh object to smooth

  • Stiffness (float, optional) – Spring stiffness, by default 1. If no forces are applied, the choice of stiffness is irrelevant.

  • Forces (np.ndarray or NoneType, optional) – nx3 array of applied forces, where n is the number of nodes in the mesh. If provided, there must be forces assigned to all nodes, by default None.

  • Displacments (np.ndarray or NoneType, optional) – nx3 array of applied forces, where n is the number of nodes in the mesh. If provided, there must be forces assigned to all nodes, by default None. Nodes with non-zero displacements will be held fixed at their displaced position, while nodes with zero displacement in x, y, and z will be free to move (to prescribe a displacement of 0 to hold a node in place, add that node to options[‘FixedNodes’].)

  • options (dict) –

    Smoothing options. Available options are:

    iterateint or str

    Fixed number of iterations to perform, or ‘converge’ to iterate until convergence, by default ‘converge’.

    tolerancefloat

    Convergence tolerance. For local Laplacian smoothing, iteration will terminate if the largest movement of a node is less than the specified tolerance, by default 1e-3.

    maxIterint

    Maximum number of iterations when iterate=’converge’, By default 20.

    FixedNodesset or array_like

    Set of nodes that are held fixed during iteration, by default none are fixed.

    FixFeaturesbool

    If true, feature nodes on edges or corners (identified by DetectFeatures()) will be held in place, by default False.

    FixSurfbool

    If true, all nodes on the surface will be held in place and only interior nodes will be smoothed, by default True.

Returns:

Mnew – Mesh object with the new node locations.

Return type:

mymesh.mesh