[petsc-users] Array of SNES's

Justin Chang jychang48 at gmail.com
Wed Jan 6 01:29:04 CST 2016


Okay so i think there's no need for this in my case.

Doing a standard NewtonLS and using the same SNES was no issue at all. My
original issue was dealing with the Variational Inequality at each grid
point which seemed to break down unless I "reset" the SNES. But when I use
these options: -snes_fd -ksp_type preonly -pc_type lu, it works perfectly
if I use the same snes for all N grid points. Yes I sacrifice some time
forming a FD, but it's not as great as creating new SNES objects each time.

Strange

Justin

On Tue, Jan 5, 2016 at 9:30 PM, Patrick Sanan <patrick.sanan at gmail.com>
wrote:

> Do all the SNES's need to be constructed at the same time? It will
> obviously require a lot of memory to store N SNES objects (or perhaps
> your N is small), and if they don't all need to exist simultaneously, then
> do you have the option to
> create and destroy one at a time as you loop over your grid points?
> On Tue, Jan 05, 2016 at 09:24:11PM -0700, Justin Chang wrote:
> > Timothee,
> >
> > No i haven't tried, mainly because I don't know how. Btw I am not doing
> > this in C or FORTRAN, I want to do this in python (via petsc4py) since I
> am
> > trying to make this compatible with Firedrake (which is also
> python-based).
> >
> > Thanks,
> > Justin
> >
> > On Tue, Jan 5, 2016 at 8:57 PM, Timothée Nicolas <
> timothee.nicolas at gmail.com
> > > wrote:
> >
> > > Hello and happy new year,
> > >
> > > Have you actually tried ? I just declared an array of 10 snes and
> created
> > > them, and there is no complaint whatsoever. Also, something I do
> usually is
> > > that I declare a derived type which contains some Petsc Objects (like
> SNES,
> > > KSP, matrices, vectors, whatever), and create arrays of this derived
> types.
> > > This works perfectly fine in my case (I use FORTRAN btw).
> > >
> > > Best wishes
> > >
> > > Timothee
> > >
> > >
> > > 2016-01-06 11:53 GMT+09:00 Justin Chang <jychang48 at gmail.com>:
> > >
> > >> Hi all,
> > >>
> > >> Is it possible to create an array of SNES's? If I have a problem size
> N
> > >> degrees of freedom, I want each dof to have its own SNES solver
> (basically
> > >> a pointer to N SNES's). Reason for this is because I am performing a
> > >> "post-processing" step where after my global solve, each entry of my
> > >> solution vector of size N will go through some algebraic manipulation.
> > >>
> > >> If I did a standard LU solve for these individual SNES's, I could use
> the
> > >> same snes and this issue would be moot. But i am using the Variational
> > >> Inequality, which basically requires a fresh SNES for each problem.
> > >>
> > >> Thanks,
> > >> Justin
> > >>
> > >
> > >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160106/6e6ff618/attachment.html>


More information about the petsc-users mailing list