def initialize_schur_ksp_obj(matrix_A, schur_approx): """ Creates a right-hand-side and solution PETSc4Py vector for testing ksp solves. Parameters ---------- matrix_A: :class:`p4pyPETSc.Mat` Global matrix object. schur_approx: :class:`LS.SchurPrecon` Returns ------- ksp_obj: :class:`p4pyPETSc.KSP` """ ksp_obj = p4pyPETSc.KSP().create() ksp_obj.setOperators(matrix_A, matrix_A) pc = schur_approx.pc ksp_obj.setPC(pc) ksp_obj.setFromOptions() pc.setFromOptions() pc.setOperators(matrix_A, matrix_A) pc.setUp() schur_approx.setUp(ksp_obj) ksp_obj.setUp() ksp_obj.pc.setUp() return ksp_obj
def initialize_asm_ksp_obj(matrix_A): """ Creates a right-hand-side and solution PETSc4Py vector for testing ksp solves. Parameters ---------- matrix_A: :class:`p4pyPETSc.Mat` Global matrix object. Returns ------- ksp_obj: :class:`p4pyPETSc.KSP` """ ksp_obj = p4pyPETSc.KSP().create() ksp_obj.setOperators(matrix_A, matrix_A) ksp_obj.setFromOptions() ksp_obj.setUp() return ksp_obj