Reading OpenFOAM mesh (made with blockMeshDict) with cgx to make .msh and .nam files

I am a new user of Calculix and I am trying to create .msh and .nam files for my Calculix setup. I made my mesh with BlockMeshDict and now I am trying to load it into cgx using : cgx -foam command. I keep getting the same ERROR which is the following:

ERROR; Set:beam in boundaryField not known

Can someone help me with the information on why I keep getting this error and where can I fine any instructions on how to create .msh and .nam files if I do not make my mesh in Salome or similar? I cannot find anything connected to how to readmesh made in OpenfOAM - with blockMeshDict, snappyHexMesh, etc. - with cgx in order to create necessary NODE and surface files readable by Calculix.

Thank you in advance,

Hi Martina! I can help you with this problem. The first thing I want to clarify is that the .msh and .nam files are not the standard files used in Calculix. Instead, Calculix uses files with .inp and .dat extensions. The .inp files contain input data, such as the definition of materials, boundary conditions, etc. .dat files contain the data used to solve equations. To import a grid created with BlockMeshDict into Calculix, you will need to export it in a format that can be read by Calculix. There are several ways to do this, but one of the most common is to use the .unv file format, which is supported by both BlockMeshDict and Calculix. To export a grid into .unv format, you need to do the following steps:
Open a terminal and navigate to the directory where your BlockMeshDict grid is located.
Run the foamToVTK utility using the following command:
foamToVTK -latestTime
Run the vtkUnstructuredGridToTetrahedron utility using the following command:
vtkUnstructuredGridToTetrahedron blockMesh.vtk blockMesh_unv.vtk
Open the blockMesh_unv.vtk file in Paraview and export it in .unv format.
After you export the grid into .unv format, you can import it into Calculix using the command:
ccx filename.inp
where filename.inp is your .inp file containing the definition of materials, boundary conditions, etc.
I hope this helps you solve the problem! If you have additional questions, feel free to ask me.

1 Like

Thank you very much for this thorough and detailed explanation! Some things are now much more clearer and seem less complicated.
You helped a lot!
Thank you,

So, I tried the procedure that you showed me and everything works until one point- the vtkUnstructuredGridToTetrahedron. I get the message:

vtkUnstructuredGridToTetrahedron: command not found

I am using OpenFOAM 2212 version.

@ScottRaymond I can also not find any mention of vtkUnstructuredGridToTetrahedron on the internet. Is this maybe some internal tool?

Do you maybe mean this OpenFOAM tool? (OpenFOAM v2212)

$ vtkUnstructuredToFoam -help

Usage: vtkUnstructuredToFoam [OPTIONS] <vtk-file>
  <vtk-file>        The input legacy ascii vtk file
  -case <dir>       Case directory (instead of current directory)
  -doc              Display documentation in browser
  -help             Display short help and exit
  -help-full        Display full help and exit

Convert legacy VTK file (ascii) containing an unstructured grid to an OpenFOAM
mesh without boundary information

I think you are right.

1 Like