Use of sync_times and CSVTimeSequenceStepper

75 views
Skip to first unread message

Laboure, Vincent M

unread,
Nov 1, 2017, 1:25:00 PM11/1/17
to moose...@googlegroups.com
Hello,

I am confused by the behavior I see while simultaneously using CSVTimeSequenceStepper and sync_times.

To illustrate, let's start from ex06.i and replace the Executioner and Outputs blocks as follows:


[Executioner]
  type = Transient   # Here we use the Transient Executioner
  solve_type = 'PJFNK'
  end_time = 10

  [./TimeStepper]
    type = CSVTimeSequenceStepper
    file_name = times.csv
    header = true
    column_index = 0
  [../]
[]

[Outputs]
  execute_on = 'timestep_end'

  [./Exodus]
    type = Exodus
    sync_times = '2.5 5 7.5'
  [../]
[]

where times.csv contains:

times

0

2

4

6

8

10



I would expect to have the calculation done at t=0, 2, 2.5, 4, 5, 6, 7.5, 8 and 10.

But I obtain the following output:


Time Step  0, time = 0

                dt = 0


Time Step  1, time = 2

                dt = 2

 0 Nonlinear |R| = 6.633250e+00

      0 Linear |R| = 6.633250e+00

      1 Linear |R| = 4.921179e-01

      2 Linear |R| = 1.057758e-01

      3 Linear |R| = 2.016850e-02

      4 Linear |R| = 3.951396e-03

      5 Linear |R| = 7.471891e-04

      6 Linear |R| = 1.484212e-04

      7 Linear |R| = 2.753187e-05

 1 Nonlinear |R| = 2.753248e-05

      0 Linear |R| = 2.753248e-05

      1 Linear |R| = 7.089529e-06

      2 Linear |R| = 1.389134e-06

      3 Linear |R| = 2.677787e-07

      4 Linear |R| = 4.891557e-08

      5 Linear |R| = 9.269718e-09

      6 Linear |R| = 1.478652e-09

      7 Linear |R| = 2.137042e-10

 2 Nonlinear |R| = 2.136978e-10

 Solve Converged!


Time Step  2, time = 2.5

                dt = 0.5

 0 Nonlinear |R| = 6.503836e-01

      0 Linear |R| = 6.503836e-01

      1 Linear |R| = 3.733889e-02

      2 Linear |R| = 1.349206e-03

      3 Linear |R| = 7.134024e-05

      4 Linear |R| = 3.593708e-06

 1 Nonlinear |R| = 3.593401e-06

      0 Linear |R| = 3.593401e-06

      1 Linear |R| = 2.341765e-07

      2 Linear |R| = 1.042688e-08

      3 Linear |R| = 4.668492e-10

      4 Linear |R| = 2.004333e-11

 2 Nonlinear |R| = 2.004302e-11

 Solve Converged!


Time Step  3, time = 4.5

                dt = 2

 0 Nonlinear |R| = 4.670466e-01

      0 Linear |R| = 4.670466e-01

      1 Linear |R| = 1.438115e-01

      2 Linear |R| = 2.145633e-02

      3 Linear |R| = 4.409174e-03

      4 Linear |R| = 8.649163e-04

      5 Linear |R| = 1.530161e-04

      6 Linear |R| = 2.956971e-05

      7 Linear |R| = 5.441473e-06

      8 Linear |R| = 9.970968e-07

 1 Nonlinear |R| = 9.966030e-07

      0 Linear |R| = 9.966030e-07

      1 Linear |R| = 2.668810e-07

      2 Linear |R| = 5.282268e-08

      3 Linear |R| = 8.882192e-09

      4 Linear |R| = 1.659798e-09

      5 Linear |R| = 3.505907e-10

      6 Linear |R| = 6.325552e-11

      7 Linear |R| = 1.209213e-11

      8 Linear |R| = 2.352621e-12

 2 Nonlinear |R| = 2.355979e-12

 Solve Converged!


Time Step  4, time = 5

                dt = 0.5

 0 Nonlinear |R| = 2.804298e-01

      0 Linear |R| = 2.804298e-01

      1 Linear |R| = 1.787252e-02

      2 Linear |R| = 5.117175e-04

      3 Linear |R| = 3.076864e-05

      4 Linear |R| = 1.260350e-06

 1 Nonlinear |R| = 1.259914e-06

      0 Linear |R| = 1.259914e-06

      1 Linear |R| = 7.446553e-08

      2 Linear |R| = 3.656179e-09

      3 Linear |R| = 1.565495e-10

      4 Linear |R| = 6.855908e-12

 2 Nonlinear |R| = 6.855050e-12

 Solve Converged!


Time Step  5, time = 7

                dt = 2

 0 Nonlinear |R| = 2.514843e-01

      0 Linear |R| = 2.514843e-01

      1 Linear |R| = 9.245499e-02

      2 Linear |R| = 1.007916e-02

      3 Linear |R| = 2.414702e-03

      4 Linear |R| = 3.780721e-04

      5 Linear |R| = 7.493249e-05

      6 Linear |R| = 1.420499e-05

      7 Linear |R| = 2.815109e-06

      8 Linear |R| = 5.125218e-07

 1 Nonlinear |R| = 5.131553e-07

      0 Linear |R| = 5.131553e-07

      1 Linear |R| = 1.337102e-07

      2 Linear |R| = 2.589829e-08

      3 Linear |R| = 4.491862e-09

      4 Linear |R| = 9.580410e-10

      5 Linear |R| = 1.751285e-10

      6 Linear |R| = 3.446868e-11

      7 Linear |R| = 6.493084e-12

      8 Linear |R| = 1.074326e-12

 2 Nonlinear |R| = 1.075178e-12

 Solve Converged!


Time Step  6, time = 7

                dt = 2e-14

 0 Nonlinear |R| = 1.913833e-01

      0 Linear |R| = 1.913833e-01

      1 Linear |R| = 1.035488e-02

      2 Linear |R| = 7.763906e-04

      3 Linear |R| = 5.946323e-05

      4 Linear |R| = 4.157463e-06

      5 Linear |R| = 3.035617e-07

 1 Nonlinear |R| = 2.264181e-03

      0 Linear |R| = 2.264181e-03

      1 Linear |R| = 1.091082e-04

      2 Linear |R| = 6.813983e-06

      3 Linear |R| = 4.846451e-07

      4 Linear |R| = 3.129582e-08

      5 Linear |R| = 2.133659e-09

 Solve Did NOT Converge!





*** ERROR ***

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



Would this be a bug or am I missing something?

Thanks,
Vincent



--
Vincent Laboure, Ph.D.
Postdoctoral Computational Nuclear Engineering Research Associate,
Reactor Physics Analysis & Design,
Idaho National Laboratory

Cody Permann

unread,
Nov 1, 2017, 1:44:16 PM11/1/17
to moose...@googlegroups.com
Interesting test case! There is complex interaction here for sure. So for review, the TimeSteppers only get to suggest the next time step. It's up to the Executioner to make sure the next step is reasonable based on all the constraints of the current simulation. If you take a look at TimeSequenceStepperBase, you can see how the DT is computed:

With your input file, the DT between every sequence is 2.0 so that's where your odd stepping behavior is coming from (2.5 - 4.5). No when you get to time = 4.5 the stepper is still suggesting a 2.0 time step size but MOOSE realizes that's not possible because of the sync time at 5 so that step gets constrained by MOOSE.

Now the final step is the most bizarre but I have a theory. We are getting from 5 - 7 OK, but after that there's a time step of 2e-14, where did that come from?! Well time is of course s float and there must be some really small error accumulating when we are doing the constraining that makes it ~6.99999 instead of 7. MOOSE isn't showing you the full floating point representation of that number however it is there. The timestepper is suggesting another time step size of 2 here since it doesn't know about the sync times but MOOSE is again constraining that step size to hit the sync time exactly calculating the ridiculously small dt. There's a tolerance that you can set here to ignore really small dts like that:

So that's an explanation of what's happening, now what to do about it. First, it seems like you aren't happy with the calculation in the TimeSequenceStepper base class. Perhaps we need a new one, or perhaps we need to work on the way sync times are handled but this all gets kind of complicated. I'm open to ideas. Let's chat about what behavior you are looking for and see if we can work it in. Also, it'd be awesome to submit this as a test case so that we could test against in in the future. In particular, it'd be nice to figure out where the floating point error is coming from to cause that super tiny step!

Cody


 

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/CAEdUeg5AkcVEseHfdm7NMq4V8o43viYxOrnk4mPbxYNTyv6F7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Wang, Yaqi

unread,
Nov 1, 2017, 1:47:53 PM11/1/17
to moose-users
If time step is tiny, should the initial residual almost be equal to the converged residual in the last time step?

To unsubscribe from this group and stop receiving emails from it, send an email to moose-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users+unsubscribe@googlegroups.com.

Laboure, Vincent M

unread,
Nov 1, 2017, 2:33:53 PM11/1/17
to moose...@googlegroups.com
Let me explain a little more my practical case: I have a large calculation that runs first in a separate calculation and stores data to impose the boundary conditions of a smaller calculation. Because I would like to have that smaller calculation run the same time steps as the large one (unless there are convergence issues, in which case dividing the time step by 2 as needed is fine), I read from the CSV file the time steps that the large calculation used.

However, because the data would be too large, I only want to output my results at certain times (which may or may not match the time steps from the large calculation). Ideally, I would simply have the time stepper suggest the following time steps in the previous example: dt=2, 0.5, 1.5, 1, 1, 1.5, 0.5, 2 to have t=0, 2, 2.5, 4, 5, 6, 7.5, 8 and 10 (at least if no convergence issues are detected).


Your explanation makes the whole thing clearer but I am still wondering:
- say MOOSE gets to t=6.9999. Why would it try to get to t=7 (which is neither in the sync_times nor suggested by the CSV)? Actually, if I modify the CSV file to contain:

times
0
2
4
6
8
8.1
8.2
8.3
8.4
8.5
10

which should not affect the results since I only added times after the time the original simulation crashed, I get:

Time Step  5, time = 5.1

                dt = 0.1

 0 Nonlinear |R| = 2.514843e-01

      0 Linear |R| = 2.514843e-01

      1 Linear |R| = 2.763382e-03

      2 Linear |R| = 3.398114e-05

      3 Linear |R| = 5.132667e-07

 1 Nonlinear |R| = 5.133225e-07

      0 Linear |R| = 5.133225e-07

      1 Linear |R| = 1.132831e-08

      2 Linear |R| = 1.678031e-10

      3 Linear |R| = 2.918767e-12

 2 Nonlinear |R| = 2.918726e-12

 Solve Converged!


Time Step  6, time = 5.2

                dt = 0.1

 0 Nonlinear |R| = 2.462830e-01

      0 Linear |R| = 2.462830e-01

      1 Linear |R| = 2.703549e-03

      2 Linear |R| = 3.332629e-05

      3 Linear |R| = 5.051625e-07

 1 Nonlinear |R| = 5.052864e-07

      0 Linear |R| = 5.052864e-07

      1 Linear |R| = 1.119102e-08

      2 Linear |R| = 1.660266e-10

      3 Linear |R| = 2.889914e-12

 2 Nonlinear |R| = 2.889943e-12

 Solve Converged!


Time Step  7, time = 5.3

                dt = 0.1

 0 Nonlinear |R| = 2.413877e-01

      0 Linear |R| = 2.413877e-01

      1 Linear |R| = 2.647517e-03

      2 Linear |R| = 3.272164e-05

      3 Linear |R| = 4.976774e-07

 1 Nonlinear |R| = 4.976097e-07

      0 Linear |R| = 4.976097e-07

      1 Linear |R| = 1.105918e-08

      2 Linear |R| = 1.643631e-10

      3 Linear |R| = 2.862470e-12

 2 Nonlinear |R| = 2.862768e-12

 Solve Converged!


Time Step  8, time = 5.4

                dt = 0.1

 0 Nonlinear |R| = 2.367664e-01

      0 Linear |R| = 2.367664e-01

      1 Linear |R| = 2.594871e-03

      2 Linear |R| = 3.216105e-05

      3 Linear |R| = 4.907565e-07

 1 Nonlinear |R| = 4.908218e-07

      0 Linear |R| = 4.908218e-07

      1 Linear |R| = 1.094396e-08

      2 Linear |R| = 1.628889e-10

      3 Linear |R| = 2.838577e-12

 2 Nonlinear |R| = 2.838448e-12

 Solve Converged!


Time Step  9, time = 5.5

                dt = 0.1

 0 Nonlinear |R| = 2.323925e-01

      0 Linear |R| = 2.323925e-01

      1 Linear |R| = 2.545262e-03

      2 Linear |R| = 3.163938e-05

      3 Linear |R| = 4.843483e-07

 1 Nonlinear |R| = 4.843661e-07

      0 Linear |R| = 4.843661e-07

      1 Linear |R| = 1.083137e-08

      2 Linear |R| = 1.615359e-10

      3 Linear |R| = 2.816275e-12

 2 Nonlinear |R| = 2.816427e-12

 Solve Converged!


Time Step 10, time = 7

                dt = 1.5

 0 Nonlinear |R| = 2.282429e-01

      0 Linear |R| = 2.282429e-01

      1 Linear |R| = 6.580220e-02

      2 Linear |R| = 5.162893e-03

      3 Linear |R| = 1.027880e-03

      4 Linear |R| = 1.144660e-04

      5 Linear |R| = 1.777523e-05

      6 Linear |R| = 2.703837e-06

      7 Linear |R| = 4.216496e-07

 1 Nonlinear |R| = 4.219170e-07

      0 Linear |R| = 4.219170e-07

      1 Linear |R| = 9.062405e-08

      2 Linear |R| = 1.466693e-08

      3 Linear |R| = 2.175340e-09

      4 Linear |R| = 2.788627e-10

      5 Linear |R| = 4.433641e-11

      6 Linear |R| = 5.967448e-12

      7 Linear |R| = 8.692569e-13

 2 Nonlinear |R| = 8.693531e-13

 Solve Converged!


Time Step 11, time = 7

                dt = 2e-14

 0 Nonlinear |R| = 1.879210e-01

      0 Linear |R| = 1.879210e-01

      1 Linear |R| = 7.926400e-03

      2 Linear |R| = 4.555972e-04

      3 Linear |R| = 3.615031e-05

      4 Linear |R| = 2.457529e-06

      5 Linear |R| = 1.882006e-07

 1 Nonlinear |R| = 2.699427e-03

      0 Linear |R| = 2.699427e-03

      1 Linear |R| = 1.377476e-04

      2 Linear |R| = 8.174908e-06

      3 Linear |R| = 5.155869e-07

      4 Linear |R| = 4.216658e-08

      5 Linear |R| = 3.098053e-09

 Solve Did NOT Converge!





*** ERROR ***

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


So it looks to me as if MOOSE extracts the dt's from the CSV file (and not the absolute times) and assigns them based on the time step _index_. And when it reaches the end of the available dt's (here at time step #11, because the CSV has 10 useful rows), it has no clue what to use so it just sets dt to 2e-14.

Or at least, that's what it looks like to me

Thanks,
Vincent



For more options, visit https://groups.google.com/d/optout.



--

Cody Permann

unread,
Nov 1, 2017, 2:42:14 PM11/1/17
to moose...@googlegroups.com
Ok so there's definitely a bug in the TimeSequenceStepperBase then. It looks like it doesn't know how to handle a constrained step in any way! More work is needed to make this work.
Reply all
Reply to author
Forward
0 new messages