[petsc-users] linear problem solved by snes in 2 iteration.

Hailong Xiao xiaohl1986 at gmail.com
Thu Dec 8 12:45:09 CST 2011


I see. now it's one iteration.
Thank you Jed.

Hailong

On Thu, Dec 8, 2011 at 12:33 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> It is because of the dafault convergence tolerances.
>
> Try -ksp_rtol 1e-10
> On Dec 8, 2011 10:12 AM, "Hailong Xiao" <xiaohl1986 at gmail.com> wrote:
>
>> Hi
>>
>> I am using cell centered finite difference method for
>> -div K (grad p) = f
>> with Neumann boundary condtion.
>>
>> I called
>> SNESGetKSP(snes, &ksp);
>> MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, PETSC_NULL, &nullsp);
>> KSPSetNullSpace(ksp, nullsp);
>> MatNullSpaceDestroy(&nullsp);
>>
>> to handle the null space.
>>
>> But I got the result like the following
>>   0 SNES Function norm 3.512407365520e+02
>>   Linear solve converged due to CONVERGED_RTOL iterations 16
>>   1 SNES Function norm 6.615335308038e-03
>>   Linear solve converged due to CONVERGED_RTOL iterations 20
>>   2 SNES Function norm 3.979662741066e-08
>>
>> I checked my numerical solution with analytical solution
>> (p=x,y,z,cos(pi*x),cos(pi*y), cos(pi*z).
>>
>> These are the difference between the petsc result and analytical solution
>> for
>> -da_grid_x 5
>> -da_grid_y 5
>> -da_grid_z 100
>>
>> i j k 1 1 0
>> petsc      0.499959
>> true       0.495
>> petsc-true 0.00495888
>> i j k 1 1 1
>> petsc      0.486626
>> true       0.485
>> petsc-true 0.00162554
>> i j k 1 1 2
>> petsc      0.475959
>> true       0.475
>> petsc-true 0.000958875
>> i j k 1 1 3
>> petsc      0.465673
>> true       0.465
>> petsc-true 0.000673159
>>
>> I think I got the correct solution.
>>
>> I do not understand why snes took 2 iterations for a linear problem? Is
>> it normal?
>>
>>
>> --
>> Hailong
>>
>


-- 
Hailong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111208/a379285d/attachment.htm>


More information about the petsc-users mailing list