[petsc-users] Increasing norm with finer mesh

Mark Adams mfadams at lbl.gov
Tue Oct 2 14:27:12 CDT 2018


On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang <weizhuo2 at illinois.edu> wrote:

> The example code and makefile are attached below. The whole thing started
> as I tried to build a Helmholtz solver, and the mean error (calculated by:
> sum( | numerical_sol - analytical_sol | / analytical_sol ) )
>

This is a one norm. If you use max (instead of sum) then you don't need to
scale. You do have to be careful about dividing by (near) zero.


> increases as I use finer and finer grids.
>

What was the rate of increase?


> Then I looked at the example 12 (Laplacian solver) which is similar to
> what I did to see if I have missed something. The example is using 2_norm.
> I have made some minor modifications (3 places) on the code, you can search
> 'Modified' in the code to see them.
>
> If this helps: I configured the PETSc to use real and double precision.
> Changed the name of the example code from ex12.c to ex12c.c
>
> Thanks for all your reply!
>
> Weizhuo
>
>
> Smith, Barry F. <bsmith at mcs.anl.gov>
>
>
>>    Please send your version of the example that computes the mean norm of
>> the grid; I suspect we are talking apples and oranges
>>
>>    Barry
>>
>>
>>
>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang <weizhuo2 at illinois.edu> wrote:
>> >
>> > I also tried to divide the norm by m*n , which is the number of grids,
>> the trend of norm still increases.
>> >
>> > Thanks!
>> >
>> > Weizhuo
>> >
>> > Matthew Knepley <knepley at gmail.com>
>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang <weizhuo2 at illinois.edu>
>> wrote:
>> > Hi!
>> >
>> > I'm recently trying out the example code provided with the KSP solver
>> (ex12.c). I noticed that the mean norm of the grid increases as I use finer
>> meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at
>> m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive,
>> since most of the time error should decreases when using finer grid. Am I
>> doing this wrong?
>> >
>> > The norm is misleading in that it is the l_2 norm, meaning just the
>> sqrt of the sum of the squares of
>> > the vector entries. It should be scaled by the volume element to
>> approximate a scale-independent
>> > norm (like the L_2 norm).
>> >
>> >   Thanks,
>> >
>> >      Matt
>> >
>> > Thanks!
>> > --
>> > Wang Weizhuo
>> >
>> >
>> > --
>> > 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/
>> >
>> >
>> > --
>> > Wang Weizhuo
>>
>>
>
> --
> Wang Weizhuo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181002/8a82549f/attachment.html>


More information about the petsc-users mailing list