idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.77k stars 1.05k forks source link

Constant Timestepper (dt=; end_time=) fails to hit desired time exactly #18819

Open GiudGiud opened 3 years ago

GiudGiud commented 3 years ago

Bug Description

Constant time stepper struggles on last time step. Very likely to be a numerical round off issue. Cant really disallow this case. Maybe we should have a default saying "hey if it s within 1% of what we would have taken we ll just do 101% and call it a day"

 0 Nonlinear |R| = 5.513604e-03
      0 Linear |R| = 5.513604e-03
      1 Linear |R| = 1.013631e-14
 1 Nonlinear |R| = 1.758920e-04
      0 Linear |R| = 1.758920e-04
      1 Linear |R| = 2.241747e-18
 2 Nonlinear |R| = 5.029084e-08
      0 Linear |R| = 5.029084e-08
      1 Linear |R| = 4.459719e-22
 3 Nonlinear |R| = 1.421402e-11
 Solve Converged!

Outlier Variable Residual Norms:
  pressure: 1.421173e-11

Postprocessor Values:
+----------------+----------------+----------------+----------------+
| time           | max_v          | mdot           | mu_value       |
+----------------+----------------+----------------+----------------+
:                :                :                :                :
|   1.360000e+01 |   2.100362e+00 |   1.870537e+04 |   1.660000e-02 |
|   1.370000e+01 |   2.100581e+00 |   1.870624e+04 |   1.660000e-02 |
|   1.380000e+01 |   2.100795e+00 |   1.870708e+04 |   1.660000e-02 |
|   1.390000e+01 |   2.101002e+00 |   1.870791e+04 |   1.660000e-02 |
|   1.400000e+01 |   2.101204e+00 |   1.870873e+04 |   1.660000e-02 |
|   1.410000e+01 |   2.101401e+00 |   1.870952e+04 |   1.660000e-02 |
|   1.420000e+01 |   2.101592e+00 |   1.871030e+04 |   1.660000e-02 |
|   1.430000e+01 |   2.101778e+00 |   1.871105e+04 |   1.660000e-02 |
|   1.440000e+01 |   2.101959e+00 |   1.871178e+04 |   1.660000e-02 |
|   1.450000e+01 |   2.102135e+00 |   1.871250e+04 |   1.660000e-02 |
|   1.460000e+01 |   2.102305e+00 |   1.871319e+04 |   1.660000e-02 |
|   1.470000e+01 |   2.102472e+00 |   1.871385e+04 |   1.660000e-02 |
|   1.480000e+01 |   2.102633e+00 |   1.871450e+04 |   1.660000e-02 |
|   1.490000e+01 |   2.102790e+00 |   1.871512e+04 |   1.660000e-02 |
|   1.500000e+01 |   2.102942e+00 |   1.871572e+04 |   1.660000e-02 |
+----------------+----------------+----------------+----------------+

Scalar Variable Values:
+----------------+----------------+
| time           | lambda         |
+----------------+----------------+
:                :                :
|   1.360000e+01 |   1.540407e-13 |
|   1.370000e+01 |   1.296352e-13 |
|   1.380000e+01 |   1.062166e-13 |
|   1.390000e+01 |   3.248671e-13 |
|   1.400000e+01 |   4.420976e-14 |
|   1.410000e+01 |  -3.739088e-14 |
|   1.420000e+01 |  -2.005832e-13 |
|   1.430000e+01 |  -6.433543e-13 |
|   1.440000e+01 |  -7.489171e-13 |
|   1.450000e+01 |  -5.143793e-13 |
|   1.460000e+01 |  -8.805599e-13 |
|   1.470000e+01 |  -7.576160e-13 |
|   1.480000e+01 |  -4.227230e-13 |
|   1.490000e+01 |  -5.444391e-13 |
|   1.500000e+01 |  -2.062939e-13 |
+----------------+----------------+

Time Step 153, time = 15, dt = 3.73035e-14
 0 Nonlinear |R| = 5.251776e-03
      0 Linear |R| = 5.251776e-03
      1 Linear |R| = 3.141821e-18
 1 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.599636e-18
 2 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.591965e-18
 3 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.193201e-18
 4 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.211853e-18
 5 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.653428e-18
 6 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.729807e-18
 7 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.235308e-18
 8 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.565421e-18
 9 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.102318e-18
10 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.690031e-18
11 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.601004e-18
12 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.863331e-18
13 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.597738e-18
14 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.322971e-18
15 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.748903e-18
16 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.540925e-18
17 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.597470e-18
18 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.405433e-18
19 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 1.612575e-18
20 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.232449e-18
21 Nonlinear |R| = 3.711552e-03
      0 Linear |R| = 3.711552e-03
      1 Linear |R| = 2.075951e-18
22 Nonlinear |R| = 3.711552e-03
Nonlinear solve did not converge due to DIVERGED_MAX_IT iterations 22
 Solve Did NOT Converge!
  Finished Solving                                                                       [  7.24 s] [    0 MB]
Aborting as solve did not converge

Time Step 153, time = 15, dt = 2e-14
 0 Nonlinear |R| = 5.251776e-03
      0 Linear |R| = 5.251776e-03
      1 Linear |R| = 3.276656e-18
 1 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.728369e-18
 2 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 1.822757e-18
 3 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 1.904594e-18
 4 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.059277e-18
 5 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.076020e-18
 6 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.052952e-18
 7 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.697963e-18
 8 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.663033e-18
 9 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 1.794293e-18
10 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 1.997355e-18
11 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 1.872130e-18
12 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 1.810328e-18
13 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.069111e-18
14 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.443806e-18
15 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.016770e-18
16 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 1.853249e-18
17 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.072785e-18
18 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.711975e-18
19 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.074721e-18
20 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.042727e-18
21 Nonlinear |R| = 4.520624e-03
      0 Linear |R| = 4.520624e-03
      1 Linear |R| = 2.737143e-18
22 Nonlinear |R| = 4.520624e-03
Nonlinear solve did not converge due to DIVERGED_MAX_IT iterations 22
 Solve Did NOT Converge!
  Finished Solving                                                                       [  7.31 s] [    0 MB]
Aborting as solve did not converge

*** ERROR ***
The following error occurred in the object "TimeStepper", of type "ConstantDT".

Solve failed and timestep already at or below dtmin, cannot continue!

Steps to Reproduce

Run the VTB msr/steady inputs

Impact

Annoying

gambka commented 3 years ago

I've had this happen in very rare cases as well. You can set the parameter timestep_tolerance in the Executioner to a value a little higher than the default value (2e-14) and that has helped me in these situations. Especially when you are taking 1 second timesteps I would increase the default a few orders of magnitude and see if that works.

WilkAndy commented 3 years ago

I believe there is a timestep_tolerance parameter that gets around this, but i completely agree that this sort of thing is stupid