CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Looking for good Test Cases for Code Validation (

Spacegirl1923 August 28, 2013 15:33

Looking for good Test Cases for Code Validation
Hello all, and thanks in advance for any help you can offer.

I have just finished up writing a pretty basic 2-D Euler solver and I think I have worked out the obvious bugs. But I would like to run some validation tests and plan to add on some DG methods and maybe upgrade eventually to NS.

So what I need help with is-- What kind of validation tests are good to run? Currently I have ran a cylinder, NACA0012 airfoil, and a channel with a bump. The pressure, velocities etc all look fairly good, visually they are what I would expect and I am thinking about adding in a section to calculate the coefficient of pressure on the surfaces to just verify the actual numbers. What else can I throw at my code? What other things should I be looking for? I really want to put this through the ringer before I add in more complicated parts so please anything that would really test it would be awesome!

Thanks again!

cfdnewbie August 28, 2013 15:44

Hello Megan,
before starting with some "real world" test cases, the most important way to test your code is by the method of manufactured solution. You will find a lot of information about this on google. In brief, you choose any given (smooth) solution to your equation, plug it in, compute the residual and use that as a source term. By doing that, you can test you formal order of accuracy of your code for both space and time and ensure the correct order of convergence. Inspection by eye is not sufficient, since you can never tell the the difference between a 3rd and 4th order solution without actually computing the errors. This is especially important if you want to add DG functionality.

Hope this helps!

Alex C. August 28, 2013 15:56

In the case your code is transient and compressible, an easy case to setup is the Sod Shock Tube.

It is a 1D case, but it is a good practice to run it in 2D or 3D. There are exact solution for the case, which makes validation very easy.

If you code does not handle transient or compressible flow, then you'll need to go with something else. Injecting an analytic solution to verify your residuals is a very good suggestion in order to validate what you did.

Congrats for the home-code!

Spacegirl1923 August 28, 2013 18:21

Great! Thank you both for the suggestions I will look into them.

So as far as the method of manufactured solution, how difficult is it to either find or write a code to generate the source terms needed for verification? If I understand correctly from briefly reading about it you are essentially adding in source terms which you expect to also see in the error at the end of the solve? As far as order of accuracy I guess I'm not sure how that has to do with validation of the code? Currently the cylinder grid I've evaluated has 4 levels of refinement and using the L2Norm I can back out the order of accuracy, but I don't see how that tells me if the algorithm I've coded is correct? What am I missing in this? Thanks!

I have run a similar 1-D code through the various shock problems for validation but I had not thought to try it on the 2-D code... how does one 'two-dimensionalize' the sod shock tube problem?

Thanks again for all the help, I'm a little new at this so I appreciate it a ton!


Alex C. August 28, 2013 21:17


Originally Posted by Spacegirl1923 (Post 448617)
how does one 'two-dimensionalize' the sod shock tube problem?

You setup a rectangle, and initialize the domain to have a pressure discontinuity at the normal section in the middle. The easiest boundaries in my opinion is to setup symmetry plane at every boundaries, and to stop the time marching before the shock reflexion occurs on the tube extremities.

An other way is to set pressure inlet on the side of high pressure, and pressure outlet on the side of low pressure. Therefore you can simulate longer than the reach of the shock to the boundary, but once the shock has passed, you will only have a growing velocity toward infinity (Poiseuille flow without viscosity)

All times are GMT -4. The time now is 15:05.