Model.midsurfmesh#

Model.midsurfmesh(collection, criteria_file, param_file, elem_size=-1.0, elem_type=-1, elem_order=-1, min_elem_size=-1.0, max_elem_size=-1.0, elem_feature_angle=-1.0, no_geomcleanup=-1, no_node_move_across_edges=-1, no_remove_holes=-1, no_seed_holes=-1, do_washer=-1, thickness_mode=-1, thickness_min=-1.0, thickness_max=-1.0, midsurf_method=-1, save_model=-1, keep_midsurf_elems=-1)#

Creates a mesh on the mid-surface extracted from a solid body. The mesh is created using the approach, with optional application of geometry and elements cleanup steps. The function also optionally assigns thickness to the created mesh.

The mid-surface must already exist, and must be organized in a component with the name “Middle Surface”. The mesh is applied only to surfaces in this component.

The parameters controlling mesh creation are set using specified criteria and parameters file, or can be set using flexible string input.

The assignment of thickness is available only through the string input. The thickness assignment is supported for the following user profiles:

Abaqus, LS-DYNA, Nastran, OptiStruct, Radioss

Parameters:
  • collection (Collection) – The collection containing the input geometry entities for thickness calculations. Valid entities are surfaces and solids.

  • criteria_file (hwString) –

    The full path and file name of the element quality criteria file to use. If the criteria are set by a preceding function, “dummy” should be used as the file name.

    This is ignored, if the criteria and parameter auto-generation mode (elem_size) is set in the string input.

  • param_file (hwString) –

    The full path and file name of the geometry cleanup parameters file to use. If the parameters are set by a preceding function, “dummy” should be used as the file name.

    This is ignored, if the criteria and parameter auto-generation mode (elem_size) is set in the string input.

  • elem_size (double) –

    The mesh element size. If a positive value is given, then the criteria_file and param_file arguments are ignored. The criteria and parameters are auto-generated inside the function using default values adjusted to the given element size.

    The remaining mesh and geometry cleanup parameters have effect only if elem_size is given and has a valid value. They are used for tuning the auto-generation.

  • elem_type (int) –

    Element type. Valid only when elem_size > 0. Valid options are:

    0 - trias

    1 - quads

    2 - mixed

  • elem_order (int) –

    Element order. Valid only when elem_size > 0. Valid options are:

    1 - First order

    2 - Second order

  • min_elem_size (double) – The minimum element size used for auto-generated criteria. Valid only when elem_size > 0. Default value is 0.3*elem_size.

  • max_elem_size (double) – The maximum element size used for auto-generated criteria. Valid only when elem_size > 0. Default value is 1.75*elem_size.

  • elem_feature_angle (double) – The element feature angle, in degrees, used for detection of features in post-mesh smoothing and cleanup. Valid only when elem_size > 0. Default value is 25.0.

  • no_geomcleanup (int) –

    Flag for geometry cleanup. Valid only when elem_size > 0. Valid options are:

    0 - Apply geometry cleanup

    1 - Do not apply geometry cleanup

  • no_node_move_across_edges (int) –

    Flag for nodes to be able to move across geometry edges. Valid only when elem_size > 0. Valid options are:

    0 - Nodes are allowed to move across non-feature geometry edges in post-mesh smoothing and cleanup

    1 - Nodes are not allowed to move off geometry edges

  • no_remove_holes (int) –

    Flag for removing small holes. Valid only when elem_size > 0. Valid options are:

    0 - Small holes are removed during geometry cleanup. The default hole diameter for removal is the maximum of 0.4*elem_size and 0.8*min_elem_size.

    1 - Do not remove small holes

  • no_seed_holes (int) –

    Flag for seed holes. Valid only when elem_size > 0. Valid options are:

    0 - Seed holes with fixed points in geometry cleanup

    1 - Do not seed holes

  • do_washer (int) –

    Flag for creating washers. Valid only when elem_size > 0. Valid options are:

    0 - Do not create washers around holes

    1 - Create washers around holes

  • thickness_mode (int) –

    Option for thickness assignment. Valid options are:

    0 - Do not assign thickness

    1 - Assign thickness

  • thickness_min (double) – The minimum thickness to use. Ignored if thickness_mode=0, if omitted, or if provided as 0.0.

  • thickness_max (double) – The maximum thickness to use. Ignored if thickness_mode=0, if omitted, or if provided as 0.

  • midsurf_method (int) – Reserved for future development.

  • save_model (int) – Reserved for future development.

  • keep_midsurf_elems (int) –

    Flag for handling of existing elements associated with surfaces in the “Middle Surface” component. Valid options are:

    0 - Delete existing elements

    1 - For completely meshed connected surfaces, the mesh is kept. Partially meshed connected surfaces are remeshed.

    2 - All existing elements are kept. This may result in a break in connectivity of the mesh.

Examples#

Mesh a mid - surface use element quality criteria “ C:/crit/10mm.criteria “ and cleanup parameters file “ C:/crit/10mm.param “ , with no additional input parameters#
import hm
import hm.entities as ent

model = hm.Model()

model.midsurfmesh(
    collection=hm.Collection(model, ent.Solid, populate=False),
    criteria_file="C:/crit/10mm.criteria",
    param_file="C:/crit/10mm.param",
)
mesh a mid-surface using element quality criteria “C:/crit/10mm.criteria” and cleanup parameters file “C:/crit/10mm.param”, with element thickness assignment using all solid geometry (no limits on the minimum and maximum thickness)#
import hm
import hm.entities as ent

model = hm.Model()

solid_collection = hm.Collection(model, ent.Solid)

model.midsurfmesh(
    collection=solid_collection,
    criteria_file="C:/crit/10mm.criteria",
    param_file="C:/crit/10mm.param",
    thickness_mode=1,
)
Mesh a mid - surface with cleanup parameters file “ C:/crit/10mm.param “ and with element thickness assignment use all solid geometry ( no limits on the minimum and maximum thickness ) and use specific quality criteria#
import hm
import hm.entities as ent

model = hm.Model()

strarray = [
    " 0 penalty value      0.00    0.00    0.80    1.00   10.00",
    " 1 min length        1 1.0   3.000   2.749   1.502   1.000   0.749  1",
    " 2 max length        1 1.0   3.000   3.600   4.500   6.000   9.000  0",
    " 3 aspect ratio      1 1.0   1.000   2.000   4.400   5.000  10.000  0",
    " 4 warpage           1 1.0   0.000   5.000  13.000  15.000  30.000  0",
    " 5 max angle quad    1 1.0  90.000 110.000 134.000 140.000 160.000  0",
    " 6 min angle quad    1 1.0  90.000  70.000  46.000  40.000  20.000  0",
    " 7 max angle tria    1 1.0  60.000  80.000 112.000 120.000 150.000  0",
    " 8 min angle tria    1 1.0  60.000  50.000  34.000  30.000  15.000  0",
    " 9 skew              1 1.0   0.000  10.000  34.000  40.000  70.000  0",
    "10 jacobian          1 1.0   1.000   0.900   0.700   0.600   0.300  0",
    "11 chordal dev       0 1.0   0.000   0.300   0.800   1.000   2.000  0",
    "12 taper             1 1.0   0.000   0.200   0.500   0.600   0.900  0",
    "13 % of trias        1 1.0   0.000   6.000  10.000  15.000  20.000  0",
]

model.setqualitycriteria(string_array=strarray, mode=0)

solid_collection = hm.Collection(model, ent.Solid)

model.midsurfmesh(
    collection=solid_collection,
    criteria_file="dummy",
    param_file="C:/crit/10mm.param",
    thickness_mode=1,
)
Mesh a mid - surface with element size 12.0 ( mixed elements type ) use auto - generated element quality criteria and cleanup parameters , a minimum element size of 5.0 , an elements feature angle of 15.0 , and assign element thickness use all solid geometry ( no limits on the minimum and maximum thickness )#
import hm
import hm.entities as ent

model = hm.Model()

solid_collection = hm.Collection(model, ent.Solid)

model.midsurfmesh(
    collection=solid_collection,
    criteria_file="dummy",
    param_file="dummy",
    elem_size=12.0,
    min_elem_size=5.0,
    elem_feature_angle=15.0,
    thickness_mode=1,
)