[petsc-users] Suggestions for code with dof >> 1 ?

Christophe Ortiz christophe.ortiz at ciemat.es
Tue Oct 22 10:36:37 CDT 2013


On Tue, Oct 22, 2013 at 3:37 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Tue, Oct 22, 2013 at 8:29 AM, Christophe Ortiz <
> christophe.ortiz at ciemat.es> wrote:
>
>> Hi Barry,
>>
>> Thanks for suggestions. Here is the output.
>> Before using the options you suggest I get:
>>
>>  TSAdapt 'basic': step 182 accepted t=0.341561   + 3.416e-02 wlte=1.1e-09
>> family='arkimex' scheme=0:'3' dt=3.757e-02
>>       TSAdapt 'basic': step 183 accepted t=0.375717   + 3.757e-02
>> wlte=9.05e-14 family='arkimex' scheme=0:'3' dt=4.133e-02
>>       TSAdapt 'basic': step 184 stage rejected t=0.413289   + 4.133e-02
>> retrying with dt=1.033e-02
>>       TSAdapt 'basic': step 184 stage rejected t=0.413289   + 1.033e-02
>> retrying with dt=2.583e-03
>> ...
>>       TSAdapt 'basic': step 184 stage rejected t=0.413289   +2.212e-198
>> retrying with dt=5.529e-199
>>       TSAdapt 'basic': step 184 stage rejected t=0.413289   +5.529e-199
>> retrying with dt=1.382e-199
>> [0]PETSC ERROR: --------------------- Error Message
>> ------------------------------------
>> [0]PETSC ERROR: Floating point exception!
>> [0]PETSC ERROR: Vec entry at local location 12 is not-a-number or
>> infinite at end of function: Parameter number 3!
>>
>>
>>  I re-checked my Jacobian several times, and I found few errors. But now
>> I think it is ok.
>> Then, with the options you suggest, it stops immediatly. Not even one
>> timestep:
>>
>
> Something is very wrong here. The Jacobian should at least have something
> on the diagonal from the time derivative,
> but the Laplacian (u, v) and q (w) also have diagonals.
>
>    Matt
>
>
I found out that it works up to a certain time. Then, for intermediate
times, solution exhibits artificial oscillations. For larger times,
complete divergence.

In case it could matter, I start for u and v with two initial gaussian
distributions with a peak at 1e20. They are very close to surface (i=0).
For w, uniform value of 1. Do you think it could be due to a combination of
very small/very large values ?

Anyway, I tried one of the hints given in the link you sent me (Why is
Newton's method (SNES) not converging, or converges slowly?). I multiplied
all the F() and the Jacobian by hx (the mesh size) in order to rescale, as
it is suggested (*Change the units (nondimensionalization), boundary
condition scaling, or formulation so that the Jacobian is better conditioned
*). This trick is used in ex25.c but I removed it at the beginning since I
thought it was not useful...

Now it works better for larger times. The solution seems correct. However,
for longer times, it gets into trouble again. The solution presents
artificial oscillations again. And for longer times, complete divergence:

      TSAdapt 'basic': step 322 accepted t=17.8389    + 5.000e-01 wlte=
 0 family='arkimex' scheme=0:'1bee' dt=5.000e-01
    0 SNES Function norm 7.451002297320e+57
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Floating point exception!
[0]PETSC ERROR: Vec entry at local location 0 is not-a-number or infinite
at end of function: Parameter number 3!
.... ....
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: VecValidValues() line 30 in src/vec/vec/interface/rvector.c
[0]PETSC ERROR: PCApply() line 444 in src/ksp/pc/interface/precon.c
[0]PETSC ERROR: KSP_PCApply() line 227 in
src/ksp/ksp/interface//home/u5751/petsc-3.4.1/include/petsc-private/kspimpl.h
[0]PETSC ERROR: KSPInitialResidual() line 64 in
src/ksp/ksp/interface/itres.c
[0]PETSC ERROR: KSPSolve_GMRES() line 239 in src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: KSPSolve() line 441 in src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: SNESSolve_NEWTONLS() line 220 in src/snes/impls/ls/ls.c
[0]PETSC ERROR: SNESSolve() line 3636 in src/snes/interface/snes.c
[0]PETSC ERROR: TSStep_ARKIMEX() line 765 in src/ts/impls/arkimex/arkimex.c
[0]PETSC ERROR: TSStep() line 2458 in src/ts/interface/ts.c
[0]PETSC ERROR: TSSolve() line 2583 in src/ts/interface/ts.c
[0]PETSC ERROR: main() line 457 in src/ts/examples/tutorials/diffusion.c

Other findings:

- Limiting the max timestep allowed seems helping and allows to go to
larger times without divergence.
- Increasing number of nodes seems to help too.

Does it have something to do with explicit stage of IMEX method ?


Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131022/c710f4f5/attachment-0001.html>


More information about the petsc-users mailing list