Repository navigation
mesh2cdb: writing MAPDL .cdb files from gmsh #4695
chenshuo-aiden-wang
started this conversation in
General
Replies: 1 comment 1 reply
|
Thank you a lot @chenshuo-aiden-wang! It looks nice! Would you be open to create a PR? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I was doing research before I started using MAPDL and gmsh together and kept hitting the same thing. You have a STEP file, gmsh meshes it fine, and then there is no way to get the mesh into MAPDL. MAPDL doesn't read STEP. gmsh doesn't write .cdb. meshio reads about forty formats and writes thirty, and .cdb is not one of them either. So the mesh just sits there.
I wrote something small that does that one piece.
pip install mesh2cdb
mesh2cdb part.msh -o part.cdb
Then cdread it like any other archive. It also takes .inp, .bdf, .vtu, .vtk, anything meshio reads, since meshio does the reading and I only write the .cdb.
It covers the eight solid types: tet4, tet10, hex8, hex20, wedge6, wedge15, and pyramids as degenerate SOLID185/186. Named regions come across too. If you name a face fixed in gmsh you get a CMBLOCK, so you can CMSEL,S,FIXED instead of rebuilding the selection with NSEL,LOC every time the mesh changes.
It does not mesh anything, and it does not write materials, BCs or loads. Nodes, elements, element types, components.
I did check it, because MAPDL will load a broken .cdb without saying anything and then just be wrong. Every element type gets a uniaxial patch test against F = EAδ/L. The node ordering tables were derived by building elements and asking MAPDL for the volume rather than reading them out of docs, because gmsh and MAPDL order midside nodes differently and nothing tells you when you got it wrong.
This is a simple version. The technicality is based on what I needed, so it's probably missing whatever you need. Fork it, change it, or open a PR, happy to take them.
https://github.com/Alto-Auto/mesh2cdb
All reactions