gearbox.fem.mesh#
Structured quad/hex meshes of gear teeth and gear pairs, generated with Gmsh.
The cross section of every tooth is split in two mirror-image half teeth. Each half tooth is covered by two four-sided blocks meshed with a transfinite (mapped) algorithm and recombined into quadrilaterals:
the tooth block, bounded by the tooth profile (root circle, fillet, flank, tip circle), the tooth axis, the line through the middle of the tooth gap and an inner arc below the root;
the rim block, between that inner arc and the bore.
The profile is sampled with its own element sizes (fine in the fillet and on the flank), so the
nodes lie exactly on the tooth form computed by ToothProfile.
Helical gears are obtained by extruding the section with a twist; the mesh is then made of
hexahedra. The idea of block-structured meshes follows the GGGears program (K. Poulios); no code
of that program is used.
Gmsh is an optional dependency: pip install python-gearbox[fem].
- class GearMesh[source]#
Bases:
objectResult of a meshing run.
- min_quality#
Smallest scaled Jacobian of the elements; 1 is a rectangle or a box and values at or below 0 denote inverted or degenerate elements. The measure depends on angles only, so slender elements are not penalised.
- Type:
- placements#
For each body prefix (
""for a single gear,"PINION_"/"WHEEL_"for a pair), the centre(x, y), the tooth axis angles [rad] and the twist of the section over the face width [rad].
- __init__(paths, dimension, node_count, element_count, min_quality, groups=<factory>, bodies=<factory>, placements=<factory>)#
- class ToothMeshSettings[source]#
Bases:
objectElement sizes and subdivision counts of the structured tooth mesh.
Sizes are expressed as fractions of the normal module, so the same settings give a similar mesh quality for any gear size.
- tooth_elements#
Elements across half the tooth thickness, from the axis to the flank. The tip circle uses the same number.
- Type:
- rim_elements#
Elements through the rim, in the radial direction.
Nonechooses a number that keeps the rim elements at about four times longer than wide.- Type:
int | None
- surface_growth#
Ratio between consecutive element sizes moving from the flank and the root fillet towards the inside of the tooth. The elements are finest at the surface, where contact and root stresses peak; 1 keeps them uniform, 1.2-1.4 grades them noticeably.
- Type:
- variant#
"fillet_block"(the default) closes the flank block on the root form circle and gives the fillet a block of its own, split at the point where the profile tangent makesfillet_anglewith the tooth axis; the element size in the critical root section is then controlled independently and undercut teeth are meshed evenly."standard"meshes the root and the fillet in one block, closed by a line atcross_angle.- Type:
- fillet_angle#
Angle [deg] between the profile tangent and the tooth axis at the split point of the
"fillet_block"variant (30 is the ISO 6336-3 critical section).- Type:
- cross_angle#
Angle [deg] below the horizontal of the line that closes the flank block towards the tooth axis; it sets how deep the flank block reaches into the tooth.
"standard"variant only:"fillet_block"closes it with the root form circle.- Type:
- width_elements#
Elements across the face width (3D only).
Nonemakes the layers as thick as the flank elements, so the elements at the flank are about cubic; this multiplies the element count byface_width / flank element size.- Type:
int | None
- order#
Element order, 1 (linear) or 2 (quadratic, serendipity 8-node quads/20-node hexes).
- Type:
- bore_diameter#
Bore diameter [mm]. Defaults to the shaft diameter of the gear, or to half the root diameter if the gear has no shaft.
- Type:
float | None
- refined(factor)[source]#
Return settings with about
factortimes more elements per length.The profile sizes are divided by
factorand the elements across the tooth are multiplied by it; the layers across the face width follow the flank size.- Parameters:
factor (float) – Refinement factor, positive; 2 halves the element size, 0.5 doubles it.
- Raises:
ValueError – If
factoris not positive.- Return type:
- __init__(root_size=0.2, fillet_size=0.05, flank_size=0.08, tooth_elements=10, rim_elements=None, surface_growth=1.25, variant='fillet_block', fillet_angle=30.0, cross_angle=30.0, width_elements=None, order=1, bore_diameter=None)#
- mesh_gear(gear, output_dir, model_name='gear', dimension=Dimension.TWO_D, settings=None, teeth=1, formats=('msh',))[source]#
Mesh a sector of
teethconsecutive teeth of one gear.The tooth axis of the first tooth points along +y; the gear axis is the z axis and the face width extends over
0 <= z <= face_width. A positive helix angle twists the section counter-clockwise with increasingz.- Parameters:
gear (Gear) – Gear to mesh (never modified).
output_dir (str | Path) – Destination folder, created if missing.
model_name (str) – Base name of the written files; spaces are replaced by underscores.
dimension (Dimension | str | int) –
"2D"(quadrilaterals) or"3D"(hexahedra).settings (ToothMeshSettings | None) – Mesh settings,
ToothMeshSettingsdefaults if omitted.teeth (int) – Number of consecutive teeth in the sector, between 1 and the number of teeth.
formats (Sequence[str]) – Output formats, any of
"msh"(Gmsh),"inp"(Abaqus/CalculiX) and"vtk".
- Returns:
A
GearMeshwith the written paths and mesh statistics.- Raises:
ImportError – If Gmsh is not installed.
ValueError – For internal gears, an invalid
teethcount or an unknown format.
- Return type:
- mesh_pair(transmission, output_dir, model_name='pair', dimension=Dimension.TWO_D, settings=None, teeth=(3, 4), formats=('msh',), pinion_rotation=0.0)[source]#
Mesh a gear pair in meshing position, with a sector of teeth around the pitch point.
The pinion is centred at the origin and the wheel at
(0, a)withathe working centre distance. A pinion tooth is centred on the line of centres and the wheel has a tooth gap there, so the flanks are in contact at zero backlash. The helix of the wheel has the opposite hand to the helix of the pinion. Physical group names are prefixed byPINION_andWHEEL_.pinion_rotationturns the pinion counter-clockwise from that position and the wheel by the matching angle,-pinion_rotation * z1 / z2, so the teeth stay in mesh.- Parameters:
transmission (Transmission | Sequence[Gear]) – A transmission, or a
(pinion, wheel)sequence of gears.output_dir (str | Path) – Destination folder, created if missing.
model_name (str) – Base name of the written files; spaces are replaced by underscores.
dimension (Dimension | str | int) –
"2D"(quadrilaterals) or"3D"(hexahedra).settings (ToothMeshSettings | Sequence[ToothMeshSettings] | None) – Mesh settings, one for both gears or a
(pinion, wheel)pair.teeth (tuple[int, int]) – Teeth meshed on the
(pinion, wheel), each between 1 and its tooth count.formats (Sequence[str]) – Output formats, see
mesh_gear().pinion_rotation (float) – Rotation of the pinion from the symmetric position [deg].
- Returns:
A
GearMeshwith the written paths and mesh statistics.- Raises:
ImportError – If Gmsh is not installed.
ValueError – For internal gears, an invalid
teethcount or an unknown format.
- Return type: