Exporting Multics film simulation results for structural simulations in other software
The VTK results generated during a Multics simulation (referred to as primary simulation), for example film pressure distribution, etc., may be used for simulations (referred to as secondary simulation) in other software (e.g., ANSYS Static Structural), directly, without having to manually configure loads/displacements and/or take assumptions. In fact, spatially distributed property values, from either a single time step, or time-averaged over a period (at each point) can be used in the secondary simulations. Each software has its own requirements for the format of the input data, and this example is specifically tailored for importing film pressure results from a Multics(primary) simulation results into ANSYS Static Structural(secondary) simulation. This can also be replaced with other VTK fields that are outputted by Multics. Please refer to VTK Outputs for more information on the available VTK fields. Based on a specific Multics film VTK field being exported, the import process in the secondary simulation might be different, and must be checked with the documentation of the secondary simulation software.
ANSYS Static Structural (secondary simulation) typically requires the pressure data to be in a .csv format, with the first 3 columns being the X, Y and Z coordinates of the points where pressure data has been calculated, and the 4th column being the actual pressure data.
The details of how to import this CSV file to ANSYS for specific simulations are well explained by ANSYS here
The method to convert Multics results to the required input format is explained below. This tutorial uses Python for the conversion, and assumes that the Multics film results in VTK format are already available with the user.
Procedure
Install and import Python dependencies.
pandas
pyvista
import pyvista as pv import pandas as pd import glob, os
Collect and read VTK files to be used.
files = sorted(glob.glob("./MulticsResults/Gap1.*.vtk")) mesh0 = pv.read(files[0])
Here,
Gap1.*.vtkis the name of the VTK files generated by Multics.Gap1is the name of the film in Multics. The * typically represents the time-step number of the vtk file. In this example, the vtk file collection is stored in theMulticsResultsfolder, but you can change the path as per your requirement.Warning
In a Multics simulation for a pump, a particular body face may have multiple films attached to it (for e.g., the lateral face of an EGM has separate lateral films for both drive and driven gears). In this case, it is important that the user collects and reads all the VTK files, corresponding to ALL FILMS on an interface, and eventually store them in the same dataframe/table, as described further. It is also important that all the films that are being imported share the same coordinate system. This coordinate system MUST also match the body coordinate system for the simulations being carried out in ANSYS. If the user is able to assign individual patches/regions in ANSYS for each individual films, combining them in a single dataframe may not be necessary. However, the coordinate systems MUST match perfectly.
Copy the
vtkpoint coordinates in a separate array and store in a dataframe for exporting to CSV.pts = mesh0.points.copy() # shape (N,3) df = pd.DataFrame({"X": pts1[:,0], "Y": pts1[:,1], "Z": pts1[:,2]})
Make sure to append the dataframe with data from all the films on the body face/selection.
Loop through all the VTK files, extract the pressure distribution at each time step and average it. Append the time-averaged pressure distribution to the dataframe.
P_tot = 0 for i,f in enumerate(files): m = pv.read(f) # sanity: confirm same #points; if not, resample onto pts if m.n_points != mesh0.n_points: m = m.sample_points(mesh0, tol=1e-9) # resample P_tot = m.point_data["pFilm[bar]"] + P_tot P_avg_t = P_tot / len(files) # average over time df["P"] = P_avg_t # bar
In this example, the field
pFilm[bar]corresponds to the Multics VTK field that is of interest during the secondary simulation.Make sure to transform Pressure units and coordinates as needed, before exporting.
Finally, export the dataframe to a CSV file.
df.to_csv("MulticsFilmPressure.csv", index=False)
This will create a CSV file named MulticsFilmPressure.csv in the current working directory, which can be directly imported into ANSYS Static Structural for further analysis.