[petsc-users] How to change PC content during Iterations

Jed Brown jedbrown at mcs.anl.gov
Mon Oct 31 08:08:32 CDT 2011


As a hack, you can probably PCSetType(pc, PCNONE); PCSetType(pc, PCILU);
and then set the new number of levels.

PCILU should be updated to be able to do this.
On Oct 31, 2011 4:14 AM, "behzad baghapour" <behzad.baghapour at gmail.com>
wrote:

> This means to PCDestroy() and then PCCreate again at that iteration?
>
>
> On Mon, Oct 31, 2011 at 2:32 PM, Matthew Knepley <knepley at gmail.com>wrote:
>
>> On Mon, Oct 31, 2011 at 10:58 AM, behzad baghapour <
>> behzad.baghapour at gmail.com> wrote:
>>
>>> I did it but received this Error when I want to change the level of fill
>>> for PCILU:
>>>
>>
>> Right, you would have to recreate the preconditioner. The SetType() would
>> not work since
>> you did not actually change the type.
>>
>>    Matt
>>
>>
>>> [0]PETSC ERROR: --------------------- Error Message
>>> ------------------------------------
>>> [0]PETSC ERROR: Object is in wrong state!
>>> [0]PETSC ERROR: Cannot change levels after use!
>>> [0]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>> On Mon, Oct 31, 2011 at 2:19 PM, Matthew Knepley <knepley at gmail.com>wrote:
>>>
>>>> On Mon, Oct 31, 2011 at 8:55 AM, behzad baghapour <
>>>> behzad.baghapour at gmail.com> wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> I'm using KSP iteration (for now) to solve my nonlinear problem and
>>>>> handling Newton Iterations manually. Here I want to change the PC method
>>>>> from some specified KSP iteration. How should I do it correctly in Petsc?
>>>>>
>>>>
>>>> Call PCSetType() and then KSPSetOperators() again in your loop
>>>>
>>>>    Matt
>>>>
>>>>
>>>>> Thanks, B.B.
>>>>>
>>>>> --
>>>>> ==================================
>>>>> Behzad Baghapour
>>>>> Ph.D. Candidate, Mechecanical Engineering
>>>>> University of Tehran, Tehran, Iran
>>>>> https://sites.google.com/site/behzadbaghapour
>>>>> Fax: 0098-21-88020741
>>>>> ==================================
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>
>>>
>>>
>>> --
>>> ==================================
>>> Behzad Baghapour
>>> Ph.D. Candidate, Mechecanical Engineering
>>> University of Tehran, Tehran, Iran
>>> https://sites.google.com/site/behzadbaghapour
>>> Fax: 0098-21-88020741
>>> ==================================
>>>
>>>
>>
>>
>> --
>> 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
>>
>
>
>
> --
> ==================================
> Behzad Baghapour
> Ph.D. Candidate, Mechecanical Engineering
> University of Tehran, Tehran, Iran
> https://sites.google.com/site/behzadbaghapour
> Fax: 0098-21-88020741
> ==================================
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111031/602a8f83/attachment.htm>


More information about the petsc-users mailing list