*EL PRINT ELKE in a linear *STATIC or *BUCKLE step: segmentation fault (resultsmech.f reads the velocities, which linstatic.c and arpackbu.c pass as NULL)

Summary

Section 7.53 (*EL PRINT) of the 2.23 manual lists “the kinetic energy (key=ELKE)” among the whole-element variables, without restricting it to dynamic steps. Requested in a step that ccx runs linearly, it crashes ccx with a segmentation fault (exit 139) at the first stress calculation, and nothing is printed after the banner. Affected: a linear *STATIC step (also one that follows a *FREQUENCY or *BUCKLE step, e.g. explicit *DYNAMIC, then *FREQUENCY, then *STATIC) and *BUCKLE. The same step with ELSE instead of ELKE runs, and so does the same request in an NLGEOM *STATIC step or a *DYNAMIC step.

For a *FREQUENCY step ccx already handles this request (calinput.f, master lines 1492-1510): it drops ELKE and warns

 *WARNING in calinput: ELKE-output requested
          this is not available in a
          frequency calculation: ELKE
          is deactivated in this and all
          subsequent steps (unless reactived
          explicitly)

Version

ccx 2.23 (macOS arm64) and current master (537aa81, built on macOS arm64): the same results. Source: master 537aa81.

Already reported or fixed?

Not reported: I found no matching GitHub issue (open or closed) or pull request in Dhondtguido/CalculiX, and no calculix.discourse.group topic (checked 3 Nov 2026). Not fixed: linstatic.c, arpackbu.c and resultsmech.f are unchanged in this respect on master (537aa81).

Related:

Minimal input

elke_static.inp:

** One C3D8 cube, base held, a load on the top face, linear *STATIC step,
** kinetic energy (ELKE) requested on *EL PRINT.
*NODE, NSET=NALL
1, 0., 0., 0.
2, 1., 0., 0.
3, 1., 1., 0.
4, 0., 1., 0.
5, 0., 0., 1.
6, 1., 0., 1.
7, 1., 1., 1.
8, 0., 1., 1.
*ELEMENT, TYPE=C3D8, ELSET=EALL
1, 1, 2, 3, 4, 5, 6, 7, 8
*NSET, NSET=BOT
1, 2, 3, 4
*NSET, NSET=TOP
5, 6, 7, 8
*MATERIAL, NAME=M
*ELASTIC
1000., 0.3
*DENSITY
1.E-3
*SOLID SECTION, ELSET=EALL, MATERIAL=M
*BOUNDARY
BOT, 1, 3
*STEP
*STATIC
*CLOAD
TOP, 3, 0.25
*EL PRINT, ELSET=EALL
ELKE
*END STEP

Variants (one change each):

deck change
else_static.inp ELSE instead of ELKE
elke_nlgeom.inp *STEP, NLGEOM
elke_dynamic.inp *DYNAMIC / 0.1, 1. instead of *STATIC
elke_buckle.inp *BUCKLE / 2 instead of *STATIC, load TOP, 3, -0.25
else_buckle.inp elke_buckle.inp with ELSE
elke_freq_static.inp a step *FREQUENCY / 2 before the static step
elke_expl_freq_static.inp two steps before the static step: *STEP, INC=100000 / *DYNAMIC, EXPLICIT / 1.E-5, 1.E-3 / *EL PRINT, ELSET=EALL / ELKE / *END STEP, then *STEP / *FREQUENCY / 2 / *END STEP
elke_freq.inp *FREQUENCY / 2 instead of *STATIC and its *CLOAD lines

How to run

ccx elke_static (and the variants the same way)

Expected

The step runs and prints a kinetic energy of 0 (the step is static), or ccx drops the request with a warning, as it does in a *FREQUENCY step.

Actual

deck ccx 2.23 master 537aa81
elke_static segmentation fault (139) segmentation fault (139)
elke_buckle segmentation fault segmentation fault
elke_freq_static segmentation fault segmentation fault
elke_expl_freq_static segmentation fault segmentation fault
else_static, else_buckle exit 0 exit 0
elke_nlgeom exit 0, ELKE 1.418507E-10 the same
elke_dynamic exit 0, ELKE 6.560558E-07 the same
elke_freq exit 0, the warning above the same

Under lldb the crash is a read at address 0x8 in resultsmech_.

Where it goes wrong

A request for ELKE sets ikin=1 (resultsini.c, master lines 326-332). resultsmech.f then copies the element’s nodal velocities (lines 458-463):

        elseif(ikin.eq.1) then
          do j=1,nope
            do k=1,3
              veoldl(k,j)=veold(k,konl(j))
            enddo
          enddo            
        endif

linstatic.c declares the velocities only as dummy arguments for its results() calls (line 120: double *veold=NULL,*accold=NULL,...), and so does arpackbu.c (line 112). veold(1,1) is then the address 0x8.

Fix

Possible fix (not built or tested): in linstatic.c and arpackbu.c, allocate veold with zeros when ELKE is requested (the kinetic energy of a static step is 0), or drop ELKE with a warning for these procedures, as calinput.f does for *FREQUENCY (master lines 1492-1510).

Confirmed using official ccx 2.23 build on Windows, needs a GitHub ticket.

The analysis (elke_static) indeed crashes.

1 Like

Posted: *EL PRINT ELKE in a linear *STATIC or *BUCKLE step: segmentation fault (resultsmech.f reads the velocities, which linstatic.c and arpackbu.c pass as NULL) · Issue #321 · Dhondtguido/CalculiX · GitHub

1 Like