turbo_moc.plotting_mpl module#
turbo_moc.plotting_mpl – matplotlib plots built from turbo_moc.design_nozzle’s result dict. Static/publication-quality output, matching the color/style conventions already established across the NICFD_2026 postprocessing scripts (pressure in orange, Mach in green, jaxprop.COLORS_PYTHON).
Mirrors turbodash’s plotting_mpl.py/plotting_plotly.py split: this module is the matplotlib half; turbo_moc.plotting_plotly provides the same functions returning go.Figure instead, for the Dash app. Both take the SAME data dict (design_nozzle’s return value, or MOCSolver.build_result_data()) and an optional existing axes/figure to draw into – nothing here calls the solver or knows about MOCSolver/FluidManager.
Every function also accepts an optional reference=<second data dict> to overlay a second design for comparison (same color, dashed/lighter, to distinguish it from the current one) – e.g. pin one design, run another, compare. Used by turbo_moc.app’s “pin as reference” workflow, but standalone too.
- turbo_moc.plotting_mpl.plot_axis_properties(data, ax=None, 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_mpl.plot_blade(blade_data, ax=None, 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 – turbo_moc.geometry. parametrize_stator_blade’s
blade_curve(closed B-spline contour) repeated n_blades times at the design pitch, in mm (this module’s only plot not in SI, matching the ported blade-parametrization script’s own working units). reference=<second blade_data dict> overlays a second design (dashed, lighter). highlight_cp=<int> marks one control point of the CURRENT (not reference) blade with a distinct marker – used by turbo_moc.app’s interactive control-point editor (see turbo_moc.geometry.move_control_point_along_normal) to show which point a nudge will move. show_cp_labels annotates each control point of the CURRENT blade with its index (needed to pick a cp_index for that editor) – reference control points are never labeled, to keep an overlaid comparison readable.
- turbo_moc.plotting_mpl.plot_characteristics_mesh(data, ax=None, 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. Both line families, not just one.
data[‘mesh_data’]’s stage2_c_plus/stage2_c_minus/stage3_mesh are the individual characteristic SEGMENTS (radiating fan lines, one direction); stage2_fronts/stage3_fronts are the FRONT polylines connecting points across the fan at each marching step (the other direction) – together these two families are what makes it a grid rather than a one-directional fan. Matches the composite figure MOCSolver.plot_results()/MOCSolverMLN.plot_results() draw live during a show_plot=True solve (Sauer line, reflex-zone connectors, and all), reconstructed here from the saved data dict instead of needing the live solver object.
reference=<data dict> overlays a second design’s WALL only by default (dashed) – its full characteristic mesh is skipped unless show_reference_mesh=True, since two overlaid meshes get visually busy fast.
- turbo_moc.plotting_mpl.plot_meridional_view(meridional_data, ax=None, units='mm')[source]#
Meridional (axial-radial, x-r) 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.
- turbo_moc.plotting_mpl.plot_nozzle_contour(data, ax=None, mirror=True, show_sauer=True, show_kernel=True, reference=None, label='Current', reference_label='Reference')[source]#
Wall contour (the actual nozzle shape). mirror=True reflects the solved half across the axis for the full profile (this is a 2D axisymmetric half-solve throughout turbo_moc, same convention as the rest of the codebase). reference=<data dict> overlays a second design (dashed, lighter) for comparison.
- turbo_moc.plotting_mpl.plot_radial_cascade(radial_data, ax=None, show_radius_circles=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) to overlay the two rows, same as plotting_plotly’s version.
- turbo_moc.plotting_mpl.plot_rotor_blade(data, ax=None, show_junctions=True, reference=None, label='Current', reference_label='Reference')[source]#
Pressure/suction surfaces from turbo_moc.rotor.design_rotor_vortex_blade (NASA TN D-4421/Goldman & Scullin 1968 vortex-flow method, validated against the report’s own worked example – see vortex_blade.py’s module docstring), each plotted in ITS OWN local frame (own vortex center at the origin) – the two surfaces are NOT stitched into a single closed blade contour here (that needs the leading/trailing-edge treatment TN D-4421 covers separately, plus a rounding radius, neither implemented yet); data[“pitch”]/data[“chord”] give the NATURAL (not guessed) blade-to-blade spacing and the lower surface’s own inlet-to-outlet chord length, derived directly from the geometry.
show_junctions marks the transition-arc/circular-arc boundary on each surface (small circle) – purely informational; with the corrected (real marching-based) construction these should NOT show a visible kink. reference=<second data dict> overlays a second design (dashed/lighter).
- turbo_moc.plotting_mpl.plot_rotor_vortex_blade(data, ax=None, show_surfaces=True, show_mach_lines=False, reference=None, label='Current', reference_label='Reference')[source]#
Filled vortex-flow rotor blade (turbo_moc.rotor.design_rotor_vortex_blade’s “blade” key) – see notes/rotor_vortex_blade.md for what this closure actually is (pressure joined to suction shifted by +pitch, closed by tangent segments at beta_inlet/beta_outlet – NOT pressure+suction of the same instance closed directly). show_surfaces overlays the raw pressure/suction curves; show_mach_lines overlays the recorded characteristic segments from the transition-arc marching.
- turbo_moc.plotting_mpl.plot_ts_diagram(data, ax=None, show_dome=True, show_spinodal=False, reference=None, label='Current', reference_label='Reference')[source]#
T-s diagram: the saturation dome (from data[‘fluid_name’]) plus three highlighted points of the expansion – Total (stagnation, data[‘s0’]/[‘T0_stagnation’]), MoC start (the first solved axis point, ~the sonic/critical state Stage 1 seeds from – data[‘axis’][‘s’][0]/ [‘T’][0]), and Outlet (the last axis point). MoC start and Outlet are connected with a straight line (the two endpoints of what the solver actually marches, as opposed to Total, which sits upstream of where the solve starts at ~zero velocity).
The dome itself is drawn with jaxprop’s own Fluid.plot_phase_diagram (the same T-s/phase-diagram plotter used across the rest of this codebase’s jaxprop-based scripts), not a hand-rolled line plot – turbo_moc._phase_diagram.get_fluid caches the Fluid per fluid name so the saturation line (and, if requested, the spinodal line) is computed once and reused, not recomputed on every call. show_spinodal=True adds the metastable-region spinodal line (relevant for the subcooled-liquid flashing inlets this solver supports) – off by default since it’s a real iterative optimization per point, not free like the saturation line.
- turbo_moc.plotting_mpl.plot_wall_properties(data, ax=None, 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).