gearbox.fem.post#
Post-processing of the FEM analyses: line of action, contact patches, sweeps and plots.
The plots draw on a matplotlib Axes that the caller creates, so they can be combined freely;
matplotlib comes with pip install python-gearbox[fem] and is imported only by the functions
that draw. Coordinates follow mesh_pair(): the pinion is centred at the
origin, the wheel at (0, a_w) above it, and the pinion turns counter-clockwise, so the contact
runs up the line of action from A (start of contact, at the wheel tip) to E (end of
contact, at the pinion tip). Positions on the line are measured from the pitch point C,
positive towards E.
- class ContactPatch[source]#
Bases:
objectThe contact of one pinion tooth.
- point#
Centre of the patch, the coordinates of its nodes weighted by their pressure [mm].
- on_path#
Whether the patch lies on the path of contact
A-E.Falsefor the sharp tip edge of a tooth that the deflection brings into contact just beforeAor afterE; the pressure there is singular and depends on the mesh.- Type:
- __init__(tooth, point, position, offset, pressure, on_path)#
- class LineOfAction[source]#
Bases:
objectLine of action of an external spur (or, in the transverse section, helical) pair.
- reduced_modulus#
1 / ((1 - nu1^2)/E1 + (1 - nu2^2)/E2)[MPa], the modulus of the Hertzian contact of two cylinders in plane strain.- Type:
- pinion_half_angle#
Half the angular tooth thickness of the pinion at its working pitch circle [rad].
- Type:
- classmethod of(transmission)[source]#
Build the line of action of a transmission.
- Raises:
ValueError – For an internal gear.
- Return type:
- property normal: ndarray#
Unit vector normal to the line, towards the pinion tooth ahead of the contact.
- property pitch_curvature: tuple[float, float]#
Radii of curvature of the flanks at the pitch point,
r_b tan(alpha_wt)[mm].
- coordinates(point)[source]#
Position of
pointalong the line and its distance from it (alongnormal).
- is_single_contact(position)[source]#
Whether only one pair of teeth is in contact at
position.- Return type:
- hertz_pressure(position, load)[source]#
Hertzian pressure of two cylinders with the radii of curvature of the flanks.
- mesh_position(position)[source]#
Mesh position that puts the contact at
positionon the line of action.- Returns:
The
pinion_rotationofmesh_pair()[deg], for the pinion tooth that is on the line of centres in the symmetric position.- Return type:
- __init__(pressure_angle, base_radii, pitch_radii, approach, recess, base_pitch, reduced_modulus, pinion_half_angle)#
- class SweepPoint[source]#
Bases:
objectOne mesh position of
contact_sweep().- patches#
Contact of each pinion tooth, see
ContactPatch.- Type:
- followed#
The patch of the followed tooth (the one closest to
position).- Type:
- stress(kind='principal')[source]#
Nodal
"principal"or"von_mises"stress, forplot_field().
- __init__(position, root_stress_pinion, root_stress_wheel, patches, followed, requested_torque, bore_rotation, nodes, triangles, principal, von_mises)#
- contact_patches(result, line, tolerance=0.05)[source]#
Split the contact pressure of a
solve_contact()result by pinion tooth.The pressures are scaled to the requested torque like
max_contact_pressure, and the points are in the displaced position, where the flanks actually touch on the line of action.- Parameters:
result (ContactResult) – A 2D contact result.
line (LineOfAction) – The line of action of the same pair.
tolerance (float) – Distance from the line and from
A/Ewithin which a patch counts as on the path of contact [mm].
- Returns:
One
ContactPatchper pinion tooth in contact, sorted by position.- Return type:
- contact_sweep(transmission, output_dir, positions, tangential_force=None, cache=True, progress=None, **solve_options)[source]#
Solve the 2D contact of a pair at several positions along the line of action.
Each position is solved with
solve_contact()at the mesh positionLineOfAction.mesh_position(), starting from the bore rotation of the previous one. Only the summary and the nodal stresses are kept: withcachethey are stored inoutput_dirand reused when the same transmission, force and options are asked again; the solver files are removed.- Parameters:
transmission (Transmission) – The gear pair (external gears).
output_dir (str | Path) – Folder for the cache and the temporary solver files.
positions (Iterable[float]) – Positions of the followed tooth on the line of action [mm].
tangential_force (float | None) – Nominal
Ft[N], the transmission’s by default.cache (bool) – Reuse and store solved positions.
progress (Any) – Optional callable
progress(index, count, point)called after each position.**solve_options (Any) – Passed to
solve_contact()(settings,teeth,contact_stiffness,ccx, …);dimensionis always 2D.
- Returns:
One
SweepPointper position.- Return type:
- nodal_field(mesh, values, positions=None)[source]#
Triangulate the quadrilaterals of a 2D mesh and attach nodal values.
- Parameters:
- Returns:
A
matplotlib.tri.Triangulationand the values in its node order.- Raises:
ValueError – For a 3D mesh.
- Return type:
- plot_field(ax, field_data, vmax=None, levels=64, cmap='turbo', edges=True, edge_width=0.1)[source]#
Draw a nodal field as filled contours; returns the contour set (for
colorbar).- Parameters:
ax (Any) – Matplotlib axes.
field_data (tuple[Any, ndarray]) –
(triangulation, values)fromnodal_field()orstress_field().vmax (float | None) – Upper end of the colour scale; the largest value by default. Values outside
[0, vmax]are clipped.levels (int) – Number of colour levels.
cmap (str) – Colour map.
edges (bool) – Draw the element edges faintly.
edge_width (float) – Line width of the element edges.
- Return type:
- plot_line_of_action(ax, line, contact=None, labels=True, others=(), label_size=14, label_offset=1.0)[source]#
Overlay the classic scheme of the mesh on a plot of the pair.
Base circles (dashed), working pitch circles (dotted), the line of centres, the radii to the tangent points
T1andT2, the line of action and, in magenta, the path of contactA-Ewith the single contact pointsBandD.- Parameters:
ax (Any) – Matplotlib axes with the pair in the coordinates of
mesh_pair().line (LineOfAction) – The line of action of the pair.
contact (Sequence[float] | None) – A contact point to mark, e.g. the followed one.
labels (bool) – Write the names of the points that fall inside the current view, so set the axes limits first. The scheme never changes the view.
others (Iterable[Sequence[float]]) – Further contact points, marked with hollow circles.
label_size (float) – Font size of the names.
label_offset (float) – Distance of the names from the line [mm].
- stress_field(result, kind='principal', mesh=None)[source]#
First principal (
"principal") or von Mises ("von_mises") stress of a 2D result.Contact results are scaled from the torque reached to the requested torque, as their summaries are, and drawn in the displaced position, where the contact lies on the line of action; bending results in the undisplaced one.