[petsc-users] questions about the SNES Function Norm

Matthew Knepley knepley at gmail.com
Tue Apr 29 14:12:33 CDT 2014


On Tue, Apr 29, 2014 at 2:09 PM, Xiangdong <epscodes at gmail.com> wrote:

> It turns out to a be a bug  in my FormFunctionLocal(DMDALocalInfo
> *info,PetscScalar **x,PetscScalar **f,AppCtx *user). I forgot to initialize
> the array f. Zero the array f solved the problem and gave consistent result.
>
> Just curious, why does not petsc initialize the array f to zero by default
> inside petsc when passing the f array to FormFunctionLocal?
>

If you directly set entires, you might not want us to spend the time
writing those zeros.


> I have another quick question about the array x passed to
> FormFunctionLocal. If I want to know the which x is evaluated, how can I
> output x in a vector format? Currently, I created a global vector vecx and
> a local vector vecx_local, get the array of vecx_local_array, copy the x to
> vecx_local_array,  scatter to global vecx and output vecx. Is there a quick
> way to restore the array x to a vector and output?
>

I cannot think of a better way than that.

   Matt


> Thank you.
>
> Best,
> Xiangdong
>
>
>
> On Mon, Apr 28, 2014 at 10:28 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>>
>> On Apr 28, 2014, at 3:23 PM, Xiangdong <epscodes at gmail.com> wrote:
>>
>> > Hello everyone,
>> >
>> > When I run snes program,
>>
>>                ^^^^ what SNES program”?
>>
>> > it outputs "SNES Function norm 1.23456789e+10". It seems that this norm
>> is different from residue norm (even if solving F(x)=0)
>>
>>    Please send the full output where you see this.
>>
>> > and also differ from norm of the Jacobian. What is the definition of
>> this "SNES Function Norm”?
>>
>>    The SNES Function Norm as printed by PETSc is suppose to the 2-norm of
>> F(x) - b (where b is usually zero) and this is also the same thing as the
>> “residue norm”
>>
>>    Barry
>>
>> >
>> > Thank you.
>> >
>> > Best,
>> > 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/20140429/c7002b35/attachment.html>


More information about the petsc-users mailing list