[petsc-users] Problems about tolerances set in TS

Zhang, Hong hongzhang at anl.gov
Thu Apr 30 00:22:42 CDT 2020


Please do not drop the mailing list when replying.

It looks like the max steps or the final time has been set to zero for TS. You might want to check your code to see if the TS settings are correct or if they are overwritten in some callback functions by mistake.

Hong (Mr.)

> On Apr 29, 2020, at 10:16 PM, Yingjie Wu <yjwu16 at gmail.com> wrote:
> 
> Command: mpiexec -n 1 ./SGts -snes_fd -pc_type lu -ts_error_if_step_fails 0 -ts_monitor -snes_monitor \
>                          -ksp_monitor \
>                          -ksp_converged_reason \
>                          -snes_converged_reason \
>                          -snes_rtol 1.e-2 \
>                          -ksp_rtol 1.e-5 \
>                          -snes_max_it 2 \
>                          -snes_view 
> Output: Timestep 0:
> CurrentTime 0.:
> 0 TS dt 1. time 0.
> iter = 0, SNES Function norm 245.204
>      0 SNES Function norm 2.452043863308e+02
>       0 KSP Residual norm 1.641317090793e+04
>       1 KSP Residual norm 2.717662845608e-10
>     Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 1, SNES Function norm 170.58
>      1 SNES Function norm 1.705802879797e+02
>       0 KSP Residual norm 1.146216600447e+04
>       1 KSP Residual norm 3.272076151518e-11
>     Linear solve converged due to CONVERGED_RTOL iterations 1
> iter = 2, SNES Function norm 140.625
>      2 SNES Function norm 1.406249065994e+02
>   Nonlinear solve did not converge due to DIVERGED_MAX_IT iterations 2
> SNES Object: 1 MPI processes
>   type: newtonls   maximum iterations=2, maximum function evaluations=-1530494976
>   tolerances: relative=0.01, absolute=1e-50, solution=1e-08
>   total number of linear solver iterations=2
>   total number of function evaluations=1063
>   norm schedule ALWAYS
>   Jacobian is built using finite differences one column at a time
>   SNESLineSearch Object: 1 MPI processes
>     type: bt
>       interpolation: cubic
>       alpha=1.000000e-04
>     maxstep=1.000000e+08, minlambda=1.000000e-12
>     tolerances: relative=1.000000e-08, absolute=1.000000e-15, lambda=1.000000e-08
>     maximum iterations=40
>   KSP Object: 1 MPI processes
>     type: gmres
>       restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
>       happy breakdown tolerance 1e-30
>     maximum iterations=10000, initial guess is zero
>     tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.
>     left preconditioning
>     using PRECONDITIONED norm type for convergence test
>   PC Object: 1 MPI processes
>     type: lu
>       out-of-place factorization
>       tolerance for zero pivot 2.22045e-14
>       matrix ordering: nd
>       factor fill ratio given 5., needed 2.84376
>         Factored matrix follows:
>           Mat Object: 1 MPI processes
>             type: seqaij             rows=528, cols=528
>             package used to perform factorization: petsc
>             total: nonzeros=7863, allocated nonzeros=7863
>             total number of mallocs used during MatSetValues calls=0
>               not using I-node routines
>     linear system matrix = precond matrix:
>     Mat Object: 1 MPI processes
>       type: seqaij       rows=528, cols=528
>       total: nonzeros=2765, allocated nonzeros=5280
>       total number of mallocs used during MatSetValues calls=0
>         not using I-node routines
> Timestep 1:
> CurrentTime 0.:
> 1 TS dt 1. time 0.
> 
> Number of timesteps = 1 final time 0.00e+00
> 
>  After the first time step, the program directly ends the TS solution process. I've set up 50 time steps, so the program is not running properly.
>  Although the program accepted that first time step SNES did not achieve convergence, and there is no error information, but did not continue to go to the next time step calculation, chose to end the program. I hope that when the SNES not converge at a certain time step and reaches the set maximum number SNES iteration steps, it can go to the next time step calculation. 
> I am looking forward to your suggestion.
> 
> Thanks,
> Yingjie
> 
> Zhang, Hong <hongzhang at anl.gov> 于2020年4月29日周三 下午11:26写道:
> Please send the list of your command line options and the screen output with -ts_monitor.
> 
> Hong (Mr.)
> 
>> On Apr 28, 2020, at 11:00 PM, Yingjie Wu <yjwu16 at gmail.com> wrote:
>> 
>> Thank you very much for your reply.
>> I tried both switches, but unfortunately they didn't seem to meet my needs.
>>  -ts_adapt_always_accept     
>>  The switch doesn't seem to work, reporting errors
>>  when the maximum number of steps is reached without convergence, then the program exits.
>> 
>>  -ts_error_if_step_fails  0        This switch accepts the non-convergence time step and outputs the result, but does not continue into the next time step calculation (
>> 
>>  The time step hasn't reached the maximum time step I set
>> ).
>> 
>> And I wonder if the variable behind this switch is optional? What does it mean?
>> I hope to achieve in the case of non-convergence Newton step( for example, the maximum number of Newton iteration steps reached -snes_max_it 50), can go in the next time step calculation.
>> 
>> Thanks,
>> Yingjie
>> 
>> Zhang, Hong <hongzhang at anl.gov> 于2020年4月28日周二 下午10:51写道:
>> -ts_error_if_step_fails 0
>> 
>> You might want to find out why the nonlinear solver does not converge first. If you have a hand-written Jacobian, you can validate it with -snes_test_jacobian 1 (for a small test case).
>> 
>> Hong (Mr.)
>> 
>> > On Apr 28, 2020, at 8:21 AM, Yingjie Wu <yjwu16 at gmail.com> wrote:
>> > 
>> > Dear PETSc developers            
>> > Hi, 
>> > 
>> > I have recently used TS to solve nonlinear equations with time terms. since the convergence of my model is not very good, i would like to set to iterative fixed nonlinear steps per time step. If the problem does not meet the SNES convergence criteria after fixed number of nonlinear steps , then go to the next time step calculation. I tried -snes_max_it , but didn't achieve the effect I wanted, and the program stopped after iterating the fixed number of steps. How should I set up in the program?
>> > 
>> > Thanks,
>> > Yingjie
>> 
> 



More information about the petsc-users mailing list