The ts_type arkimex is used. There is right hand-side function RHSFunction set by TSSetRHSFunction() and also stiff function set by TSSetIFunction().

 

With adaptivity shut off, TS can finish its first time step after the 3rd “Nonlinear solve converged due to …”. The solution gives negative electron and neutral temperatures at the bottom boundary. I need to fix the negative temperatures and see how the code works.

 

BTW, what is this ts_adapt? Is it by default on?

 

Thank you,

Jiannan

 

From: Matthew Knepley
Sent: Friday, February 17, 2023 3:15 PM
To: Tu, Jiannan
Cc: Barry Smith; petsc-users
Subject: Re: [petsc-users] TS failed due to diverged_step_rejected

 

CAUTION: This email was sent from outside the UMass Lowell network.

 

I am not sure what TS you are using, but the estimate of the local truncation error is 91.4, and does not seem

to change when you make the step smaller, so something is off. You can shut off the adaptivity using

 

 -ts_adapt_type none

 

  Thanks,

 

      Matt

 

On Fri, Feb 17, 2023 at 3:01 PM Tu, Jiannan <Jiannan_Tu@uml.edu> wrote:

These are what I got with the options you suggested.

 

Thank you,

Jiannan

 

-------------------------------------------------------------------------------

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 1.673091274668e-03

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 8.715428433630e-02

    1 SNES Function norm 4.995727626692e-04

    2 SNES Function norm 5.498018152230e-08

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

    0 SNES Function norm 3.237461568254e-01

    1 SNES Function norm 7.988531005091e-04

    2 SNES Function norm 1.280948196292e-07

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 2.189e-02 dt=4.374e-03  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 4.881903203545e-04

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

   0 SNES Function norm 7.562592690785e-02

    1 SNES Function norm 1.143078818923e-04

    2 SNES Function norm 9.834547907735e-09

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

    0 SNES Function norm 2.683968949758e-01

    1 SNES Function norm 1.838028436639e-04

    2 SNES Function norm 9.470813523140e-09

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-03 dt=4.374e-04  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 1.821562431175e-04

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 1.005443458812e-01

    1 SNES Function norm 3.633336946661e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 1.515368382715e-01

    1 SNES Function norm 3.389298316830e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-04 dt=4.374e-05  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 4.541003359206e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 1.713800906043e-01

    1 SNES Function norm 1.179958172167e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.020265094117e-01

    1 SNES Function norm 1.513971290464e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-05 dt=4.374e-06  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 6.090269704320e-06

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.136603895703e-01

    1 SNES Function norm 1.877474016012e-06

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 3.127812462507e-01

    1 SNES Function norm 2.713146825704e-06

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-06 dt=4.374e-07  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 2.793512213059e-06

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.205196267430e-01

    1 SNES Function norm 2.572653773308e-06

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 3.260057361977e-01

    1 SNES Function norm 2.705816087598e-06

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-07 dt=4.374e-08  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 2.764855860446e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.212505522844e-01

    1 SNES Function norm 2.958996472386e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 3.273222034162e-01

    1 SNES Function norm 2.994512887620e-05

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-08 dt=4.374e-09  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072186e+03

    1 SNES Function norm 3.317240589134e-04

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.213246532918e-01

    1 SNES Function norm 2.799468604767e-04

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.274570888397e-01

    1 SNES Function norm 3.066048050994e-04

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-09 dt=4.374e-10  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072189e+03

    1 SNES Function norm 2.653507278572e-03

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.213869585841e-01

    1 SNES Function norm 2.177156902895e-03

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.275136370365e-01

    1 SNES Function norm 1.962849131557e-03

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-10 dt=4.374e-11  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473072218e+03

    1 SNES Function norm 5.664907315679e-03

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.223208399368e-01

    1 SNES Function norm 5.688863091415e-03

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.287121218919e-01

    1 SNES Function norm 4.085338521320e-03

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-11 dt=4.374e-12  wlte= 91.4  wltea=   -1 wlter=   -1

    0 SNES Function norm 2.274473071968e+03

    1 SNES Function norm 4.694691905235e-04

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.211786508657e-01

    1 SNES Function norm 1.503497433939e-04

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.272667798977e-01

    1 SNES Function norm 2.176132327279e-04

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

      TSAdapt basic arkimex 0:3 step   0 rejected t=42960      + 4.374e-12 dt=4.374e-13  wlte= 91.4  wltea=   -1 wlter=   -1

[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------

[0]PETSC ERROR:  

[0]PETSC ERROR: TSStep has failed due to DIVERGED_STEP_REJECTED

[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.

[0]PETSC ERROR: Petsc Release Version 3.16.6, Mar 30, 2022

[0]PETSC ERROR: ./iditm3d on a  named office by jtu Fri Feb 17 14:54:22 2023

[0]PETSC ERROR: Configure options --prefix=/usr/local --with-mpi-dir=/usr/local --with-fc=0 --with-openmp --with-hdf5-dir=/usr/local --download-f2cblaslapack=1

[0]PETSC ERROR: #1 TSStep() at /home/jtu/Downloads/petsc-3.16.6/src/ts/interface/ts.c:3583

 

 

 

From: Barry Smith
Sent: Friday, February 17, 2023 12:58 PM
To: Tu, Jiannan
Cc: petsc-users
Subject: Re: [petsc-users] TS failed due to diverged_step_rejected

 

CAUTION: This email was sent from outside the UMass Lowell network.

 

 

  Can you please run with also the options -ts_monitor -ts_adapt_monitor ?

 

  The output is confusing because it prints that the Nonlinear solve has converged but then TSStep has failed due to DIVERGED_STEP_REJECTED which seems contradictory

 

 

 

On Feb 17, 2023, at 12:09 PM, Tu, Jiannan <Jiannan_Tu@uml.edu> wrote:

 

My code uses TS to solve a set of multi-fluid MHD equations. The jacobian is provided with function F(t, u, u'). Both linear and nonlinear solvers converge but snes repeats itself until gets "TSStep has failed due to diverged_step_rejected." 

 

Is it because I used TSStep rather than TSSolve? I have checked the condition number. The condition number with pc_type asm is about 1 (without precondition it is about 4x10^4). The maximum ratio of off-diagonal jacobian element over diagonal element is about 21.

 

Could you help me to identify what is going wrong?

 

Thank you very much!

 

Jiannan

 

---------------------------------------------------------------------------------------------------

Run command with options

 

mpiexec -n $1 ./iditm3d -ts_type arkimex -snes_tyep ngmres -ksp_type gmres -pc_type asm \

-ts_rtol 1.0e-4 -ts_atol 1.0e-4 -snes_monitor -snes_rtol 1.0e-4 -snes_atol 1.0e-4 \

-snes_converged_reason

 

The output message is 

 

Start time advancing ...

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 1.673091274668e-03 

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 8.715428433630e-02 

    1 SNES Function norm 4.995727626692e-04 

    2 SNES Function norm 5.498018152230e-08 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

    0 SNES Function norm 3.237461568254e-01 

    1 SNES Function norm 7.988531005091e-04 

    2 SNES Function norm 1.280948196292e-07 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 4.881903203545e-04 

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 7.562592690785e-02 

    1 SNES Function norm 1.143078818923e-04 

    2 SNES Function norm 9.834547907735e-09 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

    0 SNES Function norm 2.683968949758e-01 

    1 SNES Function norm 1.838028436639e-04 

    2 SNES Function norm 9.470813523140e-09 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 2

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 1.821562431175e-04 

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 1.005443458812e-01 

    1 SNES Function norm 3.633336946661e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 1.515368382715e-01 

    1 SNES Function norm 3.389298316830e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 4.541003359206e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 1.713800906043e-01 

    1 SNES Function norm 1.179958172167e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.020265094117e-01 

    1 SNES Function norm 1.513971290464e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 6.090269704320e-06 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.136603895703e-01 

    1 SNES Function norm 1.877474016012e-06 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 3.127812462507e-01 

    1 SNES Function norm 2.713146825704e-06 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 2.793512213059e-06 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.205196267430e-01 

    1 SNES Function norm 2.572653773308e-06 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 3.260057361977e-01 

    1 SNES Function norm 2.705816087598e-06 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 2.764855860446e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.212505522844e-01 

    1 SNES Function norm 2.958996472386e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 3.273222034162e-01 

    1 SNES Function norm 2.994512887620e-05 

  Nonlinear solve converged due to CONVERGED_FNORM_ABS iterations 1

    0 SNES Function norm 2.274473072186e+03 

    1 SNES Function norm 3.317240589134e-04 

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.213246532918e-01 

    1 SNES Function norm 2.799468604767e-04 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.274570888397e-01 

    1 SNES Function norm 3.066048050994e-04 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 2.274473072189e+03 

    1 SNES Function norm 2.653507278572e-03 

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.213869585841e-01 

    1 SNES Function norm 2.177156902895e-03 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.275136370365e-01 

    1 SNES Function norm 1.962849131557e-03 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 2.274473072218e+03 

    1 SNES Function norm 5.664907315679e-03 

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.223208399368e-01 

    1 SNES Function norm 5.688863091415e-03 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.287121218919e-01 

    1 SNES Function norm 4.085338521320e-03 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 2.274473071968e+03 

    1 SNES Function norm 4.694691905235e-04 

  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 1

    0 SNES Function norm 2.211786508657e-01 

    1 SNES Function norm 1.503497433939e-04 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

    0 SNES Function norm 3.272667798977e-01 

    1 SNES Function norm 2.176132327279e-04 

  Nonlinear solve converged due to CONVERGED_SNORM_RELATIVE iterations 1

[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------

[0]PETSC ERROR:   

[0]PETSC ERROR: TSStep has failed due to DIVERGED_STEP_REJECTED

[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.

[0]PETSC ERROR: Petsc Release Version 3.16.6, Mar 30, 2022

[0]PETSC ERROR: ./iditm3d on a  named office by jtu Fri Feb 17 11:59:43 2023

[0]PETSC ERROR: Configure options --prefix=/usr/local --with-mpi-dir=/usr/local --with-fc=0 --with-openmp --with-hdf5-dir=/usr/local --download-f2cblaslapack=1

[0]PETSC ERROR: #1 TSStep() at /home/jtu/Downloads/petsc-3.16.6/src/ts/interface/ts.c:3583

 

 


 

--

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/