turbo_moc.plotting_plotly module#

turbo_moc.plotting_plotly – same functions as turbo_moc.plotting_mpl, returning go.Figure instead of matplotlib axes. Meant for the Dash app (turbodash’s own app.py consumes plotly.graph_objects figures the same way, built from its plotting_plotly.py) – a callback calls turbo_moc.design_nozzle(…) once, then these functions to build the figures it returns.

Same inputs as plotting_mpl: the data dict from design_nozzle() / MOCSolver.build_result_data(). No solver/UI objects, no state.

Every function also accepts an optional reference=<second data dict> to overlay a second design for comparison (same color, dashed/lighter) – see plotting_mpl’s module docstring. Used by turbo_moc.app’s “pin as reference” workflow, but standalone too.

turbo_moc.plotting_plotly.plot_annular_blade_3d(blade_data, r_hub, r_shroud, n_blades=1, flare='pitch_scale', n_span=13, theta0=0.0, source='stator', n_preview=None, rotor=None)[source]#

3D preview of turbo_moc.geometry.wrap_blade_annular(…): the blade profile genuinely wrapped circumferentially at every span station from r_hub to r_shroud (not the flat hub/tip loft of the “flared” STEP export), rendered as one go.Mesh3d surface per previewed blade copy. n_blades is the TRUE blade count (sets the angular spacing between copies); n_preview optionally caps how many of them are actually drawn, for a responsive preview, WITHOUT changing that spacing – see wrap_blade_annular’s docstring.

rotordict or None

Optional second row (source=”rotor”) added to the SAME figure/scene, e.g. from turbo_moc.app’s rotor-store (already scaled to mm). Keys: “blade_data” (required), “r_hub”/”r_shroud” (required), “n_blades” (default 1), “flare” (default: same as the stator’s own flare), “n_span”/”theta0”/”n_preview” (default: same as the stator’s own), “z_offset” (default 0 – the rotor’s own axial start, e.g. the stator’s axial chord plus a row-to-row gap, same convention as turbo_moc.geometry.build_meridional_view).

turbo_moc.plotting_plotly.plot_axis_properties(data, reference=None, label='Current', reference_label='Reference')[source]#

Pressure (left, orange) + Mach (right, green) vs axial distance along the centerline – data[‘axis’], extended with a flat line out to the nozzle exit (see _extend_axis_to_exit). reference=<data dict> overlays a second design’s axis properties (dashed, same extension).

turbo_moc.plotting_plotly.plot_blade(blade_data, n_blades=2, show_control_points=True, show_cp_labels=True, show_trailing_edge=True, highlight_cp=None, reference=None, label='Current', reference_label='Reference')[source]#

Cascade view of the fitted blade profile – see plotting_mpl. plot_blade for the ported script’s mm units, the reference-overlay semantics shared with the rest of this module, and what highlight_cp/ show_cp_labels are for.

turbo_moc.plotting_plotly.plot_characteristics_mesh(data, mirror=True, show_wall=True, show_kernel=True, show_fronts=True, show_sauer=True, show_reflex=True, reference=None, show_reference_mesh=False, label='Current', reference_label='Reference')[source]#

The nozzle contour (wall + convergent inlet) together with the full characteristic grid – merges what used to be two separate plots (plot_nozzle_contour + plot_characteristics_mesh) into one view, since the mesh is drawn directly on top of the geometry it was solved from anyway. See below for why stage*_fronts (not just stage*_c_plus/minus/stage3_mesh) are needed to actually look like a grid rather than a one-directional fan, and why the reflex-zone connectors are reconstructed from IVP/div_wall rather than read from mesh_data.

reference=<data dict> overlays a second design’s WALL only by default (dashed); its full characteristic mesh is skipped unless show_reference_mesh=True (busy fast otherwise).

turbo_moc.plotting_plotly.plot_meridional_view(meridional_data, units='mm', z_range=None)[source]#

Meridional (axial-radial) sketch of a stator + rotor stage from turbo_moc.geometry.build_meridional_view(…): hub/tip lines for each row (straight, per the shared-axial-station flare convention – see that function’s docstring), with the passage between them filled.

Coordinate convention (shared with the cascade view in app.py’s update_cascade_plot): z = axial/flow direction, r = radius. Drawn rotated 90 deg from the raw (x=axial, y=radius) data – r horizontal, z vertical – by swapping which raw coordinate feeds which axis (same “rotate, then re-zero so it reads forward from 0” treatment as the cascade plot’s own _rotate_traces_display, rather than a literal matrix rotation that would also flip the flow-reading direction).

turbo_moc.plotting_plotly.plot_nozzle_contour(data, mirror=True, show_sauer=True, show_kernel=True, reference=None, label='Current', reference_label='Reference')[source]#
turbo_moc.plotting_plotly.plot_radial_cascade(radial_data, show_radius_circles=True, clip_quadrant=True)[source]#

Full annular cascade view of turbo_moc.geometry.wrap_blade_radial(…) / wrap_rotor_blade_radial(…) results: every blade copy plus its trailing edge, laid out around the annulus, with the r1/r2 bounding circles as a visual reference. Also accepts a “combined” dict (radial_data[“mode”]==”combined”, with “stator”/”rotor” sub-dicts, as built by turbo_moc.app’s Phase 5 “Both” source) to overlay the two rows the same way Phase 4 overlays the unrolled cascade.

turbo_moc.plotting_plotly.plot_rotor_vortex_blade(data, show_surfaces=True, show_mach_lines=False, reference=None, label='Current', reference_label='Reference')[source]#

Vortex-flow rotor blade (turbo_moc.rotor.design_rotor_vortex_blade, NASA TN D-4421/Goldman & Scullin 1968) – see notes/rotor_vortex_blade.md for what pressure, suction, blade, and the Mach-line segments actually are; NOT the same construction as plot_blade (Phase 2’s nozzle-derived stator blade) even though both return a pitch.

show_surfaces overlays the raw pressure/suction transition-arc + circular-arc curves (thin, semi-transparent) on top of the filled blade polygon – useful for sanity-checking the closure against the surfaces it was built from. show_mach_lines overlays the recorded characteristic segments from the marching recursion (thin, faint).

turbo_moc.plotting_plotly.plot_ts_diagram(data, show_dome=True, reference=None, label='Current', reference_label='Reference')[source]#

T-s diagram – see plotting_mpl.plot_ts_diagram for the exact meaning of the three highlighted points (Total, MoC start, Outlet) and why only MoC-start-to-Outlet gets a connecting line.

turbo_moc.plotting_plotly.plot_wall_properties(data, reference=None, label='Current', reference_label='Reference')[source]#

Pressure (left, orange) + Mach (right, green) vs axial distance along the wall – data[‘wall_final’]. reference=<data dict> overlays a second design’s wall properties (dashed).