Meshing Tutorials 

How To extrude 2D mesh into 3D in Calculix – pipe mesh example

Previous steps:

The 2D mesh was created in Blender with the use of the fbd export script. The generation of the 2D mesh itself is the subject of an other Tutorial document.

Starting up and opening the 2D mesh:

Start up CalculiX:

cgx -b cylinder3.fbd
Highslide JS

The next step is to swep the 2D mesh in 3D among a strait line. Let's call the other end of the pipe “top”. All the entities (points, lines, surfaces imported) are stored in the “all” selection at the beginning. We will use a translation vector of [0,0,18] – z direction:

swep all top tra 0 0 18
Highslide JS Highslide JS

Check what is the default division for the lines. We would like to use hexahedron cells, all the lines will be divided due to its division definition. The division definition can be visulaized for example for all the lines in the model:

plot ld all
Highslide JS

Note that the new lines – the ones parallel to the z axis - have 4 as division! Change the division of these lines!
Switch the “+x” view:

Highslide JS

Now change the division:

qdiv

Selection mode “all”:

a

Define the opposite corners of the selection rectangle:

r
r
Highslide JS Highslide JS

Type in the new division definition (for two digit definitions type a <SPACE> before the numbers!):

 99

Quit the division definition command:

q

Now define the cell type which the mesher should use as hexahedrons

Highslide JS
elty all he8

Start meshing:

mesh all

The reply is the following:

please wait for 'ready'
numFaces:456192 numElems:76032 size:32845824
ready

Visualize the newly created elements:

plot e all
Highslide JS

Toggle on “Element Edges”:

Highslide JS

Switch visualization for element face visualization for smaller memory usage:

plot f all

Now create selections for inlet, outlet and wall. To do the selection the first letter of the element name should be typed in – p for points, l for lines, s for surfaces, etc.. For the boundary conditions element faces should be selected (f). Let's begin with the inlet boundary (“in”):

qadd in
a
r
r
f
q
Highslide JS

Check what was selected (with green color):

plot f all
plus f in g
Highslide JS

Remove non necessary faces from selection:

qrem in
a
r
r
f
q

Create the outlet (“out”) and wall (“wall”) selections on the similar way. Visulizing the result - “in” with green, “out” with red and “wall” with blue:

plot f all
plus f in g
plus f out r
plus f wall b
Highslide JS Highslide JS

Check what selections are existing with what content:

prnt se

The reply is the following:

1 all stat:o n:80100 e:76032 f:7872 p:1602 l:3937 s:3104 b:768 L:0 S:0 se:0
2 top stat:c n:801 e:0 f:768 p:801 l:1568 s:768 b:0 L:0 S:0 se:0
3 in stat:c n:0 e:0 f:768 p:0 l:0 s:0 b:0 L:0 S:0 se:0
4 -NJBY stat:c n:0 e:0 f:0 p:0 l:0 s:0 b:0 L:0 S:0 se:0
5 out stat:c n:0 e:0 f:768 p:0 l:0 s:0 b:0 L:0 S:0 se:0
6 wall stat:c n:0 e:0 f:6336 p:0 l:0 s:0 b:0 L:0 S:0 se:0

Export mesh in OpenFOAM format with the existing face selections (“in” - patch type, “out” - patch type and “wall” - wall type):

send all foam patch in patch out wall wall

Reply:

please wait for 'ready'
use boundary: type:patch set:in
use boundary: type:patch set:out
use boundary: type:wall set:wall
wrote foam mesh
ready

The mesh is ready to be used in OpenFOAM now! You can quit CalculiX:

quit