[petsc-users] Petsc error: cannot chang local size of Amat after use old sizes 10 10 new sizes 11 11
dayedut123 at 163.com
dayedut123 at 163.com
Sat May 12 11:46:14 CDT 2018
You mean I should put MatDestroy before Matcreate? But is it different from that if I put destroy just after create in current timestep?
Thanks again
Daye
发自我的 iPhone
> 在 2018年5月12日,下午10:00,Matthew Knepley <knepley at gmail.com> 写道:
>
>> On Sat, May 12, 2018 at 8:08 AM, 我 <dayedut123 at 163.com> wrote:
>>
>> Thanks for your reply! I'm confused about how to create a new matrix during the time step advancing.
>> For better understand my problem, simple pseudo code (just contains the main functions) like this:
>
> It looks like MatDestroy should come before the next Create.
>
> Matt
>
>> /////////////////////////////////
>> KSP ksp;
>> PC pc;
>> KSPCreate;
>> Mat A;
>> for(int timestep=0; timestep<20; timestep++)
>> {
>> //for example
>> if(timestep==2)
>> {
>> localsize change;
>> }
>> MatCreateMPIAIJWithArrays(PETSC_COMM_WORLD, localsize, localsize, m, m, istore, jstore, vstore, &A);
>> KSPSolve;
>>
>> MatDestroy(&A);
>> }
>> /////////////////////////////
>> Thanks again!
>> Daye
>>
>>
>>
>>
>> At 2018-05-11 19:07:35, "Matthew Knepley" <knepley at gmail.com> wrote:
>>> On Fri, May 11, 2018 at 4:23 AM, 我 <dayedut123 at 163.com> wrote:
>>> Hello all,
>>> I use the function MatCreateMPIAIJWithArrays to construct my matrix. But the number of local rows m and local columns n may change during the timestep advancing. When the local size changes, the error like "Petsc error: cannot chang local size of Amat after use old sizes 10 10 new sizes 11 11" will appear. Any suggestions about it ?
>>
>> If the parallel layout changes, you need to create a new matrix.
>>
>> Thanks,
>>
>> Matt
>>
>>> Thank you very much!
>>> Daye
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> 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/
>>
>>
>>
>>
>
>
>
> --
> 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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180513/2ebf28ee/attachment.html>
More information about the petsc-users
mailing list