Segmentation fault with ccx_2.19 dynamic modal analysis

Hello,

I am using the ccx_2.19 pre-compiled binary.
I have slightly modified the example shell model shellf.inp to run a modal dynamic analysis:

...
*NSET,NSET=N15
15
*AMPLITUDE,NAME=A1
0.,0.,5.E-5,1.,5.E-4,1.
*STEP
*FREQUENCY,STORAGE=YES
10
*CLOAD
15,3,3,0.
*END STEP
*STEP
*MODAL DYNAMIC
1.E-5,1.E-4
*CLOAD,AMPLITUDE=A1
15,3,3,1.E-6
*MODAL DAMPING,RAYLEIGH
,,50.,0.
*NODE PRINT,NSET=N15
U
*END STEP

The run fails with a segmentaiton error in the dynamic analysis step. I can’t see anything obvioulsy wrong in the input, but maybe I am missing something?

Note:

  1. I am able to run the other modal dynamic examples without errors (beamdy1, beamdy2, beamdy3, beamdy4, beamdy5, beamdy6, beamdy17).
  2. I set CCX_LOG_ALLOC=1 , but must admit not sure what to do with the output.

Any ideas as to the cause of the error would be very much appreciated, as well as solutions / work arounds. Thanks.

1 Like

hello,

maybe these:
shell elements are expanded into threedimensional elements !?
maybe you can try first a simulation with solid elements !?
wbr

Indeed, you are right, the shell elements are probably causing the error here (as I am able to run the solid element “beamdy” examples without difficulty)… But the geometry that I am meshing is 2D and so I do not want to transition to 3D elements from the start.

The manual (section 6.9.5 Modal dynamic analysis) seems to imply that *MODAL DYNAMIC should work with shell elements - and that is exactly the use-case I am trying to solve here. So to me this looks like a bug.

To investigate this further, I ran a straight forward *DYNAMIC analysis of the “shellf.inp” test example, with the following step definition:

*STEP,NLGEOM=NO 
*DYNAMIC,DIRECT
1.E-5,1.E-4
*CLOAD,AMPLITUDE=A1
15,3,1.E-6
*NODE PRINT,NSET=N15
U
*END STEP

This worked without problem and generates sensible data.

I noticed an interesting difference in the .12d output files between this run and the modal dynamic analysis:

  • the *MODAL DYNAMIC analysis generates mean rotation MPCs at the SPC’d and loaded nodes
  • the *DYNAMIC analysis generates knots at the SPC locations only

Questions:

  1. Is there a way to force knot generation rather than MPCs? Assuming this might solve the problem.
  2. As an alternative workaround, is there a fast way of generating and saving an expanded shell model for further analysis? That way, I could run the frequency analysis directly on the 3D model to feed the dynamic modal analysis.
1 Like

hello,

maybe these can help for the second question:

*NODE FILE,OUTPUT=3D
U,

after these you can send out the new mesh in pre
with
seta new e all
seta new n all
send new abq

you can have one example

1 Like

I changed the concentrated load by a distributed one and got same error. My guess is that there is a bug but, more investigation is needed.

2 Likes

@OliviaS I don’t think there is a fast way to do number 2. I’ve experienced similar issues in the past and what I end up doing is expanding them manually and applying proper boundary conditions.

1 Like

Thanks @jbr and @dichtstoff for the comments on option 2). I might try to do this manually for a specific model of interest, but since the cgx/ccx analysis I would like to use is part of a parametric loop where geometry and mesh change, I might give automating this a go aswell at some point and maybe share the code with the community (since other people might run into simmilar problems with shells).

In the meantime, I hope this bug might get resolved in future releases… Would be happy to contribute or test again in the future - please get in touch.

1 Like

An option may be to use a gmsh script within your automated python code. If I recall correctly, there is a python wrapper for gmsh.

1 Like

Hi all,

I will look into that (Sept 2022).

Best greetings,

Guido

1 Like

Is there any progress on this issue?

I can confirm some issues for windows versions of Calculix 2.16, 2.18, 2.19 and 2.20 and solid finite elements. It seems that CalculiX is able to solve problems with smaller number of nodes (for me, it is around 1000) but fails for a larger model (for me it is around 5000 nodes). It fails for PaStiX and Spooles solvers. I think it fails after the frequency step finishes and steady state dynamic step starts. It outputs the result for the starting frequency of the steady state dynamic step.

But I run a test with about 100.000 nodes on 2.16 version for Linux and it works. So maybe it is only a windows problem?

As a continuation I must highlight my mistake. I experienced this problem - a random termination of the solver - for *Steady state dynamics analysis step and not *Model dynamics step. I missed this detail in my previous comment, but the problems seemed similar.

This problem was noticed in another post Steady state dynamics randomly terminates without error where I will post my new findings.

I am sorry for the confusion in this topic, but maybe both problems are connected.

1 Like

Hi all - just to confirm from my side that this problem still applies to v2.20.
Also, not sure this is the same error as the one you mention @Matej, as the example model I used only has 21 nodes (51 nodes for the expanded solids). I am running the linux binary in WSL. For completeness - here is the ccx output:

************************************************************

CalculiX Version 2.20, Copyright(C) 1998-2022 Guido Dhondt
CalculiX comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it under
certain conditions, see gpl.htm

************************************************************

You are using an executable made on Sun Jul 31 18:08:37 CEST 2022

  The numbers below are estimated upper bounds

  number of:

   nodes:          277
   elements:            4
   one-dimensional elements:            0
   two-dimensional elements:            4
   integration points per element:           27
   degrees of freedom per node:            3
   layers per element:            1

   distributed facial loads:            0
   distributed volumetric loads:            0
   concentrated loads:            8
   single point constraints:          408
   multiple point constraints:          481
   terms in all multiple point constraints:         3073
   tie constraints:            0
   dependent nodes tied by cyclic constraints:            0
   dependent nodes in pre-tension constraints:            0

   sets:            6
   terms in all sets:           62

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

   orientations:            4
   amplitudes:            4
   data points in all amplitudes:            7
   print requests:            1
   transformations:            0
   property cards:            0


 STEP            1

 Frequency analysis was selected

 Decascading the MPC's

 Determining the structure of the matrix:
 Using up to 1 cpu(s) for setting up the structure of the matrix.
 number of equations
 119
 number of nonzero lower triangular matrix elements
 4110

 Using up to 1 cpu(s) for setting up the structure of the matrix.
 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the symmetric stiffness/mass contributions.

 Factoring the system of equations using the symmetric spooles solver
 Using 1 cpu for spooles.

 Calculating the eigenvalues and the eigenmodes

U^T*M*U=1.000000 for eigenmode 1
U^T*M*U=1.000000 for eigenmode 2
U^T*M*U=1.000000 for eigenmode 3
U^T*M*U=1.000000 for eigenmode 4
U^T*M*U=1.000000 for eigenmode 5
U^T*M*U=1.000000 for eigenmode 6
U^T*M*U=1.000000 for eigenmode 7
U^T*M*U=1.000000 for eigenmode 8
U^T*M*U=1.000000 for eigenmode 9
U^T*M*U=1.000000 for eigenmode 10
 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the stress calculation.


 STEP            2

 Dynamic analysis was selected

 Determining the structure of the matrix:
 Using up to 1 cpu(s) for setting up the structure of the matrix.
 number of equations
 119
 number of nonzero lower triangular matrix elements
 4110

 Using up to 1 cpu(s) for setting up the structure of the matrix.
 *WARNING: 1-D or 2-D elements may cause problems in modal dynamic calculations
           ensure that point loads defined in a *MODAL DYNAMIC step
           and applied to nodes belonging to 1-D or 2-D elements have been
           applied to the same nodes in the preceding FREQUENCY step with
           magnitude zero; look at example shellf.inp for a guideline.

 Composing the dynamic response from the eigenmodes

Segmentation fault

I ran into the same crash and traced it. Guido wrote here in August 2022 (post 9) that he would look into it, and OliviaS confirmed it on 2.20 in post 12; it still happens on ccx 2.23 and on master (9ba5d76). Below are a minimal deck, the cause (dyna.c passes NULL work arrays to nonlinmpc) and a possible fix.

The deck of the first post (shellf.inp with its *MODAL DYNAMIC step) crashes on 2.23 with the same backtrace as the deck below (nonlinmpc_ ← dyna, address 0x0). OliviaS’s observation in post 3 was the right lead: the crash comes from the mean-rotation MPCs that the *MODAL DYNAMIC run generates. (The random stops of *STEADY STATE DYNAMICS on large models in posts 10-11 are a different problem, see Steady state dynamics randomly terminates without error; *STEADY STATE DYNAMICS is not affected by this one.)

Checked on ccx 2.23 (macOS arm64, OMP_NUM_THREADS=1) and master 9ba5d76 (16 Oct 2026).

What triggers it

A *MODAL DYNAMIC step segfaults (exit 139) right after the *FREQUENCY step when a shell or beam node that is not a knot has a rotational boundary condition, for example a clamp 1, 1, 6, or a moment. ccx turns such an SPC or moment into a mean-rotation MPC (label MEANROTBS). dyna.c then calls nonlinmpc for it with the work arrays aux and iaux still NULL, and nonlinmpc writes into them.

The deck below follows the rule for 1D and 2D elements in modal dynamics in section 6.9.5 (Modal dynamic analysis) of the 2.23 manual: the point load of the *MODAL DYNAMIC step is also defined, with magnitude zero, in the *FREQUENCY step. It crashes even with no load at all in the *MODAL DYNAMIC step. The same model runs in *STEADY STATE DYNAMICS, and the strip held by translational SPCs only runs in *MODAL DYNAMIC and matches the superposition of ccx’s own modes. A crash where the manual describes the input as supported is a bug.

Before it crashes, ccx prints the warning shown in post 12 (CalculiX.c:1426): point loads on 1-D or 2-D elements must also be applied, with magnitude zero, in the preceding *FREQUENCY step; “look at example shellf.inp for a guideline.” The test deck shellf.inp is exactly such a model (S8 shells clamped with Nfixx,1,6). Run in *MODAL DYNAMIC instead of its *STEADY STATE DYNAMICS step, as in the first post, it segfaults in the same place.

Minimal deck

md_shell.inp:

** S4 strip 0.5 x 0.1 x 0.01 clamped at x = 0 (nodes 1 and 2, DOFs 1-6).
** *FREQUENCY with a zero point load at node 11 (manual 6.9.5), then *MODAL DYNAMIC
*NODE
1,0,0,0
2,0,0.1,0
3,0.1,0,0
4,0.1,0.1,0
5,0.2,0,0
6,0.2,0.1,0
7,0.3,0,0
8,0.3,0.1,0
9,0.4,0,0
10,0.4,0.1,0
11,0.5,0,0
12,0.5,0.1,0
*ELEMENT,TYPE=S4,ELSET=P
1,1,3,4,2
2,3,5,6,4
3,5,7,8,6
4,7,9,10,8
5,9,11,12,10
*MATERIAL,NAME=M
*ELASTIC
2e5,0.3
*DENSITY
1e-3
*SHELL SECTION,ELSET=P,MATERIAL=M
0.01
*NSET,NSET=OUT
11
*BOUNDARY
1,1,6
2,1,6
*STEP
*FREQUENCY,STORAGE=YES
4
*CLOAD
11,3,0.
*NODE PRINT,NSET=OUT
U
*END STEP
*STEP
*MODAL DYNAMIC
0.001,0.01
*CLOAD
11,3,1.
*NODE PRINT,NSET=OUT
U
*END STEP

Run it with OMP_NUM_THREADS=1 ccx md_shell; echo $?

Expected

The *MODAL DYNAMIC step runs, as it does for the same strip without rotational SPCs: with the clamp replaced by translational SPCs on nodes 1-4 (1,1,3 / 2,1,3 / 3,1,3 / 4,1,3), ccx prints uz(11) = 18.631 at t = 0.01, and superposing the 4 mass-normalised modes it printed in the *FREQUENCY step (129.6458, 899.933, 1396.897, 1502.569 Hz) for a unit step load gives 18.631.

The clamped model itself runs in *STEADY STATE DYNAMICS (10.,100.,2 instead of the *MODAL DYNAMIC lines): exit 0, uz(11) = 23.81 at 10 Hz.

Actual

The *FREQUENCY step finishes (4 modes), then ccx is killed by a segmentation fault (exit status 139). Backtrace (lldb):

stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: ccx`nonlinmpc_ + 4028
frame #1: ccx`dyna + 28228
frame #2: ccx`main + 36892

The same exit 139 with:

  • no *CLOAD in the *MODAL DYNAMIC step,
  • one rotational SPC only: translations of nodes 1-4 held and 1,4,4,
  • a B31 cantilever (3 elements) clamped with 1,1,6;
  • no rotational SPC at all (translations of nodes 1-4 held) but a moment 11,4,1. in the *MODAL DYNAMIC step, with 11,4,0. in the *FREQUENCY step: ccx also makes a MEANROTBS MPC for a moment (gen3dforc.f:684).

Where it goes wrong

dyna.c declares the work arrays of nonlinmpc and never allocates them (lines 111 and 137-139):

    *aub=NULL,*temp_array1=NULL,*temp_array2=NULL,*aux=NULL,
  ...
  /* dummy variables for nonlinmpc */

  ITG *iaux=NULL,maxlenmpc,icascade=0,newstep=0,iit=-1,idiscon;

Any MPC whose label is not blank, CYCLIC or SUBCYCLIC sets inonlinmpc=1 (dyna.c:730-738), and dyna.c:1723-1729 (and 1894-1900) then call

      FORTRAN(nonlinmpc,(co,vold,ipompc,nodempc,coefmpc,labmpc,
			 nmpc,ikboun,ilboun,nboun,xbounact,aux,iaux,
			 &maxlenmpc,...

A rotational SPC on a shell or beam node that is not a knot becomes an MPC labelled MEANROTBS (gen3dboun.f:687, 820, 903). nonlinmpc.f:823-842 handles it in the general branch, which first copies the MPC’s terms into the work arrays:

            iaux(i)=nodempc(2,index)
            iaux(maxlenmpc+i)=node
            aux(6*maxlenmpc+i)=coefmpc(index)

iaux is NULL and maxlenmpc is not set: the write to address 0 is the segfault. nonlingeo.c:437-438 allocates both arrays (NNEW(aux,double,7*maxlenmpc); NNEW(iaux,ITG,2*maxlenmpc);, with maxlenmpc=mpcinfo[3]). steadystate.c does not call nonlinmpc, which is why *STEADY STATE DYNAMICS runs. Knots (label KNOT) and *RIGID BODY MPCs go through other branches of nonlinmpc that do not use aux, which is why a node that is a knot does not crash.

Possible fix

Allocate the work arrays in dyna.c before the time loop, as nonlingeo.c does, and free them at the end, e.g.

  if(inonlinmpc==1){
    maxlenmpc=0;
    for(i=0;i<*nmpc;i++){
      ITG index=ipompc[i],len=0;
      while(index!=0){len++;index=nodempc[3*index-1];}
      if(len>maxlenmpc) maxlenmpc=len;
    }
    NNEW(aux,double,7*maxlenmpc);
    NNEW(iaux,ITG,2*maxlenmpc);
  }
  ...
  SFREE(aux);SFREE(iaux);

Workaround: *STEADY STATE DYNAMICS, or make the node a knot. With a short B31 element (zero density) attached to nodes 1 and 2 of the deck above, ccx creates knots there, the *MODAL DYNAMIC step runs, and uz(11) = 1.7180 at t = 0.01 equals the superposition of the 4 modes it printed.

Olivias: You should change headline from 2.19 to 2.19 to 2.23, if the fault is also in 2.20 to 2.23.

And why 2.19?
2.23 is with more features and less bugs.

Confirmed using official build of ccx 2.23 on Windows. @Sandervdb Can you add a GitHub ticket for this one too?

 STEP            2

 *WARNING reading *MODAL DYNAMIC: unknown solver;
          the default solver is used
 Dynamic analysis was selected

 Determining the structure of the matrix:
 Using up to 1 cpu(s) for setting up the structure of the matrix.
 number of equations
 107
 number of nonzero lower triangular matrix elements
 2101

 Using up to 1 cpu(s) for setting up the structure of the matrix.
 *WARNING: 1-D or 2-D elements may cause problems in modal dynamic calculations
           ensure that point loads defined in a *MODAL DYNAMIC step
           and applied to nodes belonging to 1-D or 2-D elements have been
           applied to the same nodes in the preceding FREQUENCY step with
           magnitude zero; look at example shellf.inp for a guideline.

 Composing the dynamic response from the eigenmodes

Posted: *MODAL DYNAMIC segfaults when a shell or beam node has a rotational SPC or a moment: dyna.c passes NULL work arrays to nonlinmpc · Issue #299 · Dhondtguido/CalculiX · GitHub

1 Like