MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / nested

Method nested

python/test/unit/fem/test_petsc_nonlinear_assembler.py:140–162  ·  view source on GitHub ↗

Nested (MatNest).

()

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 12

solveMethod · 0.95
create_vectorFunction · 0.90
assignFunction · 0.90
assemble_matrixFunction · 0.90
assemble_vectorFunction · 0.90
bcs_by_blockFunction · 0.90
extract_function_spacesFunction · 0.90
apply_liftingFunction · 0.90
set_bcFunction · 0.90
normMethod · 0.80
nest_matrix_normFunction · 0.70
interpolateMethod · 0.45

Tested by

no test coverage detected