[petsc-users] Help with petsc4py and PC Python type
Justin Chang
jychang48 at gmail.com
Tue Jan 22 16:30:30 CST 2019
As of right now, the dict() is something the user constructs inside
mycode.py. It would contain things like the viscosity, boundary conditions,
function space, etc which are needed to construct the PC operators in
MyPCD. I believe I saw the Firedrake guys do something similar to this
On Tue, Jan 22, 2019 at 3:27 PM Jed Brown <jed at jedbrown.org> wrote:
> Justin Chang via petsc-users <petsc-users at mcs.anl.gov> writes:
>
> > 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()
>
> Where does this dict come from? When is it available?
>
> > 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/c8df83ce/attachment.html>
More information about the petsc-users
mailing list