Model.sphgenerate_new#
- Model.sphgenerate_new(collection, string_array)#
Generates SPH particles within bounded, semi-watertight (some small gaps less than pitch size allowed), regions. The relative placement of these particles is specified using the pitch distance and the fill method parameters. The region(s) can be specified using elements, elements belonging to components, and either geometric surfaces or solids. The amount and direction of fill can also be specified. The mass of each resulting particle is calculated using either an input density or the total mass of the filled space. Full SPH functionality is available for Radioss, LS-DYNA and PAM-CRASH and user profiles. Execution is supported in other profiles, without the creation of solver data.
- Parameters:
collection (Collection) – The collection containing the input entities that defines the volumes. Valid entities are elments,components (elements only), surfaces or solids.
string_array (hwStringList) –
The string array that contains the array of meshing parameters. The string
String names must be followed by a colon (:) (for example, Config:). Valid strings and values are:
Config
Indicates how the particles are located relative to each other. Valid values are:
0 - Simple cubic
1 - Face centered cubic
ElemToComps
Specifies the organization of the SPH components. Valid values are:
0 - Create elements in current component
1 - Create elements in new component
2 - Create elements in new component per cavity
MassType
Indicates how the mass of each resulting particle is calculated. Valid values are:
0 - Using the specified density of the material in conjunction with the occupied volume and the number of created particles.
1 - By dividing the specified total mass by the number of created particles.
MassDensity
If
MassType=0, this is the density of the material.If
MassType=1, this is the total mass of the particles.PartialFill
An option to fill the volume partially. This string contains six values in a fixed sequence as “is_partial_fill is_percent_or_depth fillpercent_or_depth filldir_x filldir_y filldir_z”.
is_partial_fill
0 - Fill volume fully
1 - Fill volume partially.
is_percent_or_depth
0 - Fill by depth of volume. Used when
is_partial_fill=1.1 - Fill by percentage of volume. Used when
is_partial_fill=1.fillpercent_or_depth
The percentage value when
is_percent_or_depth=0, or the depth level whenis_percent_or_depth=1.filldir_x
Fill direction vector x component.
filldir_y
Fill direction vector y component.
filldir_z
Fill direction vector z component.
PitchSize
The numerical value of the pinch distance.
Reference
Specifies an optional reference used to align the SPH grid. This string contains five values in a fixed sequence as “use_ref_origin ref_origin_x ref_origin_y ref_origin_z ref_system_id”.
use_ref_origin
0 - Do not align to a reference.
1 - Align the grid to the specified reference.
ref_origin_x
The x-coordinate of the reference origin.
ref_origin_y
The y-coordinate of the reference origin.
ref_origin_z
The z-coordinate of the reference origin.
ref_system_id
The ID of the reference coordinate system.
VolumeType
Specifies the volume(s) to be considered for meshing. This string contains four values in a fixed sequence as “volume_type nth_largest_index enclosed_vol_node_mark exclude_vol_node_mark”.
volume_type
0 - All volumes are considered.
1 - Nth largest volume only considered as given by
nth_largest_index.2 - Enclosed volumes are considered which contains nodes by
enclosed_vol_node_mark.3 - Exclude volumes from meshing which contain nodes specified by
exclude_vol_node_mark.nth_largest_index
The volume index to be meshed (starting with 1). Volumes are sorted based on descending order of volume. Used when
volume_type=1.enclosed_vol_node_mark
The collection containing nodes within enclosed volumes to consider. Used when
volume_type=2.exclude_vol_node_mark
The collection containing nodes within volumes to exclude. Used when
volume_type=3.WallClearance
The wall clearance distance for which particles will not be created.
WallOffset
The wall offset distance for which particles will be created.
Example#
Generate SPH elements for all components and all volumes , use a pitch size of 1 , partial filling with a depth of 50 along the y direction with a reference location of ( 35.0 , 11.0 , -5.0 ) , a wall clearance of 0.1 and a wall offset of 30#import hm import hm.entities as ent model = hm.Model() model.sphgenerate_new( collection=hm.Collection(model, ent.Component), string_array=[ "PitchSize: 1", "Config: 0", "MassType: 0", "MassDensity: 1", "PartialFill: 1 1 50 0 1 0", "Reference: 1 35.0 11.0 -5.0 0", "VolumeType: 0 0 0 0", "WallClearance: 0.1", "WallOffset: 30", "ElemToComps: 1", ], )