CGX: counting nodes and selecting elements


I’m studying a clamped cantilever beam with a force at one end.
I would like to test two loads:
1- point loadings on traction surface nodes
2 - facial distributed loading.

In the first case, if I know the total force F, I should assign to each surface node a force equal to F/NumNodes.
The nodes of a surface can be selected using the code below (L is the beam length).
However, how can I determine the number of selected nodes in a general case in batch mode?

seta all_nodes_set n all
enq all_nodes_set u_fixed_set rec L _ _ 0.001

In the second case, I need to know the element faces that lie on the traction surface (e.g. A00L).
Which command allows to select the face elements of a surface? (enq + rec should work for nodes only).
Once I know the face elements, I could store them in a set called “load” and save a dedicated file with

send load abq press 10


It’s slightly more complicated then that.

For a first order element, each node in the element face gets 1/N of the total force on the element facet, where N is the number of nodes in the facet. For a traction, that force depends on the element area. Keep in mind that nodes shared by element faces get part of the force from each facet!

For a second order elements, look in the section “Facial Distributed loading” of the CalculiX CrunchiX manual. You will see that some of the nodal forces are 1/3 of the total facet force on the midside nodes, while the forces on the corner nodes are zero for a C3D10 element and -1/12 for a C3D20 element.

Use comp. From the manual:

comp nodes do

will add all faces described by the nodes in set nodes despite the fact that faces are made from nodes.

Then just write the facets. So;

seta all_nodes_set n all
enq all_nodes_set u_fixed_set rec L _ _ 0.001
comp u_fixed_set do
send u_fixed_set abq sur
1 Like

I should have completed my .fbd file. I created the nodes set for fixed BC and the faces set for traction load. I also wrote the .inp file but I’m not able to get the solution. I receive the following message. What is the problem?


  The numbers below are estimated upper bounds

  number of:

   nodes:          252
   elements:          120
   one-dimensional elements:            0
   two-dimensional elements:            0
   integration points per element:            8
   degrees of freedom per node:            3
   layers per element:            1

   distributed facial loads:            0
   distributed volumetric loads:            0
   concentrated loads:            0
   single point constraints:           36
   multiple point constraints:            1
   terms in all multiple point constraints:            1
   tie constraints:            0
   dependent nodes tied by cyclic constraints:            0
   dependent nodes in pre-tension constraints:            0

   sets:            4
   terms in all sets:          642

   materials:            1
   constants per material and temperature:            2
   temperature points per material:            1
   plastic data points per material:            0

   orientations:            0
   amplitudes:            2
   data points in all amplitudes:            2
   print requests:            2
   transformations:            0
   property cards:            0

 *ERROR reading *DLOAD: element set SLOAD_SET
        has not yet been defined.
 *ERROR reading *DLOAD. Card image:
# Parameters
valu beam_length 100
valu beam_height 15
valu beam_depth 25
valu num_x_div 20
valu num_y_div 2
valu num_z_div 3
valu node_tol 0.001

# Open set "beam_set"
seto beam_set

# Draw points "p1" and "p2"
pnt p1 0 0 0
pnt p2 beam_length 0 0

# Draw line "l1"
line l1 p1 p2

# Assign line divisions
div l1 num_x_div

# Assign line "l1" to set "lines_set"
seta lines_set l l1

# Extrude line in lines_set by dx=0, dy=beam_height, dz=0, creating "num_y_div" elements
# and assign resulting entities to set "sweep_lines_set"
swep lines_set sweep_lines_set tra 0 beam_height 0 num_y_div

# Assign surface "A001" to set "surfaces_set"
seta surfaces_set s A001

# Extrude surface along (0, 0, beam_depth) creating "num_z_div" elements
# and assign resulting entities to set "sweep_surface_set"
swep surfaces_set sweep_surface_set tra 0 0 beam_depth num_z_div

# Close set "beam_set"
setc beam_set

# Set mesh element type "he8"
elty all he8

# Mesh model
mesh all

# Export "beam_set" mesh (nodes and elements) in Abaqus format 
send beam_set abq 

# Create a set for all nodes
seta all_nodes_set n all

# Assign to set "fixed_set" the nodes in set "all_nodes_set" 
# with coordinates (x=0, y=_ (all), z=_ (all)) and a tolerance "node_tol"
enq all_nodes_set fixed_set rec 0 _ _ node_tol

# Export nodes set "fixed_set" and include nodes in a set for ccx
send fixed_set abq nam

# Assign to set "load_set" the nodes in set "all_nodes_set" 
# with coordinates (x=100, y=_ (all), z=_ (all)) and a tolerance "node_tol"
enq all_nodes_set load_set rec 100 _ _ node_tol
# Add all faces described by the nodes
comp load_set do
# Export mesh faces only
send load_set abq sur
Model: Cantilever beam with load at one end.

** Load mesh nodes and elements
*INCLUDE, INPUT = beam_set.msh

** Load nodes set for fixed BC
*INCLUDE, INPUT = fixed_set.nam

** Load faces set for load 
*INCLUDE, INPUT = load_set.sur

** Fix all Dof (1 to 3) of nodes in "Nfixed_set"
Nfixed_set, 1, 3

** Create elastic material "Steel"
2.1E5, 0.3

** Assign material "Steel" to elements in "Ebeam_set"


** Assign distributed load along y-axis (P2) to set "Sload_set"
Sload_set, P2, 100.

** Quasi-static solver

*NODE PRINT, NSET = Nbeam_set

*EL PRINT, ELSET = Ebeam_set

** Output of the nodal displacements

** Output the Cauchy (true) stress extrapolated to the nodal points



yeah, it works for me too

1 Like

Your fbd and input file work without errors for me.

1 Like

Does the “load_set.sur” file look like this? The “Sload_set” should be a set of face elements, it seems a set of surfaces…

In the working directory I use this command:

ccx beam_3d
** Surfaces based on load_set
*SURFACE, NAME=Sload_set
1, S1
61, S1
2, S1
62, S1
3, S1
63, S1


if you look in the example of the manual you find these: beamd.inp



manual ccx:

assigns a pressure loading with magnitude 10. times the amplitude curve of
amplitude A1 to face number three of all elements belonging to set Se1.
Example files: beamd.

they uses elements in the set you have surfaces of your elements
you can check the sets with:

prnt se
1 all stat:o n:252 e:120 f:212 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
3 Nbeam_set stat:c n:252 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
4 Ebeam_set stat:c n:0 e:120 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
5 +C3D8 stat:c n:0 e:120 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
6 Nfixed_set stat:c n:12 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
7 Sload_set stat:c n:0 e:0 f:6 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
8 +bou stat:c n:12 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
9 +bou1 stat:c n:12 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
10 +bou2 stat:c n:12 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
11 +bou3 stat:c n:12 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
12 +dlo_ds0 stat:c n:0 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0


also the example of Mr. kraska:


Yes, it is the same.

The only thing I noticed just now is that you use a different pressure surface in your *DLOAD then the one used in the *SURFACE definition.
Without looking at the CalculiX source, I don’t know which facet is actually used in this case. I’d guess the facet mentioned in the *DLOAD?

Thanks for the references,
What is the cgx command to get those 4 numbers?


Sorry, I’m a bit confused: which name do you expect to find?
Now I use “Sload_set”, what would you use?

With cgx I could use the command below to create a .trk file which can be used after *DLOAD.

send load_set abq trac 0 -100 0
** Load faces set for load 
*INCLUDE, INPUT = load_set.trk

No, It does not work…

 *ERROR reading *DLOAD. Card image:

However, I wanted to find a method that exports the set of elements I need and then assign the DLOAD to them…
I’m not an expert so I accept any advice

Hello ,

you want to apply *DLOAD on one area of your body,
so you can use all elements with these:

Ebeam_set, P1, 10000.

or if try these:

Ebeam_set,P5, 10000.

you can these to your fbd file:

send load_set abq pres 10000
send load_set abq nam

and you can add these to your inp file:
*INCLUDE, INPUT = load_set.nam

*INCLUDE, INPUT=load_set.dlo



i don’t know why is a difference to
Ebeam_set,P1, 10000





Hi, the code for pressure seems to work (I’m comparing the results with PrePoMax).
However, if I want a bending moment, I think the appropriate command is:

send load_set abq trac 0 -100 0
send load_set abq nam

this generates the .trk file below but I’m not able to use it after *DLOAD because there is the key “TRVEC”. Do you know how to use it?

** Traction Vector based on load_set
1, TRVEC1, 1.000000e+02, 0.000000e+00, -1.000000e+00, 0.000000e+00
31, TRVEC1, 1.000000e+02, 0.000000e+00, -1.000000e+00, 0.000000e+00
2, TRVEC1, 1.000000e+02, 0.000000e+00, -1.000000e+00, 0.000000e+00
32, TRVEC1, 1.000000e+02, 0.000000e+00, -1.000000e+00, 0.000000e+00
3, TRVEC1, 1.000000e+02, 0.000000e+00, -1.000000e+00, 0.000000e+00
33, TRVEC1, 1.000000e+02, 0.000000e+00, -1.000000e+00, 0.000000e+00


i don’t know how to use it, or you can use directly with ccx.
i found nothing in the manul from ccx, but i found here a topic
with the keyword: TRVEC
maybe you have to convert the .trk file.

A Guide to Modifying Abaqus Input Files for Use in CalculiX - CalculiX (official versions are on, the official GitHub repository is at

  1. The *DSLOAD keyword is supported in both Abaqus and CalculiX but the latter code supports it to a limited extent. In Abaqus this keyword can be used to define surface-based loading: pressure, surface traction or shell edge load (using several special labels such as P, TRVEC, TRSHR, and so on) as well as a stress-driven boundary for submodeling. In CalculiX this keyword is used only for pressure load (only label P is supported) or stress-based submodeling.

Ok, that’s not good news. I did not expect this for a very basic operation.
By the way, when you reported that my original code was okay, did you mean that you were able to get the (correct) solution? Are you a Windows user?

what do you mean with correct solution?
you want to check the deformation?
what result do you have for hand calculation?
it should be not so difficult.
we don’t do your homework :slight_smile:

what you can do to apply the vertical like pressure
you can read out the reaction force for *DLOAD
and change it to your direction:

send load_set abq pres 1


forces (fx,fy,fz) for set NLOAD_SET and time 0.1000000E+01

     1 -1.562500E+05  1.364279E-09  4.161279E-09
     2 -3.125000E+05  2.307836E-09 -8.691359E-10
     3 -6.250000E+05  8.217311E-09 -5.115339E-10
     4 -3.125000E+05  4.026525E-09  1.139483E-09
     9 -6.250000E+05  6.867511E-10  7.138738E-09
    10 -3.125000E+05  1.159129E-08  2.081038E-10
    13 -3.125000E+05 -3.811616E-09  2.849958E-09
    14 -1.562500E+05  2.367869E-09  1.829505E-09
   169 -1.562500E+05 -1.820840E-09 -1.913804E-09
   170 -3.125000E+05 -8.995181E-09 -2.451088E-10
   173 -3.125000E+05 -1.122676E-08  2.499064E-09
   175 -1.562500E+05  2.173977E-10 -2.157549E-09

1,3, -1.562500E+05
2,3, -3.125000E+05
3,3, -6.250000E+05
4,3, -3.125000E+05
9,3, -6.250000E+05
10,3, -3.125000E+05
13,3, -3.125000E+05
14,3, -1.562500E+05
169,3, -1.562500E+05
170,3, -3.125000E+05
173,3, -3.125000E+05
175,3, -1.562500E+05

past and copy and with amplitude you can aply factor on your load

CalculiX is sometimes a bit tricky, but it is worth to work with it.
it helps me a lot to understand fem. I work with windows and bconverged.

I think you misunderstood me.
I know the analytical solution…and also the FE one with PrePoMax and GetDP if you want.
I’m not a lazy student who is trying to get the homework done by you.
In the beginning, you said that my code worked on your PC while on my PC I received the error.
Since I recently discovered that cgx may have some problems on Windows unlike Linux, I was wondering if my problem was due to the Operating system.

no problem,
we are talking about the same error?

 *ERROR reading *DLOAD: element set SLOAD_SET
        has not yet been defined.
 *ERROR reading *DLOAD. Card image:


Yes, it is.
If you get the same problem it means that my code was not correct.
I try to highlight my target: I want to find a set of scripts that fully cover all pre-, solving, and post- operations without any manual operations (for whatever number of elements). In this way, I can include the process in an optimization with some Python scripts (this is a simple test case that has an easy mathematical solution).
From what I see, It seems that the basic cgx commands do not allow to do that but some custom edit operations are needed (e.g. some Python adjustments). If true, this is a good point to know.

This is my first case study so I don’t have the full view of cgx+ccx features, limitations, and bugs.

PrePoMax is a good tool but it does not record the operations…so it is less suitable for automation.

The Gmsh + GetDP workflow can be fully automated but cannot deal with nonlinear effects.