Skip to content

PETSc Options

Louis Moresi edited this page Oct 13, 2021 · 2 revisions

The horse's mouth

The python interface in underworld / petsc4py

Here are the options from the Cartesian Stokes example.

Note, these are dictionary entries so options["ksp_monitor"] = None is how we activate this option and to deactivate it we need to delete that entry from the dictionary. del(options["ksp_monitor"]). It might be good to arrange to set this up through True / False assignment but PETSc does not like this at all.

    options = PETSc.Options()
    # options["help"] = None
    # options["pc_type"]  = "svd"
    options["ksp_rtol"] =  1.0e-6
    options["ksp_atol"] =  1.0e-6
    # options["ksp_monitor"] = None
    # options["snes_type"]  = "fas"
    options["snes_converged_reason"] = None
    options["snes_monitor_short"] = None
    # options["snes_view"]=None
    # options["snes_test_jacobian"] = None
    # options["snes_rtol"] = 1.0e-2  # set this low to force single SNES it. 
    options["snes_max_it"] = 10
    # options["pc_type"] = "fieldsplit"
    # options["pc_fieldsplit_type"] = "schur"
    # options["pc_fieldsplit_schur_factorization_type"] = "full"
    # # options["fieldsplit_pressure_ksp_rtol"] = 1e-6
    # options["fieldsplit_velocity_pc_type"] = "lu"
    # options["fieldsplit_pressure_pc_type"] = "jacobi" 
    # options["fieldsplit_velocity_ksp_type"] = "gmres"
Clone this wiki locally