Benchmarks with the penalty and the null-space connections#

References. M. Stamatelos and G. Labeas, see stamatelos_labeas_2023_multidomain; the DCB references, see the validation summary.

The panels models of the benchmark notebooks are compared with the two methods of imposing the multidomain connections, see Exact connections with the null-space method:

  • penalty: conn_method='penalty', the penalty stiffnesses used by the notebooks, raised 100 times for the 'SSxcte' edges of the DCB, see dcb_utils.build_dcb, and the default calc_kt_kr constant for the 'SB' bond;

  • null-space: conn_method='null-space', the 'SSxcte', 'SSycte', 'BFxcte', 'BFycte' and 'SB' connections imposed exactly.

The cohesive zone 'SB_TSL' and the prescribed displacements of the arms are penalty stiffnesses in both cases. All the models use the classical laminated plate theory (CLPT).

The null-space results are produced by conn_method_study.py, which takes the cases, discretisations and openings from the DCB notebooks themselves, and saves them in results/conn_methods/; the penalty results of the DCB cases are the results of the notebooks, results/*.npz. The cases and openings are those of the current notebooks.

The run times of both methods, the fields time and cpu_time of results/*.npz and results/conn_methods/null_space/*.npz, the profile of the cost, results/conn_methods/profile.json, and the run times of the Stamatelos notebook were measured in one job on one node of a computing cluster, under the same conditions for both methods: one run at a time, each in its own process, with one BLAS thread (the field evaluations of panels use their own threads, out_num_cores, with both methods), the penalty runs first and the null-space runs after them. The run time time is the wall time of dcb_utils.solve_dcb.

To compute the results again, after the results of the DCB notebooks (python notebooks/dcb_mode_I_validation_rerun.py run --jobs 1), delete results/conn_methods/null_space/*.npz and results/conn_methods/profile.json and run, from the root of the repository:

python notebooks/conn_method_study.py run --jobs 1 --methods null-space
python notebooks/conn_method_study.py compliance
python notebooks/conn_method_study.py profile
python notebooks/conn_method_study.py stamatelos
[1]:
%matplotlib inline
import json
import os
import sys

import numpy as np
import matplotlib.pyplot as plt
from IPython.display import Markdown, display

sys.path.insert(0, os.path.abspath('.'))
import dcb_utils as du
import conn_method_study as study

R = 'results'
OUT = os.path.join(R, 'conn_methods')
# the DCB cases, discretisations and openings of the current notebooks
jobs, compliances = study.collect()
jobs = sorted(jobs, key=lambda j: (j['notebook'], j['name']))


def load(path):
    if not os.path.exists(path):
        return None
    r = du.load(path)
    return r if len(r['delta']) else None


def curve(r):
    return np.r_[0., r['delta']], np.r_[0., r['P']]


def complete(r, job):
    return r is not None and np.isclose(r['delta'][-1], job['openings'][-1])


pct = lambda a, b: 100*(a/b - 1)
res = {j['name']: dict(penalty=load(os.path.join(R, j['name'] + '.npz')),
                       null=load(os.path.join(study.method_dir('null-space'), j['name'] + '.npz')))
       for j in jobs}
print('%d DCB cases: %s' % (len(jobs), ', '.join(j['name'] for j in jobs)))

17 DCB cases: alfano2001_TableII_XAS913C, alfano2001_TableI_to1.7, alfano2001_TableI_to1.7_K1e5, alfano2001_TableI_to57, camanho2003_DCB_AS4PEEK, krueger2008_DCB_MD_tau40, krueger2008_DCB_MD_tau60, krueger2008_DCB_UD_tau40, krueger2008_DCB_UD_tau60, tijs2022_a40_G0.95, tijs2022_a48, tijs2023_full_weld, tijs2023_weld_center, tijs2023_weld_center_autoclave, tijs2023_weld_center_standard, turon2007_le0.125_tau60, turon2007_le0.125_tau60_K1e6

DCB: peak loads#

Both methods. For each case: the peak load \(P_{max}\) and the initial stiffness \(K_0\) of dcb_utils.summary, the crack growth \(\Delta a\) at the last opening, the number of bisections of the increments and the run time, measured with both methods under the same conditions, see above and Measured wall times. The differences are those of the null-space method with respect to the penalty method. Runs not yet complete show the openings reached and the peak of those openings, marked with *.

[2]:
rows = ['| case | openings | penalty $P_{max}$ (N) | null-space $P_{max}$ (N) | diff. (%) '
        '| $K_0$ diff. (%) | $\\Delta a$ penalty / null-space (mm) | bisections | time penalty / null-space (min) |',
        '|---|---|---|---|---|---|---|---|---|']
table = {}
for j in jobs:
    name, n = j['name'], len(j['openings'])
    rp, rn = res[name]['penalty'], res[name]['null']
    sp = du.summary(*curve(rp))
    sn = du.summary(*curve(rn)) if rn is not None else None
    done = complete(rn, j)
    table[name] = dict(penalty=sp, null=sn, done=done)
    k = 0 if rn is None else len(rn['delta'])
    Pn = '-' if sn is None else '%.2f%s' % (sn['Pmax'], '' if done else '*')
    dP = '%+.3f' % pct(sn['Pmax'], sp['Pmax']) if done else '-'
    dK = '%+.3f' % pct(sn['K0'], sp['K0']) if done else '-'
    da = '%.1f / %s' % (rp['a'][-1] - j['case']['a0'], '-' if rn is None else '%.1f' % (rn['a'][-1] - j['case']['a0']))
    bis = '%d / %s' % (rp['failed'], '-' if rn is None else '%d' % rn['failed'])
    tt = '%.1f / %s' % (float(rp['time'])/60, '-' if rn is None else '%.1f' % (float(rn['time'])/60))
    rows.append(f"| {name} | {k} of {n} | {sp['Pmax']:.2f} | {Pn} | {dP} | {dK} | {da} | {bis} | {tt} |")
display(Markdown('\n'.join(rows)))

case

openings

penalty \(P_{max}\) (N)

null-space \(P_{max}\) (N)

diff. (%)

\(K_0\) diff. (%)

\(\Delta a\) penalty / null-space (mm)

bisections

time penalty / null-space (min)

alfano2001_TableII_XAS913C

60 of 60

93.56

93.62

+0.065

+0.131

9.1 / 9.1

0 / 0

18.3 / 20.2

alfano2001_TableI_to1.7

40 of 40

50.78

50.78

+0.002

+0.066

6.0 / 6.0

0 / 0

14.4 / 14.9

alfano2001_TableI_to1.7_K1e5

40 of 40

50.81

50.81

+0.003

+0.066

6.0 / 6.0

0 / 0

17.2 / 16.0

alfano2001_TableI_to57

60 of 60

64.46

64.45

-0.026

+0.130

9.0 / 9.0

0 / 0

16.4 / 17.1

camanho2003_DCB_AS4PEEK

60 of 60

140.08

140.08

+0.005

+0.123

7.4 / 7.4

0 / 0

15.8 / 14.7

krueger2008_DCB_MD_tau40

60 of 60

108.69

108.65

-0.033

+0.154

7.1 / 7.1

0 / 0

11.6 / 11.9

krueger2008_DCB_MD_tau60

60 of 60

109.97

109.96

-0.004

+0.161

9.9 / 9.9

0 / 0

15.4 / 16.5

krueger2008_DCB_UD_tau40

60 of 60

63.52

63.49

-0.038

+0.130

8.5 / 8.5

0 / 0

14.1 / 14.8

krueger2008_DCB_UD_tau60

60 of 60

64.24

64.23

-0.008

+0.133

9.9 / 9.9

0 / 0

20.3 / 21.5

tijs2022_a40_G0.95

60 of 60

182.07

182.04

-0.018

+0.304

10.6 / 10.6

0 / 0

15.2 / 15.9

tijs2022_a48

60 of 60

166.23

166.22

-0.006

+0.115

10.1 / 10.1

0 / 0

14.9 / 14.8

tijs2023_full_weld

60 of 60

147.97

147.98

+0.009

+0.131

4.9 / 5.2

0 / 0

14.7 / 14.2

tijs2023_weld_center

60 of 60

119.19

119.14

-0.039

+0.357

5.5 / 5.5

0 / 0

12.2 / 12.4

tijs2023_weld_center_autoclave

60 of 60

87.88

87.88

+0.000

+0.156

8.2 / 8.2

0 / 0

16.1 / 14.7

tijs2023_weld_center_standard

60 of 60

114.99

114.98

-0.008

+0.151

5.8 / 5.8

0 / 0

11.8 / 12.6

turon2007_le0.125_tau60

60 of 60

64.02

64.04

+0.020

+0.098

11.1 / 11.1

0 / 0

16.8 / 17.6

turon2007_le0.125_tau60_K1e6

60 of 60

64.13

64.14

+0.011

+0.098

4.4 / 4.4

0 / 0

12.3 / 13.1

DCB: load-opening curves#

The difference between the curves is the largest difference of the load at the same opening, relative to the peak load of the penalty method, before and after the peak.

[3]:
rows = ['| case | openings compared | before the peak, max. $|P_{null} - P_{pen}|/P_{max}$ (%) | after the peak (%) |',
        '|---|---|---|---|']
for j in jobs:
    rp, rn = res[j['name']]['penalty'], res[j['name']]['null']
    if rn is None:
        continue
    k = len(rn['P'])
    ipk = int(np.argmax(rp['P']))
    d = 100*np.abs(rn['P'] - rp['P'][:k])/rp['P'].max()
    pre = d[:min(ipk + 1, k)].max()
    post = '%.3f' % d[ipk + 1:].max() if k > ipk + 1 else '-'
    rows.append(f"| {j['name']} | {k} of {len(rp['P'])} | {pre:.3f} | {post} |")
display(Markdown('\n'.join(rows)))

case

openings compared

before the peak, max. \(|P_{null} - P_{pen}|/P_{max}\) (%)

after the peak (%)

alfano2001_TableII_XAS913C

60 of 60

0.103

0.067

alfano2001_TableI_to1.7

40 of 40

0.043

0.032

alfano2001_TableI_to1.7_K1e5

40 of 40

0.042

0.032

alfano2001_TableI_to57

60 of 60

0.102

0.089

camanho2003_DCB_AS4PEEK

60 of 60

0.096

0.147

krueger2008_DCB_MD_tau40

60 of 60

0.112

0.129

krueger2008_DCB_MD_tau60

60 of 60

0.120

0.068

krueger2008_DCB_UD_tau40

60 of 60

0.101

0.085

krueger2008_DCB_UD_tau60

60 of 60

0.107

0.082

tijs2022_a40_G0.95

60 of 60

0.105

0.064

tijs2022_a48

60 of 60

0.091

0.132

tijs2023_full_weld

60 of 60

0.096

0.064

tijs2023_weld_center

60 of 60

0.111

0.146

tijs2023_weld_center_autoclave

60 of 60

0.116

0.083

tijs2023_weld_center_standard

60 of 60

0.113

0.105

turon2007_le0.125_tau60

60 of 60

0.079

0.067

turon2007_le0.125_tau60_K1e6

60 of 60

0.079

0.054

[4]:
n = len(jobs)
ncol = 4
fig, axes = plt.subplots(int(np.ceil(n/ncol)), ncol, figsize=(15, 3.2*np.ceil(n/ncol)),
                         constrained_layout=True)
for ax, j in zip(axes.ravel(), jobs):
    rp, rn = res[j['name']]['penalty'], res[j['name']]['null']
    ax.plot(*curve(rp), color='k', lw=1.5, label='penalty')
    if rn is not None:
        ax.plot(*curve(rn), color='C3', lw=1.2, ls='--', label='null-space')
    ax.set_title(j['name'], fontsize=9)
    ax.set_xlabel(r'$\delta$ (mm)', fontsize=8)
    ax.set_ylabel('$P$ (N)', fontsize=8)
    ax.tick_params(labelsize=7)
    ax.grid(True, alpha=0.3)
axes.ravel()[0].legend(fontsize=7)
for ax in axes.ravel()[n:]:
    ax.axis('off')
plt.show()
../_images/notebooks_conn_method_comparison_6_0.png

DCB: elastic compliances#

dcb_utils.elastic_compliance of dcb_lecinana2023.ipynb and of the calibration of dcb_tijs2023_phd.ipynb, a single opening well below the damage onset.

[5]:
path = os.path.join(OUT, 'compliance.json')
if os.path.exists(path):
    comp = json.load(open(path))
    rows = ['| notebook | $a_0$ (mm) | penalty (mm/N) | null-space (mm/N) | diff. (%) |', '|---|---|---|---|---|']
    for c in comp:
        rows.append(f"| {c['notebook']} | {c['a0']:.2f} | {c['penalty']:.6f} | {c['null-space']:.6f} "
                    f"| {pct(c['null-space'], c['penalty']):+.3f} |")
    display(Markdown('\n'.join(rows)))

notebook

\(a_0\) (mm)

penalty (mm/N)

null-space (mm/N)

diff. (%)

dcb_tijs2023_phd.ipynb

30.00

0.007848

0.007833

-0.186

dcb_tijs2023_phd.ipynb

35.00

0.012259

0.012239

-0.162

dcb_tijs2023_phd.ipynb

40.00

0.018076

0.018050

-0.144

dcb_tijs2023_phd.ipynb

45.00

0.025492

0.025459

-0.129

dcb_tijs2023_phd.ipynb

30.00

0.012343

0.012317

-0.208

dcb_tijs2023_phd.ipynb

35.00

0.019270

0.019235

-0.182

dcb_tijs2023_phd.ipynb

40.00

0.028417

0.028372

-0.161

dcb_tijs2023_phd.ipynb

45.00

0.040097

0.040039

-0.145

dcb_tijs2023_phd.ipynb

30.00

0.023891

0.023843

-0.200

dcb_tijs2023_phd.ipynb

35.00

0.037480

0.037415

-0.174

dcb_tijs2023_phd.ipynb

40.00

0.055445

0.055360

-0.154

dcb_tijs2023_phd.ipynb

45.00

0.078399

0.078290

-0.139

dcb_lecinana2023.ipynb

32.05

0.009551

0.009535

-0.173

dcb_lecinana2023.ipynb

33.40

0.010763

0.010745

-0.167

dcb_lecinana2023.ipynb

35.93

0.013301

0.013281

-0.156

dcb_lecinana2023.ipynb

38.05

0.015713

0.015690

-0.148

dcb_lecinana2023.ipynb

42.97

0.022398

0.022368

-0.133

DCB: computational cost#

The wall times of the runs, measured with both methods under the same conditions, are compared in Measured wall times below. The cost is also measured by component, with python notebooks/conn_method_study.py profile (profile_case and profile_panels, saved in results/conn_methods/profile.json), after the runs, in the same job and with the same settings of the threads:

  • each component of a Newton-Raphson iteration of dcb_utils.solve_dcb is timed for each case, with both methods one after the other, at the linear solution at the opening of the stored peak load, where the damage grows ahead of the crack tip;

  • kT_pan is the tangent stiffness of the panels, calc_kT, with the nonlinear terms of CLPT, timed once; residual is get_kC_conn plus calc_fint; kT_TSL the damage-rate stiffness of the cohesive zone; reduce the product \(\boldsymbol{Z}^\top \boldsymbol{K} \boldsymbol{Z}\), the sum of the matrices and the products of the vectors by \(\boldsymbol{Z}\); solve the sparse solution of structsolve.solve; Z the construction of the null-space basis, once per run; the components other than kT_pan are the median of 3 repetitions.

The cost of a run follows from these timings and from the number of calls of each component, given by the iterations of each opening and the rules of solve_dcb, see conn_method_study.iteration_counts and conn_method_study.predicted_cost.

[6]:
PR = json.load(open(os.path.join(OUT, 'profile.json')))
IT = PR['iterations']
names = sorted(j['name'] for j in jobs)
missing = [nm for nm in names if nm + '|penalty' not in IT or nm + '|null-space' not in IT]
if missing:
    print('not in profile.json, skipped in the cost tables:', ', '.join(missing))
names = [nm for nm in names if nm not in missing]
bond = {j['name']: j['case'].get('bond_width') for j in jobs}
per_res = lambda t: t['kC_conn'] + t['fint']
per_red = lambda t: t['reduce'] + t['sum'] + t['vec']
rest = lambda t: per_res(t) + t['kT_TSL'] + per_red(t) + t['solve']
rows = ['| case | unknowns penalty / null-space | nonzeros of the system (M) | `Z` (s) | `kT_pan` penalty / null-space (s) '
        '| `residual` (s) | `kT_TSL` (s) | `reduce` (s) | `solve` (s) | iteration without `kT_pan` (s) | diff. (%) |',
        '|---|---|---|---|---|---|---|---|---|---|---|']
for name in names:
    p, n = IT[name + '|penalty'], IT[name + '|null-space']
    tp, tn = p['t'], n['t']
    rows.append(f"| {name} | {p['size']} / {n['size_r']} | {p['nnz_k0']/1e6:.2f} / {n['nnz_k0']/1e6:.2f} | {n['t_Z']:.3f} "
                f"| {tp['kT_pan']:.1f} / {tn['kT_pan']:.1f} | {per_res(tp):.2f} / {per_res(tn):.2f} "
                f"| {tp['kT_TSL']:.2f} / {tn['kT_TSL']:.2f} | - / {per_red(tn):.3f} | {tp['solve']:.2f} / {tn['solve']:.2f} "
                f"| {rest(tp):.2f} / {rest(tn):.2f} | {pct(rest(tn), rest(tp)):+.1f} |")
display(Markdown('\n'.join(rows)))
kTs = np.array([[IT[nm + '|' + m]['t']['kT_pan'] for m in ('penalty', 'null-space')] for nm in names])
print('kT_pan: %.1f to %.1f s; null-space / penalty %.3f to %.3f, the same computation, timed once'
      % (kTs.min(), kTs.max(), (kTs[:, 1]/kTs[:, 0]).min(), (kTs[:, 1]/kTs[:, 0]).max()))

case

unknowns penalty / null-space

nonzeros of the system (M)

Z (s)

kT_pan penalty / null-space (s)

residual (s)

kT_TSL (s)

reduce (s)

solve (s)

iteration without kT_pan (s)

diff. (%)

alfano2001_TableII_XAS913C

2268 / 1948

2.14 / 2.00

0.027

5.0 / 5.1

0.81 / 0.82

0.58 / 0.61

  • / 0.109

0.44 / 0.37

1.86 / 1.90

+2.2

alfano2001_TableI_to1.7

2184 / 2104

2.69 / 2.62

0.008

8.8 / 8.6

0.77 / 0.71

0.42 / 0.41

  • / 0.119

0.53 / 0.46

1.74 / 1.70

-2.8

alfano2001_TableI_to1.7_K1e5

2184 / 2104

2.69 / 2.62

0.008

9.1 / 8.5

0.66 / 0.60

0.33 / 0.31

  • / 0.124

0.58 / 0.47

1.60 / 1.51

-5.8

alfano2001_TableI_to57

2268 / 1948

2.14 / 2.01

0.029

5.0 / 4.9

0.79 / 0.68

0.51 / 0.54

  • / 0.107

0.45 / 0.33

1.78 / 1.66

-6.8

camanho2003_DCB_AS4PEEK

2268 / 1948

2.14 / 1.99

0.027

5.2 / 5.1

0.58 / 0.53

0.33 / 0.32

  • / 0.098

0.44 / 0.29

1.38 / 1.24

-10.4

krueger2008_DCB_MD_tau40

2268 / 1948

2.19 / 2.04

0.027

5.2 / 5.3

0.49 / 0.46

0.27 / 0.26

  • / 0.104

0.47 / 0.33

1.26 / 1.15

-8.9

krueger2008_DCB_MD_tau60

2268 / 1948

2.19 / 2.04

0.029

5.1 / 5.1

0.70 / 0.63

0.44 / 0.43

  • / 0.117

0.53 / 0.33

1.70 / 1.51

-11.2

krueger2008_DCB_UD_tau40

2268 / 1948

2.14 / 2.00

0.028

5.0 / 5.0

0.63 / 0.58

0.39 / 0.39

  • / 0.095

0.44 / 0.33

1.49 / 1.39

-6.2

krueger2008_DCB_UD_tau60

2268 / 1948

2.14 / 2.00

0.027

5.0 / 5.0

0.91 / 0.87

0.68 / 0.73

  • / 0.113

0.43 / 0.33

2.05 / 2.05

-0.3

tijs2022_a40_G0.95

2268 / 1948

2.14 / 2.02

0.027

5.1 / 5.0

0.66 / 0.59

0.41 / 0.38

  • / 0.095

0.40 / 0.32

1.50 / 1.39

-7.4

tijs2022_a48

2268 / 1948

2.14 / 2.05

0.030

5.3 / 5.3

0.61 / 0.58

0.36 / 0.37

  • / 0.104

0.46 / 0.33

1.47 / 1.39

-5.2

tijs2023_full_weld

2268 / 1948

2.19 / 2.04

0.028

5.0 / 5.1

1.04 / 1.00

0.19 / 0.19

  • / 0.099

0.44 / 0.30

1.71 / 1.59

-6.7

tijs2023_weld_center

2268 / 1948

2.19 / 2.08

0.026

5.1 / 5.1

0.51 / 0.45

0.26 / 0.25

  • / 0.105

0.46 / 0.32

1.26 / 1.13

-10.4

tijs2023_weld_center_autoclave

2268 / 1948

2.19 / 2.08

0.028

5.2 / 5.3

0.58 / 0.56

0.35 / 0.34

  • / 0.112

0.48 / 0.37

1.43 / 1.38

-3.8

tijs2023_weld_center_standard

2268 / 1948

2.19 / 2.08

0.029

5.2 / 5.3

0.50 / 0.47

0.26 / 0.26

  • / 0.113

0.45 / 0.33

1.24 / 1.18

-4.9

turon2007_le0.125_tau60

2268 / 1948

2.14 / 2.02

0.033

5.1 / 5.3

0.70 / 0.69

0.45 / 0.48

  • / 0.103

0.46 / 0.36

1.63 / 1.63

-0.0

turon2007_le0.125_tau60_K1e6

2268 / 1948

2.14 / 2.01

0.028

5.1 / 5.1

0.59 / 0.56

0.36 / 0.35

  • / 0.094

0.42 / 0.31

1.40 / 1.31

-6.3

kT_pan: 4.9 to 9.1 s; null-space / penalty 0.938 to 1.034, the same computation, timed once

The tangent of the panels is computed by numerical integration of the nonlinear CLPT terms, fkC_num and fkG_num, on the default max(2m - 1, 7) by max(2n - 1, 7) points of panels.shell.gauss_points. Its cost grows as \(n_x n_y (3 m n)^2\), so that it comes almost entirely from the two cohesive-zone panels, which have the largest numbers of terms:

[7]:
for name, pans in PR['panels'].items():
    tot = sum(r['t_kC'] + r['t_kG'] for r in pans)
    rows = [f'**{name}**', '', '| panel | terms $m \\times n$ | points $n_x \\times n_y$ | `calc_kC` (s) | `calc_kG` (s) | share (%) |',
            '|---|---|---|---|---|---|']
    for r in pans:
        kind = 'cohesive zone' if r['tsl'] else 'arm / bonded'
        rows.append(f"| {r['group']}, {kind}, a = {r['a']:.1f} mm | {r['m']} x {r['n']} | {r['nx']} x {r['ny']} "
                    f"| {r['t_kC']:.2f} | {r['t_kG']:.2f} | {100*(r['t_kC'] + r['t_kG'])/tot:.1f} |")
    display(Markdown('\n'.join(rows)))
p = IT['turon2007_le0.125_tau60|penalty']
print('cProfile of one iteration without kT_pan, turon2007_le0.125_tau60, penalty:')
print('\n'.join(p['cprofile'].splitlines()[:22]))

alfano2001_TableI_to57

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 51.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

bot, cohesive zone, a = 18.7 mm

25 x 10

49 x 19

2.04

0.22

47.2

bot, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 51.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 18.7 mm

25 x 10

49 x 19

2.14

0.22

49.4

top, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

alfano2001_TableII_XAS913C

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 51.6 mm

8 x 8

15 x 15

0.04

0.01

0.9

bot, cohesive zone, a = 18.4 mm

25 x 10

49 x 19

2.25

0.23

48.3

bot, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, arm / bonded, a = 51.6 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 18.4 mm

25 x 10

49 x 19

2.25

0.23

48.3

top, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

alfano2001_TableI_to1.7

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, cohesive zone, a = 70.0 mm

30 x 10

59 x 19

3.69

0.41

48.0

bot, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.5

top, cohesive zone, a = 70.0 mm

30 x 10

59 x 19

3.94

0.41

50.9

top, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.5

alfano2001_TableI_to1.7_K1e5

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, cohesive zone, a = 70.0 mm

30 x 10

59 x 19

3.82

0.39

49.5

bot, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.5

top, cohesive zone, a = 70.0 mm

30 x 10

59 x 19

3.81

0.40

49.5

top, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.5

camanho2003_DCB_AS4PEEK

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 50.3 mm

8 x 8

15 x 15

0.03

0.00

0.8

bot, cohesive zone, a = 18.8 mm

25 x 10

49 x 19

2.10

0.24

47.6

bot, arm / bonded, a = 32.9 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 50.3 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, cohesive zone, a = 18.8 mm

25 x 10

49 x 19

2.18

0.22

49.0

top, arm / bonded, a = 32.9 mm

8 x 8

15 x 15

0.04

0.01

0.8

krueger2008_DCB_UD_tau40

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 101.1 mm

8 x 8

15 x 15

0.04

0.01

0.8

bot, cohesive zone, a = 18.9 mm

25 x 10

49 x 19

2.14

0.22

48.3

bot, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, arm / bonded, a = 101.1 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, cohesive zone, a = 18.9 mm

25 x 10

49 x 19

2.14

0.22

48.3

top, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

krueger2008_DCB_UD_tau60

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 101.1 mm

8 x 8

15 x 15

0.04

0.01

0.8

bot, cohesive zone, a = 18.9 mm

25 x 10

49 x 19

2.14

0.22

48.3

bot, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, arm / bonded, a = 101.1 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, cohesive zone, a = 18.9 mm

25 x 10

49 x 19

2.15

0.22

48.3

top, arm / bonded, a = 30.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

krueger2008_DCB_MD_tau40

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 125.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

bot, cohesive zone, a = 21.8 mm

25 x 10

49 x 19

2.30

0.24

48.4

bot, arm / bonded, a = 31.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 125.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 21.8 mm

25 x 10

49 x 19

2.29

0.24

48.2

top, arm / bonded, a = 31.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

krueger2008_DCB_MD_tau60

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 125.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

bot, cohesive zone, a = 21.8 mm

25 x 10

49 x 19

2.18

0.22

48.0

bot, arm / bonded, a = 31.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, arm / bonded, a = 125.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, cohesive zone, a = 21.8 mm

25 x 10

49 x 19

2.21

0.22

48.5

top, arm / bonded, a = 31.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

tijs2022_a48

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 28.0 mm

8 x 8

15 x 15

0.03

0.00

0.8

bot, cohesive zone, a = 24.0 mm

25 x 10

49 x 19

2.06

0.22

47.3

bot, arm / bonded, a = 48.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 28.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 24.0 mm

25 x 10

49 x 19

2.15

0.23

49.3

top, arm / bonded, a = 48.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

tijs2022_a40_G0.95

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 36.0 mm

8 x 8

15 x 15

0.03

0.01

0.8

bot, cohesive zone, a = 24.0 mm

25 x 10

49 x 19

2.14

0.22

48.3

bot, arm / bonded, a = 40.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, arm / bonded, a = 36.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, cohesive zone, a = 24.0 mm

25 x 10

49 x 19

2.14

0.22

48.3

top, arm / bonded, a = 40.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

tijs2023_full_weld

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.03

0.01

0.8

bot, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.13

0.22

48.1

bot, arm / bonded, a = 44.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.15

0.22

48.5

top, arm / bonded, a = 44.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

tijs2023_weld_center

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.03

0.01

0.8

bot, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.12

0.22

48.0

bot, arm / bonded, a = 36.2 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.15

0.22

48.7

top, arm / bonded, a = 36.2 mm

8 x 8

15 x 15

0.04

0.01

0.9

tijs2023_weld_center_standard

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.04

0.01

0.8

bot, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.26

0.23

48.5

bot, arm / bonded, a = 36.2 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.24

0.23

48.2

top, arm / bonded, a = 36.2 mm

8 x 8

15 x 15

0.04

0.01

0.9

tijs2023_weld_center_autoclave

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

bot, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.26

0.23

48.3

bot, arm / bonded, a = 36.2 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 78.3 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 21.7 mm

25 x 10

49 x 19

2.26

0.23

48.3

top, arm / bonded, a = 36.2 mm

8 x 8

15 x 15

0.04

0.01

0.9

turon2007_le0.125_tau60

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 71.4 mm

8 x 8

15 x 15

0.04

0.01

0.8

bot, cohesive zone, a = 23.6 mm

25 x 10

49 x 19

2.20

0.30

48.1

bot, arm / bonded, a = 55.0 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, arm / bonded, a = 71.4 mm

8 x 8

15 x 15

0.04

0.01

0.9

top, cohesive zone, a = 23.6 mm

25 x 10

49 x 19

2.28

0.23

48.5

top, arm / bonded, a = 55.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

turon2007_le0.125_tau60_K1e6

panel

terms \(m \times n\)

points \(n_x \times n_y\)

calc_kC (s)

calc_kG (s)

share (%)

bot, arm / bonded, a = 81.7 mm

8 x 8

15 x 15

0.03

0.00

0.8

bot, cohesive zone, a = 13.3 mm

25 x 10

49 x 19

2.17

0.22

48.7

bot, arm / bonded, a = 55.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, arm / bonded, a = 81.7 mm

8 x 8

15 x 15

0.04

0.01

0.8

top, cohesive zone, a = 13.3 mm

25 x 10

49 x 19

2.14

0.22

48.0

top, arm / bonded, a = 55.0 mm

8 x 8

15 x 15

0.04

0.01

0.8

cProfile of one iteration without kT_pan, turon2007_le0.125_tau60, penalty:
         20752 function calls (20716 primitive calls) in 1.661 seconds

   Ordered by: internal time
   List reduced from 336 to 12 due to restriction <12>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.400    0.400    0.400    0.400 {built-in method scipy.sparse.linalg._dsolve._superlu.gssv}
        1    0.314    0.314    0.493    0.493 multidomain.py:4820(calc_kT_TSL)
        1    0.274    0.274    0.285    0.285 multidomain.py:4748(_kC_TSL)
        4    0.156    0.039    0.167    0.042 multidomain.py:2335(uvw)
        4    0.134    0.033    0.134    0.033 {built-in method scipy.sparse._sparsetools.csr_sort_indices}
        6    0.124    0.021    0.126    0.021 shell.py:3757(calc_fint)
       16    0.043    0.003    0.043    0.003 {built-in method scipy.sparse._sparsetools.coo_tocsr}
        1    0.027    0.027    0.035    0.035 sparseutils.py:96(make_symmetric)
       17    0.026    0.002    0.026    0.002 {built-in method scipy.sparse._sparsetools.csr_plus_csr}
      336    0.020    0.000    0.020    0.000 {method 'reduce' of 'numpy.ufunc' objects}
        1    0.020    0.020    0.025    0.025 sparseutils.py:78(_used_cols)
        3    0.017    0.006    0.017    0.006 {method 'repeat' of 'numpy.ndarray' objects}


Cost of the runs#

For each case, the cost of the runs is predicted at the openings reached by the null-space run, from its iterations and from those of the penalty run at the same openings. The tangent of the panels is given the mean of the timings of the two methods, since it is the same computation. The column same iterations uses the iterations of the penalty run for both methods, which isolates the cost of an iteration from the number of iterations.

[8]:
COMP = ('kT_pan', 'residual', 'kT_TSL', 'solve', 'reduce', 'setup', 'opening')
def trunc(r, k):
    return {kk: (np.asarray(v)[:k] if np.ndim(v) else v) for kk, v in r.items()}

pred = {}
rows = ['| case | openings | iterations penalty / null-space | `kT_pan` calls penalty / null-space '
        '| penalty (h) | null-space (h) | diff. (%) | same iterations, diff. (%) | `kT_pan` share (%) |',
        '|---|---|---|---|---|---|---|---|---|']
for name in names:
    rp, rn = res[name]['penalty'], res[name]['null']
    if rn is None:
        continue
    k = len(rn['iters'])
    rp = trunc(rp, k)
    kT = 0.5*(IT[name + '|penalty']['t']['kT_pan'] + IT[name + '|null-space']['t']['kT_pan'])
    npn, nnn = study.iteration_counts(rp, bond[name]), study.iteration_counts(rn, bond[name])
    cp = study.predicted_cost(IT[name + '|penalty'], npn, kT)
    cn = study.predicted_cost(IT[name + '|null-space'], nnn, kT)
    cs = study.predicted_cost(IT[name + '|null-space'], npn, kT)
    pred[name] = dict(penalty=cp, null=cn, k=k)
    Tp, Tn, Ts = (sum(c.values()) for c in (cp, cn, cs))
    rows.append(f"| {name} | {k} | {npn['iter']} / {nnn['iter']} | {npn['kT_pan']} / {nnn['kT_pan']} "
                f"| {Tp/3600:.2f} | {Tn/3600:.2f} | {pct(Tn, Tp):+.1f} | {pct(Ts, Tp):+.2f} | {100*cp['kT_pan']/Tp:.1f} |")
display(Markdown('\n'.join(rows)))

fig, ax = plt.subplots(figsize=(10, 0.45*2*len(pred) + 1), constrained_layout=True)
labels, y = [], 0
for name, d in pred.items():
    for m, key in (('penalty', 'penalty'), ('null-space', 'null')):
        left = 0.
        for i, comp in enumerate(COMP):
            v = d[key][comp]/3600
            ax.barh(y, v, left=left, color='C%d' % i, label=comp if y == 0 else None)
            left += v
        labels.append(f'{name}, {m}')
        y += 1
    y += 0.5
ax.set_yticks([i + 0.5*(i//2) for i in range(len(labels))])
ax.set_yticklabels(labels, fontsize=7)
ax.invert_yaxis()
ax.set_xlabel('predicted cost at the openings of the null-space run (h)')
ax.legend(fontsize=8, ncol=len(COMP), loc='lower center', bbox_to_anchor=(0.5, 1.0))
ax.grid(True, axis='x', alpha=0.3)
plt.show()

tot = {m: {c: sum(d[m][c] for d in pred.values()) for c in COMP} for m in ('penalty', 'null')}
rows = ['| component | penalty (%) | null-space (%) |', '|---|---|---|']
for c in COMP:
    rows.append(f"| `{c}` | {100*tot['penalty'][c]/sum(tot['penalty'].values()):.2f} | {100*tot['null'][c]/sum(tot['null'].values()):.2f} |")
display(Markdown('Share of the components in the predicted cost of all the cases above:\n\n' + '\n'.join(rows)))

case

openings

iterations penalty / null-space

kT_pan calls penalty / null-space

penalty (h)

null-space (h)

diff. (%)

same iterations, diff. (%)

kT_pan share (%)

alfano2001_TableII_XAS913C

60

200 / 208

116 / 121

0.29

0.30

+4.9

+0.97

56.9

alfano2001_TableI_to1.7

40

89 / 93

78 / 78

0.24

0.24

-0.0

-0.79

78.1

alfano2001_TableI_to1.7_K1e5

40

111 / 111

80 / 80

0.25

0.25

-1.2

-1.22

77.1

alfano2001_TableI_to57

60

192 / 192

111 / 110

0.27

0.26

-3.3

-2.83

57.7

camanho2003_DCB_AS4PEEK

60

181 / 180

114 / 113

0.25

0.24

-4.0

-3.32

66.6

krueger2008_DCB_MD_tau40

60

144 / 150

93 / 95

0.20

0.20

-0.1

-2.56

68.7

krueger2008_DCB_MD_tau60

60

179 / 179

105 / 109

0.25

0.25

-2.0

-4.22

59.6

krueger2008_DCB_UD_tau40

60

176 / 175

103 / 103

0.23

0.22

-2.5

-2.35

62.3

krueger2008_DCB_UD_tau60

60

208 / 206

115 / 117

0.30

0.30

+0.4

-0.11

53.1

tijs2022_a40_G0.95

60

184 / 186

112 / 114

0.25

0.24

-1.4

-2.83

63.1

tijs2022_a48

60

180 / 178

115 / 111

0.25

0.24

-4.3

-1.73

66.0

tijs2023_full_weld

60

145 / 150

102 / 107

0.23

0.23

+1.7

-2.31

61.9

tijs2023_weld_center

60

147 / 152

101 / 102

0.20

0.20

-1.6

-3.10

69.6

tijs2023_weld_center_autoclave

60

173 / 175

109 / 110

0.24

0.24

-0.4

-1.28

66.0

tijs2023_weld_center_standard

60

146 / 155

98 / 104

0.20

0.21

+4.4

-1.36

70.2

turon2007_le0.125_tau60

60

199 / 197

117 / 119

0.28

0.28

+0.4

-0.29

61.2

turon2007_le0.125_tau60_K1e6

60

134 / 139

97 / 101

0.20

0.21

+1.9

-1.82

67.9

../_images/notebooks_conn_method_comparison_14_1.png

Share of the components in the predicted cost of all the cases above:

component

penalty (%)

null-space (%)

kT_pan

64.61

65.86

residual

17.28

16.39

kT_TSL

7.52

7.71

solve

8.61

6.52

reduce

0.54

2.02

setup

0.00

0.00

opening

1.45

1.49

Measured wall times#

The runs of the two methods were timed under the same conditions, so that their wall times compare the methods directly. The ratio between the measured wall time and the predicted cost of each run checks the prediction from the profile, with the calls of the components of the run itself.

[9]:
rows = ['| case | iterations penalty / null-space | time penalty / null-space (min) | measured diff. (%) '
        '| predicted diff. (%) | measured / predicted, penalty / null-space |',
        '|---|---|---|---|---|---|']
meas = {}
for name in names:
    rp, rn = res[name]['penalty'], res[name]['null']
    if not complete(rn, [j for j in jobs if j['name'] == name][0]):
        continue
    kT = 0.5*(IT[name + '|penalty']['t']['kT_pan'] + IT[name + '|null-space']['t']['kT_pan'])
    cp = sum(study.predicted_cost(IT[name + '|penalty'], study.iteration_counts(rp, bond[name]), kT).values())
    cn = sum(study.predicted_cost(IT[name + '|null-space'], study.iteration_counts(rn, bond[name]), kT).values())
    meas[name] = m = dict(tp=float(rp['time']), tn=float(rn['time']), cp=cp, cn=cn)
    rows.append(f"| {name} | {int(np.sum(rp['iters']))} / {int(np.sum(rn['iters']))} | {m['tp']/60:.1f} / {m['tn']/60:.1f} "
                f"| {pct(m['tn'], m['tp']):+.1f} | {pct(cn, cp):+.1f} | {m['tp']/cp:.2f} / {m['tn']/cn:.2f} |")
TP, TN = (sum(m[k] for m in meas.values()) for k in ('tp', 'tn'))
CP, CN = (sum(m[k] for m in meas.values()) for k in ('cp', 'cn'))
rows.append(f"| all {len(meas)} cases | - | {TP/60:.1f} / {TN/60:.1f} | {pct(TN, TP):+.1f} | {pct(CN, CP):+.1f} | {TP/CP:.2f} / {TN/CN:.2f} |")
display(Markdown('\n'.join(rows)))

case

iterations penalty / null-space

time penalty / null-space (min)

measured diff. (%)

predicted diff. (%)

measured / predicted, penalty / null-space

alfano2001_TableII_XAS913C

200 / 208

18.3 / 20.2

+9.9

+4.9

1.07 / 1.12

alfano2001_TableI_to1.7

89 / 93

14.4 / 14.9

+3.4

-0.0

0.99 / 1.02

alfano2001_TableI_to1.7_K1e5

111 / 111

17.2 / 16.0

-7.2

-1.2

1.13 / 1.06

alfano2001_TableI_to57

192 / 192

16.4 / 17.1

+4.6

-3.3

1.02 / 1.11

camanho2003_DCB_AS4PEEK

181 / 180

15.8 / 14.7

-6.5

-4.0

1.07 / 1.04

krueger2008_DCB_MD_tau40

144 / 150

11.6 / 11.9

+2.4

-0.1

0.98 / 1.01

krueger2008_DCB_MD_tau60

179 / 179

15.4 / 16.5

+7.5

-2.0

1.02 / 1.12

krueger2008_DCB_UD_tau40

176 / 175

14.1 / 14.8

+4.6

-2.5

1.02 / 1.10

krueger2008_DCB_UD_tau60

208 / 206

20.3 / 21.5

+5.8

+0.4

1.13 / 1.19

tijs2022_a40_G0.95

184 / 186

15.2 / 15.9

+4.4

-1.4

1.02 / 1.08

tijs2022_a48

180 / 178

14.9 / 14.8

-0.9

-4.3

0.98 / 1.01

tijs2023_full_weld

145 / 150

14.7 / 14.2

-3.1

+1.7

1.06 / 1.01

tijs2023_weld_center

147 / 152

12.2 / 12.4

+1.0

-1.6

1.00 / 1.03

tijs2023_weld_center_autoclave

173 / 175

16.1 / 14.7

-8.9

-0.4

1.11 / 1.02

tijs2023_weld_center_standard

146 / 155

11.8 / 12.6

+6.3

+4.4

0.97 / 0.98

turon2007_le0.125_tau60

199 / 197

16.8 / 17.6

+4.9

+0.4

1.02 / 1.06

turon2007_le0.125_tau60_K1e6

134 / 139

12.3 / 13.1

+6.3

+1.9

1.02 / 1.06

all 17 cases

257.6 / 262.8

+2.0

-0.4

1.04 / 1.06

[10]:
def rng(v, f='%.1f'):
    v = np.asarray(list(v), dtype=float)
    return (f + ' to ' + f) % (v.min(), v.max())

share_kT = [100*d['penalty']['kT_pan']/sum(d['penalty'].values()) for d in pred.values()] + \
           [100*d['null']['kT_pan']/sum(d['null'].values()) for d in pred.values()]
share_tsl = [100*sum(r['t_kC'] + r['t_kG'] for r in pans if r['tsl'])/sum(r['t_kC'] + r['t_kG'] for r in pans)
             for pans in PR['panels'].values()]
P_, N_ = [IT[nm + '|penalty'] for nm in names], [IT[nm + '|null-space'] for nm in names]
fmt_pan = lambda tsl: ', '.join(sorted({'%d x %d terms integrated on %d x %d points' % (r['m'], r['n'], r['nx'], r['ny'])
                                        for pans in PR['panels'].values() for r in pans if r['tsl'] == tsl}))
removed = [p['size'] - n['size_r'] for p, n in zip(P_, N_)]
nnz = [pct(n['nnz_k0'], p['nnz_k0']) for p, n in zip(P_, N_)]
solve_ = [pct(n['t']['solve'], p['t']['solve']) for p, n in zip(P_, N_)]
red_ = [per_red(n['t']) for n in N_]
tZ = [n['t_Z'] for n in N_]
diff_same, diff = [], []
it_p = it_n = 0
for name, d in pred.items():
    rp = trunc(res[name]['penalty'], d['k'])
    kT = 0.5*(IT[name + '|penalty']['t']['kT_pan'] + IT[name + '|null-space']['t']['kT_pan'])
    npn = study.iteration_counts(rp, bond[name])
    Ts = sum(study.predicted_cost(IT[name + '|null-space'], npn, kT).values())
    Tp, Tn = sum(d['penalty'].values()), sum(d['null'].values())
    diff_same.append(pct(Ts, Tp))
    diff.append(pct(Tn, Tp))
    it_p += int(np.sum(rp['iters']))
    it_n += int(np.sum(res[name]['null']['iters']))
share_res = [100*d[m]['residual']/sum(d[m].values()) for d in pred.values() for m in ('penalty', 'null')]
share_red = [100*d['null']['reduce']/sum(d['null'].values()) for d in pred.values()]
it_rest = [pct(rest(n['t']), rest(p['t'])) for p, n in zip(P_, N_)]

meas_diff = [pct(m['tn'], m['tp']) for m in meas.values()]
ratio_p = [m['tp']/m['cp'] for m in meas.values()]
ratio_n = [m['tn']/m['cn'] for m in meas.values()]
per_it = [pct(m['tn']/np.sum(res[nm]['null']['iters']), m['tp']/np.sum(res[nm]['penalty']['iters'])) for nm, m in meas.items()]
display(Markdown(f'''**Summary of the cost**

- The tangent stiffness of the panels, `kT_pan`, is {rng(share_kT)} % of the predicted cost of a run, and within it the numerical integration of the two cohesive-zone panels, {rng(share_tsl)} % of `kT_pan`: they have {fmt_pan(True)}, against {fmt_pan(False)} for the other panels. This computation is the same with both methods.
- The null-space method removes {rng(removed, '%d')} of the unknowns, but only {rng(np.negative(nnz))} % of the nonzeros of the system, which are dominated by the full coupling of the cohesive-zone panels by `'SB_TSL'`, a penalty stiffness with both methods. The sparse solution is {rng(np.negative(solve_), '%.0f')} % faster and `get_kC_conn` no longer computes the edge penalties, while $Z^\top K Z$ adds {rng(red_, '%.2f')} s per iteration. The basis $Z$ is built once, in {rng(tZ, '%.3f')} s.
- With the same iterations, the predicted cost of the null-space runs differs from that of the penalty runs by {rng(diff_same, '%+.2f')} %. The runs differ also by their numbers of iterations, {it_p} for the penalty runs against {it_n} for the null-space runs over the openings compared, giving {rng(diff, '%+.1f')} % case by case: the Newton-Raphson iterations follow slightly different paths, without a systematic trend.
- Measured under the same conditions, the run time of the null-space method differs from that of the penalty method by {rng(meas_diff, '%+.1f')} % case by case, {rng(per_it, '%+.1f')} % per iteration, and is {TN/3600:.2f} h against {TP/3600:.2f} h for the {len(meas)} cases ({pct(TN, TP):+.1f} %). The ratio measured / predicted is {rng(ratio_p, '%.2f')} for the penalty runs and {rng(ratio_n, '%.2f')} for the null-space runs, {TP/CP:.2f} and {TN/CN:.2f} in total: the profile of one iteration at the peak load predicts the runs to within these factors. The residual is {rng(share_res)} % of the predicted cost, with one trial of the line search per iteration, so that twice as many trials, whose number is not stored, would change the cost of a run by less than that.
- The connections are a small part of the cost: `reduce`, the only component added by the null-space method, is {rng(share_red)} % of the predicted cost of the null-space runs, and is offset, wholly or in part, by the faster sparse solution and residual: an iteration without `kT_pan` differs by {rng(it_rest, '%+.1f')} % from that of the penalty method. A significant reduction of the cost of these runs must come from the tangent of the panels, the residual and the damage-rate stiffness of the cohesive zone, not from the connections.'''))

Summary of the cost

  • The tangent stiffness of the panels, kT_pan, is 53.1 to 78.1 % of the predicted cost of a run, and within it the numerical integration of the two cohesive-zone panels, 96.6 to 99.0 % of kT_pan: they have 25 x 10 terms integrated on 49 x 19 points, 30 x 10 terms integrated on 59 x 19 points, against 8 x 8 terms integrated on 15 x 15 points for the other panels. This computation is the same with both methods.

  • The null-space method removes 80 to 320 of the unknowns, but only 2.8 to 7.4 % of the nonzeros of the system, which are dominated by the full coupling of the cohesive-zone panels by 'SB_TSL', a penalty stiffness with both methods. The sparse solution is 12 to 38 % faster and get_kC_conn no longer computes the edge penalties, while \(Z^ op K Z\) adds 0.09 to 0.12 s per iteration. The basis \(Z\) is built once, in 0.008 to 0.033 s.

  • With the same iterations, the predicted cost of the null-space runs differs from that of the penalty runs by -4.22 to +0.97 %. The runs differ also by their numbers of iterations, 2788 for the penalty runs against 2826 for the null-space runs over the openings compared, giving -4.3 to +4.9 % case by case: the Newton-Raphson iterations follow slightly different paths, without a systematic trend.

  • Measured under the same conditions, the run time of the null-space method differs from that of the penalty method by -8.9 to +9.9 % case by case, -10.0 to +7.5 % per iteration, and is 4.38 h against 4.29 h for the 17 cases (+2.0 %). The ratio measured / predicted is 0.97 to 1.13 for the penalty runs and 0.98 to 1.19 for the null-space runs, 1.04 and 1.06 in total: the profile of one iteration at the peak load predicts the runs to within these factors. The residual is 10.1 to 25.7 % of the predicted cost, with one trial of the line search per iteration, so that twice as many trials, whose number is not stored, would change the cost of a run by less than that.

  • The connections are a small part of the cost: reduce, the only component added by the null-space method, is 1.3 to 2.4 % of the predicted cost of the null-space runs, and is offset, wholly or in part, by the faster sparse solution and residual: an iteration without kT_pan differs by -11.2 to +2.2 % from that of the penalty method. A significant reduction of the cost of these runs must come from the tangent of the panels, the residual and the damage-rate stiffness of the cohesive zone, not from the connections.

Stamatelos and Labeas (2023): buckling of divided and stiffened plates#

stamatelos_labeas_2023_multidomain.ipynb executed with both methods: 'SSxcte' and 'SSycte' strips, 'SB' bonded sub-laminates and 'BFycte'/'BFxcte' plate blades. The penalty runs use the penalty factors of the notebook, the null-space runs ignore them. The eigenvalues are in N/m, and the single-domain references are those of the notebook. The run times of the notebook, printed below the figure, were measured in the job of the DCB runs, the two methods one after the other.

[11]:
path = os.path.join(OUT, 'stamatelos.json')
S = json.load(open(path)) if os.path.exists(path) else None
if S is not None:
    P, N = S['penalty'], S['null-space']
    rows = ['| model | reference | penalty | diff. (%) | null-space | diff. (%) |', '|---|---|---|---|---|---|']
    ref = P['ref_sd']
    for along, func in (('y', 'SSycte'), ('x', 'SSxcte')):
        for f in ('0.1', '1', '10', '100', '1000'):
            ev = P['strips'][f'{along}_{f}']
            rows.append(f"| 3 {func} strips, mode 1, penalty x{f} | {ref[0]:.1f} | {ev[0]:.1f} | {pct(ev[0], ref[0]):+.4f} | | |")
        evn = N['strips'][f'{along}_1']
        rows.append(f"| 3 {func} strips, mode 1, null-space | {ref[0]:.1f} | | | {evn[0]:.1f} | {pct(evn[0], ref[0]):+.4f} |")
    for name, d in P['table2'].items():
        dn = N['table2'][name]
        rows.append(f"| Table 2 {name}, 3 SSxcte (N/mm) | {d['sd']:.4f} | {d['Nxx']:.4f} | {pct(d['Nxx'], d['sd']):+.4f} "
                    f"| {dn['Nxx']:.4f} | {pct(dn['Nxx'], dn['sd']):+.4f} |")
    for i in range(3):
        a, b, r = P['table3'][i], N['table3'][i], P['table3_sd'][i]
        rows.append(f"| Table 3 mode {i + 1}, 3 SSycte | {r:.1f} | {a:.1f} | {pct(a, r):+.4f} | {b:.1f} | {pct(b, r):+.4f} |")
    mono = P['sb_mono'][0]
    for k in P['sb']:
        a, b = P['sb'][k][0], N['sb'][k][0]
        rows.append(f"| bonded halves, {k}, mode 1 | {mono:.1f} | {a:.1f} | {pct(a, mono):+.4f} | {b:.1f} | {pct(b, mono):+.4f} |")
    for key, d in P['table45'].items():
        dn = N['table45'][key]
        for v in ('edge', 'interior', 'rotated'):
            if f'{v}_1' in d:
                rows.append(f"| Tables 4/5 {key}, blade {v} (N/mm) | {d['sd']:.2f} | {d[v + '_1']:.2f} | {pct(d[v + '_1'], d['sd']):+.2f} "
                            f"| {dn[v + '_1']:.2f} | {pct(dn[v + '_1'], dn['sd']):+.2f} |")
        if 'edge_100' in d:
            rows.append(f"| Tables 4/5 {key}, blade edge, penalty x100 | {d['sd']:.2f} | {d['edge_100']:.2f} | {pct(d['edge_100'], d['sd']):+.2f} | | |")
    display(Markdown('\n'.join(rows)))

model

reference

penalty

diff. (%)

null-space

diff. (%)

3 SSycte strips, mode 1, penalty x0.1

14297.9

12065.5

-15.6134

3 SSycte strips, mode 1, penalty x1

14297.9

14010.3

-2.0113

3 SSycte strips, mode 1, penalty x10

14297.9

14268.2

-0.2071

3 SSycte strips, mode 1, penalty x100

14297.9

14294.9

-0.0208

3 SSycte strips, mode 1, penalty x1000

14297.9

14297.6

-0.0020

3 SSycte strips, mode 1, null-space

14297.9

14297.9

+0.0000

3 SSxcte strips, mode 1, penalty x0.1

14297.9

13269.5

-7.1922

3 SSxcte strips, mode 1, penalty x1

14297.9

14250.9

-0.3287

3 SSxcte strips, mode 1, penalty x10

14297.9

14293.1

-0.0331

3 SSxcte strips, mode 1, penalty x100

14297.9

14297.4

-0.0033

3 SSxcte strips, mode 1, penalty x1000

14297.9

14297.8

-0.0003

3 SSxcte strips, mode 1, null-space

14297.9

14297.9

+0.0000

Table 2 [0_3/90_3]s, 3 SSxcte (N/mm)

27.1520

27.1504

-0.0059

27.1520

+0.0000

Table 2 [0_3/90_3/0_3/90_3], 3 SSxcte (N/mm)

17.2571

17.2564

-0.0042

17.2571

+0.0000

Table 2 [0_2/45_2/0_2/45_2/0_2], 3 SSxcte (N/mm)

15.9435

15.9427

-0.0048

15.9435

+0.0003

Table 2 [0_2/45_2/0_2/-45_2/0_2], 3 SSxcte (N/mm)

15.0281

15.0274

-0.0049

15.0281

+0.0000

Table 2 [0_6/60_6], 3 SSxcte (N/mm)

12.1101

12.1102

+0.0008

12.1106

+0.0039

Table 3 mode 1, 3 SSycte

14297.9

14294.9

-0.0208

14297.9

+0.0000

Table 3 mode 2, 3 SSycte

14655.6

14654.7

-0.0064

14655.6

+0.0000

Table 3 mode 3, 3 SSycte

23840.2

23839.5

-0.0029

23840.2

+0.0002

bonded halves, SB, top first, mode 1

17317.2

17308.6

-0.0496

17317.2

-0.0000

bonded halves, SB, bottom first, mode 1

17317.2

17308.6

-0.0496

17317.2

+0.0000

bonded halves, SB_TSL, top first, mode 1

17317.2

17308.6

-0.0496

17308.6

-0.0496

bonded halves, SB_TSL, bottom first, mode 1

17317.2

17308.6

-0.0496

17308.6

-0.0496

Tables 4/5 table4/uniform, blade edge (N/mm)

119.01

119.62

+0.51

119.75

+0.62

Tables 4/5 table4/uniform, blade interior (N/mm)

119.01

119.78

+0.64

119.89

+0.73

Tables 4/5 table4/uniform, blade rotated (N/mm)

119.01

119.62

+0.51

119.75

+0.62

Tables 4/5 table4/uniform, blade edge, penalty x100

119.01

119.75

+0.62

Tables 4/5 table4/triangular, blade edge (N/mm)

179.21

178.33

-0.49

179.12

-0.05

Tables 4/5 table4/triangular, blade interior (N/mm)

179.21

179.45

+0.14

179.57

+0.20

Tables 4/5 table4/triangular, blade rotated (N/mm)

179.21

178.33

-0.49

179.12

-0.05

Tables 4/5 table4/triangular, blade edge, penalty x100

179.21

179.11

-0.06

Tables 4/5 table5/uniform, blade edge (N/mm)

119.01

117.84

-0.98

117.89

-0.95

Tables 4/5 table5/uniform, blade interior (N/mm)

119.01

117.90

-0.94

117.93

-0.91

Tables 4/5 table5/uniform, blade rotated (N/mm)

119.01

117.84

-0.98

117.89

-0.95

Tables 4/5 table5/uniform, blade edge, penalty x100

119.01

117.89

-0.95

Tables 4/5 table5/triangular, blade edge (N/mm)

179.19

175.78

-1.91

176.59

-1.45

Tables 4/5 table5/triangular, blade interior (N/mm)

179.19

176.89

-1.29

176.91

-1.27

Tables 4/5 table5/triangular, blade rotated (N/mm)

179.19

175.78

-1.91

176.59

-1.45

Tables 4/5 table5/triangular, blade edge, penalty x100

179.19

176.58

-1.46

[12]:
if S is not None:
    heights = np.linspace(0., 9., 10)
    fig, axes = plt.subplots(1, len(P['figure7']), figsize=(16, 3.2), constrained_layout=True)
    rows = ['| lamination | max. diff. null-space vs penalty (%) | max. diff. penalty vs BladeStiff1D (%) | max. diff. null-space vs BladeStiff1D (%) |',
            '|---|---|---|---|']
    for ax, (name, d) in zip(axes, P['figure7'].items()):
        dn = N['figure7'][name]
        pm, pn, sd = map(np.array, (d['P_md'], dn['P_md'], d['P_sd']))
        ax.plot(heights, sd, 's--', ms=3, mfc='none', color='C1', label='BladeStiff1D')
        ax.plot(heights, pm, 'o-', ms=3, color='k', label='penalty')
        ax.plot(heights, pn, 'x--', ms=4, color='C3', label='null-space')
        ax.set_title(name, fontsize=8)
        ax.set_xlabel('blade height (mm)', fontsize=8)
        ax.grid(True, alpha=0.3)
        rows.append(f"| {name} | {np.abs(pct(pn, pm)).max():.2f} | {np.abs(pct(pm, sd)).max():.1f} | {np.abs(pct(pn, sd)).max():.1f} |")
    axes[0].set_ylabel('$P_{cr}$ (N)')
    axes[0].legend(fontsize=7)
    fig.suptitle('Figure 7 of Stamatelos and Labeas (2023): 11 SSycte strips and 10 BFycte blades')
    plt.show()
    display(Markdown('\n'.join(rows)))
    print('notebook run time: penalty %.0f s, null-space %.0f s' % (P['time'], N['time']))
../_images/notebooks_conn_method_comparison_20_0.png

lamination

max. diff. null-space vs penalty (%)

max. diff. penalty vs BladeStiff1D (%)

max. diff. null-space vs BladeStiff1D (%)

[0_3/90_3]s

0.01

1.3

1.3

[0_3/90_3/0_3/90_3]

0.02

1.3

1.3

[0_2/45_2/0_2/45_2/0_2]

0.01

1.3

1.3

[0_2/45_2/0_2/-45_2/0_2]

0.01

1.3

1.3

[0_6/60_6]

0.01

1.6

1.6

notebook run time: penalty 81 s, null-space 77 s

Discussion#

DCB. The 17 cases of 6 notebooks were run to the last opening with both methods, without bisections of the increments:

  • the peak loads of the two methods agree within 0.07 %, and the load-opening curves within 0.12 % of the peak load before the peak and 0.15 % after it;

  • the crack growth at the last opening is the same, except for tijs2023_full_weld, 0.3 mm longer with the null-space method;

  • the null-space models are slightly stiffer, the initial stiffness by 0.07 % to 0.36 % and the elastic compliances lower by 0.13 % to 0.21 %: the connections 'SSxcte' and 'SB' are exact, while their penalty stiffnesses, 100 times the default of calc_kt_kr for the edges, leave a small compliance.

The penalty stiffnesses of dcb_utils.build_dcb are therefore adequate for these benchmarks: they change the stiffness by about 0.1 % to 0.4 % and the peak loads by less than 0.07 %, which is negligible for these benchmarks. The null-space method gives these results without a penalty factor to choose.

Stamatelos and Labeas (2023). For the strips connected by 'SSycte' or 'SSxcte', the plates of Tables 2 and 3 and the laminates bonded by 'SB', the null-space method reproduces the single-domain eigenvalues to within 0.004 %, whereas the penalty results depend on the penalty factor: -15.6 % at 0.1 times the default stiffness of the 'SSycte' strips, -2.0 % at the default and -0.02 % at 100 times the default. For the plate blades connected by 'BFycte' and 'BFxcte', the null-space results are the limit of the penalty results, equal to those at 100 times the default penalty within 0.01 %, while the default penalty differs from them by up to 0.46 %. The remaining differences to the BladeStiff1D references of Tables 4 and 5, up to 1.5 % with the null-space method and 1.9 % with the default penalty, and of Figure 7, 1.3 % to 1.6 %, are those of the models, not of the connections. The 'SB_TSL' connection is a penalty stiffness in both cases, and gives the same results.

Cost. See the summary of the cost above. Timed under the same conditions, one run at a time, the 17 DCB runs take 4.38 h with the null-space method against 4.29 h with the penalty method (+2.0 %), from -8.9 % to +9.9 % case by case, while the profile predicts -4.3 % to +4.9 %; the measured times are 0.97 to 1.19 times the predicted ones, so that the case-by-case differences are within the scatter of the timings. The tangent stiffness of the panels, the same with both methods, is 53 % to 78 % of the predicted cost of the DCB runs, almost entirely that of the cohesive-zone panels, and with the same iterations the null-space runs cost from 4.2 % less to 1.0 % more: the product \(\boldsymbol{Z}^\top \boldsymbol{K} \boldsymbol{Z}\) is offset, wholly or in part, by the smaller system and the residual without the edge penalties. The runs of the Stamatelos notebook took 77 s with the null-space method against 81 s with the penalty method, measured once under the same conditions; this notebook has many small models and was not profiled.

Conclusion. The null-space method gives the results of the penalty method in the limit of an infinite penalty stiffness, with no penalty factor to choose and no loss of conditioning, and at the same cost in the DCB benchmarks, +2 % over the 17 runs, within the scatter of the timings case by case. Where the penalty stiffnesses of the notebooks are large enough, as in the DCB benchmarks, both methods agree within 0.4 %; where they are not, the penalty results depend on the factor, while the null-space results do not.