CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

can we use final convergence residuals for regression testing of our code?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By sbaffini
  • 1 Post By Eifoehn4
  • 1 Post By Eifoehn4

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 7, 2022, 08:31
Default can we use final convergence residuals for regression testing of our code?
  #1
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Hello everyone,

I'm trying to automate some kind of regression testing mechanism for ensuring that the code produces same results for same test cases every time...

Checking the solution (i.e conserved values) of the mesh, would be accurate, but somewhat difficult to implement.

I just want to do it in the laziest way possible for now. Would checking the progression of the residuals be accurate enough?

For steady state simulations the residual plots obviously follow the same pattern every time. But for unsteady simulations (i didn't code them yet) the residual plots is very erratic and unstable.

I'm thinking of only checking the final residual values at convergence, instead of checking every point on the residual plots, to ensure the same residual plot is generated every time.

Is this correct?

Can we just check the residuals at the final convergence, and say that our simulation is correct, or do we need to check and verify that the same residual plot is generated every time?


That is, Is the graph shown below important, or only the final residual results at the last iteration?
Attached Images
File Type: jpg resid.jpg (36.9 KB, 16 views)
aerosayan is offline   Reply With Quote

Old   August 8, 2022, 10:46
Default
  #2
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,152
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by aerosayan View Post
Hello everyone,

I'm trying to automate some kind of regression testing mechanism for ensuring that the code produces same results for same test cases every time...

Checking the solution (i.e conserved values) of the mesh, would be accurate, but somewhat difficult to implement.

I just want to do it in the laziest way possible for now. Would checking the progression of the residuals be accurate enough?

For steady state simulations the residual plots obviously follow the same pattern every time. But for unsteady simulations (i didn't code them yet) the residual plots is very erratic and unstable.

I'm thinking of only checking the final residual values at convergence, instead of checking every point on the residual plots, to ensure the same residual plot is generated every time.

Is this correct?

Can we just check the residuals at the final convergence, and say that our simulation is correct, or do we need to check and verify that the same residual plot is generated every time?


That is, Is the graph shown below important, or only the final residual results at the last iteration?
Let's supersede the fact that NO, it is not ok for the unsteady residuals to show unpredictable behavior. Even if you were performing DNS, as long as done with the same code on the same machine and boundary/initial conditions, for meaningfully short times you should have identical results if your code has a deterministic behavior.

The general question you ask really has no single answer. Roughly speaking, my point of view is that it is more than ok, but with a caveat. I am fully aware of the fact that I am fully exposed to some problems.

Typically, one either wants to check that, after a modification, the code performs exactly the same, bit to bit, or that performances (speed and/or accuracy) have improved. In the first case, I personally only trust pure diffs on binary outputs, nothing less. In the latter case, however, things are less obvious. Are you willing to accept more speed at lower (absolute) accuracy? What about the opposite? Do you expect, with your modification, to achieve both?

What I want to convey here is the fact that a specific decision on any given metric is only meaningful after a specific modification is taken into account so, chasing a perfect approach is elusive. So the next question is, do I really understand and/or am I really able to generalize any metric based on the full convergence graph which is different from the residual at the end of the prescribed number of iterations? If an RMS of the residual was available as a measure, would I really understand it when comparing multiple cases?

In my case all the above questions had a no as an answer, which lead me to the following: I use the final residual as a measure, but I know it is something just for the sake of it. In the end, I use it more for the cases where identical binary results are expected than the others. Yet, it really is sufficently powerful to be useful. But:

1) It is isn't really any robust

2) Going beyond it doesn't give any meaningful further advantage in my case, so I don't
aerosayan likes this.
sbaffini is offline   Reply With Quote

Old   August 8, 2022, 21:18
Default
  #3
Senior Member
 
Eifoehn4's Avatar
 
-
Join Date: Jul 2012
Location: Germany
Posts: 184
Rep Power: 13
Eifoehn4 is on a distinguished road
Regression testing is meant to check if a recent code change has adversely affected existing features. The test won't tell you if your code works correct.

If you want to check many features, the final iteration step might become expensive in the future. Generally a binary check after a few time steps should be sufficient.
aerosayan likes this.
__________________
Check out my side project:

A multiphysics discontinuous Galerkin framework: Youtube, Gitlab.
Eifoehn4 is offline   Reply With Quote

Old   August 8, 2022, 22:59
Default
  #4
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by Eifoehn4 View Post
Generally a binary check after a few time steps should be sufficient.

Do you mean, we should write the solution state (conserved values of each cell) into a binary file, and match it with a similar binary file that has been previously manually verified?
aerosayan is offline   Reply With Quote

Old   August 9, 2022, 07:04
Default
  #5
Senior Member
 
Eifoehn4's Avatar
 
-
Join Date: Jul 2012
Location: Germany
Posts: 184
Rep Power: 13
Eifoehn4 is on a distinguished road
Yes or if your IO uses HDF5 you can apply a h5diff on your state file. Here you also can set tolerances if needed.
aerosayan likes this.
__________________
Check out my side project:

A multiphysics discontinuous Galerkin framework: Youtube, Gitlab.
Eifoehn4 is offline   Reply With Quote

Old   August 10, 2022, 06:41
Default
  #6
New Member
 
james
Join Date: Aug 2022
Posts: 1
Rep Power: 0
noah6273 is on a distinguished road
hey good one
noah6273 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help sought on axial compressor simulation jyotir OpenFOAM Running, Solving & CFD 0 November 17, 2021 10:49
Free surface issues with interDyMFoam for hydroturbine oumnion OpenFOAM Running, Solving & CFD 0 October 6, 2017 14:05
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 13:12
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03


All times are GMT -4. The time now is 16:20.