Deformed mesh for new simulation?

Is it possible to use the deformed mesh from one simulation as the input to another simulation?

ParaView has a number of options to export the deformed shape, but for my application, I think I need to export the actual mesh (not just the shape) so that re-meshing is not required. My final goal is to use the Python Calculator in ParaView to compute the sum of both stress fields. I presume I need to use the same mesh (just with shifted node positions) for the Python Calculator to work.

I need to run the second simulation because there us a change in boundary conditions.

Hi Ben!

Indeed you can use the two-step method as you described. It is not fully automatic on the platform but is definitely doable. This is the way it works:

  • start with the first simulation to calculated the deformation of the original mesh
  • use a third party software (ParaView/Python code) to deform the mesh. Usually this comes down to moving the mesh point position while keeping the “structure” intact
  • save the new mesh in one of SimScale’s supported formats: UNV, OpenFOAM, EGC, MED
  • upload the modified mesh to your project and use it as a base for the simulation

Hope this helps!
Pawel

1 Like

Hi Pawel (@psosnowski),

I can follow the basic steps you have outlined but I’m stuck on the detail.

ParaView gives me the following options to export the deformed mesh:

  • CSV File (*csv)
  • Exodus II File (*.g, *.e, *.ex2, *.ex2v2, *.exo, *.gen, *.exoII, *.exoii)
  • VTK MultiBlock Data Files (*.vtm)
  • Xdmf Data File (*.xmf)
  • Xdmf3 Data File (*.xmf)

None of these formats are directly supported by SimScale.

Is there a conversion tool I need to use? I thought maybe Gmsh or the VTK2MED function in Salome may to the trick. But I have no experience with either of these. Or is there an alternative technique that does not require an intermediate conversion?

As a side note, I have found an alternative approach to solving this problem. Setting values for the stress initial conditions did the trick. Having said that, I’m still interested in understanding how to do this “staged” or “cascaded” approach as the initial conditions will only work in a limited set of cases.

Hi @BenLewis ,
in which situation would you want to use this approch?
If you have a nonlinear analysis you would also need to have the stresses and strains from the first analysis as initial conditions for your second one, which can be tricky.

I never did this approach, but here are a few things that might help:

  1. Exporting the deformed mesh with ParaView is rather straight forward:
  • Import the result in ParaView and add a WarpByVector filter with scale 1.
  • Export the deformed shape by right click in the WarpBy Vector item and selecting Save Data. This will export a VTM multiblock dataset of the deformed mesh.
  1. The hard part actually is to convert the VTK(VTM) to a UNV or MED file.
    The Salome method you referenced is outdated. In current releases there exists a different method that you can import from VTKReader, as discussed in the salome forum.
    In the salome python console some code like this should work:

from VTKReader import * vtu = VTURawReader('/path_to_deformed_vtk/exported.vtu') med = vtu.loadInMEDFileDS()

But actually I tried it and didn’t get it to work. Maybe you need special export options for this method to work.

  • GMESH should be able to also import (legacy) VTK files and export MED, but again, I was not able to do this. The VTK import fails again.

Maybe someone else did this before and could help.

Best,
Richard

Hi Richard (@rszoeke),

I agree, this technique would not be valid for a non-linear simulation. My intention was to use this approach for two linear simulations where one contact changes from sliding to bonded.

In ParaView, Save Geometry only gives me one option - a ParaView Data File (*pvd). I do not see the option to export to a VTM file. I’m using v4.4. Maybe this is a new option for v5.0?

I guess for now I will let this go. Thanks for looking into this for me.

Sorry @BenLewis,
I meant Save Data. I updated my last post.