Code Monkey home page Code Monkey logo

gmsh2ccx's Introduction

© Ihor Mirzov, May 2019
Distributed under GNU General Public License v3.0



Gmsh to CalculiX converter (.inp to .inp)

The problem is that for 2D cases during exporting mesh in the .inp-format Gmsh does not generate *SURFACE keyword and does not list element edges belonging to the 'Physical Curve'. It makes impossible later to apply boundary conditions on 2D element's edges in CalculiX.

Moreover, for each geometrical line Gmsh creates and exports beam (T3D2) elements which in 2D case is absolutely unacceptable, because leads to unwanted entities in the Calculix model.



gmsh3.geo, gmsh4.geo

Gmsh example files. You'll need 'gmsh' command to be available in your OS. Generate 2D square and mesh it with CPS3 or CPS4 elements with command:

gmsh gmsh3.geo -2 -o gmsh3.inp -v 0 -save_all

for triangular mesh or:

gmsh gmsh4.geo -2 -o gmsh4.inp -v 0 -save_all

for quadrilateral mesh.



gmsh2ccx.py

Convert Gmsh .inp-file to CalculiX .inp-file. Works with 2D first order triangles and quadrangles. Tested in Gmsh 4.2.2 and Calculix 2.15.

The script from Gmsh element sets corresponding to the 'Physical Curve' generates *SURFACE and *NSET (optionally) blocks. For the *SURFACE corectly accounts for element's edge numbers.

Run with command:

python3 gmsh2ccx.py -g gmsh3.inp -c ccx3.inp -e S3 -ns 1

or

python3 gmsh2ccx.py -g gmsh4.inp -c ccx4.inp -e S4 -ns 1

where:

  • gmsh3.inp/gmsh4.inp are input file names to process (obtained from Gmsh)

  • ccx3.inp/ccx3.inp are output file names (for CalculiX)

  • S3/S4 are CalculiX element types: S3 for 2D triangular mesh, S4 for 2D quadrilateral mesh

  • ns is a flag showing whether to output node sets (1) or not (0)

The script needs INPParser.py library.



INPParser.py

Parses finite element mesh in the Abaqus, Gmsh or CalculiX .inp-file.

Tested on C3D8, 2D quadrilateral and triangular first order elements.

Reads nodes coordinates, elements composition, node and element sets, surfaces.

Calculates elements cendroid coordinates.

Generates triangles or quadrangles list to use with matplotlib.

'project_field_on_centroids' method interpolates node field to elements centroids.



Your help

Please, you may:

  • Star this project.
  • Simply use this software and ask questions.
  • Share your models and screenshots.
  • Report problems by posting issues.
  • Do something from the TODO-list.



TODO

  • dimensionality parameter in INPParser.py
  • automatically distinguish mesh dimensions (2D/3D)
  • automatically distinguish elements type (S3/S4/S6/S8)
  • check elements normals
  • second order elements S6, S8
  • make pypi package

gmsh2ccx's People

Contributors

imirzov avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

gmsh2ccx's Issues

Zero elements in CGX

Hello everyone,

I’ve just started to learn CalculiX with Gmsh, but it doesnt really work. I opened a simple beam (step-file) with Gmsh and converted it to geo-file by Creating a physical group (Volume). Then I created a 2D-mesh. After that I exported it to an inp-file for reading it with CalculiX Launcher. Finally I converted it to inp-File for Python-script with the launcher. But if I run the CGX-Preprocessor an empty cgx appears with zero elements (like in the picture). Did I do anything wrong?
8116a001ed3fbbf075b0dae9a54230632cbbc2c4

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.