After installation, the PFLARE PC types can then be used like native PETSc PC types, either by writing code to set the PETSc type/options, or through command line arguments. A few examples include:
in Fortran:
call KSPGetPC(ksp, pc, ierr)
call PCSetType(pc, PCAIR, ierr)
! ...[e.g., KSPSolve somewhere here]
or in C:
ierr = KSPGetPC(ksp, &pc);
ierr = PCSetType(pc, PCAIR);
// ...[e.g., KSPSolve somewhere here]
or in Python with petsc4py:
pc = ksp.getPC()
pc.setType("air")
# ...[e.g., KSPSolve somewhere here]
or via the command line: -pc_type air.
in Fortran:
call KSPGetPC(ksp, pc, ierr)
call PCSetType(pc, PCAIR, ierr)
call PCAIRSetZType(pc, AIR_Z_LAIR, ierr)
call PCAIRSetInverseType(pc, PFLAREINV_WJACOBI, ierr)
call PCAIRSetSmoothType(pc, "fcf", ierr)
! ...[e.g., KSPSolve somewhere here]
or in C:
ierr = KSPGetPC(ksp, &pc);
ierr = PCSetType(pc, PCAIR);
ierr = PCAIRSetZType(pc, AIR_Z_LAIR);
ierr = PCAIRSetInverseType(pc, PFLAREINV_WJACOBI);
ierr = PCAIRSetSmoothType(pc, "fcf");
// ...[e.g., KSPSolve somewhere here]
or in Python with petsc4py:
import pflare
pc = ksp.getPC()
pc.setType("air")
pflare.pcair_set_z_type(pc, pflare.AIR_Z_LAIR)
pflare.pcair_set_inverse_type(pc, pflare.PFLAREINV_WJACOBI)
pflare.pcair_set_smooth_type(pc, "fcf")
# ...[e.g., KSPSolve somewhere here]
or via the command line: -pc_type air -pc_air_z_type lair -pc_air_inverse_type wjacobi -pc_air_smooth_type fcf.
in Fortran:
call KSPGetPC(ksp, pc, ierr)
call PCSetType(pc, PCPFLAREINV, ierr)
call PCPFLAREINVSetPolyOrder(pc, 20, ierr)
call PCPFLAREINVSetType(pc, PFLAREINV_NEWTON, ierr)
call PCPFLAREINVSetMatrixFree(pc, PETSC_TRUE, ierr)
! ...[e.g., KSPSolve somewhere here]
or in C:
ierr = KSPGetPC(ksp, &pc);
ierr = PCSetType(pc, PCPFLAREINV);
ierr = PCPFLAREINVSetPolyOrder(pc, 20);
ierr = PCPFLAREINVSetType(pc, PFLAREINV_NEWTON);
ierr = PCPFLAREINVSetMatrixFree(pc, PETSC_TRUE);
// ...[e.g., KSPSolve somewhere here]
or in Python with petsc4py:
import pflare
pc = ksp.getPC()
pc.setType("pflareinv")
pflare.pcpflareinv_set_poly_order(pc, 20)
pflare.pcpflareinv_set_type(pc, pflare.PFLAREINV_NEWTON)
pflare.pcpflareinv_set_matrix_free(pc, True)
# ...[e.g., KSPSolve somewhere here]
or via the command line: -pc_type pflareinv -pc_pflareinv_type newton -pc_pflareinv_poly_order 20 -pc_pflareinv_matrix_free.
There are a number of Jupyter notebooks in notebooks/, which include an introduction to the key components of PFLARE and some simple Python examples. These can be run locally, or you can click the Binder badge at the top of the README to run these interactively.