Hi folks,

  The following set of options:

ap_mg_params = {"mat_type": "matfree",

                "snes_type": "ksponly",

                "ksp_type": "gmres",

                "ksp_rtol": 1.0e-8,

                "ksp_atol": 0.0,

                "ksp_max_it": 1000,

                "ksp_monitor": None,

                "ksp_converged_reason": None,

                "ksp_norm_type": "unpreconditioned",

                "pc_type": "mg",

                "mg_coarse_ksp_type": "preonly",

                "mg_coarse_pc_type": "python",

                "mg_coarse_pc_python_type": "firedrake.AssembledPC",

"mg_coarse_assembled_pc_type": "lu",

                "mg_coarse_assembled_pc_factor_mat_solver_type": "mumps",

"mg_levels_ksp_type": "richardson",

                "mg_levels_ksp_max_it": 1,

"mg_levels_ksp_richardson_scale": 1/3,

                "mg_levels_pc_type": "python",

                "mg_levels_pc_python_type": "__main__.Shifted",

"mg_levels_aux_pc_type": "python",

                "mg_levels_aux_pc_python_type": "firedrake.PatchPC",

                "mg_levels_aux_patch_pc_patch_save_operators": True,

"mg_levels_aux_patch_pc_patch_partition_of_unity": False,

                "mg_levels_aux_patch_pc_patch_sub_mat_type": "seqaij",

                "mg_levels_aux_patch_pc_patch_construct_type": "star",

                "mg_levels_aux_patch_pc_patch_multiplicative": False,

                "mg_levels_aux_patch_pc_patch_symmetrise_sweep": False,

                "mg_levels_aux_patch_pc_patch_construct_dim": 0,

                "mg_levels_aux_patch_sub_ksp_type": "preonly",

                "mg_levels_aux_patch_sub_pc_type": "lu"}


causes the message at the bottom of this email (below which is my Shifted class). What am I doing wrong?


all the best

--cjc



Traceback (most recent call last):

  File "libpetsc4py/libpetsc4py.pyx", line 1343, in libpetsc4py.PCApply_Python

  File "/Users/colincotter/firedrake/src/firedrake/firedrake/preconditioners/assembled.py", line 114, in apply

    push_appctx(dm, self._ctx_ref)

AttributeError: 'Shifted' object has no attribute '_ctx_ref'


The above exception was the direct cause of the following exception:


SystemError: <built-in method insert of list object at 0x1125f5548> returned a result with an error set

Exception ignored in: 'petsc4py.PETSc.traceback'

SystemError: <built-in method insert of list object at 0x1125f5548> returned a result with an error set



class Shifted(AuxiliaryOperatorPC):

    def form(self, pc, test, trial):

        ur, ui = split(trial)
        vr, vi = split(test)

        hrP = tau*H/(arP**2 + aiP**2)*(arP*div(ur) + aiP*div(ui))
        hiP = tau*H/(arP**2 + aiP**2)*(-aiP*div(ur) + arP*div(ui))

        aP = (
            inner(arP*ur,vr) - inner(aiP*ui, vr)
            - tau*inner(f*perp(ur),vr) +
            tau*g*inner(hr,div(vr)) +
            inner(arP*ui,vi) + inner(aiP*ur, vi)
            - tau*inner(f*perp(ui),vi) +
            tau*g*inner(hi,div(vi))
        )*dx

        bcs = None
        return (aP, bcs)