[petsc-users] questions about snes ex3.c

Xiangdong epscodes at gmail.com
Wed Apr 2 13:44:01 CDT 2014


On Wed, Apr 2, 2014 at 9:49 AM, Matthew Knepley <knepley at gmail.com> wrote:

> On Wed, Apr 2, 2014 at 8:23 AM, Xiangdong <epscodes at gmail.com> wrote:
>
>> Hello everyone,
>>
>> I have two quick questions about src/snes/examples/tutorials/ex3.c.
>>
>> 1) In line 150-151, why do we need to call MatSeqAIJSetPreallocation
>> before MatMPIAIJSetPreallocation? I found that without the seqaij call, the
>> program crashed. However, the mat J we want to create is the mpiaij.
>>
>
> One is used in serial, the other in parallel. Really, you can just call
>

So depending on the number of processors given in the runtime, either
seqaij or mpiaij is not executed, thought both lines are complied. Is it
correct?

Thank you.

Xiangdong


>
>
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatXAIJSetPreallocation.html
>
>    Matt
>
>
>> 2) In line 390-397, it sets the values of the residue function at the
>> boundary. Where do these values come from? In other words, I am not clear
>> about ff[0]=xx[0] and ff[xs+xm-1] = xx[xs+xm-1] - 1.0;
>>
>> Thank you.
>>
>> Xiangdong
>>
>
>
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140402/9113093d/attachment.html>


More information about the petsc-users mailing list