-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsolve_arclength_split.m
49 lines (36 loc) · 1.01 KB
/
solve_arclength_split.m
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
function [converged, du, dl, du1] = solve_arclength_split(timeStep, neq, iter, Kglobal, Rglobal, dof_force, Fext, assy4r, Du, Dl, ds, du1)
psi = 1.0;
FextReduced = Fext(assy4r);
FtF = Fext'*Fext;
if(timeStep > 1)
A = Du'*Du + psi*Dl*Dl*FtF - ds*ds;
a = 2.0*Du(assy4r)';
b = 2.0*psi*Dl*FtF;
else
A = 0.0;
a = 0.0*Du(assy4r)';
b = 1.0;
end
%%% Applying Boundary Conditions
R = Rglobal(assy4r);
rNorm = norm(R,2);
rNorm = sqrt(rNorm*rNorm + A*A);
fprintf(' rNorm : %5d ... %12.6E \n', iter, rNorm);
du = R*0.0;
dl = 0.0;
converged = false;
if(rNorm < 1.0e-6)
converged = true;
return;
end
K1 = Kglobal(assy4r,assy4r);
[L, U, P] = lu(sparse(K1));
%% solve the matrix system
duu = L\(P*FextReduced);
du1 = U\duu;
duu = L\(P*R);
du2 = U\duu;
du2 = -du2; % this is because the Residual is added to the RHS
dl = (a*du2 - A)/(b+a*du1);
du = -du2 + dl*du1;
end