On direct elimination of constraints in KKT systems

On direct elimination of constraints in KKT systems
Cleve Ashcraft, Roger Grimes
LSTC
[email protected], [email protected]
Sparse Days Meeting 2011 at CERFACS
September 6-7, 2011
Toulouse, FRANCE
1
Outline of talk
• coupled linear system
– singular stiffness linear system
– full rank constraint linear system
• two approaches for solution
– direct elimination
– null space projection
• types of constraints and spy plots
– Dirichlet conditions
– adaptive conditions
– rigid body conditions
– large door model
2
Outline of talk (continued)
• various topics
– when not to use direct elimination
– inertial relief
– nice basis problem
– re-use of permutations
– Lagrange multipliers and residual forces
– rank-revealing QR factorizations
• summary
3
Start with a singular linear system
K u=f
• stiffness matrix K is n × n sparse and singular,
• displacement vector u is n × 1
3 translations, 3 rotations
• force vector f is n × 1
• solution u is not unique.
• Ku = f comes from a nonlinear iteration and
we expect there to be one equilibrium point
• we expect additional information
to find a unique solution.
4
(1)
Add a linear system of constraints
C u=g
• constraint matrix C is r × n sparse, r ≤ n
• displacement vector u is n × 1
3 translations, 3 rotations
• right hand size vector g is r × 1
• equation (2) is satisfied exactly.
• impose condition :
u lies in the n × r column space of C T
• now we bifurcate our analysis
– direct elimination
– null space projection
5
(2)
Outline of talk
• coupled linear system
– singular stiffness linear system
– full rank constraint linear system
• two approaches for solution
– direct elimination
– null space projection
• types of constraints and spy plots
– Dirichlet conditions
– adaptive conditions
– rigid body conditions
– large door model
6
Direct elimination (step 1)
• Form the KKT system
"
#
T
KM,M CR,M uM
fM
=
v
gR
CR,M
0
R
• KM,M sparse, semi-positive definite,
frequently its rank deficiency is six or less
• CR,M sparse, full rank, |R| ≤ |M|
• vR, Lagrange multipliers
• indefinite linear (n + r) × (n + r) system
• with large rigid bodies, very indefinite,
r can be much greater than (n − r)
7
(3)
Null space projection (step 1)
• find n × (n − r) matrix Z such that C Z = 0
• For example, full size LQ factorization
T
Q
C= L 0
ZT
• L is r × r, Q is n × r, Z is n × (n − r)
• QT Q = I, Z T Z = I, and QT Z = 0
• write displacements u as u = Q αD + Z αI
8
(4)
Null space projection (step 2)
• constraint equation
Cu = g =⇒ C(Q αD + Z αI ) = g
=⇒ CQ αD = g since CZ = 0
=⇒ LQT Q αD = g =⇒ αD = L−1g
• write displacements u as u = ZαI + QL−1g
• insert into stiffness equation
Ku = K(ZαI + QL−1g) = f
• modify right hand side
KZ αI = f + ∆f = f − KQL−1g
9
(5)
Null space projection (step 3)
• impose Galerkin condition
T (f − KQL−1g)
Z T KZ αI = Z
= Z T f − Z T KQ L−1g
• (n − r) × (n − r) matrix Z T KZ is positive definite
10
(6)
Direct elimination (step 2)
• analyze constraint matrix CR,M
CR,M uM = gR
(7)
• find permutation matrices PS,R and PM,N
T
CS,N uN = PS,RCR,MPM,N PM,N uM
= PS,R gR = gS
(8)
• find block structure, CS,D nonsingular r × r
uI
CS,I CS,D
= gS
uD
(9)
this is the “nice basis problem”
11
Direct elimination (step 3)
• compute inverse CD,S , where CD,S CS,D = ID,D
• premultiply with CD,S
uI
= CD,S gS
CD,S CS,I CS,D
uD
• simpler constraint system
uI
CD,I ID,D
= gD
uD
• simpler KKT system
   

T
KI,I KI,D CD,I
fI
uI
   

KD,I KD,D ID,D  uD = fD
gD
vD
CD,I ID,D 0
12
(10)
(11)
Direct elimination (step 4)
• reduced linear system
b I,I uI = fbI
K
(12)
• Eliminate trailing block rows and columns
−1 h
i K
ID,D
KD,I
T
D,D
b
K
C
KI,I = KI,I − D,I I,D
ID,D 0
CD,I
−1 h
i K
ID,D
fD
D,D
T
b
fI = fI − CD,I KI,D
gD
ID,D 0
• Block inverse
−1 KD,D ID,D
0
ID,D
=
ID,D 0
ID,D (−KD,D )
13
Direct elimination (step 5)
• should not be a
ID,D
0
and
surprise, since
−1 KD,D
I
−KD,D
= D,D
ID,D
0
ID,D
ID,D 0
KD,D ID,D
−1
ID,D
0
=
−KD,D ID,D
b I,I uI = fbI
• reduced linear system K
h
i 0
−ID,D KD,I
T
b
KI,I = KI,I + KI,D CD,I
−ID,D KD,D
CD,I
h
i 0
−ID,D fD
T
b
fI = fI + KI,D CD,I
−ID,D KD,D gD
14
Null space projection (step 4)
• If we start with the simpler constraints
uI
CD,I ID,D
= gD
uD
and permuted and blocked stiffness equation
KI,I KI,D uI
fI
=
KD,I KD,D uD
fD
(13)
(14)
• orthogonal, not orthonormal subspaces
"
#
T
CD,I
II,I
QN ,D =
, ZN ,I =
,
−C
ID,D
D,I
QTN ,D ZN ,I = 0,
QTN ,D QN ,D 6= I,
15
ZTN ,I ZN ,I 6= I
Null space projection (step 5)
• split solution
II,I
0I
0I
uI
uI +
=
= ZN ,I uI +
gD
−CD,I
gD
uD
• insert into stiffness equation Ku = f
KI,I KI,D
II,I
fI
0I
=
u +
KD,I KD,D
fD
gD
−CD,I I
KI,I KI,D
II,I
KI,D
fI
uI =
−
gD
KD,I KD,D −CD,I
fD
KD,D
16
(15)
(16)
(17)
Null space projection (step 6)
• impose Galerkin condition, solve
b I,I uI = fbI
K
where
and
b I,I =
K
fbI =
II,I
−CD,I
II,I
−CD,I
T KI,I KI,D
KD,I KD,D
T 17
(18)
II,I
−CD,I
KI,D
fI
gD
−
KD,D
fD
(19)
(20)
Equivalent reduced linear systems
• from direct elimination
h
i 0
−ID,D KD,I
T
b
KI,I = KI,I + KI,D CD,I
CD,I
−ID,D KD,D
h
i 0
−ID,D fD
T
b
K
C
fI = fI +
I,D D,I −I
gD
D,D KD,D
• from null space projection
T II,I
KI,I KI,D
II,I
b
KI,I =
−CD,I
KD,I KD,D −CD,I
T II,I
KI,D
fI
b
fI =
−
gD
fD
−CD,I
KD,D
18
Outline of talk
• coupled linear system
– singular stiffness linear system
– full rank constraint linear system
• two approaches for solution
– direct elimination
– null space projection
• types of constraints and spy plots
– Dirichlet conditions
– adaptive conditions
– rigid body conditions
– large door model
19
Dirichlet conditions
• uD = u0D , dependent dof given values
• constraint matrix
CS,N = CS,I CS,D = 0S,I IS,D
CD,N = CD,I ID,D = 0D,I ID,D
• reduced system
b I,I = KI,I
K
fbI = fI − KI,D u0D
20
(21)
(22)
Adaptive conditions
• ui = α ∗ uj + β ∗ uk
• linear interpolation between two nodes
• constraint matrix
CS,N = CS,I CS,D = CS,I IS,D
CD,N = CD,I ID,D
• idea extends to tied contact,
slave node linear combination of 3-4 nodes
21
(23)
(24)
Adaptive conditions : mesh
8
7
6
5
1
ui = uj + uk
2
4
3
2
1
0
0
2
4
6
8
10
22
12
Adaptive conditions : KKT system
I_1
• magenta –
stiffness matrix
not modified
I_2
• green –
stiffness matrix
modified
• red –
stiffness matrix
not modified
D
S
I_1
I_2
nz = 228
D
S
23
• yellow –
constraint matrix
Adaptive conditions : Reduced system
0
2
4
• magenta –
stiffness matrix
not modified
6
8
10
12
• green –
stiffness matrix
modified
14
16
18
20
0
2
4
6
8
10
12
nz = 109
14
16
18
20
24
Rigid body conditions : mesh
7
6
ui = Ti,cmucm

10 0
0 1 0

0 0 1
Ti,cm = 
0 0 0

0 0 0
00 0
5
i
i
i
i
i
i
4
cm
i
i
i
i
i
i
3
2
1
1
2
3
4
5
6
25
7
0
∗
∗
1
0
0
∗
0
∗
0
1
0

∗
∗

0

0

0
1
Rigid body conditions : KKT system
• magenta –
stiffness matrix
not modified
I_1
• green –
stiffness matrix
modified
I_2
• red –
stiffness matrix
not modified
D
S
I_1
I_2
D
S
nz = 388
26
• yellow –
constraint matrix
Rigid body conditions : Reduced system
0
5
10
• magenta –
stiffness matrix
not modified
15
20
• green –
stiffness matrix
modified
25
30
35
40
0
5
10
15
20
nz = 248
25
30
35
40
27
Door model, 1,288,044 dof, 38,478 constraints
• constraints
distributed across
16 processors
4
0
x 10
0.5
• C has 38,478 rows
and 53,673 nonzero
columns
1
1.5
2
• 2,916 tied contact
2.5
• 5 interpolation
constraints
3
3.5
0
0.5
1
1.5
2
2.5
3
nz = 136962
3.5
4
4.5
5
4
x 10
28
• 297 rigid bodies,
35,532 rows
Door model, 1,288,044 dof, 38,478 constraints
4
0
4
x 10
0
• |CS,D | = 39144,
almost diagonal
0.5
1
• |CD,S | = 39144,
no-fill inverse
1.5
2
• |CS,I | = 97818,
(on left)
2.5
• |CD,I | = 98142,
(on right)
3
3.5
0
5000
10000
nz = 97818
15000
x 10
0.5
1
1.5
2
2.5
3
3.5
0
29
5000
10000
nz = 98142
15000
Outline of talk
• various topics
– when not to use direct elimination
– inertial relief
– nice basis problem
– re-use of permutations
– Lagrange multipliers and residual forces
– rank-revealing QR factorizations
30
When is direct elimination a bad idea?
• When CD,I is dense, or has one or more dense rows,
b I,I is dense
then K
• Expand CD,I = CD,S CS,I
– we want CD,S to be sparse
– only possible when CS,D has many components,
i.e., diagonal or block diagonal
– CD,S has a good block triangular form
with small diagonal blocks
– also want CS,I to be sparse
• Interesting ordering problem,
much different from ordering stiffness matrix K
31
Example : Inertial relief, CE,I and CE,D dense
• rows and columns : eliminate D, keep E

   
T
T
KI,I KI,D CD,I CE,I
fI
uI

   
T
KD,I KD,D ID,D CE,D  uD  fD 

  =  
gD
 CD,I ID,D 0
0  vD
gE
vE
CE,I CE,D 0
0
• reduce to then solve for uI and vE .
# "
bT
b I,I C
K
uI
fbI
E,I
=
bE,I 0
vE
gbE
C
(25)
(26)
• recover uD and vD
# "
T
KD,I CE,D
KD,D ID,D uD
uI
fD
=
(27)
−
ID,D 0
vD
vE
gD
CD,I 0
32
Nice basis problem CR,MuM = gR
• Given r × n matrix CR,M find
– permutations PS,R and PN ,M
T
PS,RCR,MPN ,M PN ,MuM = PS,RgR
CS,N uN = gS
– find independent I and dependent D dof
uI
CS,I CS,D
= gS
uD
(28)
(29)
(30)
with CS,D square, nonsingular
−1 is sparse, well conditioned
– inverse CD,S = CS,D
33
Nice basis problem CR,MuM = gR
• purely structural based permutations
have created singular CS,D matrices.
• use structural and numeric phases
to compute the permutations
PS1,R1
IS1,R1
PS,R =
IS2,R2
PS2,R2
IN1,M1
PN1,M1
PN ,M =
PN2,M2
IN2,M2
no MPP implementation (not needed yet)
(31)
(32)
• structural phase needs a tolerance to bound max |CD,S |
34
Re-using the permutations
• The operation
minimize kf − Kuk2 subject to Cu = g
is done inside a nonlinear iteration
• we can reuse the permutations for several steps
• monitor max |CD,S |/ max |CS,D |
• monitor max |CD,I |/ max |CS,I |
• as the constraint matrix C becomes stale,
CD,S and CD,I can become ill-conditioned
since the ordering may not be suited for the entries
35
Lagrange multiplers
More than just a mathematical construct.
• residual forces : r = f − Ku = C T v
• Lagrange multipliers are residual forces
at dependent dof
vD = rD = fD − KD,N uN
(33)
• residual forces at N :
#
"
#
"
T
T v
C
C
T v =
D,I v =
D,I D
rN = CD,N
D
ID,I D
vD
(34)
• residual forces at original ordering M :
T
vD
rM = PM,N rN = PM,N CD,N
36
(35)
Relaxation of full rank constraints
• full rank property =⇒ CS,D is nonsingular
• rank-revealing QR factorization of CR,M
CR,MPM,N = QR,K RK,N = QR,K RK,D RI,N
where |K| = |D| ≤ |R|
CR,MPM,N
QR,K RK,D
RK,D
ID,D
CR,MuM
PN ,MuM
uD
RK,I
uI
uD
RK,I
uI
uD
RD,I
uI
37
=
=
gR
gR
= gR
= gK = QR,K gR
= gD = RD,KgK
Why RRQR on constraint matrix C?
• Full rank =⇒
no replicated constraint rows across processors
• Useful feature, return information to user
on over-constrained system
– presently return information about dof
– RRQR can return information about
constraint rows
• New feature for engineer —
weighted constraint rows
38
Summary
• Basic idea : use constraints to reduce system size,
often indefinite matrix −→ definite matrix
• Two approaches are equivalent
– direct elimination
– null space projection
• Nice basis problem
– structural methods inadequate by themselves
– numeric methods necessary for a robust solution
– MPP implementation interesting research topic
39