CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Requesting help for validating software (

HectorRedal August 27, 2010 16:44

Requesting help for validating software
2 Attachment(s)

I am currently developing a software for solving incompressible / compressible fluids flows using the finite element method.
Right now, I am testing the software by simulating a lid driven cavity.
For validating the software I am using the data provided in the following link:

The results I have obtained are quite different from the stated in the link above.
I would like to know if the problem is that the simulation time is not so long as to get the steady state.

For a Reynolds number of 1000, I am taken a simulation interval of 20 seconds. I don't know if this time is long enough so as to get the steady state. I have re-run the simulation upto 30 seconds, but the results are pretty similar, so I assume that the steady state is reached. Is this assumption correct?

I am enclosing two graphs (jpg files) that are the comparison between the reference results and the results I have got. You can take a look at them.

Could anyone help me with this issue?

Thanks in advance for your help and time,

Hector Redal.

otd August 28, 2010 10:08

Some observations of the comparison solutions you posted. This is to suggest things you might consider, NOT criticism.

Your solution appears to be either (1) not fully converged, or (2) belonging to a much more viscous fluid.

Possible reasons for (1) is that it should be run for longer times.

Possible reasons for (2):
(a) The finite element solution generates numerical errors that appear as an effective or computational 'viscosity' that is much larger than the physical value prescribed for the fluid.
(b) The mesh you have used is inadequate, again resulting in a falsely large viscosity for the computation.
(c) The time step you've used is too large, causing convergence to a false solution.
I'm sorry that I'm using finite difference language. I assume that the concepts exist in finite element lingo - but I don't know that language.

Anyway, you might want to try again using much smaller elements. Also consider using smaller time steps for your marching.

Good luck!

HectorRedal August 29, 2010 02:15

Hi otd,

First of all, I would like to thank you for your time and support.
The information you have provided to me is very valuable.
I have been working in the cfd field only for one year and a half, and as you can see, I have still a lot to learn.
And, only to add that the observations you have provided are very good, and they don't contain any kind of criticism. So, thank you!!

For debugging this problem, I have followed the strategy pointed out by you.

Regarding suggestion (1), I have rerun the case for longer time (from 20 seconds to 100 seconds) and the results are pretty similar: no significant change can be seen.

So, I am affraid, that as you have suggested, there are some programmatic errors in the code that is adding artiffical 'viscosity' to the solution.

I have followed the hints for (2), and the results obtained are not very promising:
Either changing the size of the mesh or changing the time step does not affect the converged solution.
So, the only option left is the errors in the implementation of the code. I am afraid I will have to debug the code so as to find the problematic module.

Other hypothesis I am thinking about is that as the reference length for calculating the Reynolds number I have taken one of the side of the square. Maybe in the reference, the reference length might have be taken for the diagonal of the square.
I don't know if this difference may account for the differences in the results.
I suppose that this is not the case, since the differences from the results obtained with the code I am developing and the results from the reference are very high.

Anyway, once again, thank you for your suggestions.

Best regards,

ganesh August 30, 2010 04:27

Dear Hector,

I am not sure if this might help you, but following are some of my suggestions.

1. If you are trying with a grid that is not cartesian, please try first with a uniform cartesian mesh, say a 50*50 for a unit square domain will suffice.

2. Re is calculated based on the characteristic length which is the cavity length, using the diagonal doesnt change the Re much (in terms of order of magnitude), so if results are wrong at 100 it is going to be wrong at 200 too.

3. If a non cartesian grid is employed for the results that you have shown, try running at a higher Re, say 5000 and see if the results are closer.

4. Also consider running the simulation to steady state by not considering the total time as such (like 20 s or 30 s), but by measuring the error in residuals, say the normalised error in the kinetic energy measured in an L2 norm over the entire domain must be less than some tolerance typically 1e-6.

I have had problems with non--cartesian meshes when running at lower Re using a finite volume staggered mesh framework, and it appeared quite evidently in that the vortex pattern (plot streamlines to see this) was completely wrong, esp. the corners. If you are facing similar problems, which also reflect in the profiles, then the issue is mostly with the computation of viscous fluxes.
Also make sure that there is no mass leakage, in particular, the divergence constraint is being satisfied to reasonable accuracy.

Hope this helps.


HectorRedal September 4, 2010 10:32

1 Attachment(s)
Hi Ganesh,

First of all, I would like to thank you for your suggestions.

I am going to add some useful information regarding this issue.
1.- The type of grid I am using is cartesian. It is not an uniform gratesian grid, but a grade cartesian grid (with finner grid in the boundaries of the cavity).
2.- I have re-run the simulation with a higher Reynolds number, but the results are even worse. You can take a look at the picture I am enclosing.

You have suggested to measure the error in residuals, so as to determine if the flow has reached the steady state. This will take some time, since the code has been developed by me and I will have to include this type of calculation in the software.

I will come back when I have finished the implementation of this computation.

Thanks for your help and support.

Best regards,

All times are GMT -4. The time now is 14:31.