# How to calculate the major and minor axes of a bubble based on 3D tilted bubble interface vtk data

Dear all, How to calculate the major and minor axes of a bubble based on 3D inclined bubble interface vtk data?

I sample some vtk bubble interface data from OpenFOAM, at the same time, I also saved the 6 extreme points of the bubble interface in the XYZ direction(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax), the coordinate data of these points are used to calculate the major axis and minor axis of the bubble. In addition, mass center (Xc, Yc, Zc) is also recorded

The (Xmin, Ymin, Zmin, Xmax, Ymax, Zmax) of this bubble is known,
ΔX=Xmax-Xmin & ΔY=Ymax-Ymin & ΔZ=Zmax-Zmin;

So, the major axis equals to ΔY or ΔX, the minor axis equals to ΔZ;

This approach works well when the bubbles are not incline, but,As the size of the bubble increases, it will incline and the method of directly evaluating the major and minor axes of the bubble using the coordinates of the 6 extreme points fails.

For inclined bubbles, now I have vtk files for each moment of the bubble, but the calculated major axis and minor axis are all wrong (because the calculation scheme of the major axis and minor axis of the non-inclined bubble is adopted). In addition, I also have the centroid coordinates at each moment. Most papers indicate that the short axis can be aligned with the velocity direction. I wonder if I can extract the minor axis from this scheme?

But how can this be done from various vtk files in paraview?

For example, how to establish the vector formed by the centroid coordinates of adjacent time steps in paraview and find the coordinates of the two intersections with the vtk interface. In addition, consider that this work needs to be performed in batches, because the long and short axes of multiple vtk files need to be calculated (I guess at present whether we need to cooperate with python script to achieve the purpose)

At one moment, I wanted to measure manually, but suddenly I thought, I am a follower of Paraview, how can I do such a thing.

guys, give me a hands! If it is really impossible to calculate ratio with vtk, we will finally go back to OpenFOAM to improve the solver to output the correct major and minor axes of the inclined bubble. If you have experience, or if you have suggestions on algorithm, can you tell us more? thx

Best regards!
Na

One idea is to calculate the `Gaussian_Curvature` or `Mean_Curvature` for the surface of each bubble (Polygonal Mesh) with the Curvature Filter and extract its maximum and minimum points using the `Find Data` tool.
This approach may be useful if the bubble is always a smooth convex shape.

Hello, Kenichiro-Yoshimi,
Calculate the `Gaussian_Curvature` or `Mean_Curvature` for the surface, then check the major and minor axes. You are right, it’s a good way to find it.

When the bubble is not inclined, the extreme point of curvature is really on the minor axis, which confirms the idea.

**But,**the extreme points extracted by Mean_ Curvature Filter are not distributed on the major or minor axes directly

When the bubble is inclined, how do the coordinates of these two extreme points reflect the Major and minor axes? Can you tell me more about your experience in handling this situation.

Best regards!
Na

The method using curvature does not seem to work well. My apologies.

If the tilted bubbles are elliptical-like in shape, then finding the major and minor axes as eigenvectors of the moment of inertia tensor is a commonly used method. However, since bubbles vary in shape, this method may not work either.

Please refer to the State file below for specific instructions on how to do this.

ellipsoid_axes.pvsm (436.5 KB)