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

How to implement Regression Testing for CFD codes?

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes
  • 1 Post By aerosayan
  • 1 Post By aerosayan
  • 1 Post By ssh123
  • 2 Post By sbaffini
  • 2 Post By Alex C.
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2021, 06:14
Default How to implement Regression Testing for CFD codes?
  #1
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
My code is getting very complicated, and due to recent changes some bugs were introduced that went unnoticed for some time. That made me extremely sad. I want a method to ensure that new addition to the codebase, doesn't introduce bugs.

How can implement such a regression testing system for CFD codes?

Specifically, I'm facing difficulty as CFD codes work on arrays containing thousands of values, and I don't know how I can implement a system to validate the results. Preferably something already exists, and I don't have to reinvent the wheel.
Attached Images
File Type: jpeg sad-kitteh.jpeg (105.3 KB, 6 views)
aero_head likes this.
aerosayan is offline   Reply With Quote

Old   July 5, 2021, 06:26
Default
  #2
New Member
 
Truong Dang
Join Date: Oct 2016
Location: Vietnam
Posts: 21
Rep Power: 9
ssh123 is on a distinguished road
That's the reason why I'm thinking of Java and migrating my C++ CFD code to Java. When implementing your code in Java, you can simply employ several test frameworks eg. Junit for regression testing.

For your case I think you can create wrappers to Java for methods which you want to test and employ Junit to call them.
ssh123 is offline   Reply With Quote

Old   July 5, 2021, 06:56
Default
  #3
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by ssh123 View Post
That's the reason why I'm thinking of Java and migrating my C++ CFD code to Java. When implementing your code in Java, you can simply employ several test frameworks eg. Junit for regression testing.

Java for CFD? Probably going to end badly.
You're giving up performance for your code, in hopes of a better experience in testing?
That seems counter intuitive.
aero_head likes this.
aerosayan is offline   Reply With Quote

Old   July 5, 2021, 07:12
Default
  #4
New Member
 
Truong Dang
Join Date: Oct 2016
Location: Vietnam
Posts: 21
Rep Power: 9
ssh123 is on a distinguished road
Let me try with a simple 2D Euler equations solver. I'll update my finding in this thread.
aerosayan likes this.
ssh123 is offline   Reply With Quote

Old   July 5, 2021, 08:18
Default
  #5
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
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
My code is getting very complicated, and due to recent changes some bugs were introduced that went unnoticed for some time. That made me extremely sad. I want a method to ensure that new addition to the codebase, doesn't introduce bugs.

How can implement such a regression testing system for CFD codes?

Specifically, I'm facing difficulty as CFD codes work on arrays containing thousands of values, and I don't know how I can implement a system to validate the results. Preferably something already exists, and I don't have to reinvent the wheel.
It really depends from what you already have, both in terms of testing and versioning control/branching model. I mean, hopefully, you already have:

1) unit tests: another piece of code where you basically test all the modules/libraries that couldn't, otherwise, be tested (say, a gauss-jordan or tridiagonal routine, a triangle-box intersection routine, etc.)

2) verification cases: where you test your whole code against grid and time step refinements of as much analytical solutions you can (I typically include the same case under different reference systems here)

3) validation cases: where you test your whole code against known experimental data

4) a versioning control method: where you have git/svn/whatever to reliably track changes in the code

5) a branching model: where you have very rigid rules that specify how a code goes into production, how bugs get fixed and how new developments get into production code. Say, this

6) Some mechanism of continuous integration/development: where all the above is automated and properly orchestrated as a function of your branching model. At the very minimum, all the tests (unit, verification and validation) should be performed when some code is ready to become production.

I guess you are lost somewhere in between 1 and 6?
aerosayan and aero_head like this.
sbaffini is offline   Reply With Quote

Old   July 5, 2021, 08:18
Default
  #6
Member
 
Join Date: Jul 2013
Posts: 55
Rep Power: 12
Alex C. is on a distinguished road
Quote:
Originally Posted by aerosayan View Post
My code is getting very complicated, and due to recent changes some bugs were introduced that went unnoticed for some time. That made me extremely sad. I want a method to ensure that new addition to the codebase, doesn't introduce bugs.

How can implement such a regression testing system for CFD codes?

Specifically, I'm facing difficulty as CFD codes work on arrays containing thousands of values, and I don't know how I can implement a system to validate the results. Preferably something already exists, and I don't have to reinvent the wheel.
I'm not currently developing CFD, but still do C++ production code.

I'm using Google Test for unit testing and FitNesse for system testing.

I highly recommend Google Test framework.

FitNesse 'works' fine, meaning I can successfully test my software, but the setup is trickier to make than it is hard to break... which makes it a bit annoying. I work in a large organization, so I live with it. I would probably explore other solutions in a different context.
ssh123 and aerosayan like this.
Alex C. is offline   Reply With Quote

Old   July 5, 2021, 09:38
Default
  #7
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
I guess you are lost somewhere in between 1 and 6?

I have git based version control, a basic branching pipeline, and some basic unit tests.


Integration testing seems challenging, as we have to compare the current solution with the previously validated solution data. I'm currently guessing that we have to manually validate the solution once, then store the result in a file, which we can later use for our integration tests.


Of course that becomes challenging when the mesh sizes are very large.
aerosayan is offline   Reply With Quote

Old   July 5, 2021, 10:08
Default
  #8
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
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
I have git based version control, a basic branching pipeline, and some basic unit tests.


Integration testing seems challenging, as we have to compare the current solution with the previously validated solution data. I'm currently guessing that we have to manually validate the solution once, then store the result in a file, which we can later use for our integration tests.


Of course that becomes challenging when the mesh sizes are very large.

Then, I guess, your code just needs a monitor feature, so that different point/surface/volume values/norms can be extracted. If written to file, combined with residuals, you should have a fairly large set of posssible comparisons for different metrics. This could be used both in validation and verification. Of course, you still need a reference toward which make comparisons, but this could now be just a line in a text file (yet, I would still sotre the whole file).

But, let me tell you that, frameworks and automations can't solve all the problems. My point of view on these things is that, together with everything we already mentioned, they are just needed pieces of a formal process.

Like having a perfect score in a driving licence exam, they won't, by themselves, save you from accidents (nor will any autopilot feature, for that matter, if you know what I mean).

In my case for example, I like the fact that the process is completely formalized and all (I even review each one of my own commits), but when something new gets in, you can't completely outsource things to some automation. If this was the case, there should be examples of bugfree softwares, but there aren't.
aerosayan likes this.
sbaffini 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
CFD codes with body conforming block structured AMR capabilities? aerosayan Main CFD Forum 6 January 9, 2021 03:12
Help! Delete the UDM codes in the UDF Messi Fluent UDF and Scheme Programming 2 January 28, 2014 09:01
Is it worth it? Jason Bardis Main CFD Forum 47 July 27, 2011 04:52
Testing of commercial LES codes Dada Dinesh Main CFD Forum 1 February 2, 2004 04:27
Comparison of CFD Codes Kerem Main CFD Forum 9 May 9, 2003 04:29


All times are GMT -4. The time now is 17:57.