turbo_moc.deprecated.geometry.turbogrid module#
turbo_moc.geometry.turbogrid – export a wrapped annular blade (turbo_moc. geometry.wrap_blade_annular) to ANSYS CFX-BladeGen’s .inf + .curve file triple, the geometry input TurboGrid consumes for turbomachinery blade meshing.
Format and conventions matched against turbodash’s own validated exporter (turbodash/export_turbogrid.py on turbodash’s origin/main, commit ad9fdce – superseding the earlier rotor-only demos/cyclopentane_case/ export_rotor_turbogrid.py this module first matched at commit 81b3e33) rather than reverse-engineered from a BladeGen-produced reference file, since getting an interchange format wrong tends to fail silently (TurboGrid imports something, just not the right shape). Details that are NOT obvious from the file contents alone, confirmed from that implementation:
profile.curve’s three columns are true Cartesian (X, Y, Z) with the blade’s own axial/chordwise coordinate as X and (Y, Z) = (r*cos(theta), r*sin(theta)) – i.e. literally turbo_moc.geometry.annular’s own (z, x, y) triple from wrap_blade_annular, just reordered.
The header’s angle label is “alpha_in”/”alpha_out” for a stator row (absolute flow angle convention) but “beta_in”/”beta_out” for a rotor row (relative/blade-angle convention) – not the same label for both.
Profile span stations are inset 1% of span from r_hub/r_shroud by default (hub_shroud_offset_fraction), matching turbodash’s own convention. NOTE: this does NOT explain a real “Trim operation failed… Surfaces … do not intersect” TurboGrid error hit on a single-row stator import – setting the inset to 0 (spans exactly at r_hub/r_shroud) was tried and did NOT fix it, so the actual cause is still open; don’t assume either setting here is the culprit.
hub.curve/shroud.curve are just TWO points each (a straight line from x_min to x_max at the constant hub/shroud radius), not a dense point cloud – consistent with this module’s own “flare has the same axial stations, radius doesn’t vary along one row’s own chord” convention (turbo_moc.geometry.meridional’s docstring).
The axial extension of hub.curve/shroud.curve past the blade’s own LE/TE is ASYMMETRIC by default – 1x chord upstream, 2x chord downstream (more room for wake development on the outlet side), not a single symmetric margin.
- turbo_moc.deprecated.geometry.turbogrid.export_turbogrid_blade(blade_data, r_hub, r_shroud, n_blades, output_dir, span_sections=11, hub_shroud_offset_fraction=0.01, inlet_extension_fraction=1.0, outlet_extension_fraction=2.0, x_offset=0.0, flare='pitch_scale', theta0=0.0, source='stator', axis='X', units='MM', te_type='CutOffEnd')[source]#
Export BladeGen.inf + hub.curve + shroud.curve + profile.curve for TurboGrid meshing – the wrapped-annulus counterpart to turbo_moc. geometry.export_annular_blade_step’s STEP solid (same wrap math, turbo_moc.geometry.wrap_blade_annular, same r_hub/r_shroud/flare conventions), but as the plain-text profile-points format TurboGrid itself consumes, with no cadquery dependency.
- Parameters:
- blade_datadict
Stator (parametrize_stator_blade/_semi’s output) or rotor (design_rotor_vortex_blade’s output, already scaled to mm) – pick which via source.
- r_hub, r_shroudfloat
Hub/shroud radii (mm).
- n_bladesint
Blade count – written as “Number of Blade Sets” and used for the pitch-scale flare physics (see wrap_blade_annular).
- output_dirPath
Directory the four files are written into (created if missing).
- span_sectionsint
Number of profile.curve span stations (>= 2).
- hub_shroud_offset_fractionfloat
Inset the first/last profile station this fraction of span in from r_hub/r_shroud – TurboGrid wants near-wall profiles, not sections sitting exactly on the hub/shroud wall.
- inlet_extension_fraction, outlet_extension_fractionfloat
How far hub.curve/shroud.curve extend upstream/downstream of the blade’s own LE/TE, as a fraction of its axial chord (asymmetric by default – more room downstream for wake development). Set the side facing an adjacent row to 0 – extensions belong at the machine’s true inlet/outlet, not padding an internal row interface (see shift_turbogrid_files’s docstring).
- x_offsetfloat
Added to every axial (X) coordinate after the fact – positions this row in a shared global frame against an already-exported neighbor (e.g. a turbodash rotor), equivalent to exporting at 0 then calling shift_turbogrid_files, just in one step.
- flare, theta0see wrap_blade_annular.
- source“stator” or “rotor”.
- axisAxis of Rotation written to BladeGen.inf (“X”, “Y”, or “Z”).
- unitsGeometry Units written to BladeGen.inf.
- te_typeBlade 0 TE treatment written to BladeGen.inf.
- Returns:
- dict
Paths written: {“inf”, “profile”, “hub”, “shroud”}.
- turbo_moc.deprecated.geometry.turbogrid.read_turbogrid_x_extent(hub_curve_path)[source]#
(x_min, x_max) of a hub.curve/shroud.curve file – format-agnostic (works on ANY BladeGen-format export, not just this module’s own, since the X column convention is shared; see this module’s docstring). Use this on a row’s hub.curve where the facing side’s extension fraction was exported as 0 to get that row’s TRUE blade/domain edge there, for computing the axial offset to hand to shift_turbogrid_files.
- turbo_moc.deprecated.geometry.turbogrid.shift_turbogrid_files(src_dir, dst_dir, x_offset)[source]#
Copy a BladeGen export (profile.curve + hub.curve + shroud.curve + BladeGen.inf – from THIS module or any other tool writing the same format, e.g. turbodash’s) into dst_dir with every X (axial) coordinate shifted by x_offset. BladeGen.inf has no coordinates, so it’s just copied unchanged.
This is the tool for lining up two independently-exported blade rows (each with its own local axial origin) so they share one global axial frame with no overlap and no gap at their interface – same principle turbodash’s own assembly exporter uses (one additive offset per row), just applied here as a standalone post-export step since the two rows come from different, unconnected design tools. Pick one row to anchor (x_offset=0, leave it as exported) and shift the OTHER by:
x_offset = (anchor_x_max_at_interface + gap) - this_row_x_min_at_interface
where both x_max/x_min are read (read_turbogrid_x_extent) from each row’s hub.curve AFTER re-exporting with that row’s facing-side extension fraction set to 0 – otherwise you’re offsetting by each row’s own inlet/outlet padding instead of its true blade/domain edge, and the rows will overlap or leave an unwanted gap at the interface.
Radius (hub/shroud) continuity at the interface is NOT handled here – shifting coordinates only repositions a row axially. If the two rows’ hub/shroud radii differ at the interface, that’s a design mismatch (fix it in whichever tool designed that row), not a file-shift fix.