Extrapolated nodal values (S, E, ENER, *SECTION PRINT) of C3D8, C3D8I, C3D20R and expanded 2-D/shell elements are 4e-5 low: the 2x2x2 table in extrapolate.f has 4-digit constants

Summary

extrapolate.f takes the integration-point values of an element to its nodes with fixed tables. For the 2x2x2 scheme (C3D8, C3D8I, C3D20R, and the 2-D and shell elements expanded into them, e.g. CPS4 and S8R) the table a8 is typed with four significant digits:

      data a8 /2.549d0,-.683d0,.183d0,-.683d0,-.683d0,.183d0,
     &     -.04904d0,.183d0,...

The exact entries are the products of (1+√3)/2 and (1-√3)/2: 2.5490381, -0.6830127, 0.1830127, -0.0490381. Each row of the table must sum to 1, so that a constant field stays constant. With the rounded values each row sums to

2.549 - 3 x 0.683 + 3 x 0.183 - 0.04904 = 0.99996,

so every extrapolated nodal value of these elements is 4e-5 too small. A uniform stress of 10 comes out as 9.9996 at every node, *SECTION PRINT reports a section force of 9.9996 for an applied 10, and the strain and the energy density are low by the same factor. The integration-point values (*EL PRINT) are exact, and a C3D8R mesh of the same block (one point, copied to the nodes) prints 10.00000.

The 2.23 manual describes this extrapolation as trilinear (section 6.2.5, C3D20R): “the extrapolation of integration point values to the nodes is trilinear”. A trilinear extrapolation reproduces constant and linear fields exactly. (Section 6.13 says that nodal values “are extrapolated values and consequently less accurate”; that applies to fields an extrapolation cannot follow, not to a constant one.) The tables for C3D20, C3D10 and C3D15 in the same file are typed with five decimals; their row sums are off by 1e-5 to 5e-5 (measured below).

This is a small error, but it is systematic. It shows up whenever results are checked against a known value: the section force of a bar, a patch test, an energy balance. The fix is to type the constants with full precision.

Version

ccx 2.23 (macOS arm64) and current master (537aa81, 2 Nov 2026): identical output. The tables are the same in both.

Already reported or fixed?

Not reported: I found no GitHub issue or pull request in Dhondtguido/CalculiX about the extrapolation constants (searched “extrapol”, “a8”, “nodal stress”, “9.9996”, “0.99996”, 3 Nov 2026). Issue #147 shows the effect without naming it: a 1000 N pretension prints “Section print of the pretension section 9.999600E+02 N (OK)”. Not fixed: extrapolate.f (lines 148-158 on master), extrapolate_se.f (line 149) and beamextscheme.f (line 38) have the same rounded a8.

Minimal input

extrap_c3d8.inp:

** Unit cube, one C3D8, uniaxial stress sxx = 10 (force 10 on the x = 1 face).
** Every integration point has sxx = 10 and exx = 0.01; the extrapolated
** nodal values should be the same.
*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=XMAX
2, 3, 6, 7
*SURFACE, NAME=SX
1, S4
*MATERIAL, NAME=MAT
*ELASTIC
1000., 0.3
*SOLID SECTION, ELSET=EALL, MATERIAL=MAT
*BOUNDARY
1, 1, 3
4, 1, 1
4, 3, 3
5, 1, 2
8, 1, 1
*STEP
*STATIC
*CLOAD
XMAX, 1, 2.5
*EL PRINT, ELSET=EALL
S
*EL FILE
S, E, ENER
*SECTION PRINT, SURFACE=SX, NAME=SP1
SOF
*END STEP

extrap_c3d8r.inp: the same with TYPE=C3D8R.

extrap_linear.inp: a linear stress field, also exact at the integration points. Every node is prescribed u_x = 1e-3 (10 x + x z), so with nu = 0 the exact field is sxx = 10000 + 1000 z, szx = 500 x.

** one C3D8, all nodes prescribed: u_x = 1e-3*(10*x + 1*x*z), u_y = u_z = 0; E = 1e6, nu = 0
*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
*MATERIAL, NAME=MAT
*ELASTIC
1.e6, 0.
*SOLID SECTION, ELSET=EALL, MATERIAL=MAT
*STEP
*STATIC
*BOUNDARY
1, 1, 1, 0
1, 2, 3, 0.
2, 1, 1, 0.01
2, 2, 3, 0.
3, 1, 1, 0.01
3, 2, 3, 0.
4, 1, 1, 0
4, 2, 3, 0.
5, 1, 1, 0
5, 2, 3, 0.
6, 1, 1, 0.011
6, 2, 3, 0.
7, 1, 1, 0.011
7, 2, 3, 0.
8, 1, 1, 0
8, 2, 3, 0.
*EL PRINT, ELSET=EALL
S
*EL FILE
S
*END STEP

How to run

ccx extrap_c3d8
ccx extrap_c3d8r
ccx extrap_linear

Expected

extrap_c3d8: sxx = 10, exx = 0.01, eyy = ezz = -0.003 and ENER = 0.05 at every node; section force 10 (the face has area 1).

extrap_linear: sxx = 10000 at the nodes with z = 0 and 11000 at z = 1; szx = 0 at x = 0 and 500 at x = 1.

Actual

extrap_c3d8, .dat: all eight integration points have 1.000000E+01 for sxx, e.g.

         1   1  1.000000E+01 -2.258159E-15  3.564691E-16 -1.899464E-15 -4.385002E-16 -1.007474E-16

The .frd has the same values at all eight nodes; node 1:

 -4  STRESS      6    1
 -1         1 9.99960E+00-2.16506E-15 1.46589E-15-1.95216E-15-1.43429E-16-2.49575E-16
 -4  TOSTRAIN    6    1
 -1         1 9.99960E-03-2.99988E-03-2.99988E-03-2.53781E-18-1.86458E-19-3.24448E-19
 -4  ENER        1    1
 -1         1 4.99980E-02

and *SECTION PRINT gives

   total surface force (fx,fy,fz) and moment about the origin(mx,my,mz)

    9.999600E+00 -5.326450E-16 -1.416842E-15 -1.923498E-16  4.999800E+00 -4.999800E+00

and area 1.000000E+00, normal force 9.999600E+00.

extrap_c3d8r: 1.00000E+01, 1.00000E-02, -3.00000E-03, 5.00000E-02 at every node, and section force 1.000000E+01.

extrap_linear, .frd: sxx = 9.99958E+03 at z = 0 (nodes 1-4) and 1.09996E+04 at z = 1 (nodes 5-8); szx = -8.44006E-03 at x = 0 and 4.99988E+02 at x = 1.

ccx 2.23 and master 537aa81 print the same numbers.

The other element types, one element each with every node prescribed by the same two fields (uniform and linear; the linear field lies in the element’s own interpolation space except for C3D4, C3D6 and C3D8R, so its integration-point values are exact), give these deviations of the nodal sxx from the exact value (2.23 and master identical):

element table row sums of the table nodal sxx / exact - 1, uniform field the same, linear field
C3D8, C3D8I, C3D20R a8 0.99996 -4.0e-5 at every node -4.2e-5 to -3.6e-5
C3D20 a27 0.99996 to 1.00005 -4.0e-5 to +5.0e-5 -4.2e-5 to +5.0e-5
C3D10 a4 0.99999 -1.0e-5 -1.0e-5 to -9.1e-6
C3D15 a9 0.99999 -1.0e-5 -1.0e-5 to -9.1e-6
C3D8R, C3D4, C3D6 (copy, a2) 1 0 (field not in the element’s space)

A CPS4 square under uniaxial stress 10 and an S8R plate under a membrane stress 10 print 9.99960E+00 at their nodes too: their expanded C3D8 and C3D20R elements use a8.

gen.py: writes the decks of the table (one element per type, all nodes prescribed)
# One element of each solid type, every node prescribed by u = (1e-3*(10*x + f*x*z), 0, 0), nu = 0, E = 1e6:
# f = 0: uniform sxx = 1e4;  f = 1: sxx = 1e4 + 1e3*z, szx = 500*x
import sys, os
out = sys.argv[1]
hexc = [(0,0,0),(1,0,0),(1,1,0),(0,1,0),(0,0,1),(1,0,1),(1,1,1),(0,1,1)]
edges20 = [(1,2),(2,3),(3,4),(4,1),(5,6),(6,7),(7,8),(8,5),(1,5),(2,6),(3,7),(4,8)]
tetc = [(0,0,0),(1,0,0),(0,1,0),(0,0,1)]
edges10 = [(1,2),(2,3),(3,1),(1,4),(2,4),(3,4)]
wedc = [(0,0,0),(1,0,0),(0,1,0),(0,0,1),(1,0,1),(0,1,1)]
edges15 = [(1,2),(2,3),(3,1),(4,5),(5,6),(6,4),(1,4),(2,5),(3,6)]
def mid(c, e): return [tuple((c[a-1][k]+c[b-1][k])/2 for k in range(3)) for a,b in e]
types = {'C3D8':hexc,'C3D8I':hexc,'C3D8R':hexc,'C3D20R':hexc+mid(hexc,edges20),'C3D20':hexc+mid(hexc,edges20),
         'C3D10':tetc+mid(tetc,edges10),'C3D4':tetc,'C3D15':wedc+mid(wedc,edges15),'C3D6':wedc}
for f in (0,1):
    for t,c in types.items():
        L = ['** one %s, all nodes prescribed: u_x = 1e-3*(10*x + %d*x*z), u_y = u_z = 0; E = 1e6, nu = 0' % (t,f), '*NODE, NSET=NALL']
        L += ['%d, %g, %g, %g' % (i+1,*p) for i,p in enumerate(c)]
        ids=[str(i+1) for i in range(len(c))]
        L += ['*ELEMENT, TYPE=%s, ELSET=EALL' % t, '1, ' + ', '.join(ids[:15]) + (',' if len(ids)>15 else '')]
        if len(ids)>15: L.append(', '.join(ids[15:]))
        L += ['*MATERIAL, NAME=MAT','*ELASTIC','1.e6, 0.','*SOLID SECTION, ELSET=EALL, MATERIAL=MAT','*STEP','*STATIC','*BOUNDARY']
        for i,(x,y,z) in enumerate(c):
            L.append('%d, 1, 1, %.12g' % (i+1, 1e-3*(10*x + f*x*z)))
            L.append('%d, 2, 3, 0.' % (i+1))
        L += ['*EL PRINT, ELSET=EALL','S','*EL FILE','S','*END STEP']
        open(os.path.join(out, '%s_f%d.inp' % (t.lower(), f)), 'w').write('\n'.join(L)+'\n')

extrap_linear.inp above is its c3d8_f1.inp.

Where it goes wrong

src/extrapolate.f on master:

  • lines 148-158: data a8 with 2.549, -.683, .183, -.04904 (row sum 0.99996). It is used for 20R, 8 and 8I elements at lines 760-781 and 879-900.
  • line 105: data a4 (C3D10) with 1.92705 and -0.30902 (row sum 0.99999). The exact values are √5 (1 - b) = 1.9270509831 and -√5 b = -0.3090169944, with b = 0.1381966011 the tetrahedral point coordinate.
  • line 126: data a9 (C3D15), and from line 196 data a27 (C3D20): five-digit constants, row sums 0.99999 and 0.99996 to 1.00005.

src/extrapolate_se.f (line 149, sensitivity output) and src/beamextscheme.f (line 38) carry the same a8.

Fix

Type the constants with full precision. For a8 the exact values are

 2.549038105676658d0   ((1+sqrt(3))/2)**3
-0.6830127018922193d0  ((1+sqrt(3))/2)**2 * (1-sqrt(3))/2
 0.1830127018922193d0  (1+sqrt(3))/2 * ((1-sqrt(3))/2)**2
-0.04903810567665797d0 ((1-sqrt(3))/2)**3

in the same positions. For a4: 1.927050983124842d0 and -0.3090169943749474d0. a9 and a27 would best be regenerated from the shape functions, or computed once at run time.

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

   total surface force (fx,fy,fz) and moment about the origin(mx,my,mz)

    9.999600E+00 -1.865709E-14 -5.839107E-15  7.695169E-16  4.999800E+00 -4.999800E+00
1 Like

Posted: Extrapolated nodal values (S, E, ENER, *SECTION PRINT) of C3D8, C3D8I, C3D20R and expanded 2-D/shell elements are 4e-5 low: the 2x2x2 table in extrapolate.f has 4-digit constants · Issue #319 · Dhondtguido/CalculiX · GitHub

1 Like