How to synchronize solid-fluid time steps

Dear Precice Developers:

I use paraview to import the result files of Calculix solid and Openfoam fluid (Calculix result file. frd has been converted to VTK file, the directory is FLAP-0001.VTK.FLAP-0002.VTK…). When the two result files can not be displayed at the same time,

I found the problem in ParaView VTK file real time (0.001 0.002…) Convert to a time index (1.2.3…) , how can I achieve two result files at the same time.
I have tried the VTK file and the VTU file and I can confirm that the problem is with the ParaView timing. Please give me a little help, thank you

Hi,

I don’t know how to fix this properly, but a workaround is to use a “Temporal Shift Scale” filter in Paraview, which scales the time of the data. So if you step is 0.001, a scale of 0.001 should do the trick.
(However it wouldn’t work with variable time step)

Hope it helps!

If it were me, I would open ONLY the Calculix results in ParaView and then immediately write them out in the .pvd format using File → Save Data. Paraview’s .pvd format is really just one of a variety of vtk formats (.vtp, .vtu, .vtm, .vtk, etc.) with an .xml wrapper associated. ParaView will create the .xml file for you and store the data in an associated directory. Now, you can open the .xml file with a text editor and manually modify the time values for each vtk file such that they align with your OpenFOAM results. Then, when you want to visualize them together simply load the .pvd file instead of the original .vtk files.

See here for a little guidance on the pvd file format.

Also, this approach is definitely overkill if all of your Calculix data is evenly-spaced in time. If that’s the case, the “Temporal Shift Scale” filter is definitely the way to go.

1 Like

Thank you, Martin

I tried two methods:

  1. Temporal shift scale filter in Paraview

  2. Write the PVD file of ParaView

In the first method, I use ccx2ParaView(https://github.com/calculix/ccx2paraview) and frdToVTKConverter(https://github.com/precice/calculix-adapter/tree/master/tools/frdConverter) to convert frd to VTK. After reading VTK file and scaling time, a strange problem occurs: ccx500 time steps, Openfoam500 time steps, the time range is 0-5 seconds, the step length is 0.01s, the two combined into 562 time steps

from this figure, it can be seen that there are two 4.77s, I can roughly confirm that the time problem is CCX. For example, the difference between double and float, 0.0199 and 0.02, I think direct use of temporal shift scale filter may cause such problems.

In the second way, I tried to use PVD files to specify time steps for VTU files. This method was fine in my tests
Example PVD file







Thank you Mike:
I tried the method you gave, using PVD file to open all VTK files, this method is correct,
I also want to ask you a question, how does ParaView make VTK grid (solid part) move over time? Because by default, when you open the VTK file and click “Play”, the grid does not move. One way I know now is to insert a “calculator”, choose variable ”displacement“, choose “warp by Vertor” .do you have a better way?

ParaView doesn’t move the grid points of the Calculix solution automatically because Calculix actually doesn’t move the grid points when it solves. Instead, Calculix solves by storing the initial grid locations and a displacement vector at each node. Depending on how you created the .vtk files from the .frd Calculix solution file your displacement vector may be stored as either a vector array or individual vector component scalar values. As you mentioned, using the “warp by vector” filter is the best way to visualize this displacement in ParaView. Of course, if the values you have stored are not yet a vector, then you have to create a vector from the components first. As you said, this is most easily done with the “calculator” filter using something like this:

U_x*iHat + U_y*jHat + U_z*kHat

where U_x is the scalar value for the node displacement in the x-direction, U_y in the y-direction, and U_z in the z-direction.

1 Like

Ok, thank you, Mike. Your advice can help me learn preCICE, a very good software, faster.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.