[petsc-users] An issue of order of accuracy.

Barry Smith bsmith at mcs.anl.gov
Wed Dec 4 18:19:52 CST 2013


  Alan,

   I changed your initial grid size to 10 to get faster solve times and get what is below.  Note that your “exact solution” is quadratic, since the method is second order this means that not only is the “exact solution” an exact solution to the PDE, it is also an exact solution to the algebraic equations (for any grid size) hence the L2Norm of the error is only due to the round off of the algebraic solution, not due to any discretization error. In general, when testing for discretization error you always need to “cook up” an exact solution that is not completely represented in the approximation space. You also need to use a really tight algebraic tolerance to eliminate the algebraic error from the computation



~/Src/petsc/test-dir  master $ ./ex45 -pc_type mg  -ksp_rtol 1e-12 
mx = 10, my = 10, mz =10, mm = 1, nn = 1, pp = 1
Residual norm 1.81616e-12
L2Norm = 1.107359e-12
Total Time Elapsed: 0.048599
~/Src/petsc/test-dir  master $ ./ex45 -pc_type mg  -ksp_rtol 1e-12 -da_refine 1
mx = 19, my = 19, mz =19, mm = 1, nn = 1, pp = 1
Residual norm 3.36741e-12
L2Norm = 1.037148e-12
Total Time Elapsed: 0.183398
~/Src/petsc/test-dir  master $ ./ex45 -pc_type mg  -ksp_rtol 1e-12 -da_refine 2
mx = 37, my = 37, mz =37, mm = 1, nn = 1, pp = 1
Residual norm 1.09476e-11
L2Norm = 2.330658e-12
Total Time Elapsed: 1.180839
~/Src/petsc/test-dir  master $ ./ex45 -pc_type mg  -ksp_rtol 1e-12 -da_refine 3
mx = 73, my = 73, mz =73, mm = 1, nn = 1, pp = 1
Residual norm 3.19809e-11
L2Norm = 2.278763e-12
Total Time Elapsed: 10.819450
~/Src/petsc/test-dir  master $ ./ex45 -pc_type mg   -da_refine 3
mx = 73, my = 73, mz =73, mm = 1, nn = 1, pp = 1
Residual norm 0.000103197
L2Norm = 1.011806e-05
Total Time Elapsed: 7.250106


On Dec 4, 2013, at 5:25 PM, Alan Z. Wei <zhenglun.wei at gmail.com> wrote:

> Dear all, 
>     I hope you had a great Thanksgiving. 
>     Currently, I tested the order of accuracy for /src/ksp/ksp/tutorial/example/ex45.c. Since the 2nd-order discretization is used in this program and ksp solver is converged to 10^-7, I expected that the solution should provides a 2nd-order in L2 norm. However, as I tested (even with a Laplace equation), the L2 norm slope is much less than 2. Sometime, if the grid size is reduced, the L2 norm increases. Could anyone help me about this issue, please?
> 
> Here is the L2 norm outputted:
> 
> Grid	L2 norm (10^-8)
> 0.05	4.36242
> 0.025	2.20794
> 0.0125	7.02749
> 0.00625	12.64   
>     Once the grid size is reduced to half, the number of the grid will be multiplied by 8 in order to keep the same size of the computational domain.
>     The code is also attached. It is from ex45.c with very little modifications. 
> 
> thanks in advance,
> Alan
> 
> <ex45.c><TestRun.txt>



More information about the petsc-users mailing list