<div dir="ltr"><div dir="ltr">Hi all,<div><br></div><div>I am attempting to write my own scour preconditioner for a FEniCS/petsc4py. I managed to attach a DMShell to the KSP so that I can employ command-line options for field splitting. Suppose I want to solve the Navier-Stokes equation and have the following command-line options:</div><div><br></div><div>-ksp_type fgmres</div><div>-pc_type fieldsplit</div><div>-pc_fieldsplit_type schur</div><div>-pc_fieldsplit_schur_fact_type full</div><div>-fieldsplit_0_ksp_type gmres</div><div>-fieldsplit_0_pc_type hypre</div><div>-fieldsplit_1_ksp_type preonly</div><div>-fieldsplit_1_pc_type python</div><div>-fieldsplit_1_pc_python_type pfibs.MyPCD</div><div><br></div><div>Where MyPCD is part of my pfibs module and looks something like this:</div><div><br></div><div>class MyPCD(object):</div><div>    def setUp(self, pc):</div><div>          # Do something #</div><div>             ....</div><div>    def apply(self, pc, x, y):</div><div>          # Do something #</div><div>             ....</div><div><br></div><div>The problem is that in my actual python code (mycode.py) I have a dict() object that I would like to pass into the setUp() call inside MyPCD to read in, but it is not clear how I can do this if I set the pc python type via command line options. If I hard-coded this, I would just call pc.setPythonContext(...) but I was wondering if there's a way to do this, e.g., attaching an appctx/dict to the pc itself. Does anyone have ideas or suggestions on how to go about doing this?</div><div><br></div><div>Thanks,</div><div>Justin</div></div></div>