2
$\begingroup$

How do I get an .inp file from Gmsh? I need to create a simple geometry and mesh it and define the boundary conditions in Gmsh and export it as an .inp file at the end (because I need to use it in a third party solver). I couldn't find much help from the documentation of Gmsh it seems there exists a mesh file format in Gmsh that exits in two flavors: ASCII and binary.

Any suggestion would be appreciated.

$\endgroup$
4
  • 1
    $\begingroup$ .inp is a pretty generic extension. Is there any formal format specification or where is it going to be used? $\endgroup$
    – Anton Menshov
    Mar 17, 2020 at 19:09
  • $\begingroup$ @AntonMenshov, I have a solver that gets .inp files created in Abaqus, but I don't have access to Abaqus, so I found out that it is possible to create inp files using gmsh, but I had a look at the documentation of gmsh and I couldn't figure out how to create an .inp file with gmsh. that's the story. $\endgroup$
    – Dude
    Mar 18, 2020 at 13:34
  • $\begingroup$ The place you're most likely to find answers are the gmsh-specific mailing lists. $\endgroup$ Mar 19, 2020 at 15:02
  • $\begingroup$ @Dude I wanted to write an answer mentioning the meshio library, but realized that someone has already posted an answer: scicomp.stackexchange.com/a/34456/18289 I can highly recommend that actively maintained Python library. $\endgroup$ May 23, 2021 at 16:33

2 Answers 2

3
$\begingroup$

There are powerful tools for mesh conversion, for example MeshIO. With this open-source tool installed you would only have to type for conversion of msh-to-inp (vice versa for inp-to-msh)

meshio convert --input-format gmsh --output-format abaqus inputfile.msh outputfile.inp

I tested it on Ubuntu linux (22.04) and Python (3.10.6), it works with both ascii and binary files.

$\endgroup$
1
$\begingroup$

As you want to get any suggestion, here are mine:

If you need to get started with gmsh from scratch, take a look at their tutorial section here, their wiki or on youtube.

You can mesh your created geometry and export it as an .inp file. In the gui use: File -> Export -> then select .inp as file format. If you want to use gmsh from the command line look here. For defining boudary conditions take a look here. I'm not 100% sure but I don't think you can define boundary conditions as such in gmsh. You'll have to create a Physical Group for that, see her in their documentation.

$\endgroup$
3
  • $\begingroup$ You could add the explanations instead of just adding links to other websites $\endgroup$
    – nicoguaro
    Apr 28, 2020 at 13:44
  • $\begingroup$ @riyansh.legend how can we import .inp file into Gmsh? thanks a lot in advance! $\endgroup$ Dec 22, 2020 at 6:28
  • $\begingroup$ @YSVSDVXCVXCV According to this comment of the owner, there's only a .inp writer and no reader function. $\endgroup$ Feb 21, 2021 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.