SimScale CAE Forum

Floating point error compressible 2D diamond airfoil


Hey Darren,

Your suggestion initially didn’t resolve the issue but it makes perfect sense due to how sharp the edge is. So I’ve continued to implement it as I finally found out what was causing the layering issue below.

This is the result!

Looks pretty good now. What do you think? Might need some more tuning to keep the layers evenly apart and maintain grid quality at the edge, but otherwise much better than the previous iteration.

So the change I made (after much guessing and reading) was to increase the “Max internal face skewness angle [°]”. Not only do the layers appear well now, it further confirms my initial guess that the quality controls are deleting the layers off at this area.

However, the minor catch is that now checkMesh does not deem the mesh as OK even with 0 illegal cells. So some further optimizing of the values for the “Max internal face skewness angle [°]” and maybe the “Max boundary face skewness angle [°]” will be needed along with maybe the layer controls, depending on geometry of course.

Ideally we get something like this in the below figure (in a hex mesh ofc) where the layers “lie on a straight horizontal line” rather than looking like they are converging to a single point like in the above figure.

I’ll go ahead and proceed with the 2D mesh generation now while I continue to optimize the layers. Will keep you posted.




Hey Darren, I’m a little confused about 3D to 2D generation. I’ve downloaded your file posted and attempted to follow the steps in the video but I don’t seem to be able to find the extrudeMeshDict in the folder as you can see below. I’m pretty sure I missed something, so could you enlighten me on what to do?

Your download file



I’ve also downloaded the refined mesh in this post, the files are as such.




No issues till the part where I had to edit the extrudeMeshDict.


Sorry Barry, I have update the link to include the other files, there should be a folder, unpack and put that next to constant folder and within system there is the extrudeMeshDict.

Sorry for the late reply.



Hi everyone,

So just an update on this project. Yes I am still working on it and no it has not been very cooperative :stuck_out_tongue:.

Some small good news, finally got OpenFOAM properly installed (dual boot) in Ubuntu and runs perfectly fine. This has allowed me to generate the much needed 2D meshes. Very special thanks to @1318980 for all his brilliant help and insight. Cheers Darren.

Now for the next set of problems. But first, a screenshot.

Run 7

As you can see, some optimization has been done. I’ve cut the mesh in half basically with a symmetrical BC at the bottom. The diamond is still no-slip and the mach no has been recalculated correctly (I hope, more on this later). For a speed of Mach 2, the theta beta shock graph predicts a shock angle of around 45 degrees.

Well, this is clearly not the case. Why? I’m not sure myself. Which leads to a speculation that again I may have miscalculated the inlet flow speed due to my unfamiliarity of sorta how to based on the material stated. For reference here is the material data (air).

My inlet flow speed of 682.6 m/s is assuming a R = 287, T = 293 K, Gamma of 1.4. The simulation is density based although I’m not sure if I’m controlling the air properties correctly, hence the immense road block.

Till then I will continue cracking on. If anyone wants to chip in and give some ideas, that would be most welcome. If more information is required, do let me know and I will be sure to provide.

Cheers everyone.



Think you’re ok on the inlet velocity.

Not sure the cause of the differing results tho. Is this the same setup as your other run all bar the symmetry? Because that was closer.



Hey @DarrenLynch,

Hmm I agree. Did some testing by increasing the inlet velocity to 900 m/s, same inaccurate behavior. Probably the inlet speed is correct. Something else is causing this problem.

Went to check it and it is slightly different. The obvious change is the last closer run was a 3D simulation (sorta). There are some differences, I remember testing them out but forgot the outcome other than that it was not very successful for whatever reason. I’ll list down the differences below.

Semi-successful run

  • Initial conditions - Pressure 101325 Pa
  • Inlet - Velocity inlet Fixed Value Mach 1.785 (612.54 m/s) | Temp Fixed Value 293 K.
  • Outlet - Pressure Outlet Fixed Value 101325
  • Top and bottom - Sym
  • Foil - Slip Wall | Temp Fixed Value 293 K

Unsuccessful 2D run

  • Initial conditions - Pressure 101325 Pa
  • Inlet - Custom | Velocity inlet Fixed Value Mach 2 (686. m/s) | Pressure Fixed Value 101325 | Temp Fixed Valkue 293 K
  • Outlet - Custom | Velocity Zero Grad | Pressure Zero Grad | Temp Zero Grad
  • Top - Custom | Velocity Zero Grad | Pressure Zero Grad | Temp Zero Grad
  • Bottom - Sym
  • Foil - Slip Wall | Temp Zero Grad

So I’ll address the changes. I didn’t want to force the solution out, so I did change the outlet to zero grad for all in order to do that. Inlet I felt needed to be more defined so I input a fixed value for pressure as well. I did not want the shockwaves to reverb within the bounding domain and affect the sim hence the top of the domain is also zero grad.

Other than this, the other major change is that the new run is a 2D sim and it is also cut in half to reduce the mesh size.

I’ve simulated with the full 2D mesh that is not a sym and same result. Courant number is kept below 1 and another run with max Co at 0.1 also produces the same wrong result.

Darren, I think I will retry the sim with the exact same parameters as the closer run (as same as I can make it) and see how it goes. Update here when its ready.

Cheers mate.


EDIT: The sim following the somewhat closer results setup is done, but the results are similar in that the shock is not attached. In addition, the backflow dosen’t seem to be cooperating very well. It will need some tuning. Reference screenshot below.

Here is a closeup of the detached shock with and without mesh elements.

Side note, the prandtl meyer expansion fans can be seen though which is pretty neat. If only the results were correct :persevere:


@Get_Barried, I am thinking, for supersonic conditions (I was adding to subsonic) the radius I advised on the sharp edge might be too blame, walls are a slip, we don’t need layers, if layers are not needed we don’t need to soften the blow by adding radius and thus their removal should have no negative effects?

Worryingly though I couldn’t see any radius on the symmetric setup? So the problem would still persist?



Hey Darren,

That could be true. However, I figured that the radius would be small enough. Then again, the layers do kind of “amplify” the curvature of the tip of the foil so I think you’re on to something.

Yes that was what I was thinking as well. The symmetric setup should effectively remove that radius. I think what I will do now is to keep the sharp edges, maybe make a single layer and see how it goes. Back to Ubuntu!

Will keep you posted.



EDIT: No luck it seems. Below is the screenshot of the results.

Hmm. Back to more digging work :thinking: