Skip to content
Open

code #13

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions python/stokes-dolfin-snes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

import sys

parameters["form_compiler"]["quadrature_degree"] = 6
parameters["form_compiler"]["cpp_optimize"] = True
parameters["form_compiler"]["cpp_optimize_flags"] = "-O3 -ffast-math -march=native"

def usage():
print sys.argv[0]+""" [options] dolfin_mesh.xml
options:
Expand Down Expand Up @@ -81,20 +85,21 @@ def usage():
--petsc.se_snes_atol 1.0e-7

--petsc.se_ksp_converged_reason
--petsc.se_ksp_type bcgs
--petsc.se_ksp_type gcr
--petsc.se_ksp_monitor_true_residual
--petsc.se_ksp_rtol 1.0e-6
--petsc.se_ksp_atol 1.0e-6
--petsc.se_ksp_rtol 1.0e-7
--petsc.se_ksp_atol 1.0e-7

--petsc.se_pc_type fieldsplit
--petsc.se_pc_fieldsplit_type schur
--petsc.se_pc_fieldsplit_schur_factorization_type upper
--petsc.se_pc_fieldsplit_schur_Rpreconditioner user

--petsc.se_fieldsplit_0_ksp_type preonly
--petsc.se_fieldsplit_0_pc_type gamg
--petsc.se_fieldsplit_0_ksp_max_it 1
--petsc.se_fieldsplit_0_pc_type ml

--petsc.se_fieldsplit_1_ksp_type preonly
--petsc.se_fieldsplit_1_ksp_max_it 2
--petsc.se_fieldsplit_1_pc_type jacobi
""".split()

Expand Down Expand Up @@ -235,12 +240,12 @@ def extract_sub_vector(V, subspace):
(v, q) = TestFunctions(Z)

schur_D = assemble(inner(p, q)*dx)
[bc.apply(schur_D) for bc in bcs]
#[bc.apply(schur_D) for bc in bcs]
schur = extract_sub_matrix(schur_D, 1, 1)

def monitor(snes, its, norm):
pc = snes.ksp.pc
pc.setFieldSplitSchurPrecondition(PETSc.PC.SchurPreType.USER, schur)
pc.setFieldSplitSchurPreType(PETSc.PC.SchurPreType.USER, schur)

snes.setMonitor(monitor)

Expand Down