Creating a rectangular tube in CalculiX
Rectangular tubes are one of the standard shapes of beams. This article shows how to create them in CalculiX GraphiX.
Sharp corners
A rectangle with sharp corners is easiest to generate in CalculiX. In practice, these are often made by extrusion.
It is generated by the following code for cgx
:
## Define the view. rot y rot l 30 rot u 15 ## Dimensions # Rectangle parameters, width, height, wall thickness valu W / 50 1000 valu H / 50 1000 valu t / 2 1000 # Profile length valu L / 200 1000 # Divisions valu divW 20 valu divH 20 valu divt 4 valu divl 48 # Derived values valu W2 / W 2 valu H2 / H 2 valu WI - W t ## Geometry # First corner line seto l1 pnt p1 0 W 0 pnt p2 0 WI t line ! p1 p2 divt setc # Center point pnt pm 0 W2 H2 # Rectangle surface seto Face1 swep l1 l2 mir pm y divW swep l2 l3 mir pm z divH swep l3 l4 mir pm y divW swep l4 new mir pm z divH setc comp Face1 do merg p Face1 merg l Face1 ## Show the geometry valu showgeom 1 if showgeom > 0 capt Rectangular profile face geometry. plot pa all plus la all plus sa all stop hcpy png rectangular-profile-geometry sys mogrify -trim rectangular-profile-geometry.png endif seto profile swep Face1 Face2 tra L 0 0 divl setc comp profile do elty all he20r mesh all ## Create the mesh valu showmesh 1 if showmesh > 0 frame capt Rectangular profile mesh. view elem plot e all n view surf stop hcpy png rectangular-profile-mesh sys mogrify -trim rectangular-profile-mesh.png endif
The geometry and resulting mesh look as follows.
Rounded corners
Steel profiles often have rounded corners because of the way they are manufactured. The following code generates such a profile. The basic concept is to create a line and sweep that to form 1/4 of the profile. This is then mirrored two times and merged. By default, the internal radius equals the wall thickness. This is generally considered the minimum value.
First, useful values for defining the geometry are defined:
## Define the view rot y rot r 135 rot u 25 ## Parameters # Width, height and length in [m] valu B 0.10 valu H 0.15 valu L 0.25 # Wall thickness [m] valu t 0.004 # Number of elements in Y valu dy2 6 # Number of elements in Z valu dz2 8 # Twice the number of elements in the radius valu dr 8 # Twice the number of elements in X valu dl 24 # Calculated values valu B2 / B 2 valu H2 / H 2 valu B2i - B2 t valu H2i - H2 t valu Ri t valu cpy - B2i Ri valu cpz H2i valu ncpy - 0 cpy
Then the geometry is created. First a point which is then extruded into the first line:
## Geometry seto tube-section pnt ! 0 B2i 0 swep tube-section new tra 0 t 0 4
The line is swept into a rectagle. Then a line is swept around a point to create a rounded corner:
swep tube-section ln2 tra 0 0 cpz dz2 pnt cpt 0 cpy cpz swep ln2 ln3 rot cpt x 90 dr
Another line is swept into a surface and the whole mirrored in the z-direction:
swep ln3 new tra 0 ncpy 0 dy2 copy tube-section new mir z
A final mirror in the y-direction and then all is merged:
copy tube-section new mir y setc merg p tube-section merg l tube-section
The following code generated pictures of the planar geometry and the mesh:
## Show the geometry valu showgeom 0 if showgeom > 0 capt Rounded rectangular profile face geometry. plot pa all plus la all plus sa all stop hcpy png rounded-rectangular-profile-geometry sys mogrify -trim roundedrectangular-profile-geometry.png endif ## Extrude the tube seto tube swep tube-section new tra L 0 0 dl setc comp tube do ## Mesh the tube elty all he20r mesh all ## Show the mesh valu showmesh 0 if showmesh > 0 frame capt Rectangular profile mesh. view elem plot e all n view surf stop hcpy png rounded-rectangular-profile-mesh sys mogrify -trim rounded-rectangular-profile-mesh.png endif
The complete profile and mesh look as follows.
For comments, please send me an e-mail.
Related articles
- Meshing a circle with hex elements in CalculiX
- Building CalculiX with the PaStiX solver without CUDA
- Element names in Calculix
- FEA based on STEP geometry using gmsh and CalculiX
- Folded leaf spring ball joint flexure