Nested (MatNest).
()
| 138 | |
| 139 | # Nested (MatNest) |
| 140 | def nested(): |
| 141 | """Nested (MatNest).""" |
| 142 | x = create_vector([V0, V1], kind=PETSc.Vec.Type.NEST) |
| 143 | |
| 144 | assign((u, p), x) |
| 145 | |
| 146 | A = assemble_matrix(a_block, bcs=[bc], kind="nest") |
| 147 | b = assemble_vector(L_block, kind="nest") |
| 148 | bcs1 = bcs_by_block(extract_function_spaces(a_block, 1), bcs=[bc]) |
| 149 | apply_lifting(b, a_block, bcs=bcs1, x0=x, alpha=-1.0) |
| 150 | for b_sub in b.getNestSubVecs(): |
| 151 | b_sub.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE) |
| 152 | bcs0 = bcs_by_block([L.function_spaces[0] for L in L_block], [bc]) |
| 153 | |
| 154 | set_bc(b, bcs0, x, alpha=-1.0) |
| 155 | A.assemble() |
| 156 | assert A.getType() == "nest" |
| 157 | Anorm = nest_matrix_norm(A) |
| 158 | bnorm = b.norm() |
| 159 | A.destroy() |
| 160 | b.destroy() |
| 161 | x.destroy() |
| 162 | return Anorm, bnorm |
| 163 | |
| 164 | def monolithic(): |
| 165 | """Monolithic version.""" |
nothing calls this directly
no test coverage detected