[petsc-users] [EXTERNAL] Re: Problem with PCFIELDSPLIT

Matthew Knepley knepley at gmail.com
Fri Jul 16 14:38:14 CDT 2021


On Fri, Jul 16, 2021 at 3:33 PM Tang, Qi <tangqi at msu.edu> wrote:

> Matt,
>
> We are confident that the modified Schur complement works well based on
> our subksp and ksp tests. Let me summarize what you suggest us to do
> regarding to our original question of TSSolve. Instead of calling subksp,
> you suggest we should provide two matrices J and Jpre through
> TSSetIJacobian, where J is the original Jacobian and Jpre is the one we
> modified and both are 2x2 blocks. Then if we call fieldsplit, petsc will
> automatically use Jpre to construct its Schur complement in the
> preconditioner stage. Is that what you suggested?
>

Yes, exactly. We should be able to reproduce what you have done, but now
completely from the command line.

  Thanks,

     Matt


> Thanks a lot!
>
> Qi
>
>
>
>
>
> On Jul 7, 2021, at 3:54 PM, Matthew Knepley <knepley at gmail.com> wrote:
>
> On Wed, Jul 7, 2021 at 2:33 PM Jorti, Zakariae <zjorti at lanl.gov> wrote:
>
>> Hi Matt,
>>
>>
>> Thanks for your quick reply.
>>
>> I have not completely understood your suggestion, could you please
>> elaborate a bit more?
>>
>> For your convenience, here is how I am proceeding for the moment in my
>> code:
>>
>>
>> TSGetKSP(ts,&ksp);
>>
>> KSPGetPC(ksp,&pc);
>>
>> PCSetType(pc,PCFIELDSPLIT);
>>
>> PCFieldSplitSetDetectSaddlePoint(pc,PETSC_TRUE);
>>
>> PCSetUp(pc);
>>
>> PCFieldSplitGetSubKSP(pc, &n, &subksp);
>>
>> KSPGetPC(subksp[1], &(subpc[1]));
>>
> I do not like the two lines above. We should not have to do this.
>
>> KSPSetOperators(subksp[1],T,T);
>>
>  In the above line, I want you to use a separate preconditioning matrix M,
> instead of T. That way, it will provide
> the preconditioning matrix for your Schur complement problem.
>
>   Thanks,
>
>       Matt
>
>> KSPSetUp(subksp[1]);
>>
>> PetscFree(subksp);
>>
>> TSSolve(ts,X);
>>
>>
>> Thank you.
>>
>> Best,
>>
>>
>> Zakariae
>> ------------------------------
>> *From:* Matthew Knepley <knepley at gmail.com>
>> *Sent:* Wednesday, July 7, 2021 12:11:10 PM
>> *To:* Jorti, Zakariae
>> *Cc:* petsc-users at mcs.anl.gov; Tang, Qi; Tang, Xianzhu
>> *Subject:* [EXTERNAL] Re: [petsc-users] Problem with PCFIELDSPLIT
>>
>> On Wed, Jul 7, 2021 at 1:51 PM Jorti, Zakariae via petsc-users <
>> petsc-users at mcs.anl.gov> wrote:
>>
>>> Hi,
>>>
>>>
>>> I am trying to build a PCFIELDSPLIT preconditioner for a matrix
>>>
>>> J =  [A00  A01]
>>>
>>>        [A10  A11]
>>>
>>> that has the following shape:
>>>
>>>
>>> M_{user}^{-1} = [I   -ksp(A00) A01] [ksp(A00)           0] [I
>>>              0]
>>>
>>>                           [0                        I]  [0
>>> ksp(T)] [-A10 ksp(A00)  I ]
>>>
>>>
>>> where T is a user-defined Schur complement approximation that replaces
>>> the true Schur complement S:= A11 - A10 ksp(A00) A01.
>>>
>>>
>>> I am trying to do something similar to this example (lines 41--45 and
>>> 116--121):
>>> https://www.mcs.anl.gov/petsc/petsc-current/src/snes/tutorials/ex70.c.html
>>> <https://urldefense.com/v3/__https://www.mcs.anl.gov/petsc/petsc-current/src/snes/tutorials/ex70.c.html__;!!HXCxUKc!hoEfgnaraTfQoSgAiplsc6GJ_HuPXN88m5AJVy1gb7WVMNkGENDnJ3zToOGlhw$>
>>>
>>>
>>> The problem I have is that I manage to replace S with T on a
>>> separate single linear system but not for the linear systems generated by
>>> my time-dependent PDE. Even if I set the preconditioner M_{user}^{-1}
>>> correctly, the T matrix gets replaced by S in the preconditioner once I
>>> call TSSolve.
>>>
>>> Do you have any suggestions how to fix this knowing that the matrix J
>>> does not change over time?
>>>
>>> I don't like how it is done in that example for this very reason.
>>
>> When I want to use a custom preconditioning matrix for the Schur
>> complement, I always give a preconditioning matrix M to the outer solve.
>> Then PCFIELDSPLIT automatically pulls the correct block from M, (1,1) for
>> the Schur complement, for that preconditioning matrix without
>> extra code. Can you do this?
>>
>>   Thanks,
>>
>>     Matt
>>
>>> Many thanks.
>>>
>>>
>>> Best regards,
>>>
>>>
>>> Zakariae
>>>
>>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!hoEfgnaraTfQoSgAiplsc6GJ_HuPXN88m5AJVy1gb7WVMNkGENDnJ3wB3dcMFw$>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!hoEfgnaraTfQoSgAiplsc6GJ_HuPXN88m5AJVy1gb7WVMNkGENDnJ3wB3dcMFw$>
>
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210716/8ff08867/attachment-0001.html>


More information about the petsc-users mailing list