[petsc-dev] Unions of IS and MatNest

Lawrence Mitchell wence at gmx.li
Fri Mar 20 16:53:12 CDT 2020


On Fri, 20 Mar 2020 at 21:07, Pierre Jolivet <pierre.jolivet at enseeiht.fr>
wrote:

>
>
> On 19 Mar 2020, at 7:56 PM, Matthew Knepley <knepley at gmail.com> wrote:
>
> On Fri, Mar 13, 2020 at 11:20 AM Pierre Jolivet <
> pierre.jolivet at enseeiht.fr> wrote:
>
>>
>>
>> On 13 Mar 2020, at 2:36 PM, Matthew Knepley <knepley at gmail.com> wrote:
>>
>> On Fri, Mar 13, 2020 at 3:19 AM Pierre Jolivet <
>> pierre.jolivet at enseeiht.fr> wrote:
>>
>>>
>>>
>>> On 12 Mar 2020, at 11:40 PM, Matthew Knepley <knepley at gmail.com> wrote:
>>>
>>> On Thu, Mar 12, 2020 at 5:59 PM Jed Brown <jed at jedbrown.org> wrote:
>>>
>>>> Pierre Jolivet <pierre.jolivet at enseeiht.fr> writes:
>>>>
>>>> > Hello,
>>>> > Has there been any follow-up on this
>>>> https://lists.mcs.anl.gov/pipermail/petsc-users/2015-January/024020.html
>>>>  <
>>>> https://lists.mcs.anl.gov/pipermail/petsc-users/2015-January/024020.html
>>>> >?
>>>> > Given a 3x3 MatNest A = [A_00,0,0 ; 0,A_11,0 ; 0,0,A_22], I’d like to
>>>> setup a two-way fieldsplit coupling [A_00,0 ; 0,A_11] and [A_22] but I
>>>> can’t figure out the proper options.
>>>>
>>>> Are you looking for a Schur split or additive/multiplicative?
>>>
>>>
>>> Don’t know yet which will perform best, do you have a specific solution
>>> in mind for one scenario or the other?
>>> I was mostly wondering if it was possible in a general context, not
>>> taking -pc_fieldsplit_type into account.
>>>
>>> -pc_fieldsplit_field_0 0,1 -pc_fieldsplit_field_1 2 -pc_fieldsplit_type
>>> schur
>>>
>>>
>>> These flags, used with my .cpp, yield:
>>> [0]PETSC ERROR: Arguments are incompatible
>>> [0]PETSC ERROR: To use Schur complement preconditioner you must have
>>> exactly 2 fields
>>> If I use -pc_fieldsplit_%d_fields <a,b,..> as advocated in the manual
>>> (instead of -pc_fieldsplit_field_%d as you suggested), I get the same error.
>>>
>>
>> Okay it is  -pc_fieldsplit_%d_fields. When you use this, how many fields
>> does it think you have?
>>
>>
>> Three.
>> In case it’s not clear, the MWE is at the bottom of my first email
>> (nest.cpp).
>> $ mpicxx nest.cpp -I$PETSC_DIR/$PETSC_ARCH/include -I$PETSC_DIR/include
>> -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc
>> $ ./a.out -pc_type fieldsplit -pc_fieldsplit_0_fields 0,1
>> -pc_fieldsplit_1_fields 2 -pc_fieldsplit_type schur
>> […]
>> [0]PETSC ERROR: Arguments are incompatible
>> [0]PETSC ERROR: To use Schur complement preconditioner you must have
>> exactly 2 fields
>> […]
>>     Split info:
>>     Split number 0 Defined by IS
>>     Split number 1 Defined by IS
>>     Split number 2 Defined by IS
>> […]
>>
>
> I see now. If you call PCFieldsplitSetIS(), this overrides anything else.
> We do not even try to discover the split. If you want
> a split determined by command line arguments, you have to defer the split.
> It looks like it can get splits from the MatNest,
> so just do not call SetIS().
>
>
> So, I’ve commented the three PCFieldSplitSetIS.
> $ ./a.out -pc_type fieldsplit -pc_fieldsplit_0_fields 0,1
> -pc_fieldsplit_1_fields 2 -pc_fieldsplit_block_size 3
> is starting to give me something meaningful in the KSPView, i.e.:
> […]
>   Split number 0 Fields  0, 1
> […]
>   Split number 1 Fields  2
> But it’s surrounded by a bunch of errors such as:
> [0]PETSC ERROR: Arguments are incompatible
> [0]PETSC ERROR: Could not find index set
>
> Do I need some other command-line options?
>

If you have a flat 3x3 matnest, the index set matching will not find a
subset that is anything other than a 1-field split. I have a patch lying
around that i think fixes this. I can try and dig it out on Monday.

Lawrence

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200320/f7abb872/attachment-0001.html>


More information about the petsc-dev mailing list