(Sorry I forgot to answer all in the first message) Well I have never used Petsc in python, but in FORTRAN, it seems to work like any array. So why not use a python list for instance ? You would start with SNESs = [], create a new snes and append it to the list with SNESs.append(snes). Then you can use your list. That would not do it ?
Timothee 2016-01-06 13:24 GMT+09:00 Justin Chang <jychan...@gmail.com>: > 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.nico...@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 <jychan...@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 >>> >> >> >