Skip to content

Conversation

@gsabinoo
Copy link
Collaborator

@gsabinoo gsabinoo commented Nov 6, 2025

Overview

This PR implements a suite of post-processing methods for bearing analysis visualization and result inspection. These methods provide users with immediate access to simulation results without requiring re-execution.


Implementation

Modified Classes

  • TiltingPad
  • ThrustPad
  • PlainJournal

New Methods

1. show_results()

Displays formatted tables with key simulation results including:

  • Operating conditions: speed, equilibrium type, number of pads
  • Field results: maximum pressure, maximum temperature, minimum film thickness
  • Equilibrium parameters: eccentricity, attitude angle
  • Load information: forces in X and Y directions
  • Dynamic stiffness coefficients: kxx, kxy, kyx, kyy
  • Damping coefficients: cxx, cxy, cyx, cyy
  • Pad rotation angles and moments (when available)

Supports both single and multiple frequency results.

2. plot_results(show_plots=False, freq_index=0)

Generates comprehensive visualizations for pressure and temperature fields:

  • Scatter plots for pressure distribution
  • Scatter plots for temperature distribution
  • 2D contour plots for pressure fields
  • 2D contour plots for temperature fields

Returns: Dictionary of Plotly figure objects for flexible post-processing.

3. show_coefficients_comparison()

Displays a comparison table of dynamic coefficients across all analyzed frequencies. Particularly useful for multi-frequency analyses to quickly identify trends and variations in bearing behavior at different operating speeds.

4. show_execution_time()

Reports the total simulation execution time.

5. show_optimization_convergence(by='index')

Displays the optimization residual history for each frequency, showing:

  • Iteration count
  • Residual values at each iteration
  • Convergence behavior

Valuable for debugging convergence issues and understanding the optimization process.

Helper Method

record_optimization_residual(residual_value, iteration=None) - tracks optimization progress during the solve process.


Usage Examples

1. Initial Setup

from ross.bearings.thrust_pad import thrust_pad_example

# Use the default class example
bearing = thrust_pad_example()

2. Display Results

bearing.show_results()

Output:

=====================================================================================
                          THRUST BEARING RESULTS - 90.0 RPM                          
=====================================================================================
+---------------------------+---------------------------+---------------------------+
|         Parameter         |           Value           |            Unit           |
+---------------------------+---------------------------+---------------------------+
|      Operating Speed      |            90.0           |            RPM            |
|      Equilibrium Mode     |         calculate         |             -             |
|      Maximum Pressure     |         6.9570e+06        |             Pa            |
|    Maximum Temperature    |            70.4           |             °C            |
|   Maximum Film Thickness  |         2.0652e-04        |             m             |
|   Minimum Film Thickness  |         8.1598e-05        |             m             |
|    Pivot Film Thickness   |         1.3150e-04        |             m             |
|         Axial Load        |         1.3320e+07        |             N             |
|      kzz (Stiffness)      |         3.1763e+11        |            N/m            |
|       czz (Damping)       |         1.0806e+10        |           N*s/m           |
+---------------------------+---------------------------+---------------------------+

3. Plot Pressure and Temperature Fields

# By default, plots are not automatically displayed
figures = bearing.plot_results()

# Plot only the 2D pressure contour
figures["pressure_2D"].show()

Figure:

Pressure Plot

4. Check Optimization Convergence

The equilibrium position is determined through an optimization process. To check convergence:

# Show optimization convergence with graphical visualization
bearing.show_optimization_convergence(show_plots=True)

Output:

=========================================================
           OPTIMIZATION CONVERGENCE - 90.0 RPM           
=========================================================
+---------------------------+---------------------------+
|         Iteration         |        Residual [N]       |
+---------------------------+---------------------------+
|             1             |       378947.112688       |
|             2             |        27724.023669       |
|             3             |        4753.901941        |
|             4             |        2267.382187        |
|             5             |         381.146245        |
|             6             |         25.796494         |
|             7             |          6.502821         |
|             8             |          0.143314         |
|             9             |          0.162634         |
|             10            |          0.113231         |
|             11            |          0.084976         |
+---------------------------+---------------------------+

Plot:

Convergence Plot

5. Compare Coefficients at Multiple Frequencies

from ross.units import Q_
from ross.bearings.thrust_pad import ThrustPad

bearing = ThrustPad(
    n=1,
    pad_inner_radius=Q_(1150, "mm"),
    pad_outer_radius=Q_(1725, "mm"),
    pad_pivot_radius=Q_(1442.5, "mm"),
    pad_arc_length=Q_(26, "deg"),
    angular_pivot_position=Q_(15, "deg"),
    oil_supply_temperature=Q_(40, "degC"),
    lubricant="ISOVG68",
    n_pad=12,
    n_theta=10,
    n_radial=10,
    frequency=Q_([90, 120, 150], "RPM"),
    equilibrium_position_mode="calculate",
    model_type="thermo_hydro_dynamic",
    axial_load=13.320e6,
    radial_inclination_angle=Q_(-2.75e-04, "rad"),
    circumferential_inclination_angle=Q_(-1.70e-05, "rad"),
    initial_film_thickness=Q_(0.2, "mm"),
)

bearing.show_coefficients_comparison()

Output:

=====================================================================================
                        DYNAMIC COEFFICIENTS COMPARISON TABLE                        
=====================================================================================
+---------------------------+---------------------------+---------------------------+
|      Frequency [RPM]      |         kzz [N/m]         |        czz [N*s/m]        |
+---------------------------+---------------------------+---------------------------+
|            90.0           |         3.1763e+11        |         1.0806e+10        |
|           120.0           |         2.7508e+11        |         7.0187e+09        |
|           150.0           |         2.4604e+11        |         5.0222e+09        |
+---------------------------+---------------------------+---------------------------+

6. Check Execution Time

bearing.show_execution_time()

Output:

Execution time: 15.26 seconds

Implementation Details

  • Class-specific implementations for each bearing class, accounting for differences in how results are calculated and stored across different bearing models
  • PrettyTable library for formatted console output
  • Visualization methods return figure objects, allowing users to further customize or save plots
  • Optimization history stored indexed by frequency for efficient retrieval

Methods Summary

Method Description Returns
show_results() Displays table with all simulation results None (print)
plot_results() Generates pressure and temperature visualizations Dict of Plotly figures
show_coefficients_comparison() Compares coefficients across frequencies None (print)
show_execution_time() Shows execution time None (print)
show_optimization_convergence() Displays optimization convergence None (print/plot)

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 27.64045% with 322 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.72%. Comparing base (bc15f55) to head (90a5cc6).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
ross/bearings/plain_journal.py 19.76% 134 Missing ⚠️
ross/bearings/tilting_pad.py 28.10% 110 Missing ⚠️
ross/bearings/thrust_pad.py 37.60% 78 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1234      +/-   ##
==========================================
- Coverage   83.25%   81.72%   -1.53%     
==========================================
  Files          42       42              
  Lines       12120    12452     +332     
==========================================
+ Hits        10090    10177      +87     
- Misses       2030     2275     +245     
Files with missing lines Coverage Δ
ross/units.py 90.41% <ø> (ø)
ross/bearings/thrust_pad.py 85.66% <37.60%> (-5.29%) ⬇️
ross/bearings/tilting_pad.py 75.32% <28.10%> (-1.19%) ⬇️
ross/bearings/plain_journal.py 58.43% <19.76%> (-6.77%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 418e44d...90a5cc6. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gsabinoo gsabinoo marked this pull request as ready for review November 11, 2025 14:19
@raphaeltimbo raphaeltimbo merged commit 3ff97f1 into petrobras:main Nov 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants