[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Matrix free example snes/ex20.c
- To: petsc-users@xxxxxxxxxxx
- Subject: Re: Matrix free example snes/ex20.c
- From: "Matthew Knepley" <knepley@xxxxxxxxx>
- Date: Sat, 29 Dec 2007 21:05:26 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=SKrzNjxqJGyUgCwyFifjjeb92OKFYDzFPcCJUSCls7E=; b=u4p3csXjbhN9SBFk94dvad00/O4GN0RDpy1oOjZQqbAljZMG1m3UMg9v9/afd9SyVm4Rz7T0N9rJbqFOaks2RoVODhF8JfW3L8DuycztCpjch7LGAzm8wWpe2jtrIuct5bknRy7YrgpMyyJcHTHv/n7QTkgGh45fU/xFu06EFHQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=h1J3R7yuYo0aIO7AMsThCvh4eCPFSDyW5IWd0vE0zDrOIxyhBT6QFGBB0P3KmLvKyUd9+ns7PIlrcSFMWEhhC21yxKABkd/1LVUXibfkgV673Uwez5clY1chboixSLg2iVTgcRv5f6NdwTYz0r8mGn1y0epnCefR3/MxUZQH+5E=
- In-reply-to: <000601c84a88$b1f54cb0$203010ac@neutrino>
- References: <65DF14FD-8FFC-4F20-A30A-63EC203FCA52@mcs.anl.gov> <000601c84a88$b1f54cb0$203010ac@neutrino>
- Reply-to: petsc-users@xxxxxxxxxxx
- Sender: owner-petsc-users@xxxxxxxxxxx
On Dec 29, 2007 8:07 PM, Vijay M <vijay.m@xxxxxxxxx> wrote:
> Hi all,
>
> I was trying to compile and run the ex20.c example code in the tutorial
> section of SNES. Although it does not explicitly specify that –snes_mf
> option can be used, my understanding is that as long as a nonlinear residual
> function is written correctly, PETSc will calculate via finite difference
> the action of the Jacobian on a given vector. Is that correct ?
Yes.
> Now if that is the case, then please observe the discrepancy in the number
> of linear iterations taken with an analytical Jacobian and matrix-free
> option. What puzzles me is that the SNES function norm are quite close for
> both the methods but the linear iterations differ by a factor of 3. Why
> exactly is this ?
There is no PC when using -snes_mf whereas the default is ILU for the analytic
Jacobian.
Matt
> Here's the output to make this clearer.
>
> vijay :mpirun -np 1 ex20 -ksp_type gmres -snes_monitor
>
> 0 SNES Function norm 2.271442542876e-01
>
> 1 SNES Function norm 6.881516100891e-02
>
> 2 SNES Function norm 1.813939751552e-02
>
> 3 SNES Function norm 2.354176462207e-03
>
> 4 SNES Function norm 3.063728077362e-05
>
> 5 SNES Function norm 3.106106268946e-08
>
> 6 SNES Function norm 5.344742712545e-12
>
> 0 SNES Function norm 2.271442542876e-01
>
> 1 SNES Function norm 6.881516100891e-02
>
> 2 SNES Function norm 1.813939751552e-02
>
> 3 SNES Function norm 2.354176462207e-03
>
> 4 SNES Function norm 3.063728077362e-05
>
> 5 SNES Function norm 3.106106268946e-08
>
> 6 SNES Function norm 5.344742712545e-12
>
> Number of Newton iterations = 6
>
> Number of Linear iterations = 18
>
> Average Linear its / Newton = 3.000000e+00
>
>
>
> vijay :mpirun -np 1 ex20 -ksp_type gmres -snes_monitor -snes_mf
>
> 0 SNES Function norm 2.271442542876e-01
>
> 1 SNES Function norm 6.870629867542e-02
>
> 2 SNES Function norm 1.804335379848e-02
>
> 3 SNES Function norm 2.290074339682e-03
>
> 4 SNES Function norm 3.082384186373e-05
>
> 5 SNES Function norm 3.926396277038e-09
>
> 6 SNES Function norm 3.754922566585e-16
>
> 0 SNES Function norm 2.271442542876e-01
>
> 1 SNES Function norm 6.870629867542e-02
>
> 2 SNES Function norm 1.804335379848e-02
>
> 3 SNES Function norm 2.290074339682e-03
>
> 4 SNES Function norm 3.082384186373e-05
>
> 5 SNES Function norm 3.926396277038e-09
>
> 6 SNES Function norm 3.754922566585e-16
>
> Number of Newton iterations = 6
>
> Number of Linear iterations = 54
>
> Average Linear its / Newton = 9.000000e+00
>
>
>
> Thanks,
>
> Vijay
>
>
--
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