[petsc-users] snes_type aspin without DA example

Barry Smith bsmith at petsc.dev
Fri Jun 23 11:57:05 CDT 2023


  Take a look at setNestSubVecs() in /src/binding/petsc4py/src/petsc4py/PETSc/Vec.pyx it seems to deal with passing an array of PETSc objects. Likely there are additional instances where arrays of objects are passed between Python and C. 

  I do not understand this code, but the Python experts will. Perhaps this type of construct can be hoisted up into a petsc4py implementation utility useful for any place in PETSc where arrays of objects must be passed back and forth.

  Barry


> On Jun 23, 2023, at 6:12 AM, Karin&NiKo <niko.karin at gmail.com> wrote:
> 
> In order to transfer from Python to C a list of int, real or bool as an input, there are the functions iarray_i, iarray_r and iarray_b.
> In order to transfer from C to Python a list of int, real, bool or pointers as an output, there are the functions oarray_i, oarray_r, oarray_b and oarray_p.
> Nevertheless I do not find the function iarray_p which (I think) is required to transfer a list of Scatter when calling SNESNASMSetSubdomains.
> Am I right ?
> 
> Le ven. 23 juin 2023 à 09:40, Karin&NiKo <niko.karin at gmail.com <mailto:niko.karin at gmail.com>> a écrit :
>> Dear Barry,
>> I have started looking at the code but I miss an example using SNESNASMSetSubdomains. In fact I do not even find a single use of the function in PETSc.
>> Could someone provide me with an example ?
>> Thanks,
>> Nicolas
>> 
>> Le ven. 23 juin 2023 à 02:17, Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> a écrit :
>>> 
>>>   A test would be great.
>>> 
>>>> On Jun 22, 2023, at 3:20 PM, Karin&NiKo <niko.karin at gmail.com <mailto:niko.karin at gmail.com>> wrote:
>>>> 
>>>> Thank you Barry. I will try this.
>>>> Should I provide a test in src/binding/petsc4py/test/test_snes.py ?
>>>> 
>>>> Le jeu. 22 juin 2023 à 20:41, Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> a écrit :
>>>>> 
>>>>>   You are not missing anything. The petsc4py stub for SNESNASMSetSubdomains() has not been written. You could add it by adding to
>>>>> src/petsc4py/PETSc/SNES.pyx and src/petsc4py/PETSc/petscsnes.pxi and then make a merge request  https://petsc.org/release/developers/contributing/ to get it into PETSc.
>>>>> 
>>>>>> On Jun 22, 2023, at 1:54 PM, Karin&NiKo <niko.karin at gmail.com <mailto:niko.karin at gmail.com>> wrote:
>>>>>> 
>>>>>> Dear PETSc team,
>>>>>> 
>>>>>> I would like to play with aspin-type nonlinear solvers. I have found several tests like snes/tutorials/ex19.c but they all use DA, which I don't want to use since I need to stick at the algebraic level.
>>>>>> Then, I started looking at petsc4py/demo/ode/heat.py and tried to set up things.
>>>>>> Unfortunately, I get the error "DM has no default decomposition defined.  Set subsolves manually with SNESNASMSetSubdomains()" which, I think, I do understand.
>>>>>> But I do not find any implementation of the SNESNASMSetSubdomains in petsc4py. 
>>>>>> Am I missing something ? 
>>>>>> Thanks,
>>>>>> Nicolas
>>>>> 
>>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230623/92593ed0/attachment.html>


More information about the petsc-users mailing list