Skip to content

How to mesh complex geometries on NetGen and properly analyse on CalculiX

How to mesh complex geometries on NETGEN and properly analyse on CalculiX
NetGen it’s a powerful 3D tetrahedral mesh generatorl that can handle complex geometries and a great variety of meshing options, the tetrahedral meshs as those created with Netgen are the best option on the selection of a discretization theorem for a non conventional bodycas long as it can handle a decent meshing density , wich it’s possible with the use of current medium-high level processing units. The tetrahedral elements can adjust more easily to the curves and spline surfaces of the model, preserving its proportion form.

On NetGen a 3D model can be meshed under a great variety of meshing controls in order to adjust de meshing density to the desired especifications.

Netgen is open source based on the LGPL license. It is available for Unix/Linux and Windows.

You can find it here:

Calculix its one of the first options on the solution of  big and complex field numerical problems , but it is exeeded on the huge task of meshing complex 3D multi bodies geometries which however does not take away any credit to the program.

Here it is a simple step by step tutorial wich can be a guide in the process of meshing with NetGen and analysing in CalculiX

Before start please consider the next author notes.

Note 1: In this case, a 3D model on ( .igs) format will be use, any other format can be use for with this process only with a few changes on the geometry repairing step.
Note 2: In this case a very complex 3D model was used to test the NetGen capabilities to maximun, the reader can (and it is advise to) choose to use a simple model first in order to understand the steps of the tutorial and then try bigger tasks.

1. Getting the geometry:

An invented 3D very complex model with no conecction to any real live object was prepared for this tutorial, if the reader choose to use this model it can be find here  netgen mesh calculix , but any other .igs file will work to. The geometry its a 3d high pressure tank saved on a IGES, the Initial Graphics Exchange Specification (IGES) format is an ANSI neutral data format for digital exchange of information among Computer-aided design (CAD) systems. Read more about the format at:

On your own 3D model make sure you have a single body geometry (at least for this tutorial) without any zero volumen regions like intersections. Also, make sure your file its exported on .igs format, the extension on lowercase.

2. Importing the geometry to NetGen GUI:
Open NetGen GUI and then on File menu click on import and search for your .igs file then selected.

After a while the model will appear on the working area, it is recommendable that the reader learn to differ between the colors that NetGen assign to the faces of the models, the brighter green face represent the external side of the face ( the one facing the space with no volume) and the dark ones represent the internal side ( the ones facing the volumen of the model); by this way the reader can determine when a body have any error over it’s faces alignment.

3. Repairing the geometry:
In some cases the 3D model is imported with some face alignment errors due to many reasons depending on which CAD program the reader uses, anyway, the procedure to fix this error is quite easy.

Simply click on Geometry and then IGES/STEP Topology Explorer/Doctor and select Analize Geometry and when finish Heal Geometry, this will adjust the faces of the model to fit in to the body without make any dimensional change.

The color of the faces will change to its correct order.

Even if the .igs model have no error on its faces it is recomendable to perform this healing just in case.

4. Setting Up the discretization parameters and meshing:
When the geometry is ready, the mesh can be created, for this some basic controls must be apply, click on mesh and then on Meshing Options

In the new windows the meshing parameters will appear, where the user
can define the steps that the program will follow to create de mesh.

Also the mesh quality can be selected from a list, in this case the
quality will be selected as Very Fine to create a nice uniform surface
around de small circular curves, click on Apply and Ok to close the
window and finaly hit Ctrl-m to start the meshig process.

The process of meshin will first create the faces meshing and finaly the
3D element columen, after your model end meshing make sure you have a
number of 3D elements and no just 2D elements.

The mesh density can be changed after the initial mesh is created so that will not be a problem.

If the reader is meshing the tutoria’s model be aware that this process can take a very, very long time depending on your machine

5. Changing the meshing quality:

After the mesh is created you can change the quality of it by subdividing the actual mesh into a smaller element composite, but this procedure is completly optional and will be not make on the tank model due its initial high density level.
Anyway, the way to do it in any other mesh is clickin in the subdividing Refinement Uniform option at in Refinement menu.
6. Adding set of facer for boundary conditions and loads:

One of the greatest issues on CGX ( the pre and post processing module on CalculiX) it is the lack of a way to properly select an area or a side of the model to define some boundary conditions or to apply loads, where the proces of selecting element faces one by one on complex geometries is tremendously complicated. This issue can be solve by marking this faces with a set prevously on NetGen.

Two sets of faces will be created for the tank model, one fixed geometry to enclose the DOF and one normal pressure to the internal face to recreate the force made by a compressed gas on it.

For this go to Mesh/ Edit Boundary Conditions , a little window will appear from here the name faces will be assign.

Double click the face and then write the name of the fixed face (333) and finaly Change, doing the same thing for the load face (111).

7. Exporting to CalcuLix format:

When the mesh is ready for its analysis it must be exported so CalculiX can handle the model and read the created set of faces, click on Filea and then Save Mesh, do not try to saved on Abaqus format, CalculiX can translate the .vol format that NetGen uses.

8. Importing from CalculIX:
In a console ( doesn’t mind what system are you using) type:

$ cgx -ng tank.vol

Change ccx for your own CalculiX command for the pre processing module CGX and tankmesh.vol for the name you have choose for your mesh. After a while, depending of the size of the mesh file, the 3D model will appear.

9. Translating the boundary conditions:

NetGen exports the mesh with 3D volume elements and a set of diferent 2D surface elements on all they faces, the idea is to extract the just the 3D elements from the whole file whit its own set name.

The sets created on NetGen can be listed by the command: prnt se ; the sets name start by +setxxx and in the x’s field the (111) and the (333) names created previusly will appear.

The process for translating the sets are quite easy, just follow the next process for separate the 3D elements:

  • comp +setXXX up
  • comp +setYYY up
  • plot f +setXXX (this will show up the faces of the set XXX)
  • plot f +setYYY (this will show up the faces of the set YYY)

From here you can change, add, delete and mix the faces sets for your own work, for this model the 333 set will be exported as fix.nam (send fix abq nam) and the 333 set as load.dlo (send load abq pres 100)

10. Trying an analysis:

A simple linear elastic analysis will be performed for the tank model, but the reader can make use of any other case of study he wants.

The next one its the .inp file commented code for the high pressure tank analysis:






*INCLUDE, INPUT=load.dlo


End of the tutorial.


The model, mesh, sets and .INP files can be download from SourceForge Page by this link: netgen mesh calculix

Leave a Reply