0% found this document useful (0 votes)
48 views55 pages

Isogeometric Analysiss: Knot Utility

This document provides functions for working with knots in isogeometric analysis. It includes functions to generate Gauss points for numerical integration, generate non-uniform and repeated knots, reduce repeated knots, insert knots at specified points, and elevate the degree of knots. The functions allow manipulating control point matrices and knot vectors for NURBS-based isogeometric analysis.

Uploaded by

Daniel Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views55 pages

Isogeometric Analysiss: Knot Utility

This document provides functions for working with knots in isogeometric analysis. It includes functions to generate Gauss points for numerical integration, generate non-uniform and repeated knots, reduce repeated knots, insert knots at specified points, and elevate the degree of knots. The functions allow manipulating control point matrices and knot vectors for NURBS-based isogeometric analysis.

Uploaded by

Daniel Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Isogeometric Analysiss

Knot utility

Gauss points data


Gausspoint[q_] := Block[{Gp, w},
If[q  1, {Gp = {0.000000000000000},
w = {2.000000000000000}}];
If[q  2, {Gp = {- 0.577350269189626,
0.577350269189626},
w = {1.000000000000000,
1.0000000000000}}];
If[q  3, {Gp = {- 0.774596669241483,
0.774596669241483
},
w = {0.555555555555556,
0.888888888888889,
0.555555555555556}}];
If[q  4, {Gp = {- 0.861134311594053,
- 0.339981043584856,
0.339981043584856,
0.861134311594053},
w = {0.347854845137454,
0.652145154862546,
0.652145154862546,
0.347854845137454}}];
If[q  5, {Gp = {- 0.906179845938664,
- 0.538469310105683,
0.000000000000000,
0.538469310105683,
0.906179845938664},
w = {0.236926885056189,
0.478628670499366,
0.568888888888889,
0.478628670499366,
0.236926885056189}}];
If[q  6, {Gp = {- 0.932469514203152,
- 0.661209386466265,
- 0.238619186003152,
0.238619186003152,
0.661209386466265,
0.932469514203152},
w = {0.171324492379170,
0.360761573048139,
0.467913934572691,
0.467913934572691,
2 TestFinished.cdf

0.360761573048139,
0.171324492379170}}];
If[q  7, {Gp = {- 0.949107912342759,
- 0.741531185599394,
- 0.405845151377397,
0.000000000000000,
0.405845151377397,
0.741531185599394,
0.949107912342759 },
w = {0.129484966168870,
0.279705391489277,
0.381830050505119,
0.417959183673469,
0.381830050505119,
0.279705391489277,
0.129484966168870}}];
If[q  8, {Gp = {- 0.960289856497536,
- 0.796666477413627,
- 0.525532409916329,
- 0.183434642495650,
0.183434642495650,
0.525532409916329,
0.796666477413627,
0.960289856497536},
w = {0.101228536290376,
0.222381034453374,
0.313706645877887,
0.362683783378362,
0.362683783378362,
0.313706645877887,
0.222381034453374,
0.101228536290376}}];
If[q  9, {Gp = {- 0.968160239507626,
- 0.836031107326636,
- 0.613371432700590,
- 0.324253423403809,
0.000000000000000,
0.324253423403809,
0.613371432700590,
0.836031107326636,
0.968160239507626},
w = {0.081274388361574,
0.180648160694857,
0.260610696402935,
0.312347077040003,
0.330239355001260,
0.312347077040003,
0.261610696402935,
0.180648160694857,
0.081274388361574}}];
TestFinished.cdf 3

If[q  10, {Gp = {- 0.973906528517172,


- 0.865063366688985,
- 0.679409568299024,
- 0.433395394129247,
- 0.148874338981631,
0.148874338981631,
0.433395394129247,
0.679409568299024,
0.865063366688985,
0.973906528517172},
w = {0.066671344308688,
0.149451349150581,
0.219086362515982,
0.269266719309996,
0.295524224714753,
0.295524224714753,
0.269266719309996,
0.219086362515982,
0.149451349150581,
0.066671344308688}}];
{Gp, w}
]

Knot generation
NonUniformKnot[nn_, p_] := Block{t, m, j, k, n},
n = nn - 1;
m = n + p + 1;
t = Table[0, {i, 1, m + 1}];
Forj = 2, j ≤ n - p + 1, j ++,
j-1
t〚j + p〛 = ;
n-p+1
;
For[k = m - p + 1, k ≤ m + 1, k ++,
t〚k〛 = 1;
]
;
t

4 TestFinished.cdf

Evaluate knot
EvaluateKnot[knot_] := Block[{p, n, i},
p = 0;
For[i = 1, i ≤ Length[knot], i ++,
If[knot〚i〛  0, p = p + 1];
];
p = p - 1;
n = Length[knot] - p - 1;
{n, p}
]

(*Return the number of NURBS functions and their degree*)

Repeated knot
KnotR[nn_, p_] := Block[{KnotRef, i, KnotR},
KnotRef = NonUniformKnot[nn + p - 1, p];
KnotR = KnotRef;
For[i = p + 2, i ≤ nn + p - 1, i ++,
KnotR〚i〛 = Table[KnotRef〚i〛, {k, 1, p + 1}];
]
; KnotR // Flatten
]

Reduce knot
(*Include 1 & 0*)

ReduceKnotR[knotR_] := Block[{l, i, KnotReduce, count},


l = Length[knotR];
count = 1;
KnotReduce = Table[0, {i, 1, l}];
KnotReduce〚1〛 = knotR〚1〛;
For[i = 1, i ≤ l - 1, i ++,
If[knotR〚i + 1〛 ≠ knotR〚i〛,
{count = count + 1; KnotReduce〚count〛 = knotR〚i + 1〛}]
];
Table[KnotReduce〚i〛, {i, 1, count}]]

(*Not include 0 and 1*)

KnotReduce[knot_] := Block[{k, r},


k = ReduceKnotR[knot];
r = Table[k〚i〛, {i, 2, Length[k] - 1}];
r
]
TestFinished.cdf 5

Insert knot
(*http://
www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/single-insertion.html*)

Findk[knot_, t_] := Block[{k, count, i},


count = 0;
For[i = 1, i ≤ Length[knot] - 1, i ++,
If[knot〚i〛 ≤ t < knot〚i + 1〛, count = i]
]; count
]

KnotInsert[ctp_, knot_, t_] :=


Block{n1, n2, m, i, p, Q, a, k, count, temp, newctp, newknot, ctpout},
{n1, n2} = Dimensions[ctp];
newctp = ctp;
k = Findk[knot, t];
{m, p} = EvaluateKnot[knot];
count = 0;
Q = Table[0, {i, 1, p}];
Fori = k - p + 1, i ≤ k, i ++,
t - knot〚i〛
a= ;
knot〚i + p〛 - knot〚i〛
temp = (1 - a) ctp〚i - 1〛 + a ctp〚i〛;
count ++;
Q〚count〛 = temp;
;
count = 0;
For[i = k - p + 1, i < k, i ++,
count ++;
newctp〚i〛 = Q〚count〛;
];
newknot = Sort[{knot, t} // Flatten];
newctp〚k - 1〛 = {newctp〚k - 1〛, Q〚Length[Q]〛};
newctp = newctp // Flatten;
ctpout = Table[{newctp〚i〛, newctp〚i + 1〛}, {i, 1, Length[newctp], n2}];
{ctpout, newknot}

KnotInsertM[ctp_, knot_, t_] := Block[{ctpn, knotn, i},


{ctpn, knotn} = KnotInsert[ctp, knot, t〚1〛];
For[i = 2, i ≤ Length[t], i ++,
{ctpn, knotn} = KnotInsert[ctpn, knotn, t〚i〛];
];
{ctpn, knotn}
]
6 TestFinished.cdf

KnotInsert2Dx[ctp_, knot_, t_] := Block[{m, n, i, l, ctpnew, knotnew},


{m, n, l} = Dimensions[ctp];
ctpnew = Table[0, {i, 1, m}];
For[i = 1, i ≤ m, i ++,
ctpnew〚i〛 = KnotInsert[ctp〚i〛, knot, t]〚1〛;
];
knotnew = KnotInsert[ctp〚1〛, knot, t]〚2〛;
{ctpnew, knotnew}
]

KnotInsertM2Dx[ctp_, knot_, t_] := Block[{m, n, i, l, ctpn, knotn},


{ctpn, knotn} = KnotInsert2Dx[ctp, knot, t〚1〛];
For[i = 2, i ≤ Length[t], i ++,
{ctpn, knotn} = KnotInsert2Dx[ctpn, knotn, t〚i〛];
];
{ctpn, knotn}
]

KnotInsert2Dy[ctp_, knot_, t_] := Block[{Tctp, m, n, i, l, ctpnew, knotnew},


Tctp = Transpose[ctp];
{m, n, l} = Dimensions[Tctp];
ctpnew = Table[0, {i, 1, m}];
For[i = 1, i ≤ m, i ++,
ctpnew〚i〛 = KnotInsert[Tctp〚i〛, knot, t]〚1〛;
];
knotnew = KnotInsert[Tctp〚1〛, knot, t]〚2〛;
{Transpose[ctpnew], knotnew}
]

KnotInsertM2Dy[ctp_, knot_, t_] := Block[{m, n, i, l, ctpn, knotn},


{ctpn, knotn} = KnotInsert2Dy[ctp, knot, t〚1〛];
For[i = 2, i ≤ Length[t], i ++,
{ctpn, knotn} = KnotInsert2Dy[ctpn, knotn, t〚i〛];
];
{ctpn, knotn}
]

Elevate knot
p!
Cc[i_, p_] :=
i ! (p - i) !
TestFinished.cdf 7

KnotElevate[ctp_, knot_, t_] := Block{m, p, i, Q, knotn, ctpn},


{m, p} = EvaluateKnot[knot];
Q = Table[0, {i, 1, p + t + 1}];
ctpn = Table[0, {i, 1, Length[ctp] + t}];
For[i = Length[ctp], i > 0, i --,
ctpn〚i + t〛 = ctp〚i〛
];
Fori = 1, i ≤ p + t + 1, i ++,
Cc[j, p] Cc[i - 1 - j, t] ctp〚j + 1〛
Q〚i〛 = Sum , {j, Max[0, i - 1 - t], Min[p, i - 1]}
Cc[i - 1, p + t]
;
knotn = NonUniformKnot[m + t, p + t];
For[i = 1, i ≤ p + t + 1, i ++,
ctpn〚i〛 = Q〚i〛;
];
{ctpn, knotn}

KnotElevate2Dx[ctp_, knot_, t_] := Block[{ctpn, m, n, k, i, knotn},


{m, n, k} = Dimensions[ctp];
ctpn = Table[0, {i, 1, m}];
For[i = 1, i ≤ m, i ++,
{ctpn〚i〛, knotn} = KnotElevate[ctp〚i〛, knot, t];
];
{ctpn, knotn}
]

KnotElevate2Dy[ctp_, knot_, t_] := Block[{ctpy, ctpn, m, n, k, i, knotn},


ctpy = Transpose[ctp];
{m, n, k} = Dimensions[ctpy];
ctpn = Table[0, {i, 1, m}];
For[i = 1, i ≤ m, i ++,
{ctpn〚i〛, knotn} = KnotElevate[ctpy〚i〛, knot, t];
];
{Transpose[ctpn], knotn}
]
8 TestFinished.cdf

Evaluate knotR
EvaluateKnotR[knotR_] := Block{l, count, i},
l = Length[knotR];
count = 0;
For[i = 1, i ≤ l, i ++,
If[knotR〚i〛  0, count ++]
];
l
 , count - 1
count

(*Return the number of node, and the degree of functions*)

h-refinement utilities
href[knot_] := Block{Rknot},
Rknot = ReduceKnotR[knot];
Rknot〚i〛 + Rknot〚i + 1〛
Table , {i, 1, Length[Rknot] - 1}
2

(*Just for Bazier form i.g. [0 0 0 1 1 1] from the beginning*)

(*h-ref deu*)
i
href1[step_] := Table , {i, 1, step}
step + 1

(* h-refine gian knot*)


href2[step_] := Block{a, scale, r},
a = Table[i, {i, 1, step}];
scale = Sum[a〚i〛, {i, 1, step}];
1
r = TableSum a〚j〛, {j, 1, i}, {i, step - 1};
scale
r

(*h-ref co knot*)
href3[step_] := Block{a, scale, r},
a = Table[i, {i, step, 1, - 1}];
scale = Sum[a〚i〛, {i, 1, step}];
1
r = TableSum a〚j〛, {j, 1, i}, {i, step - 1};
scale
r

(*deu quanh [0,a], deu quanh [a,1]*)


TestFinished.cdf 9

sref[step_, a_] := Block[{k1, k2},


k1 = a href1[step];
k2 = (1 - a) href1[step] + a;
{k1, a, k2} // Flatten
]

(*deu step 1 quanh [0,a] deu step 2 quanh [a,1]*)


sref[step1_, step2_, a_] := Block[{k1, k2},
k1 = a href1[step1];
k2 = (1 - a) href1[step2] + a;
{k1, a, k2} // Flatten
]

(*gian-co quanh diem a*)


sref1[step_, a_] := Block[{k1, k2},
k1 = a href2[step];
k2 = (1 - a) href3[step] + a;
{k1, a, k2} // Flatten
]

(*co - gian quanh diem a*)


sref2[step_, a_] := Block[{k1, k2},
k1 = a href3[step];
k2 = (1 - a) href2[step] + a;
{k1, a, k2} // Flatten
]

(* gian trong [0,a], deu trong [a,b], co trong [b,1] *)


sref3[step1_, step2_, a_, b_] := Block[{k1, k2, k3},
k1 = a href2[step1];
k2 = (b - a) href1[step2] + a;
k3 = (1 - b) href3[step1] + b;
{k1, a, k2, b, k3} // Flatten
]

(* co trong [0,a], deu trong [a,b], gian trong [b,1] *)


sref4[step1_, step2_, a_, b_] := Block[{k1, k2, k3},
k1 = a href3[step1];
k2 = (b - a) href1[step2] + a;
k3 = (1 - b) href2[step1] + b;
{k1, a, k2, b, k3} // Flatten
]
10 TestFinished.cdf

(*co trong [0,a], deu trong [a,b], deu trong [b,c],


deu trong [c,d], gian trong [d,1]*)
sref5[step1_, step2_, step3_, step4_, step5_, a_, b_, c_, d_] :=
Block[{k1, k2, k3, k4, k5},
k1 = a href3[step1];
k2 = (b - a) href1[step2] + a;
k3 = (c - b) href1[step3] + b;
k4 = (d - c) href1[step4] + c;
k5 = (1 - d) href2[step5] + d;
{k1, a, k2, b, k3, c, k4, d, k5} // Flatten
]

sref6[step_, a_] := Block[{k1, k2},


k1 = a href1[step];
k2 = (1 - a) href1[step] + a;
{k1, k2} // Flatten
]

(*gian, co*)

sref6[step1_, step2_, a_] := Block[{k1, k2},


k1 = a href3[step1];
k2 = (1 - a) href2[step2] + a;
{k1, k2} // Flatten
]

(*deu, co*)

sref7[step1_, step2_, a_] := Block[{k1, k2},


k1 = a href1[step1];
k2 = (1 - a) href3[step2] + a;
{k1, k2} // Flatten
]

(*deu1, deu2*)

sref8[step1_, step2_, a_] := Block[{k1, k2},


k1 = a href1[step1];
k2 = (1 - a) href1[step2] + a;
{k1, k2} // Flatten
]

(*deu,deu,deu,deu,deu,deu*)

sref9[step1_, step2_, step3_, step4_, step5_, step6_, a_, b_, c_, d_, e_] :=
Block[{k1, k2, k3, k4, k5, k6},
k1 = a href1[step1];
k2 = (b - a) href1[step2] + a;
k3 = (c - b) href1[step3] + b;
k4 = (d - c) href1[step4] + c;
k5 = (e - d) href1[step5] + d;
k6 = (1 - e) href1[step6] + e;
{k1, k2, k3, k4, k5, k6} // Flatten
]
TestFinished.cdf 11

Points utility
cpt2Array[ctp_] := Block[{ctpArray, m, n, q, p, i, j},
If[Length[Dimensions[ctp]]  3, {m, n, q} = Dimensions[ctp]];
If[Length[Dimensions[ctp]]  4, {m, n, q, p} = Dimensions[ctp]];
ctpArray = Table[0, {i, 1, m n}];
For[i = 1, i ≤ m, i ++,
For[j = 1, j ≤ n, j ++,
ctpArray〚n (i - 1) + j〛 = ctp〚i〛〚j〛;
]
]; ctpArray
]

Node ultility - Finding boundary condition nodes

Find a specific node


FindNode[p_, ctp_] := Block[{i, index, ctpVector},
ctpVector = cpt2Array[ctp];
index = 0;
For[i = 1, i ≤ Length[ctpVector], i ++,
If[p  ctpVector〚i〛, index = i]
]; {index, ctpVector〚index〛}
]

Find nodes with a determined X coordinate


FindNodeX[p_, ctp_] := Block[{i, index, count, r, ctpVector},
ctpVector = cpt2Array[ctp];
r = Table[0, {i, 1, Length[ctpVector]}];
count = 0;
For[i = 1, i ≤ Length[ctpVector], i ++,
If[p  ctpVector〚i〛〚1〛, {count = count + 1, r〚count〛 = i}]
]; {Table[r〚i〛, {i, 1, count}], Table[ctpVector〚r〚i〛〛, {i, 1, count}]}
]

Find nodes with a determined Y coordinate


FindNodeY[p_, ctp_] := Block[{i, index, count, r, ctpVector},
ctpVector = cpt2Array[ctp];
r = Table[0, {i, 1, Length[ctpVector]}];
count = 0;
For[i = 1, i ≤ Length[ctpVector], i ++,
If[p  ctpVector〚i〛〚2〛, {count = count + 1, r〚count〛 = i}]
]; {Table[r〚i〛, {i, 1, count}], Table[ctpVector〚r〚i〛〛, {i, 1, count}]}
]

Find nodes with around Δy of a determined Y coordinate (for steel determine,


12 TestFinished.cdf

Find nodes with around Δy of a determined Y coordinate (for steel determine,


for distributed loading)
FindNodeAY[x_, y_, Δy_, ctp_] := Block[{i, index, count, r, ctpVector},
ctpVector = cpt2Array[ctp];
r = Table[0, {i, 1, Length[ctpVector]}];
count = 0;
For[i = 1, i ≤ Length[ctpVector], i ++,
If[ctpVector〚i〛〚1〛  x && y - Δy ≤ ctpVector〚i〛〚2〛 ≤ y + Δy,
{count ++, r〚count〛 = i}]];
{Table[r〚i〛, {i, 1, count}], Table[ctpVector〚r〚i〛〛, {i, 1 count}]}
]

Find nodes with around Δx of a determined X coordinate (for steel determine,


for distributed loading)
FindNodeAX[x_, y_, Δx_, ctp_] := Block[{i, index, count, r, ctpVector},
ctpVector = cpt2Array[ctp];
r = Table[0, {i, 1, Length[ctpVector]}];
count = 0;
For[i = 1, i ≤ Length[ctpVector], i ++,
If[ctpVector〚i〛〚2〛  y && x - Δx ≤ ctpVector〚i〛〚1〛 ≤ x + Δx,
{count ++, r〚count〛 = i}]];
{Table[r〚i〛, {i, 1, count}], Table[ctpVector〚r〚i〛〛, {i, 1 count}]}
]

FindNodeΔX[xmin_, xmax_, y_, ctp_] := Block[{i, index, count, r, ctpVector},


ctpVector = cpt2Array[ctp];
r = Table[0, {i, 1, Length[ctpVector]}];
count = 0;
For[i = 1, i ≤ Length[ctpVector], i ++,
If[ctpVector〚i〛〚2〛  y && xmin ≤ ctpVector〚i〛〚1〛 ≤ xmax,
{count ++, r〚count〛 = i}]];
{Table[r〚i〛, {i, 1, count}], Table[ctpVector〚r〚i〛〛, {i, 1 count}]}
]
TestFinished.cdf 13

NURBS 1D utility (for truss element - note that truss is declared in space 2D)

The NonUniform B-Spline functions and its derivative


NUBS[knot_, ζ_] := Block{m, p, NN, dNN, t, term1N, term2N, term1DN, term2DN, k, i, II},
{m, p} = EvaluateKnot[knot];
NN = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
dNN = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
t = knot;
ForII = 1, II ≤ p + 1, II ++,

Fori = 1, i ≤ m, i ++,
NN〚i, 1〛 = Piecewise[{{1.0, t〚i〛 ≤ ζ ≤ t〚i + 1〛}}];
(*k=1 equivalent to zero order, so we need to minus 1 with the degree
indicator in comparision with the fomulas k start with zero*)
Fork = 2, k ≤ p + 1, k ++,

Ift〚i + k - 1〛 - t〚i〛  0, {term1N = (ζ - t〚i〛) NN〚i, k - 1〛, term1DN = NN〚i, k - 1〛},


(ζ - t〚i〛) NN〚i, k - 1〛 NN〚i, k - 1〛
term1N = , term1DN = ;
t〚i + k - 1〛 - t〚i〛 t〚i + k - 1〛 - t〚i〛
Ift〚i + k〛 - t〚i + 1〛  0, {term2N = (t〚i + k〛 - ζ) NN〚i + 1, k - 1〛,
term2DN = NN〚i + 1, k - 1〛},
(t〚i + k〛 - ζ) NN〚i + 1, k - 1〛 NN〚i + 1, k - 1〛
term2N = , term2DN = ;
t〚i + k〛 - t〚i + 1〛 t〚i + k〛 - t〚i + 1〛
NN〚i, k〛 = term1N + term2N;
dNN〚i, k〛 = (k - 1) (term1DN - term2DN);

;
{Table[NN〚i〛〚p + 1〛, {i, 1, m}], Table[dNN〚i〛〚p + 1〛, {i, 1, m}]}
(*k = 1 equivalent to zero order,
so we need to plus 1 in order to get the right order of output functions*)

14 TestFinished.cdf

Getting the value of the NonUniform B-Spline functions and its derivative
GetNUBS[knot_, ζ_] :=
Block{m, p, NN, dNN, t, term1N, term2N, term1DN, term2DN, k, i, II},
{m, p} = EvaluateKnot[knot];
NN = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
dNN = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
t = knot;
ForII = 1, II ≤ p + 1, II ++,

Fori = 1, i ≤ m, i ++,
NN〚i, 1〛 = Piecewise[{{1.0, t〚i〛 ≤ ζ ≤ t〚i + 1〛}}];
Fork = 2, k ≤ p + 1, k ++,

Ift〚i + k - 1〛 - t〚i〛  0, {term1N = (ζ - t〚i〛) NN〚i, k - 1〛, term1DN = NN〚i, k - 1〛},


(ζ - t〚i〛) NN〚i, k - 1〛 NN〚i, k - 1〛
term1N = , , term1DN = ;
t〚i + k - 1〛 - t〚i〛 t〚i + k - 1〛 - t〚i〛
Ift〚i + k〛 - t〚i + 1〛  0, {term2N = (t〚i + k〛 - ζ) NN〚i + 1, k - 1〛,
term2DN = NN〚i + 1, k - 1〛},
(t〚i + k〛 - ζ) NN〚i + 1, k - 1〛 NN〚i + 1, k - 1〛
term2N = , term2DN = ;
t〚i + k〛 - t〚i + 1〛 t〚i + k〛 - t〚i + 1〛
NN〚i, k〛 = term1N + term2N;
dNN〚i, k〛 = (k - 1) (term1DN - term2DN);

;
{Table[NN〚i〛〚p + 1〛, {i, 1, m}], Table[dNN〚i〛〚p + 1〛, {i, 1, m}]}
(*k = 1 equivalent to zero order,
so we need to plus 1 in order to get the right order of output functions*)

TestFinished.cdf 15

The NonUniform B-Spline functions and its high order derivative (for non-local
strain model)
NUBSHD[knot_, ζ_] :=
Block{m, p, NN, d1N, d2N, d3N, t, term1N, term2N, term1DN, term2DN, k, i, II},
{m, p} = EvaluateKnot[knot];
NN = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
d1N = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
d2N = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
d3N = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];

t = knot;
ForII = 1, II ≤ p + 1, II ++,

Fori = 1, i ≤ m, i ++,
NN〚i, 1〛 = Piecewise[{{1, t〚i〛 ≤ ζ ≤ t〚i + 1〛}}];
(*k=1 equivalent to zero order, so we need to minus 1 with the degree
indicator in comparision with the fomulas k start with zero*)
Fork = 2, k ≤ p + 1, k ++,

Ift〚i + k - 1〛 - t〚i〛  0, {term1N = (ζ - t〚i〛) NN〚i, k - 1〛, term1DN = NN〚i, k - 1〛},


(ζ - t〚i〛) NN〚i, k - 1〛 NN〚i, k - 1〛
term1N = , term1DN = ;
t〚i + k - 1〛 - t〚i〛 t〚i + k - 1〛 - t〚i〛
Ift〚i + k〛 - t〚i + 1〛  0, {term2N = (t〚i + k〛 - ζ) NN〚i + 1, k - 1〛,
term2DN = NN〚i + 1, k - 1〛},
(ζ - t〚i + k〛) NN〚i + 1, k - 1〛 NN〚i + 1, k - 1〛
term2N = , term2DN = ;
t〚i + k〛 - t〚i + 1〛 t〚i + k〛 - t〚i + 1〛
NN〚i, k〛 = term1N - term2N;
d1N〚i, k〛 = (k - 1) (term1DN - term2DN);
d2N〚i, k〛 = (k - 1) (D[term1DN, ζ] - D[term2DN, ζ]);
d3N〚i, k〛 = (k - 1) (D[term1DN, {ζ, 2}] - D[term2DN, {ζ, 2}]);

;
{Table[NN〚i〛〚p + 1〛, {i, 1, m}], Table[d1N〚i〛〚p + 1〛, {i, 1, m}],
Table[d2N〚i〛〚p + 1〛, {i, 1, m}], Table[d3N〚i〛〚p + 1〛, {i, 1, m}]}
(*k = 1 equivalent to zero order, so we need to plus 1 in
order to get the right order of output functions*)

16 TestFinished.cdf

Getting the NonUniform B-Spline functions and its high order derivative (for
non-local strain model)
TestFinished.cdf 17

GetNUBSHD[knot_, ζ_] := Block{m, p, NN, NNp, d1N, d2N, d3N, t, term1N,


term2N, term1DN, term2DN, term1Np, term2Np, term1DNp, term2DNp, k, i, II},
{m, p} = EvaluateKnot[knot];
NN = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
NNp = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];

d1N = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];


d2N = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];
d3N = Table[0, {i, 1, m + 1}, {j, 1, m + 1}];

t = knot;
ForII = 1, II ≤ p + 1, II ++,

Fori = 1, i ≤ m, i ++,
NN〚i, 1〛 = Piecewise[{{1, t〚i〛 ≤ ζ ≤ t〚i + 1〛}}];
NNp〚i, 1〛 = Piecewise[{{1, t〚i〛 ≤ ζζ ≤ t〚i + 1〛}}];
Fork = 2, k ≤ p + 1, k ++,

Ift〚i + k - 1〛 - t〚i〛  0, {term1N = (ζ - t〚i〛) NN〚i, k - 1〛, term1DN = NN〚i, k - 1〛,


term1Np = (ζζ - t〚i〛) NNp〚i, k - 1〛, term1DNp = NNp〚i, k - 1〛},
(ζ - t〚i〛) NN〚i, k - 1〛 NN〚i, k - 1〛
term1N = , term1DN = ,
t〚i + k - 1〛 - t〚i〛 t〚i + k - 1〛 - t〚i〛
(ζζ - t〚i〛) NNp〚i, k - 1〛 NNp〚i, k - 1〛
term1Np = , term1DNp = ;
t〚i + k - 1〛 - t〚i〛 t〚i + k - 1〛 - t〚i〛
Ift〚i + k〛 - t〚i + 1〛  0, {term2N = (t〚i + k〛 - ζ) NN〚i + 1, k - 1〛, term2DN = NN〚i + 1,
k - 1〛, term2Np = (t〚i + k〛 - ζζ) NNp〚i + 1, k - 1〛, term2DNp = NNp〚i + 1, k - 1〛},
(ζ - t〚i + k〛) NN〚i + 1, k - 1〛 NN〚i + 1, k - 1〛
term2N = , term2DN = ,
t〚i + k〛 - t〚i + 1〛 t〚i + k〛 - t〚i + 1〛
(ζζ - t〚i + k〛) NNp〚i + 1, k - 1〛 NNp〚i + 1, k - 1〛
term2Np = , term2DNp = ;
t〚i + k〛 - t〚i + 1〛 t〚i + k〛 - t〚i + 1〛
NN〚i, k〛 = term1N - term2N;
NNp〚i, k〛 = term1Np - term2Np;
d1N〚i, k〛 = (k - 1) (term1DN - term2DN);
d2N〚i, k〛 = (k - 1) (D[term1DNp, ζζ] - D[term2DNp, ζζ]) /. {ζζ  ζ};
d3N〚i, k〛 = (k - 1) (D[term1DNp, {ζζ, 2}] - D[term2DNp, {ζζ, 2}]) /. {ζζ  ζ};

;
{Table[NN〚i〛〚p + 1〛, {i, 1, m}], Table[d1N〚i〛〚p + 1〛, {i, 1, m}],
Table[d2N〚i〛〚p + 1〛, {i, 1, m}], Table[d3N〚i〛〚p + 1〛, {i, 1, m}]}
(*k = 1 equivalent to zero order, so we need to plus 1 in
order to get the right order of output functions*)

18 TestFinished.cdf

NURBS1D (adding rotational term)


NURBS1D[knot1_, ζ1_] :=
Block{mm1, pp1, NonUBS, DNonUBS, NURBS, DNURBS, N1D, DNURBSζ, w1D, W, DW, i},
{NonUBS, DNonUBS} = NUBS[knot1, ζ1];
{mm1, pp1} = EvaluateKnot[knot1];
w1D = Table[1, {i, 1, mm1}];
NURBS = Table[0, {i, 1, mm1}];
DNURBS = Table[0, {i, 1, mm1}];
W = Sum[NonUBS〚k〛 w1D〚k〛, {k, 1, mm1}];
DW = Sum[DNonUBS〚k〛 w1D〚k〛, {k, 1, mm1}];
Fori = 1, i ≤ mm1, i ++,
NonUBS〚i〛 w1D〚i〛
NURBS〚i〛 = ;
W
w1D〚i〛
DNURBS〚i〛 = (DNonUBS〚i〛 W - NonUBS〚i〛 DW);
W2
;
{NURBS, DNURBS}

Getting NURBS1D (adding rotational term)


GetNURBS1D[knot1_, ζ1_] :=
Block{mm1, pp1, NonUBS, DNonUBS, NURBS, DNURBS, N1D, DNURBSζ, w1D, W, DW, i},
{NonUBS, DNonUBS} = GetNUBS[knot1, ζ1];
{mm1, pp1} = EvaluateKnot[knot1];
w1D = Table[1, {i, 1, mm1}];
NURBS = Table[0, {i, 1, mm1}];
DNURBS = Table[0, {i, 1, mm1}];
W = Sum[NonUBS〚k〛 w1D〚k〛, {k, 1, mm1}];
DW = Sum[DNonUBS〚k〛 w1D〚k〛, {k, 1, mm1}];
Fori = 1, i ≤ mm1, i ++,
NonUBS〚i〛 w1D〚i〛
NURBS〚i〛 = ;
W
w1D〚i〛
DNURBS〚i〛 = (DNonUBS〚i〛 W - NonUBS〚i〛 DW);
W2
;
{NURBS, DNURBS}

TestFinished.cdf 19

Evaluate the support domain of each 1D NURBS function


NURBS1DDomain[knot1_] := Block[{S, n, q, k, l},
{n, q} = EvaluateKnot[knot1];
S = Table[0, {i, 1, n}];
For[k = 1, k ≤ n, k ++,
S〚k〛 = {knot1〚k〛, knot1〚k + q + 1〛};
]
;S
]

Evaluate the patch (macro element) for 1D knot


macro1D[knot1_] := Block[{k1, i, m1D},
k1 = ReduceKnotR[knot1];
m1D = Table[0, {i, 1, Length[k1] - 1}];
For[i = 1, i ≤ Length[k1] - 1, i ++,
m1D〚i〛 = {k1〚i〛, k1〚i + 1〛};
]
; m1D
]

Getting index of NURBS 1D functions


NIndex[N1Domain_, patch1D_] := Block[{NoE, EINX, k, i, L},
NoE = Length[patch1D];
L = Length[N1Domain];
EINX = Table[0, {i, 1, NoE}, {j, 1, L}];
For[k = 1, k ≤ NoE, k ++,
For[i = 1, i ≤ L, i ++,
If[! ((N1Domain〚i〛〚1〛 ≤ patch1D〚k〛〚1〛 && N1Domain〚i〛〚2〛 ≤ patch1D〚k〛〚1〛) ||
(N1Domain〚i〛〚1〛 ≥ patch1D〚k〛〚2〛 && N1Domain〚i〛〚2〛 ≥ patch1D〚k〛〚2〛)
)
, EINX〚k〛〚i〛 = i]
]
]; EINX
]
20 TestFinished.cdf

Modification Nindex - neglect the zero influential functions


NModify[NNE_] := Block[{Eo, temp, l, i, j, n, m},
{n, m} = Dimensions[NNE];
l = 0;
For [i = 1, i ≤ m, i ++,
If[NNE〚1〛〚i〛 ≠ 0, l ++]];
Eo = Table[0, {i, 1, n}, {j, 1, l}];
For[i = 1, i ≤ n, i ++,
temp = 0;
For[j = 1, j ≤ m, j ++,
If[NNE〚i〛〚j〛 ≠ 0, {temp ++; Eo〚i〛〚temp〛 = NNE〚i〛〚j〛}];
]
]
; Eo
]

Getting the control point of element


GetXe1D[Nindex_, ctp_] := Block[{ctpA, m, n, Xe, i, j},
{m, n} = Dimensions[Nindex];
Xe = Table[0, {i, 1, m}, {j, 1, n}];
For[i = 1, i ≤ m, i ++,
For[j = 1, j ≤ n, j ++,
Xe〚i, j〛 = ctp〚Nindex〚i, j〛〛;
]
]; Xe
]

Getting modified Nindex with boundary condition


BCIndex1D[NI_, BCI_] := Block[{m, n, NInBC, i, j},
{m, n} = Dimensions[NI];
NInBC = Table[0, {i, 1, m}, {j, 1, n}];
For[i = 1, i <= m, i ++,
For[j = 1, j <= n, j ++,
If[NI〚i, j〛 < BCI, NInBC〚i, j〛 = NInBC〚i, j〛];
If[NI〚i, j〛 == BCI, NInBC〚i, j〛 = - 1];
If[NI〚i, j〛 > BCI, NInBC〚i, j〛 = NI〚i, j〛 - 1];
]
]; NInBC
]
TestFinished.cdf 21

Assembly 1D
Assembly1D[Ke_, NInBC_] := Block[{m, i, j, k, n1, n2, m1, m2, Kt},
m = Max[NInBC];
Kt = Table[{{0, 0}, {0, 0}}, {i, 1, m}, {j, 1, m}];
{n1, n2} = Dimensions[NInBC];
For[i = 1, i ≤ n1, i ++,
For[j = 1, j ≤ n2, j ++,
For[k = 1, k ≤ n2, k ++,
If[NInBC〚i, j〛 ≠ - 1 && NInBC〚i, k〛 ≠ - 1,
Kt〚NInBC〚i〛〚j〛〛〚NInBC〚i〛〚k〛〛 = Kt〚NInBC〚i〛〚j〛〛〚NInBC〚i〛〚k〛〛 + Ke〚i〛〚j〛〚k〛];
]
]
];
Kt(*//ArrayFlatten*)
]

Getting the stiffness matrix in 1D (neglect the vertical displacement if the truss
system is 1D)
K1D[Kspace_] :=
Table[Kspace〚i, j〛, {i, 1, Length[Kspace], 2}, {j, 1, Length[Kspace], 2}];

Modify obtained displacement (include the displacement at boundary


condition)
Getu1D[up_, BC_] := Block[{uout, i},
uout = Table[0, {i, 1, Length[up] + 1}];
For[i = 1, i ≤ Length[up] + 1, i ++,
If[i < BC, uout〚i〛 = up〚i〛];
If[i  BC, uout〚i〛 = 0.];
If[i > BC, uout〚i〛 = up〚i - 1〛];
]; uout
]

Change the total displacement to individual displacement of each element


Getue1D[utotal_, p_] :=
Table[Table[utotal〚i + j〛, {j, 0, p}], {i, 1, Length[utotal] - p, p}];
22 TestFinished.cdf

NURBS 2D utility

NURBS2D (adding rotational term)


NURBS2D[knot1_, knot2_] :=
Block{NonUBS1, DNonUBS1, DNURBS1, NonUBS2, DNonUBS2, DNURBS2, i,
j, w2D, N2D, W, DWζ1, DWζ2, DNURBSζ1, DNURBSζ2, mm1, mm2, pp1, pp2},

{NonUBS1, DNonUBS1} = NUBS[knot1, ζ1];


{NonUBS2, DNonUBS2} = NUBS[knot2, ζ2];

{mm1, pp1} = EvaluateKnot[knot1];


{mm2, pp2} = EvaluateKnot[knot2];

w2D = Table[0.1, {i, 1, mm1}, {j, 1, mm2}];

N2D = Table[0, {i, 1, mm1}, {j, 1, mm2}];


DNURBSζ1 = Table[0, {i, 1, mm1}, {j, 1, mm2}];
DNURBSζ2 = Table[0, {i, 1, mm1}, {j, 1, mm2}];

W = Sum[NonUBS1〚k1〛 NonUBS2〚k2〛 w2D〚k1〛〚k2〛, {k1, 1, mm1},


{k2, 1, mm2}];
DWζ1 = Sum[DNonUBS1〚k1〛 NonUBS2〚k2〛 w2D〚k1〛〚k2〛, {k1, 1, mm1},
{k2, 1, mm2}];
DWζ2 = Sum[NonUBS1〚k1〛 DNonUBS2〚k2〛 w2D〚k1〛〚k2〛, {k1, 1, mm1},
{k2, 1, mm2}];
Fori = 1, i ≤ mm1, i ++,

Forj = 1, j ≤ mm2, j ++,


NonUBS1〚i〛 NonUBS2〚j〛 w2D〚i〛〚j〛
N2D〚i〛〚j〛 = ;
W
DNURBSζ1〚i〛〚j〛 =
w2D〚i〛〚j〛
(DNonUBS1〚i〛 NonUBS2〚j〛 W - NonUBS1〚i〛 NonUBS2〚j〛 DWζ1);
W2
w2D〚i〛〚j〛
DNURBSζ2〚i〛〚j〛 = (NonUBS1〚i〛 DNonUBS2〚j〛 W - NonUBS1〚i〛 NonUBS2〚j〛 DWζ2);
W2

;
{N2D, DNURBSζ1, DNURBSζ2}

TestFinished.cdf 23

Getting NURBS2D (adding rotational term)


GetNURBS2D[knot1_, knot2_, ζ1_, ζ2_] :=
Block{NonUBS1, DNonUBS1, DNURBS1, NonUBS2, DNonUBS2, DNURBS2, i,
j, w2D, N2D, W, DWζ1, DWζ2, DNURBSζ1, DNURBSζ2, mm1, mm2, pp1, pp2},

{NonUBS1, DNonUBS1} = GetNUBS[knot1, ζ1];


{NonUBS2, DNonUBS2} = GetNUBS[knot2, ζ2];

{mm1, pp1} = EvaluateKnot[knot1];


{mm2, pp2} = EvaluateKnot[knot2];

w2D = Table[0.1, {i, 1, mm1}, {j, 1, mm2}];

N2D = Table[0, {i, 1, mm1}, {j, 1, mm2}];


DNURBSζ1 = Table[0, {i, 1, mm1}, {j, 1, mm2}];
DNURBSζ2 = Table[0, {i, 1, mm1}, {j, 1, mm2}];

W = Sum[NonUBS1〚k1〛 NonUBS2〚k2〛 w2D〚k1〛〚k2〛, {k1, 1, mm1},


{k2, 1, mm2}];
DWζ1 = Sum[DNonUBS1〚k1〛 NonUBS2〚k2〛 w2D〚k1〛〚k2〛, {k1, 1, mm1},
{k2, 1, mm2}];
DWζ2 = Sum[NonUBS1〚k1〛 DNonUBS2〚k2〛 w2D〚k1〛〚k2〛, {k1, 1, mm1},
{k2, 1, mm2}];
Fori = 1, i ≤ mm1, i ++,

Forj = 1, j ≤ mm2, j ++,


NonUBS1〚i〛 NonUBS2〚j〛 w2D〚i〛〚j〛
N2D〚i〛〚j〛 = ;
W
DNURBSζ1〚i〛〚j〛 =
w2D〚i〛〚j〛
(DNonUBS1〚i〛 NonUBS2〚j〛 W - NonUBS1〚i〛 NonUBS2〚j〛 DWζ1);
W2
w2D〚i〛〚j〛
DNURBSζ2〚i〛〚j〛 = (NonUBS1〚i〛 DNonUBS2〚j〛 W - NonUBS1〚i〛 NonUBS2〚j〛 DWζ2);
W2

;
{N2D, DNURBSζ1, DNURBSζ2}

24 TestFinished.cdf

Change to NURBS function matrices into vector form


NVector[N2D_] := Block[{Nv, m, n, k, i, j},
If[Length[Dimensions[N2D]]  2, {m, n} = Dimensions[N2D]];
If[Length[Dimensions[N2D]]  3, {m, n, k} = Dimensions[N2D]];

Nv = Table[0, {i, 1, m n}];


For[i = 1, i ≤ m, i ++,
For[j = 1, j ≤ n, j ++,
Nv〚n (i - 1) + j〛 = N2D〚i〛〚j〛;
]
]; Nv
]

Getting DOF2
DOF2[NN_] := Block{Nresult, i},
Nresult = Table[0, {i, 1, 2}, {j, 1, 2 Length[NN]}];
Fori = 1, i ≤ 2 Length[NN], i = i + 2,
i+1
Nresult〚1〛〚i〛 = NN ;
2
i+1
Nresult〚2〛〚i + 1〛 = NN ;
2
;
Nresult

Matrix Ultity - Change the matrix (support domain or macro element) into the
vector form
DomainVector[S_] := Block[{Nv, m, n, i, j, Sv},
{m, n} = {Dimensions[S]〚1〛, Dimensions[S]〚2〛};
Sv = Table[0, {i, 1, m n}];
For[i = 1, i ≤ m, i ++,
For[j = 1, j ≤ n, j ++,
Sv〚n (i - 1) + j〛 = S〚i〛〚j〛;
]
]; Sv
]
TestFinished.cdf 25

Evaluate the support domain of each 2D NURBS function


NURBS2DDomain[knot1_, knot2_] := Block[{S, m, n, p, q, k, l},
{n, q} = EvaluateKnot[knot1];
{m, p} = EvaluateKnot[knot2];
S = Table[0, {i, 1, n}, {j, 1, m}];
For[k = 1, k ≤ n, k ++,
For[l = 1, l ≤ m, l ++,
S〚k〛〚l〛 = {{knot1〚k〛, knot1〚k + q + 1〛}, {knot2〚l〛, knot2〚l + p + 1〛}};
]
]; DomainVector[S]
]

Evaluate the macro element for 2D knot


macro2D[knot1_, knot2_] := Block[{k1, k2, i, j, m2D},
k1 = ReduceKnotR[knot1];
k2 = ReduceKnotR[knot2];
m2D = Table[0, {i, 1, Length[k1] - 1}, {j, 1, Length[k2] - 1}];
For[i = 1, i ≤ Length[k1] - 1, i ++,
For[j = 1, j ≤ Length[k2] - 1, j ++,
m2D〚i, j〛 = {{k1〚i〛, k1〚i + 1〛}, {k2〚j〛, k2〚j + 1〛}}
]
]; DomainVector[m2D]
]

Modification Nindex - neglect the zero influent functions


(*NModify also works*)

ZeroOff[Nin_] := Block[{count, out, i},


count = 0;
out = Table[0, {i, 1, Length[Nin]}];
For[i = 1, i ≤ Length[Nin], i ++,
If[Nin〚i〛 ≠ 0, {count ++, out〚count〛 = Nin〚i〛}]
]
; Table[out〚i〛, {i, 1, count}]
]
26 TestFinished.cdf

Getting index of NURBS 2D function


N2DIndex[N2DDomain_, marco2D_] := Block[{NOE, EINX, k, i, L},
NOE = Length[marco2D];
L = Length[N2DDomain];
EINX = Table[0, {i, 1, NOE}, {j, 1, L}];
For[k = 1, k ≤ NOE, k ++,
For[i = 1, i ≤ L, i ++,
If[! ((N2DDomain〚i〛〚1〛〚1〛 ≤ marco2D〚k〛〚1〛〚1〛 &&
N2DDomain〚i〛〚1〛〚2〛 ≤ marco2D〚k〛〚1〛〚1〛) ||
(N2DDomain〚i〛〚1〛〚1〛 ≥ marco2D〚k〛〚1〛〚2〛 &&
N2DDomain〚i〛〚1〛〚2〛 ≥ marco2D〚k〛〚1〛〚2〛) ||
(N2DDomain〚i〛〚2〛〚1〛 ≥ marco2D〚k〛〚2〛〚2〛 &&
N2DDomain〚i〛〚2〛〚2〛 ≥ marco2D〚k〛〚2〛〚2〛) ||
(N2DDomain〚i〛〚2〛〚1〛 ≤ marco2D〚k〛〚2〛〚1〛 &&
N2DDomain〚i〛〚2〛〚2〛 ≤ marco2D〚k〛〚2〛〚1〛))
, EINX〚k〛〚i〛 = i]
]
]; EINX
]

Getting the control point of element


The consitent matrix (plane strain)
EE 1-2ν
Cs = {1 - ν, ν, 0}, {ν, 1 - ν, 0}, 0, 0, ;
(1 + ν) (1 - 2 ν) 2

The consitent matrix (plane stress)


Getting modified Nindex with boundary condition (similar to 2D function of
truss space)
Assembly 2D (concrete only)
Assembly2D[Ke_, NInBC_] := Block[{m, i, j, k, n1, n2, m1, m2, Kt},
m = Max[NInBC];
Kt = Table[{{0, 0}, {0, 0}}, {i, 1, m}, {j, 1, m}];
{n1, n2} = Dimensions[NInBC];
For[i = 1, i ≤ n1, i ++,
For[j = 1, j ≤ n2, j ++,
For[k = 1, k ≤ n2, k ++,
If[NInBC〚i, j〛 ≠ - 1 && NInBC〚i, k〛 ≠ - 1,
Kt〚NInBC〚i〛〚j〛〛〚NInBC〚i〛〚k〛〛 = Kt〚NInBC〚i〛〚j〛〛〚NInBC〚i〛〚k〛〛 + Ke〚i〛〚j〛〚k〛];
]
]
];
Kt(*//ArrayFlatten*)
]
TestFinished.cdf 27

Assembly 2D (concrete reinforcement)


Assembly2D[KCon_, ConIn_, KSte_, SteIn_] := Block[{m, i, j, k, n1, n2, m1, m2, Kt},
m = Max[ConIn];
Kt = Table[0, {i, 1, m}, {j, 1, m}];
{n1, n2} = Dimensions[ConIn];
For[i = 1, i ≤ n1, i ++,
For[j = 1, j ≤ n2, j ++,
For[k = 1, k ≤ n2, k ++,
If[ConIn〚i, j〛 ≠ - 1 && ConIn〚i, k〛 ≠ - 1, Kt〚ConIn〚i〛〚j〛〛〚ConIn〚i〛〚k〛〛 =
Kt〚ConIn〚i〛〚j〛〛〚ConIn〚i〛〚k〛〛 + KCon〚i〛〚j〛〚k〛];
]
]
];
{m1, m2} = Dimensions[SteIn];
For[i = 1, i ≤ m1, i ++,
For[j = 1, j ≤ m2, j ++,
For[k = 1, k ≤ m2, k ++,
If[SteIn〚i, j〛 ≠ - 1 && SteIn〚i, k〛 ≠ - 1, Kt〚SteIn〚i〛〚j〛〛〚SteIn〚i〛〚k〛〛 =
Kt〚SteIn〚i〛〚j〛〛〚SteIn〚i〛〚k〛〛 + KSte〚i〛〚j〛〚k〛];
]
]
];
Kt // ArrayFlatten
]

Plate element (p=2 IGA standard element)

Knot and NURBS2D and its derivative


m = 2; p = 1;

knot1 = NonUniformKnot[m, p];


knot2 = NonUniformKnot[m, p];

N functions for both displacement and enhanced equivalent strain


approximation (DOF2D is added)
GetN1D[ζζ1_] := Block [{Ne, DNeζ1},
{Ne, DNeζ1} = GetNURBS1D[knot1, ζζ1];
Ne = {{Ne〚1〛, 0, Ne〚2〛, 0, - Ne〚2〛, 0, - Ne〚1〛, 0},
{0, Ne〚1〛, 0, Ne〚2〛, 0, - Ne〚2〛, 0, - Ne〚1〛}};
Ne
]
28 TestFinished.cdf

GetN1D[i_, ζζ1_, ζζ2_] := Block [{NNe, DNNeζ1, DNNeζ2, Ne},


{NNe, DNNeζ1, DNNeζ2} = GetNURBS2D[knot1, knot2, ζζ1, ζζ2];
Ne = NVector[NNe];
Ne〚i〛
]

GetN1D[ζζ1_, ζζ2_] := Block [{NNe, DNNeζ1, DNNeζ2, Ne},


{NNe, DNNeζ1, DNNeζ2} = GetNURBS2D[knot1, knot2, ζζ1, ζζ2];
Ne = NVector[NNe];
Ne
]

GetN2D[ζζ1_, ζζ2_] := Block [{NNe, DNNeζ1, DNNeζ2, NN, Ne},


{NNe, DNNeζ1, DNNeζ2} = GetNURBS2D[knot1, knot2, ζζ1, ζζ2];
Ne = NVector[NNe];
NN = DOF2[Ne];
NN
]

First Jacobian
GetJ1[ctp_, ζ1_, ζ2_] := Block[{ctpn, NN, Xa, DXζ1, DXζ2, NNe, Ne, DNζ1, DNζ2,
DNeζ1, DNeζ2, DNNeζ1, DNNeζ2, DetJ1, δζ1δX1, δζ1δX2, δζ2δX1, δζ2δX2},
ctpn = ctp // Flatten;
{NNe, DNNeζ1, DNNeζ2} = GetNURBS2D[knot1, knot2, ζ1, ζ2];
Ne = NVector[NNe];
DNeζ1 = NVector[DNNeζ1];
DNeζ2 = NVector[DNNeζ2];

DNζ1 = DOF2[DNeζ1];
DNζ2 = DOF2[DNeζ2];

DXζ1 = DNζ1.ctpn;
DXζ2 = DNζ2.ctpn;
(*First Jacobian*)
DetJ1 = DXζ1〚1〛 * DXζ2〚2〛 - DXζ1〚2〛 * DXζ2〚1〛;
DetJ1
]
TestFinished.cdf 29

B matrix of displacement approximation (2D form) i-th component


GetB2D[i_, ζζ1_, ζζ2_, ctp_] :=
Block {ctpn, NN, DXζ1, DXζ2, NNe, Ne, DNζ1, DNζ2, DNeζ1, DNeζ2,
DNNeζ1, DNNeζ2, DetJ1, δζ1δX1, δζ1δX2, δζ2δX1, δζ2δX2, B},
ctpn = ctp // Flatten;
{NNe, DNNeζ1, DNNeζ2} = GetNURBS2D[knot1, knot2, ζζ1, ζζ2];

Ne = NVector[NNe];
DNeζ1 = NVector[DNNeζ1];
DNeζ2 = NVector[DNNeζ2];

DNζ1 = DOF2[DNeζ1];
DNζ2 = DOF2[DNeζ2];

DXζ1 = DNζ1.ctpn;
DXζ2 = DNζ2.ctpn;

DetJ1 = Abs[DXζ1〚1〛 * DXζ2〚2〛 - DXζ1〚2〛 * DXζ2〚1〛];


(*first derivative of jacobian component*)
1
δζ1δX1 = DXζ2〚2〛;
DetJ1
-1
δζ2δX1 = DXζ1〚2〛;
DetJ1
-1
δζ1δX2 = DXζ2〚1〛;
DetJ1
1
δζ2δX2 = DXζ1〚1〛;
DetJ1
(*B matrix*)
B = {{DNeζ1〚i〛 δζ1δX1 + DNeζ2〚i〛 δζ2δX1, 0}, {0, DNeζ1〚i〛 δζ1δX2 + DNeζ2〚i〛 δζ2δX2},
{DNeζ1〚i〛 δζ1δX2 + DNeζ2〚i〛 δζ2δX2, DNeζ1〚i〛 δζ1δX1 + DNeζ2〚i〛 δζ2δX1}};
B

30 TestFinished.cdf

B matrix of displacement approximation (2D form) full component


GetB2D[ζζ1_, ζζ2_, ctp_] :=
Block {ctpn, NN, Xa, DXDζ1, DXDζ2, NNe, Ne, DNζ1, DNζ2, DNeζ1,
DNeζ2, DNNeζ1, DNNeζ2, DetJ1, δζ1δX1, δζ1δX2, δζ2δX1, δζ2δX2, B},
ctpn = ctp // Flatten;
{NNe, DNNeζ1, DNNeζ2} = GetNURBS2D[knot1, knot2, ζζ1, ζζ2];

Ne = NVector[NNe];
DNeζ1 = NVector[DNNeζ1];
DNeζ2 = NVector[DNNeζ2];

DNζ1 = DOF2[DNeζ1];
DNζ2 = DOF2[DNeζ2];

DXDζ1 = DNζ1.ctpn;
DXDζ2 = DNζ2.ctpn;

DetJ1 = Abs[DXDζ1〚1〛 * DXDζ2〚2〛 - DXDζ1〚2〛 * DXDζ2〚1〛];


(*first derivative of jacobian component*)
1
δζ1δX1 = DXDζ2〚2〛;
DetJ1
-1
δζ2δX1 = DXDζ1〚2〛;
DetJ1
-1
δζ1δX2 = DXDζ2〚1〛;
DetJ1
1
δζ2δX2 = DXDζ1〚1〛;
DetJ1
(*B matrix*)
B = {{DNeζ1〚1〛 δζ1δX1 + DNeζ2〚1〛 δζ2δX1, 0, DNeζ1〚2〛 δζ1δX1 + DNeζ2〚2〛 δζ2δX1, 0,
DNeζ1〚3〛 δζ1δX1 + DNeζ2〚3〛 δζ2δX1, 0, DNeζ1〚4〛 δζ1δX1 + DNeζ2〚4〛 δζ2δX1, 0},
{0, DNeζ1〚1〛 δζ1δX2 + DNeζ2〚1〛 δζ2δX2, 0, DNeζ1〚2〛 δζ1δX2 + DNeζ2〚2〛 δζ2δX2,
0, DNeζ1〚3〛 δζ1δX2 + DNeζ2〚3〛 δζ2δX2, 0, DNeζ1〚4〛 δζ1δX2 + DNeζ2〚4〛 δζ2δX2},
{DNeζ1〚1〛 δζ1δX2 + DNeζ2〚1〛 δζ2δX2, DNeζ1〚1〛 δζ1δX1 + DNeζ2〚1〛 δζ2δX1,
DNeζ1〚2〛 δζ1δX2 + DNeζ2〚2〛 δζ2δX2, DNeζ1〚2〛 δζ1δX1 + DNeζ2〚2〛 δζ2δX1,
DNeζ1〚3〛 δζ1δX2 + DNeζ2〚3〛 δζ2δX2, DNeζ1〚3〛 δζ1δX1 + DNeζ2〚3〛 δζ2δX1,
DNeζ1〚4〛 δζ1δX2 + DNeζ2〚4〛 δζ2δX2, DNeζ1〚4〛 δζ1δX1 + DNeζ2〚4〛 δζ2δX1}};
{B, DetJ1}

TestFinished.cdf 31

B matrix of improved equivalent strain approximation (1D form) full


GetB1D[ζζ1_, ζζ2_, ctp_] :=
Block {ctpn, NN, DXζ1, DXζ2, NNe, Ne, DNζ1, DNζ2, DNeζ1, DNeζ2,
DNNeζ1, DNNeζ2, DetJ1, δζ1δX1, δζ1δX2, δζ2δX1, δζ2δX2, B},
ctpn = ctp // Flatten;
{NNe, DNNeζ1, DNNeζ2} = GetNURBS2D[knot1, knot2, ζζ1, ζζ2];

Ne = NVector[NNe];
DNeζ1 = NVector[DNNeζ1];
DNeζ2 = NVector[DNNeζ2];

DNζ1 = DOF2[DNeζ1];
DNζ2 = DOF2[DNeζ2];

DXζ1 = DNζ1.ctpn;
DXζ2 = DNζ2.ctpn;

DetJ1 = Abs[DXζ1〚1〛 * DXζ2〚2〛 - DXζ1〚2〛 * DXζ2〚1〛];


(*first derivative of jacobian component*)
1
δζ1δX1 = DXζ2〚2〛;
DetJ1
-1
δζ2δX1 = DXζ1〚2〛;
DetJ1
-1
δζ1δX2 = DXζ2〚1〛;
DetJ1
1
δζ2δX2 = DXζ1〚1〛;
DetJ1
(*B matrix*)
B = {{DNeζ1〚1〛 δζ1δX1 + DNeζ2〚1〛 δζ2δX1, DNeζ1〚2〛 δζ1δX1 + DNeζ2〚2〛 δζ2δX1,
DNeζ1〚3〛 δζ1δX1 + DNeζ2〚3〛 δζ2δX1, DNeζ1〚4〛 δζ1δX1 + DNeζ2〚4〛 δζ2δX1},
{DNeζ1〚1〛 δζ1δX2 + DNeζ2〚1〛 δζ2δX2, DNeζ1〚2〛 δζ1δX2 + DNeζ2〚2〛 δζ2δX2,
DNeζ1〚3〛 δζ1δX2 + DNeζ2〚3〛 δζ2δX2, DNeζ1〚4〛 δζ1δX2 + DNeζ2〚4〛 δζ2δX2}};
B

B matrix of cohesive interface element (1D form) full component


GetB1D[ζζ1_, ctpIe_] := Block [{NNe, DNNeζ1, Bc, LL},
{NNe, DNNeζ1} = GetNURBS1D[knot1, ζζ1];
Bc = {
{NNe〚1〛, 0, NNe〚2〛, 0, - NNe〚2〛, 0, - NNe〚1〛, 0},
{0, NNe〚1〛, 0, NNe〚2〛, 0, - NNe〚2〛, 0, - NNe〚1〛}
};
LL = Norm[ctpIe〚1〛 - ctpIe〚2〛];
{Bc, LL}
]
32 TestFinished.cdf

Ultility function for post-processing

Modify total displacement (included BC nodes) for getting uelement function


Getum[u_, uBC_] := Block[{umodify, ut, i, j},
ut = Table[0, {i, 1, Length[u] + 1}];
For[i = 1, i ≤ Length[ut], i ++,
If[i < uBC, ut〚i〛 = u〚i〛];
If[i  uBC, ut〚i〛 = 0];
If[i > uBC, ut〚i〛 = u〚i - 1〛];
];
ut
]

GetumM[u_, BC_] := Block[{ut, i},


ut = Getum[u, BC〚1〛];
For[i = 2, i ≤ Length[BC], i ++,
ut = Getum[ut, BC〚i〛];
]; ut
]

Getting displacement of every element


Getues[ues_, uInBC_] := Block[{m1, m2, ue, i, j},
{m1, m2} = Dimensions[uInBC];
ue = Table[0, {i, 1, m1}, {j, 1, m2}];
For[i = 1, i ≤ m1, i ++,
For[j = 1, j ≤ m2, j ++,
If[uInBC〚i, j〛 ≠ - 1, ue〚i, j〛 = ues〚uInBC〚i, j〛〛]
];
ue〚i〛 = {{ue〚i, 1〛, ue〚i, 2〛},
{ue〚i, 3〛, ue〚i, 4〛}, {ue〚i, 5〛, ue〚i, 6〛}, {ue〚i, 7〛, ue〚i, 8〛}};
]; ue
]

Getting displacement of interface element


Getues[ues_, uInBC_] := Block[{m1, m2, ue, i, j},
{m1, m2} = Dimensions[uInBC];
ue = Table[0, {i, 1, m1}, {j, 1, m2}];
For[i = 1, i ≤ m1, i ++,
For[j = 1, j ≤ m2, j ++,
If[uInBC〚i, j〛 ≠ - 1, ue〚i, j〛 = ues〚uInBC〚i, j〛〛]
];
ue〚i〛 = {{ue〚i, 1〛, ue〚i, 2〛},
{ue〚i, 3〛, ue〚i, 4〛}, {ue〚i, 5〛, ue〚i, 6〛}, {ue〚i, 7〛, ue〚i, 8〛}};
]; ue
]
TestFinished.cdf 33

Function for changing the improved ϵeqivalent of the whole system to the
improved ϵeqivalent of system of element
Getϵeqims[ϵimeqs_, ϵInBC_] := Block[{m1, m2, ϵeqe, i, j},
{m1, m2} = Dimensions[ϵInBC];
ϵeqe = Table[0, {i, 1, m1}, {j, 1, m2}];
For[i = 1, i ≤ m1, i ++,
For[j = 1, j ≤ m2, j ++,
If[ϵInBC〚i, j〛 ≠ - 1, ϵeqe〚i, j〛 = ϵimeqs〚ϵInBC〚i, j〛〛]
];
]; ϵeqe
]

Getting displacement and strain of every element at GP


GetϵeGP[ue_, Xe_, p_] := Block{ζ, α, BB1, BB2, BB3, BB, BBt, i, j, ϵ, u, J1},
ϵ = Table[0, {i, 1, p}, {j, 1, p}];
{ζ, α} = Gausspoint[p];
Fori = 1, i ≤ p, i ++,

Forj = 1, j ≤ p, j ++,
ζ〚i〛 + 1 ζ〚j〛 + 1
{BB, J1} = GetB2D , , Xe;
2 2
ϵ〚i, j〛 = BB.(ue // Flatten);
;

;
NVector[ϵ]

34 TestFinished.cdf

GetuϵeGP[ue_, Xe_, p_] :=


Block{us, ϵs, ζ, α, BB1, BB2, BB3, BB, BBt, k, i, j, ϵ, u, NN, J1},
us = Table[0, {i, 1, Length[ue]}];
ϵs = Table[0, {i, 1, Length[ue]}];

ϵ = Table[0, {i, 1, p}, {j, 1, p}];


u = Table[0, {i, 1, p}, {j, 1, p}];
{ζ, α} = Gausspoint[p];
Fork = 1, k ≤ Length[ue], k ++,

Fori = 1, i ≤ p, i ++,

Forj = 1, j ≤ p, j ++,
ζ〚i〛 + 1 ζ〚j〛 + 1
{BB, J1} = GetB2D , , Xe〚k〛;
2 2
ζ〚i〛 + 1 ζ〚j〛 + 1
NN = GetN2D , ;
2 2
u〚i, j〛 = NN.(ue〚k〛 // Flatten);
ϵ〚i, j〛 = BB.(ue〚k〛 // Flatten);
;

;
us〚k〛 = NVector[u];
ϵs〚k〛 = NVector[ϵ];
; {us, ϵs}

GetϵeGP[uelement_, Xe_, p_] := Block{ζ, α, BB1, BB2, BB3, BB, BBt, ii, jj, ϵ, J1},
ϵ = Table[0, {i, 1, p}, {j, 1, p}];
{ζ, α} = Gausspoint[p];
Forii = 1, ii ≤ p, ii ++,

Forjj = 1, jj ≤ p, jj ++,
ζ〚ii〛 + 1 ζ〚jj〛 + 1
{BB, J1} = GetB2D , , Xe;
2 2
ϵ〚ii, jj〛 = BB.(uelement // Flatten);
;

;
NVector[ϵ]

TestFinished.cdf 35

Getting equivalent strain of each element (for non-local model)


GetϵeqeGP[ϵeqim_, p_] := Block{ζ, α, NN, ii, jj, ϵ},
ϵ = Table[0, {i, 1, p}, {j, 1, p}];
{ζ, α} = Gausspoint[p];
Forii = 1, ii ≤ p, ii ++,

Forjj = 1, jj ≤ p, jj ++,
ζ〚ii〛 + 1 ζ〚jj〛 + 1
NN = GetN1D ; ,
2 2
ϵ〚ii, jj〛 = Sum[NN〚k〛 ϵeqim〚k〛, {k, 1, Length[ϵeqim]}];
;

;
; NVector[ϵ]

Geometry
Original geometry
LL = 10 10-3 ;(*Length of the bar*)

aa = 1 10-3 ;(*high of the bar*)

Δaa = 0.001 aa;(*high of the initial cracl*)

bb = 1 10-3 ;(*Initial crack length*)

cc = 0.05 LL;(*Length of crack*)

ctp =
aa 3 aa aa 3 aa
LL, + Δaa, LL, , {LL, aa}, LL - bb, , LL - bb, , {LL - bb, aa},
2 4 2 4
aa 1 3 aa aa 1 aa
cc, ,  cc, , {0, aa}, cc, ,  cc, , {0, 0},
2 2 4 2 2 4
aa aa aa aa
LL - bb, , LL - bb, , {LL - bb, 0}, LL, - Δaa, LL, , {LL, 0};
2 4 2 4
Graphics[{Line[ctp], Line[Transpose[ctp]]}]

Dimensions[ctp]
{6, 3, 2}
36 TestFinished.cdf

H-refinement
k1 = NonUniformKnot[6, 1]; k2 = NonUniformKnot[3, 1];

k1
1 2 3 4
0, 0, , , , , 1, 1
5 5 5 5

k2
1
0, 0, , 1, 1
2

sref2[step1_, step2_, a_] := Block[{k1, k2},


k1 = a href1[step1];
k2 = (1 - a) href1[step2] + a;
{k1, k2} // Flatten
]

sref5[step1_, step2_, step3_, step4_, step5_, a_, b_, c_, d_] :=


Block[{k1, k2, k3, k4, k5},
k1 = a href1[step1];
k2 = (b - a) href1[step2] + a;
k3 = (c - b) href1[step3] + b;
k4 = (d - c) href1[step4] + c;
k5 = (1 - d) href1[step5] + d;
{k1, k2, k3, k4, k5} // Flatten
]

(*href*)
1 2 3 4
{ctpn, knot1n} = KnotInsertM2Dyctp, k1, sref58, 31, 6, 31, 8, , , , ;
5 5 5 5
1
{ctpn, knot2n} = KnotInsertM2Dxctpn, k2, sref28, 8, ;
2
(*
(*Get double*)
{ctpn,knot1n}=KnotInsertM2Dx[ctpn,knot1n,KnotReduce[knot1n]];
{ctpn,knot2n}=KnotInsertM2Dy[ctpn,knot2n,KnotReduce[knot2n]];
*)

knot2n // N
{0., 0., 0.0555556, 0.111111, 0.166667, 0.222222,
0.277778, 0.333333, 0.388889, 0.444444, 0.5, 0.555556, 0.611111,
0.666667, 0.722222, 0.777778, 0.833333, 0.888889, 0.944444, 1., 1.}
TestFinished.cdf 37

knot1n // N
{0., 0., 0.0222222, 0.0444444, 0.0666667, 0.0888889, 0.111111, 0.133333,
0.155556, 0.177778, 0.2, 0.20625, 0.2125, 0.21875, 0.225, 0.23125, 0.2375,
0.24375, 0.25, 0.25625, 0.2625, 0.26875, 0.275, 0.28125, 0.2875, 0.29375,
0.3, 0.30625, 0.3125, 0.31875, 0.325, 0.33125, 0.3375, 0.34375, 0.35, 0.35625,
0.3625, 0.36875, 0.375, 0.38125, 0.3875, 0.39375, 0.4, 0.428571, 0.457143,
0.485714, 0.514286, 0.542857, 0.571429, 0.6, 0.60625, 0.6125, 0.61875, 0.625,
0.63125, 0.6375, 0.64375, 0.65, 0.65625, 0.6625, 0.66875, 0.675, 0.68125,
0.6875, 0.69375, 0.7, 0.70625, 0.7125, 0.71875, 0.725, 0.73125, 0.7375, 0.74375,
0.75, 0.75625, 0.7625, 0.76875, 0.775, 0.78125, 0.7875, 0.79375, 0.8, 0.822222,
0.844444, 0.866667, 0.888889, 0.911111, 0.933333, 0.955556, 0.977778, 1., 1.}

EvaluateKnot[knot1n]
{90, 1}

Dimensions[ctpn]
{90, 19, 2}

ctpv = DomainVector[ctpn];

Dimensions[ctpv]
{1710, 2}

CTP = Graphics[{Red, PointSize[0.005], Point[cpt2Array[ctpn]]}, Axes  True]


0.0012
0.0010
0.0008
0.0006
0.0004

0.002 0.004 0.006 0.008 0.010

Graphics[{Line[ctpn], Line[Transpose[ctpn]]}]

Dimensions[ctpn]〚1〛
90

Dimensions[ctpn]〚2〛
19

Discretization geometry
NDomain = NURBS2DDomain[knot1n, knot2n];
m2D = macro2D[knot1n, knot2n];
DomainIn = N2DIndex[NDomain, m2D];

DomainIndexE = Table[ZeroOff[DomainIn〚i〛], {i, 1, Length[DomainIn]}];


38 TestFinished.cdf

ctpe = GetXe2D[DomainIndexE, ctpn];

Dimensions[ctpe]
{1602, 4, 2}

Boundaray condition - Constraint and Loading


{bcindex, BCPoint} = FindNodeX[0, ctpn];

ubcIndex = {2 bcindex - 1, 2 bcindex} // Flatten // Sort


{1595, 1596, 1633, 1634, 1671, 1672, 1709,
1710, 1747, 1748, 1785, 1786, 1823, 1824, 1861, 1862}

{Pindex1, PPoint1} = FindNode[{LL, aa}, ctpn];

{Pindex2, PPoint2} = FindNode[{LL, 0}, ctpn];

PPoint = {PPoint1, PPoint2};

PIndex = {2 Pindex1, 2 Pindex2};

BC = Graphics[{Black, PointSize[0.02], Point[BCPoint]}, Axes  True];

Domain = Graphics[{Red, PointSize[0.01], Point[DomainVector[ctpn]]}, Axes  True];

Show[Domain, BC]
0.0012
0.0010
0.0008
0.0006
0.0004

0.002 0.004 0.006 0.008 0.010

PC = Graphics[{Black, PointSize[0.02], Point[PPoint]}, Axes  True];

Show[Domain, PC]
0.0012
0.0010
0.0008
0.0006
0.0004

0.002 0.004 0.006 0.008 0.010

Modified Nindex of concrete for 1D (enhanced equivalent strain) and 2D


(displacement)
GetNIndex2D[Index_] := Block[{NMo, i, k, m, n, re},
{m, n} = Dimensions[Index];
re = Table[0, {i, 1, m}, {j, 1, 2 n}];
For[i = 1, i ≤ m, i ++,
For[k = 1, k ≤ n, k ++,
If[Index〚i, k〛  - 1, {re〚i, 2 k - 1〛 = - 1, re〚i, 2 k〛 = - 1},
{re〚i, 2 k - 1〛 = 2 Index〚i, k〛 - 1, re〚i, 2 k〛 = 2 Index〚i, k〛}
];
];
]; re
]

uhIndexE = GetNIndex2D[DomainIndexE];
TestFinished.cdf 39

BCIndex[NI_, BCI_] := Block[{m, n, Nout, i, j},


{m, n} = Dimensions[NI];
Nout = Table[0, {i, 1, m}, {j, 1, n}];
For[i = 1, i <= m, i ++,
For[j = 1, j <= n, j ++,
If[NI〚i, j〛 < BCI, Nout〚i, j〛 = NI〚i, j〛];
If[NI〚i, j〛 == BCI, Nout〚i, j〛 = - 1];
If[NI〚i, j〛 > BCI, Nout〚i, j〛 = NI〚i, j〛 - 1];
]
]; Nout
]

BCIndexM[NI_, BCI_] := Block[{m, n, Nout, i, j},


Nout = BCIndex[NI, BCI〚1〛];
For[i = 2, i ≤ Length[BCI], i ++,
Nout = BCIndex[Nout, BCI〚i〛 - i + 1];
]; Nout
]

uhIndexEBC = BCIndexM[uhIndexE, ubcIndex];

External force
GetForceE[NindexEBC_, BC_, PIndex_, PValues_] := Block[{PM, m, n, fexte, i, j, k},
{m, n} = Dimensions[NindexEBC];

PM = PIndex;
For[j = 1, j ≤ Length[PIndex], j ++,
For[i = 1, i ≤ Length[BC], i ++,
If[BC〚i〛 < PIndex〚j〛, PM〚j〛 = PM〚j〛 - 1]
];
];
fexte = Table[0, {i, 1, m}, {j, 1, n}];
For[k = 1, k ≤ Length[PIndex], k ++,
For[i = 1, i ≤ m, i ++,
For[j = 1, j ≤ n, j ++,
If[NindexEBC〚i, j〛  PM〚k〛, fexte〚i, j〛 = PValues〚k〛]
];
];
];
fexte
]

fuextee =
GetForceE[uhIndexEBC, ubcIndex, Table[PIndex〚i〛, {i, 1, Length[PIndex]}], {1, - 1}];

Interface points
aa
{InterfaceInd, InterfacePoints} = FindNodeΔX1.1 cc, LL - bb, , ctpn;
2
40 TestFinished.cdf

InterfaceInd
{172, 191, 210, 229, 248, 267, 286, 305, 324, 343, 362, 381, 400, 419, 438, 457, 476, 495,
514, 533, 552, 571, 590, 609, 628, 647, 666, 685, 704, 723, 742, 761, 932, 951, 970, 989,
1008, 1027, 1046, 1065, 1084, 1103, 1122, 1141, 1160, 1179, 1198, 1217, 1236, 1255,
1274, 1293, 1312, 1331, 1350, 1369, 1388, 1407, 1426, 1445, 1464, 1483, 1502, 1521}

InC = Graphics[{Blue, PointSize[0.005], Point[InterfacePoints]}, Axes  True];

Show[Domain, InC]
0.0012

0.0010

0.0008

0.0006

0.0004

0.0002

0.002 0.004 0.006


-0.0002

Length[InterfaceInd]
64

GetInterfaceElement[ctpn_, InterfacePoints_, InterfaceInd_] :=


Block{IntIndE1D, IntIndE2D, nn, i, ctpv, ctpIe},
ctpv = DomainVector[ctpn];
nn = Length[InterfaceInd];
nn
IntIndE1D = Table0, i, 1, ;
4
nn
IntIndE2D = Table0, i, 1, ;
4

nn
ctpIe = Table0, i, 1, ;
4
i+1
DoIntIndE1D  = {InterfaceInd〚i〛,
2
InterfaceInd〚i + 1〛, InterfaceInd〚nn - i〛, InterfaceInd〚nn - i + 1〛};
i+1 i+1 i+1
IntIndE2D  = 2 IntIndE1D  - 1, 2 IntIndE1D  // Flatten // Sort;
2 2 2
i+1 i+1 nn
ctpIe  = ctpvIntIndE1D , i, 1, , 2;
2 2 2
{IntIndE2D, ctpIe}

{IntIndE2D, ctpIe} = GetInterfaceElement[ctpn, InterfacePoints, InterfaceInd];


TestFinished.cdf 41

ModifyInterfaceIndex[InterfaceE_, BC_] := Block[{InterM, n1, n2, i, j, k},


{n1, n2} = Dimensions[InterfaceE];
InterM = InterfaceE;
For[i = 1, i ≤ n1, i ++,
For[j = 1, j ≤ n2, j ++,
For[k = 1, k ≤ Length[BC], k ++,
If[InterfaceE〚i, j〛 > BC〚k〛, InterM〚i, j〛 = InterM〚i, j〛 - 1];
];
];
];
InterM
]

IntIndE2DBC = ModifyInterfaceIndex[IntIndE2D, ubcIndex];

(*Manipulate[
Show[Concrete,Graphics[{PointSize[0.02],Point[ctpv〚i〛]}]],{i,1,1170}]*)

PreProcessing
CrossProduct[A_, B_] := Table[A〚i〛 B〚j〛, {i, 1, Length[A]}, {j, 1, Length[B]}]

Assembly functions
Assembly functions

AssemblyK[Ke_, InBC1_, InBC2_] := Block[{m, n, i, j, k, n1, n2, n3, m1, m2, Kt},
m = Max[InBC1];
n = Max[InBC2];
Kt = Table[0, {i, 1, m}, {j, 1, n}];
{n1, n2} = Dimensions[InBC1];
{n1, n3} = Dimensions[InBC2];
For[i = 1, i ≤ n1, i ++,
For[j = 1, j ≤ n2, j ++,
For[k = 1, k ≤ n3, k ++,
If[InBC1〚i, j〛 ≠ - 1 && InBC2〚i, k〛 ≠ - 1,
Kt〚InBC1〚i〛〚j〛〛〚InBC2〚i〛〚k〛〛 += Ke〚i〛〚j〛〚k〛;
];
];
];
];
Kt
]
42 TestFinished.cdf

External force
Assemblyf[fϵe_, InBC_] := Block[{m, i, j, k, n1, n2, m1, m2, fϵt},
m = Max[InBC];
fϵt = Table[0, {i, 1, m}];
{n1, n2} = Dimensions[InBC];
For[i = 1, i ≤ n1, i ++,
For[j = 1, j ≤ n2, j ++,
If[InBC〚i, j〛 ≠ - 1, fϵt〚InBC〚i〛〚j〛〛 += fϵe〚i〛〚j〛];
]
]
;
fϵt
]

Damage law of cohesive zone


EE = 0.1 109 ; ν = 0.3;

h = 0.5 10-3 ;

(*Plane strain*)

EE 1-2ν
CC = {1 - ν, ν, 0}, {ν, 1 - ν, 0}, 0, 0, ;
(1 + ν) (1 - 2 ν) 2

Kn = 5 1010 ; Ks = Kn;
tult = 106 ;
Gn = 100;

(*Asumption : Shear and Normal cohesive are the same*)

tult
uns = ; uss = uns;
Kn
Gn
unc = 2 ; usc = unc;
tult

Solving process
External loading
R = Assemblyf[fuextee, uhIndexEBC];

Max[Abs[R]]
Max[Abs[fuextee]]
1
TestFinished.cdf 43

Intial value
GetKInitialS[ctpe_, ctpIe_, CC_] :=
Block{k, p, J1, ii, jj, ζG, α, Kuue, Kde, , B2D, Bc, LL, D, ζN},
p = 2;
{ζG, α} = Gausspoint[p];

Kuue = Table[0, {i, 1, Length[ctpe]}];


Kde = Table[0, {i, 1, Length[ctpIe]}];
D = {{Ks, 0}, {0, Kn}};

Fork = 1, k ≤ Length[ctpe], k ++,

Forii = 1, ii ≤ p, ii ++,

Forjj = 1, jj ≤ p, jj ++,
1 + ζG〚ii〛 1 + ζG〚jj〛
{B2D, J1} = GetB2D , , ctpe〚k〛; (*3x8*)
2 2
1
Kuue〚k〛 = Kuue〚k〛 + J1 h α〚ii〛 α〚jj〛 Transpose[B2D].CC.B2D;
4
;

;

;

ζN = {0, 1};
Fork = 1, k ≤ Length[ctpIe], k ++,

Forii = 1, ii ≤ p, ii ++,
{Bc, LL} = GetB1D[ζN〚ii〛, ctpIe〚k〛]; (*2x8*)
1
Kde〚k〛 = Kde〚k〛 + LL h Transpose[Bc].D.Bc;
2
;

;
{Kuue, Kde}

{Kuue, Kde} = GetKInitialS[ctpe, ctpIe, CC];


44 TestFinished.cdf

GetwIn[uIn_, ctpIe_] := Block[{w, ζp, α, ii, BB, LL, n, i, p},


n = Length[uIn];
p = 2;
w = Table[0, {i, 1, n}, {j, 1, p}];
ζp = {0, 1};

For[i = 1, i ≤ n, i ++,
For[ii = 1, ii ≤ p, ii ++,
{BB, LL} = GetB1D[ζp〚ii〛, ctpIe〚i〛];
w〚i, ii〛 = BB.(uIn〚i〛 // Flatten);
];
];
w
]
TestFinished.cdf 45

GetDM[wIn_] := Block{n1, n2, n3, ωn, ωs, i, j, wwIn, qn, qs},


{n1, n2, n3} = Dimensions[wIn];
(*Notice this*)
wwIn = wIn;

ωn = Table[0, {i, 1, n1}, {j, 1, n2}];


ωs = Table[0, {i, 1, n1}, {j, 1, n2}];
qn = Table[0, {i, 1, n1}, {j, 1, n2}];
qs = Table[0, {i, 1, n1}, {j, 1, n2}];

Fori = 1, i ≤ n1, i ++,

Forj = 1, j ≤ n2, j ++,

IfwwIn〚i, j, 1〛 < uss, {ωs〚i, j〛 = 0; qs〚i, j〛 = 0},


wwIn〚i, j, 1〛 - uss usc
IfwwIn〚i, j, 1〛 ≤ usc, ωs〚i, j〛 = ;
wwIn〚i, j, 1〛 usc - uss
usc uss
qs〚i, j〛 = , {ωs〚i, j〛 = 1;
wwIn〚i, j, 1〛2 (usc - uss)
qs〚i, j〛 = 0};

IfwwIn〚i, j, 2〛 < uns, {ωn〚i, j〛 = 0; qn〚i, j〛 = 0},


wwIn〚i, j, 2〛 - uns unc
IfwwIn〚i, j, 2〛 ≤ unc, ωn〚i, j〛 = ;
wwIn〚i, j, 2〛 unc - uns
unc uns
qn〚i, j〛 = , {ωn〚i, j〛 = 1;
wwIn〚i, j, 2〛2 (unc - uns)
qn〚i, j〛 = 0};

;

;
{ωs, ωn, qs, qn}

46 TestFinished.cdf

AssemblyKd[Kde_, IntIndE2DBC_, uhIndexEBC_] :=


Block[{m, ii, jj, kk, Kdt, Kcct, Kddt, n1, n2},
m = Max[uhIndexEBC];
Kdt = Table[0, {i, 1, m}, {j, 1, m}];

{n1, n2} = Dimensions[IntIndE2DBC];


For[ii = 1, ii ≤ n1, ii ++,
For[jj = 1, jj ≤ n2, jj ++,
For[kk = 1, kk ≤ n2, kk ++,
Kdt〚IntIndE2DBC〚ii, jj〛, IntIndE2DBC〚ii, kk〛〛 += Kde〚ii, jj, kk〛;
];
];
]; Kdt
]

Kuut = AssemblyK[Kuue, uhIndexEBC, uhIndexEBC];

Kdt = AssemblyKd[Kde, IntIndE2DBC, uhIndexEBC];

GetInitial[λ_, Kuut_, Kdt_] :=


Block[{Ktotal, Ke, u0, u0e, u0eIn, ω0e, q0e, ϵ0e, u0eGP, Kuue, wIn, ωs, ωn, qs, qn},

u0 = Inverse[Kuut + Kdt].(λ R);


u0e = Getues[u0, uhIndexEBC];
u0eIn = Getues[u0, IntIndE2DBC];

wIn = GetwIn[u0eIn, ctpIe];


{ωs, ωn, qs, qn} = GetDM[wIn];
Print["Max shear damage :", Max[ωs]];
Print["Max normal damage :", Max[ωn]];

(*{u0eGP,ϵ0e}=GetuϵeGP[u0e,ctpe,p];*)
{u0, u0e, wIn, ωs, ωn, qs, qn}
]

sc = 0.01;

{u0, u0e, w0e, ω0s, ω0n, q0s, q0n} = GetInitial[ sc, Kuut, Kdt];
Max shear damage :0

Max normal damage :0


TestFinished.cdf 47

GetK[ctpIe_, wIne_, ωs_, ωn_, qs_, qn_] :=


Block{p, ζp, Kde, Kdde, Kcce, k, ii, Bc, LL, D, CC, DD},
ζp = {0, 1};
p = Length[ζp];
Kde = Table[0, {i, 1, Length[ctpIe]}];
Kdde = Table[0, {i, 1, Length[ctpIe]}];

Fork = 1, k ≤ Length[ctpIe], k ++,

Forii = 1, ii ≤ p, ii ++,
D = {{Ks (1 - ωs〚k, ii〛), 0}, {0, Kn (1 - ωn〚k, ii〛)}};
DD = {{- Ks wIne〚k, ii, 1〛 qs〚k, ii〛, 0}, {0, - Kn wIne〚k, ii, 2〛 qn〚k, ii〛}};

{Bc, LL} = GetB1D[ζp〚ii〛, ctpIe〚k〛];

LL
Kde〚k〛 = Kde〚k〛 + h Transpose[Bc].D.Bc;
2
LL
Kdde〚k〛 = Kdde〚k〛 + h Transpose[Bc].DD.Bc;
2
;

;
{Kde, Kdde}

AssemblyCO[Kde_, Kdde_, IntIndE2DBC_, uhIndexEBC_] :=


Block[{m, ii, jj, kk, Kdt, Kcct, Kddt, n1, n2},
m = Max[uhIndexEBC];
Kdt = Table[0, {i, 1, m}, {j, 1, m}];
Kddt = Table[0, {i, 1, m}, {j, 1, m}];

{n1, n2} = Dimensions[IntIndE2DBC];


For[ii = 1, ii ≤ n1, ii ++,
For[jj = 1, jj ≤ n2, jj ++,
For[kk = 1, kk ≤ n2, kk ++,
Kdt〚IntIndE2DBC〚ii, jj〛, IntIndE2DBC〚ii, kk〛〛 += Kde〚ii, jj, kk〛;
Kddt〚IntIndE2DBC〚ii, jj〛, IntIndE2DBC〚ii, kk〛〛 += Kdde〚ii, jj, kk〛;
];
];
]; {Kdt, Kddt}
]
48 TestFinished.cdf

Pure Newton Raphson solving


GetNext[u0_, u0e_, w0e_, ωs0_, ωn0_, qs0_, qn0_, λ_] :=
Block{Kde, Kdde, Kdt, Kddt, Kt, Pt, Δu, RR, u1, u1e, w1e, ωs, ωn, qs, qn, u1eIn},
{Kde, Kdde} = GetK[ctpIe, w0e, ωs0, ωn0, qs0, qn0];
{Kdt, Kddt} = AssemblyCO[Kde, Kdde, IntIndE2DBC, uhIndexEBC];
Kt = Kuut + Kdt + Kddt;
Pt = λ R - (Kuut + Kdt).u0;

Δu = Inverse[Kt].Pt;
Norm[Δu]
RR = ;
Norm[u0]
Print["Convergence criterion :", RR];
u1 = u0 + Δu;

u1e = Getues[u1, uhIndexEBC];


u1eIn = Getues[u1, IntIndE2DBC];

w1e = GetwIn[u1eIn, ctpIe];


{ωs, ωn, qs, qn} = GetDM[w1e];
Print["Max shear damage :", Max[ωs]];
Print["Max normal damage :", Max[ωn]];

{u1, u1e, w1e, ωs, ωn, qs, qn, RR}


GetNextStep[u_, ue_, we_, ωs_, ωn_, qs_, qn_, λ_] :=


Block{i, RR, u0, u0e, w0e, ω0s, ω0n, q0s, q0n, u1, u1e, w1e, ω1s, ω1n, q1s, q1n},
i = 0;
RR = 10;
{u0, u0e, w0e, ω0s, ω0n, q0s, q0n} = {u, ue, we, ωs, ωn, qs, qn};
WhileRR > 10-3 , {
If[RR ≥ 30 || i > 20, Break[]];
i = i + 1;
Print["Step : ", i];
{u1, u1e, w1e, ω1s, ω1n, q1s, q1n, RR} =
GetNext[u0, u0e, w0e, ω0s, ω0n, q0s, q0n, λ];
{u0, u0e, w0e, ω0s, ω0n, q0s, q0n} = {u1, u1e, w1e, ω1s, ω1n, q1s, q1n};
Print["-------------------"];
};
;
{u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ}

Chrisfield arc-length control


GetNextC[u0_, u0e_, w0e_, ω0s_, ω0n_, q0s_, q0n_, λ0_, upre_, λpre_, s0_] :=
Block{Kde, Kdde, Kdt, Kddt, K11, K12, K21, K22, Kt, P1, P2, Pt, Δ, Δu, Δλ, RR,
λ ω ω λ }
TestFinished.cdf 49

u1, λ1, u1e, w1e, ωs, ωn, qs, qn, u1eIn, Sλ, s, RR1, RR2, K1112, K2122, S2},
{Kde, Kdde} = GetK[ctpIe, w0e, ω0s, ω0n, q0s, q0n];
{Kdt, Kddt} = AssemblyCO[Kde, Kdde, IntIndE2DBC, uhIndexEBC];

Sλ = 104 ;

s= (u0 - upre).(u0 - upre) + Sλ (λ0 - λpre)2 ;

K11 = Kuut + Kdt + Kddt;


K12 = - R;
u0 - upre
K21 = ;
s
λ0 - λpre
K22 = Sλ ;
s

Max[Abs[K11], Abs[K12]]
S2 = ;
Max[Abs[K21], Abs[K22]]

K1112 = Join[K11, Transpose[{K12}], 2];


K2122 = S2 {K21, K22} // Flatten;
Kt = Join[K1112, {K2122}, 1];

P1 = λ0 R - (Kuut + Kdt).u0;

P2 = S2 (s0 - s);
Pt = {P1, P2} // Flatten;

Δ = Inverse[Kt].Pt;

Δu = Table[Δ〚i〛, {i, 1, Length[Δ] - 1}];


Δλ = Δ〚Length[Δ]〛;

Norm[Δu]
RR1 = ;
Norm[u0]
Norm[Δλ]
RR2 = ;
Norm[λ0]

Print["Convergence criterion of u: ", RR1];


Print["Convergence criterion of λ: ", RR2];

u1 = u0 + Δu;
λ1 = λ0 + Δλ;

u1e = Getues[u1, uhIndexEBC];


u1eIn = Getues[u1, IntIndE2DBC];

w1e = GetwIn[u1eIn, ctpIe];


50 TestFinished.cdf

{ωs, ωn, qs, qn} = GetDM[w1e];


Print["Max shear damage :", Max[ωs]];
Print["Max normal damage :", Max[ωn]];
Print["Loading factor :", λ1];

{u1, u1e, w1e, ωs, ωn, qs, qn, λ1, RR1, RR2}

GetNextStepC[u_, ue_, we_, ωs_, ωn_, qs_, qn_, λ_, s_] :=


Block{i, RR1, RR2, u0, u0e, w0e, ω0s, ω0n, q0s,
q0n, λ0, u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1, upre, λpre},
i = 0;
RR1 = 10;
RR2 = 10;
upre = 0.9999 u0;
λpre = 0.9999 λ;
{u0, u0e, w0e, ω0s, ω0n, q0s, q0n, λ0} = {u, ue, we, ωs, ωn, qs, qn, λ};
WhileRR1 > 10-3 || RR2 > 10-3 , {
If[RR1 ≥ 30 || RR2 ≥ 30 || i > 30, Break[]];
i = i + 1;
Print["Step : ", i];
{u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1, RR1, RR2} =
GetNextC[u0, u0e, w0e, ω0s, ω0n, q0s, q0n, λ0, upre, λpre, s];

{u0, u0e, w0e, ω0s, ω0n, q0s, q0n, λ0} = {u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1};
Print["-------------------"];
};
;
{u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1}

Dissipated energy control


GetNextD[u0_, u0e_, w0e_, ω0s_, ω0n_, q0s_, q0n_, λ0_, upre_, λpre_, τ0_] :=
Block{Kde, Kdde, Kdt, Kddt, K11, K12, K21, K22, Kt, P1, P2, Pt, Δ, Δu, Δλ, RR,
u1, λ1, u1e, w1e, ωs, ωn, qs, qn, u1eIn, p, τ, RR1, RR2, K1112, K2122, SF},
p = 2;
{Kde, Kdde} = GetK[ctpIe, w0e, ω0s, ω0n, q0s, q0n];
{Kdt, Kddt} = AssemblyCO[Kde, Kdde, IntIndE2DBC, uhIndexEBC];

Max[Abs[K11], Abs[K12]]
SF = ;
Max[Abs[K21], Abs[K22]]

1
τ= R.(u0 λpre - upre λ0);
2

K11 = Kuut + Kdt + Kddt;


K12 = - R;
TestFinished.cdf 51

1
K21 = (R λpre);
2
1
K22 = - R.upre;
2
K1112 = Join[K11, Transpose[{K12}], 2];
K2122 = SF {K21, K22} // Flatten;
Kt = Join[K1112, {K2122}, 1];

P1 = λ0 R - (Kuut + Kdt).u0;

P2 = SF (τ0 - τ);
Pt = {P1, P2} // Flatten;

Δ = Inverse[Kt].Pt;

Δu = Table[Δ〚i〛, {i, 1, Length[Δ] - 1}];


Δλ = Δ〚Length[Δ]〛;

Norm[Δu]
RR1 = ;
Norm[u0]
Norm[Δλ]
RR2 = ;
Norm[λ0]

Print["Convergence criterion of u: ", RR1];


Print["Convergence criterion of λ: ", RR2];

u1 = u0 + Δu;
λ1 = λ0 + Δλ;

u1e = Getues[u1, uhIndexEBC];


u1eIn = Getues[u1, IntIndE2DBC];

w1e = GetwIn[u1eIn, ctpIe];


{ωs, ωn, qs, qn} = GetDM[w1e];
Print["Max shear damage :", Max[ωs]];
Print["Max normal damage :", Max[ωn]];
Print["Loading factor :", λ1];

{u1, u1e, w1e, ωs, ωn, qs, qn, λ1, RR1, RR2}

52 TestFinished.cdf

GetNextStepD[u_, ue_, we_, ωs_, ωn_, qs_, qn_, λ_, s_] :=


Block{i, RR1, RR2, u0, u0e, w0e, ω0s, ω0n, q0s,
q0n, λ0, u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1, upre, λpre},
i = 0;
RR1 = 10;
RR2 = 10;
upre = 0.9999 u0;
λpre = 0.9999 λ;
{u0, u0e, w0e, ω0s, ω0n, q0s, q0n, λ0} = {u, ue, we, ωs, ωn, qs, qn, λ};
WhileRR1 > 10-3 || RR2 > 10-3 , {
If[RR1 ≥ 30 || RR2 ≥ 30 || i > 30, Break[]];
i = i + 1;
Print["Step : ", i];
{u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1, RR1, RR2} =
GetNextD[u0, u0e, w0e, ω0s, ω0n, q0s, q0n, λ0, upre, λpre, s];

{u0, u0e, w0e, ω0s, ω0n, q0s, q0n, λ0} = {u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1};
Print["-------------------"];
};
;
{u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1}

Iteration data
(*pure newton raphson*)

{u1, u1e, w1e, ω1s, ω1n, q1s, q1n, λ1} =


GetNextStep[u0, u0e, w0e, ω0s, ω0n, q0s, q0n, 2 sc];

{u2, u2e, w2e, ω2s, ω2n, q2s, q2n, λ2} =


GetNextStep[u1, u1e, w1e, ω1s, ω1n, q1s, q1n, 4 sc];

{u3, u3e, w3e, ω3s, ω3n, q3s, q3n, λ3} =


GetNextStep[u2, u2e, w2e, ω2s, ω2n, q2s, q2n, 6 sc];

{u4, u4e, w4e, ω4s, ω4n, q4s, q4n, λ4} =


GetNextStepC[u3, u3e, w3e, ω3s, ω3n, q3s, q3n, λ3, 0.1];

{u5, u5e, w5e, ω5s, ω5n, q5s, q5n, λ5} =


GetNextStepC[u4, u4e, w4e, ω4s, ω4n, q4s, q4n, λ4, 0.1];

{u6, u6e, w6e, ω6s, ω6n, q6s, q6n, λ6} =


GetNextStepC[u5, u5e, w5e, ω5s, ω5n, q5s, q5n, λ5, 0.1];

{u7, u7e, w7e, ω7s, ω7n, q7s, q7n, λ7} =


GetNextStepC[u6, u6e, w6e, ω6s, ω6n, q6s, q6n, λ6, 0.1];

{u8, u8e, w8e, ω8s, ω8n, q8s, q8n, λ8} =


GetNextStepC[u7, u7e, w7e, ω7s, ω7n, q7s, q7n, λ7, 0.1];

{u9, u9e, w9e, ω9s, ω9n, q9s, q9n, λ9} =


GetNextStepC[u8, u8e, w8e, ω8s, ω8n, q8s, q8n, λ8, 0.1];
TestFinished.cdf 53

(*Dissipated Energy control*)

{u10, u10e, w10e, ω10s, ω10n, q10s, q10n, λ10} =


GetNextStepDu9, u9e, w9e, ω9s, ω9n, q9s, q9n, λ9, 10-6 ;

{u11, u11e, w11e, ω11s, ω11n, q11s, q11n, λ11} =


GetNextStepDu10, u10e, w10e, ω10s, ω10n, q10s, q10n, λ10, 10-6 ;

{u12, u12e, w12e, ω12s, ω12n, q12s, q12n, λ12} =


GetNextStepDu11, u11e, w11e, ω11s, ω11n, q11s, q11n, λ11, 10-6 ;

{u13, u13e, w13e, ω13s, ω13n, q13s, q13n, λ13} =


GetNextStepDu12, u12e, w12e, ω12s, ω12n, q12s, q12n, λ12, 10-6 ;

{u14, u14e, w14e, ω14s, ω14n, q14s, q14n, λ14} =


GetNextStepDu13, u13e, w13e, ω13s, ω13n, q13s, q13n, λ13, 10-6 ;

{u15, u15e, w15e, ω15s, ω15n, q15s, q15n, λ15} =


GetNextStepDu14, u14e, w14e, ω14s, ω14n, q14s, q14n, λ14, 10-6 ;

{u16, u16e, w16e, ω16s, ω16n, q16s, q16n, λ16} =


GetNextStepDu15, u15e, w15e, ω15s, ω15n, q15s, q15n, λ15, 10-6 ;

{u17, u17e, w17e, ω17s, ω17n, q17s, q17n, λ17} =


GetNextStepDu16, u16e, w16e, ω16s, ω16n, q16s, q16n, λ16, 10-6 ;

{u18, u18e, w18e, ω18s, ω18n, q18s, q18n, λ18} =


GetNextStepDu17, u17e, w17e, ω17s, ω17n, q17s, q17n, λ17, 10-6 ;

{u19, u19e, w19e, ω19s, ω19n, q19s, q19n, λ19} =


GetNextStepDu18, u18e, w18e, ω18s, ω18n, q18s, q18n, λ18, 10-6 ;

{u20, u20e, w20e, ω20s, ω20n, q20s, q20n, λ20} =


GetNextStepDu19, u19e, w19e, ω19s, ω19n, q19s, q19n, λ19, 10-6 ;

{u21, u21e, w21e, ω21s, ω21n, q21s, q21n, λ21} =


GetNextStepDu20, u20e, w20e, ω20s, ω20n, q20s, q20n, λ20, 10-6 ;

{u22, u22e, w22e, ω22s, ω22n, q22s, q22n, λ22} =


GetNextStepDu21, u21e, w21e, ω21s, ω21n, q21s, q21n, λ21, 10-6 ;

{u23, u23e, w23e, ω23s, ω23n, q23s, q23n, λ23} =


GetNextStepDu22, u22e, w22e, ω22s, ω22n, q22s, q22n, λ22, 10-6 ;

{u24, u24e, w24e, ω24s, ω24n, q24s, q24n, λ24} =


GetNextStepDu23, u23e, w23e, ω23s, ω23n, q23s, q23n, λ23, 10-6 ;

{u25, u25e, w25e, ω25s, ω25n, q25s, q25n, λ25} =


GetNextStepDu24, u24e, w24e, ω24s, ω24n, q24s, q24n, λ24, 10-6 ;

{u26, u26e, w26e, ω26s, ω26n, q26s, q26n, λ26} =


GetNextStepDu25, u25e, w25e, ω25s, ω25n, q25s, q25n, λ25, 10-6 ;

{u27, u27e, w27e, ω27s, ω27n, q27s, q27n, λ27} =


GetNextStepDu26, u26e, w26e, ω26s, ω26n, q26s, q26n, λ26, 10-6 ;

{u28, u28e, w28e, ω28s, ω28n, q28s, q28n, λ28} =


GetNextStepDu27, u27e, w27e, ω27s, ω27n, q27s, q27n, λ27, 10-6 ;
54 TestFinished.cdf

{u29, u29e, w29e, ω29s, ω29n, q29s, q29n, λ29} =


GetNextStepDu28, u28e, w28e, ω28s, ω28n, q28s, q28n, λ28, 10-6 ;

{u30, u30e, w30e, ω30s, ω30n, q30s, q30n, λ30} =


GetNextStepDu29, u29e, w29e, ω29s, ω29n, q29s, q29n, λ29, 10-6 ;

{u31, u31e, w31e, ω31s, ω31n, q31s, q31n, λ31} =


GetNextStepDu30, u30e, w30e, ω30s, ω30n, q30s, q30n, λ30, 10-6 ;

{u32, u32e, w32e, ω32s, ω32n, q32s, q32n, λ32} =


GetNextStepDu31, u31e, w31e, ω31s, ω31n, q31s, q31n, λ31, 10-6 ;

{u33, u33e, w33e, ω33s, ω33n, q33s, q33n, λ33} =


GetNextStepDu32, u32e, w32e, ω32s, ω32n, q32s, q32n, λ32, 10-6 ;

{u34, u34e, w34e, ω34s, ω34n, q34s, q34n, λ34} =


GetNextStepDu33, u33e, w33e, ω33s, ω33n, q33s, q33n, λ33, 10-6 ;

{u35, u35e, w35e, ω35s, ω35n, q35s, q35n, λ35} =


GetNextStepDu34, u34e, w34e, ω34s, ω34n, q34s, q34n, λ34, 10-6 ;

{u36, u36e, w36e, ω36s, ω36n, q36s, q36n, λ36} =


GetNextStepDu35, u35e, w35e, ω35s, ω35n, q35s, q35n, λ35, 10-6 ;

{u37, u37e, w37e, ω37s, ω37n, q37s, q37n, λ37} =


GetNextStepDu36, u36e, w36e, ω36s, ω36n, q36s, q36n, λ36, 10-6 ;

{u38, u38e, w38e, ω38s, ω38n, q38s, q38n, λ38} =


GetNextStepDu37, u37e, w37e, ω37s, ω37n, q37s, q37n, λ37, 10-6 ;

{u39, u39e, w39e, ω39s, ω39n, q39s, q39n, λ39} =


GetNextStepDu38, u38e, w38e, ω38s, ω38n, q38s, q38n, λ38, 10-6 ;

{u40, u40e, w40e, ω40s, ω40n, q40s, q40n, λ40} =


GetNextStepDu39, u39e, w39e, ω39s, ω39n, q39s, q39n, λ39, 10-6 ;

{u41, u41e, w41e, ω41s, ω41n, q41s, q41n, λ41} =


GetNextStepDu40, u40e, w40e, ω40s, ω40n, q40s, q40n, λ40, 10-6 ;

{u42, u42e, w42e, ω42s, ω42n, q42s, q42n, λ42} =


GetNextStepDu41, u41e, w41e, ω41s, ω41n, q41s, q41n, λ41, 10-6 ;

{u43, u43e, w43e, ω43s, ω43n, q43s, q43n, λ43} =


GetNextStepDu42, u42e, w42e, ω42s, ω42n, q42s, q42n, λ42, 10-6 ;

{u44, u44e, w44e, ω44s, ω44n, q44s, q44n, λ44} =


GetNextStepDu43, u43e, w43e, ω43s, ω43n, q43s, q43n, λ43, 10-6 ;

{u45, u45e, w45e, ω45s, ω45n, q45s, q45n, λ45} =


GetNextStepDu44, u44e, w44e, ω44s, ω44n, q44s, q44n, λ44, 10-6 ;

{u46, u46e, w46e, ω46s, ω46n, q46s, q46n, λ46} =


GetNextStepDu45, u45e, w45e, ω45s, ω45n, q45s, q45n, λ45, 10-6 ;

{u47, u47e, w47e, ω47s, ω47n, q47s, q47n, λ47} =


GetNextStepDu46, u46e, w46e, ω46s, ω46n, q46s, q46n, λ46, 10-6 ;
TestFinished.cdf 55

{u48, u48e, w48e, ω48s, ω48n, q48s, q48n, λ48} =


GetNextStepDu47, u47e, w47e, ω47s, ω47n, q47s, q47n, λ47, 10-6 ;

{u49, u49e, w49e, ω49s, ω49n, q49s, q49n, λ49} =


GetNextStepDu48, u48e, w48e, ω48s, ω48n, q48s, q48n, λ48, 10-6 ;

{u50, u50e, w50e, ω50s, ω50n, q50s, q50n, λ50} =


GetNextStepDu49, u49e, w49e, ω49s, ω49n, q49s, q49n, λ49, 10-6 ;

{u51, u51e, w51e, ω51s, ω51n, q51s, q51n, λ51} =


GetNextStepDu50, u50e, w50e, ω50s, ω50n, q50s, q50n, λ50, 10-6 ;

{u52, u52e, w52e, ω52s, ω52n, q52s, q52n, λ52} =


GetNextStepDu51, u51e, w51e, ω51s, ω51n, q51s, q51n, λ51, 10-6 ;

{u53, u53e, w53e, ω53s, ω53n, q53s, q53n, λ53} =


GetNextStepDu52, u52e, w52e, ω52s, ω52n, q52s, q52n, λ52, 10-6 ;

{u54, u54e, w54e, ω54s, ω54n, q54s, q54n, λ54} =


GetNextStepDu53, u53e, w53e, ω53s, ω53n, q53s, q53n, λ53, 10-6 ;

{u55, u55e, w55e, ω55s, ω55n, q55s, q55n, λ55} =


GetNextStepDu54, u54e, w54e, ω54s, ω54n, q54s, q54n, λ54, 10-6 ;

{u56, u56e, w56e, ω56s, ω56n, q56s, q56n, λ56} =


GetNextStepDu55, u55e, w55e, ω55s, ω55n, q55s, q55n, λ55, 10-6 ;

{u57, u57e, w57e, ω57s, ω57n, q57s, q57n, λ57} =


GetNextStepDu56, u56e, w56e, ω56s, ω56n, q56s, q56n, λ56, 10-6 ;

{u58, u58e, w58e, ω58s, ω58n, q58s, q58n, λ58} =


GetNextStepDu57, u57e, w57e, ω57s, ω57n, q57s, q57n, λ57, 10-6 ;

{u59, u59e, w59e, ω59s, ω59n, q59s, q59n, λ59} =


GetNextStepDu58, u58e, w58e, ω58s, ω58n, q58s, q58n, λ58, 10-6 ;

{u60, u60e, w60e, ω60s, ω60n, q60s, q60n, λ60} =


GetNextStepDu59, u59e, w59e, ω59s, ω59n, q59s, q59n, λ59, 10-6 ;

usys = {0 u0e, u1e, u2e, u3e, u4e, u5e, u6e, u7e, u8e, u9e, u10e, u11e, u12e,
u13e, u14e, u15e, u16e, u17e, u18e, u19e, u20e, u21e, u22e, u23e, u24e,
u25e, u26e, u27e, u28e, u29e, u30e, u31e, u32e, u33e, u34e, u35e, u36e,
u37e, u38e, u39e, u40e, u41e, u42e, u43e, u44e, u45e, u46e, u47e, u48e,
u49e, u50e, u51e, u52e, u53e, u54e(*,u55e,u56e,u57e,u58e,u59e,u60e*)};

usys >> usys;

λsys = {0, λ1, λ2, λ3, λ4, λ5, λ6, λ7, λ8, λ9, λ10, λ11, λ12, λ13, λ14, λ15, λ16,
λ17, λ18, λ19, λ20, λ21, λ22, λ23, λ24, λ25, λ26, λ27, λ28, λ29, λ30, λ31,
λ32, λ33, λ34, λ35, λ36, λ37, λ38, λ39, λ40, λ41, λ42, λ43, λ44, λ45, λ46,
λ47, λ48, λ49, λ50, λ51, λ52, λ53, λ54(*,λ55,λ56,λ57,λ58,λ59,λ60*)};

λsys >> λsys

You might also like