[petsc-users] Help with petsc4py and PC Python type
Justin Chang
jychang48 at gmail.com
Tue Jan 22 16:00:39 CST 2019
Hi all,
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:
-ksp_type fgmres
-pc_type fieldsplit
-pc_fieldsplit_type schur
-pc_fieldsplit_schur_fact_type full
-fieldsplit_0_ksp_type gmres
-fieldsplit_0_pc_type hypre
-fieldsplit_1_ksp_type preonly
-fieldsplit_1_pc_type python
-fieldsplit_1_pc_python_type pfibs.MyPCD
Where MyPCD is part of my pfibs module and looks something like this:
class MyPCD(object):
def setUp(self, pc):
# Do something #
....
def apply(self, pc, x, y):
# Do something #
....
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?
Thanks,
Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190122/7a5e35a3/attachment.html>
More information about the petsc-users
mailing list