Git Product home page Git Product logo

gmsh-exodus-converter's Introduction

gmsh-exodus-converter

Converts a mesh written with gmsh to the exodus II format, which is used in common simulations tools, like Peridigm

Citing the code

Are you using this code for research purposes? Please take the time to cite it using this DOI:

DOI

Usage:

python convert.py -i input.msh -o output.g

Note that meshio supprts the same functionality with

meshio-convert input.msh output.e

Requirements

  • VTK Toolkit >= 5.8 (with python bindings)

If you are using Ubuntu, you must use the python-vtk package (sudo apt-get install python-vtk). There is a bug with the python-vtk6 package which provokes a segmentation fault. (More information about it here: https://gitlab.kitware.com/vtk/vtk/issues/16009)

Supported gmsh element types

The input.msh file must be generated with Gmsh. Currently, only the following elements are supported:

2D

  • 2 = 3-node triangle
  • 3 = 4-node quadrangle

3D

  • 4 = 4-node tetrahedron

gmsh format

Description of the gmsh format and how it works. An example can be found here. The [brackets] contain comments expanations about each line. More complex files can be found, refer to the gmsh documentation in that case.

Mesh format
$MeshFormat
2.2 0 8
$EndMeshFormat
Nodes

$Nodes [The start-tag $Nodes anounces that the nodes are going to be listed]

148 [Number of nodes]

1 2.5 9.5 49.6423745119 [Node number] [Element node point 1] [Elmnt node pt2] [Elmnt node #pt3]

2 2.5 6.5 28.5
3 -2.5 9.5 49.6423745119
4 -2.5 6.5 28.5
...

$EndNodes [The end-tag $EndNodes anounces that the node list is over]

Elements

For detailed information, check this section of gmsh documentation

$Elements [The start-tag $Elements anounces that the elements are going to be listed]

729 [Number of elements]

1 15 2 0 1 1 [Element number] [Elmnt type] [Elmnt physical entity tag] [Elmnt Geometry point] [Vertex tag]

2 15 2 0 2 2
3 15 2 0 3 3
4 15 2 0 4 4
5 15 2 0 5 5
...

$EndElements [The end-tag $EndElements anounces that the Elements list is over]

Element types
  • 1 = 2-node line
  • 2 = 3-node line
  • 3 = 4-node quadrangle
  • 4 = 4-node tetrahedron
  • 15 = 1-node point

Example

2D

Mesh generated with gmesh Exodus geometry visualized with paraview
Mesh Exodus

3D

Mesh generated with gmesh Exodus geometry visualized with paraview
Mesh Exodus
Mesh Exodus

gmsh-exodus-converter's People

Contributors

diehlpk avatar ilyasst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gmsh-exodus-converter's Issues

ImportError: /usr/lib/libgdal.so.1: undefined symbol: nc_def_var_deflate

I have installed libvtk6.2 and python-vtk6. When I run
python /home/yudan/Downloads/gmsh-exodus-converter-master/convert.py -i /home/yudan/Desktop/test.msh -o test.g -t 4
I have:

Traceback (most recent call last):
File "/home/yudan/Downloads/gmsh-exodus-converter-master/convert.py", line 10, in
from vtk import vtkExodusIIWriter
File "/usr/lib/python2.7/dist-packages/vtk/init.py", line 113, in
from vtkIOGDAL import *
File "/usr/lib/python2.7/dist-packages/vtk/vtkIOGDAL.py", line 1, in
from vtkIOGDALPython import *
ImportError: /usr/lib/libgdal.so.1: undefined symbol: nc_def_var_deflate

Segmentation faults when trying to convert

Hi, I'm interested in your convert script. However, when I run:

python convert.py -i plate_test_element2.msh -o output.g -t 2

I get a segmentation fault. Here is the stack trace:


#0  0x00007fffe5fa4a1b in vtkMultiProcessController::GetNumberOfProcesses() ()
   from /usr/lib/x86_64-linux-gnu/libvtkParallelCore-6.0.so.6.0
#1  0x00007fffc0cf33df in vtkPExodusIIWriter::CheckParameters() ()
   from /usr/lib/x86_64-linux-gnu/libvtkIOParallelExodus-6.0.so.6.0
#2  0x00007fffd9b571ee in vtkExodusIIWriter::WriteData() ()
   from /usr/lib/x86_64-linux-gnu/libvtkIOExodus-6.0.so.6.0
#3  0x00007fffd9b4aafa in vtkExodusIIWriter::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) () from /usr/lib/x86_64-linux-gnu/libvtkIOExodus-6.0.so.6.0
#4  0x00007ffff2ba7b80 in vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) () from /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.0.so.6.0
#5  0x00007ffff2b9df37 in vtkDemandDrivenPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) () from /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.0.so.6.0
#6  0x00007ffff2b99fa6 in vtkCompositeDataPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) () from /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.0.so.6.0
#7  0x00007ffff2ba0d51 in vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) () from /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.0.so.6.0
#8  0x00007ffff2bbf4b1 in vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) ()
   from /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.0.so.6.0
#9  0x00007ffff2b9f74d in vtkDemandDrivenPipeline::UpdateData(int) ()
   from /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.0.so.6.0
#10 0x00007ffff2bbc955 in vtkStreamingDemandDrivenPipeline::Update(int) ()
   from /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.0.so.6.0
#11 0x00007fffeec43f4e in vtkWriter::Write() ()
   from /usr/lib/x86_64-linux-gnu/libvtkIOCore-6.0.so.6.0
#12 0x00007fffeee7be35 in ?? () from /usr/lib/python2.7/dist-packages/vtk/vtkIOCorePython.so
#13 0x000000000049968d in PyEval_EvalFrameEx ()
#14 0x0000000000499ef2 in PyEval_EvalFrameEx ()
#15 0x0000000000499ef2 in PyEval_EvalFrameEx ()
#16 0x00000000004a1634 in ?? ()
#17 0x000000000044e4a5 in PyRun_FileExFlags ()
#18 0x000000000044ec9f in PyRun_SimpleFileExFlags ()
#19 0x000000000044f904 in Py_Main ()
#20 0x00007ffff7818ec5 in __libc_start_main (main=0x44f9c2 , argc=8, argv=0x7fffffffd188, 
    init=, fini=, rtld_fini=, stack_end=0x7fffffffd178)
    at libc-start.c:287
#21 0x0000000000578c4e in _start ()

Does that help identify what my problem might be?

meshio

The code in this repo is probably obsoleted by meshio:

meshio-convert input.msh output.e

(Btw, I'd used vtk in meshio once, but found it too large (and unreliable) as a dependency. meshio handles VTK files (and Exodus) manually now.)

Unknown element type TRIANGLE

I converted the file 2D fie plate_test_element2.msh as a .g file using the script.
Then, I tried using Peridigm to load this file with a dummy.peridigm input deck.
I get the following error:

adminu@a4217-03:/mnt/hgfs/Peridigm_shared/Gmsh_to_Exodus2$ Peridigm specimen.peridigm

-- Peridigm
-- version 1.4.1

/root/install/Peridigm/src/io/discretization/Peridigm_ExodusDiscretization.cpp:409:

Throw number = 1

Throw test that evaluated to true: true


**** Error in loadData(), unknown element type TRIANGLE.

Wallclock Time (seconds):
  Total            0.021

@diehlpk , any ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.