tud_lbm.io.plotting.ca_theta_plot

Ca–θ plotting utilities for leading and trailing contact lines.

Classes

CaThetaVsTimePlot

Dual-axis Ca/θ plot with normalised timestep (Δt/t_tot) on the x-axis.

CaThetaVsXPlot

Dual-axis Ca/θ plot with normalised position (X_avg/R_0) on the x-axis.

Functions

plot_dual_axis_ca_theta(→ matplotlib.figure.Figure)

Plot capillary number and contact angle on dual y-axes vs a shared x.

plot_contact_angle_vs_capillary_number(...)

Plot contact angle vs capillary number (θ on y, Ca on x).

save_figure(→ None)

Save fig to path; file format is inferred from the path suffix.

Module Contents

tud_lbm.io.plotting.ca_theta_plot.plot_dual_axis_ca_theta(x_data: numpy.ndarray, ca_trailing: numpy.ndarray, ca_leading: numpy.ndarray, theta_trailing: numpy.ndarray, theta_leading: numpy.ndarray, *, x_label: str = '$X_{\\mathrm{avg}}/R_0$', figsize: tuple[float, float] = DEFAULT_STYLE.dual_axis_figsize, dpi: int = DEFAULT_STYLE.dpi, ca_limits: tuple[float, float] | None = None, angle_limits: tuple[float, float] | None = None, x_limits: tuple[float, float] | None = None) matplotlib.figure.Figure[source]

Plot capillary number and contact angle on dual y-axes vs a shared x.

Creates a figure with Ca on the left y-axis and θ on the right y-axis (via twinx). Trailing and leading edges are distinguished by colour.

Parameters:
  • x_data – Shared x data; typically normalised time (Δt/t_tot) or normalised position (X_avg/R_0).

  • ca_trailing – Capillary number for the trailing contact line.

  • ca_leading – Capillary number for the leading contact line.

  • theta_trailing – Contact angle (degrees) for the trailing contact line.

  • theta_leading – Contact angle (degrees) for the leading contact line.

  • x_label – Label for the shared x-axis.

  • figsize – Figure size in inches (width, height).

  • dpi – Resolution in dots per inch.

  • ca_limits(y_min, y_max) for the Ca axis; auto-scaled when None.

  • angle_limits(y_min, y_max) for the θ axis; auto-scaled when None.

  • x_limits(x_min, x_max) for the x-axis; auto-scaled when None.

Returns:

A matplotlib.figure.Figure.

tud_lbm.io.plotting.ca_theta_plot.plot_contact_angle_vs_capillary_number(ca_trailing: numpy.ndarray, theta_trailing: numpy.ndarray, ca_leading: numpy.ndarray, theta_leading: numpy.ndarray, *, log_scale: bool = False, title: str | None = None, figsize: tuple[float, float] = DEFAULT_STYLE.ca_theta_figsize, dpi: int = DEFAULT_STYLE.dpi, reference_csv: str | pathlib.Path | None = None) matplotlib.figure.Figure[source]

Plot contact angle vs capillary number (θ on y, Ca on x).

Useful for overlaying an older reference dataset on a new one. For the standard dual-axis time/position view use plot_dual_axis_ca_theta().

Parameters:
  • ca_trailing – Capillary number array for the trailing edge.

  • theta_trailing – Contact angle array (degrees) for the trailing edge.

  • ca_leading – Capillary number array for the leading edge.

  • theta_leading – Contact angle array (degrees) for the leading edge.

  • log_scale – Apply logarithmic scale to the Ca axis when True.

  • title – Optional figure title.

  • figsize – Figure size in inches (width, height).

  • dpi – Figure resolution in dots per inch.

  • reference_csv – Path to a CSV file with columns Ca_trailing, theta_trailing, Ca_leading, theta_leading. When supplied the reference data is overlaid as open markers.

Returns:

A matplotlib.figure.Figure.

tud_lbm.io.plotting.ca_theta_plot.save_figure(fig: matplotlib.figure.Figure, path: str | pathlib.Path, *, dpi: int = 300) None[source]

Save fig to path; file format is inferred from the path suffix.

Parameters:
  • fig – The figure to save.

  • path – Output path (e.g. "ca_theta.png" or "ca_theta.pdf").

  • dpi – Resolution in dots per inch (only relevant for raster formats).

class tud_lbm.io.plotting.ca_theta_plot.CaThetaVsTimePlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: tud_lbm.io.plotting.base.AnalysisPlot

Dual-axis Ca/θ plot with normalised timestep (Δt/t_tot) on the x-axis.

name = 'ca_theta_vs_time'[source]
required_keys = ('ca_left', 'ca_right', 'cll_left', 'cll_right')[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute Ca, θ and x_time arrays from snapshot files.

render(ax: matplotlib.axes.Axes, precomputed: dict[str, numpy.ndarray]) None[source]

Draw dual-axis Ca/θ scatter with normalised time on x.

class tud_lbm.io.plotting.ca_theta_plot.CaThetaVsXPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: tud_lbm.io.plotting.base.AnalysisPlot

Dual-axis Ca/θ plot with normalised position (X_avg/R_0) on the x-axis.

name = 'ca_theta_vs_x'[source]
required_keys = ('ca_left', 'ca_right', 'cll_left', 'cll_right')[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute Ca, θ and x_pos arrays from snapshot files.

render(ax: matplotlib.axes.Axes, precomputed: dict[str, numpy.ndarray]) None[source]

Draw dual-axis Ca/θ scatter with normalised position on x.