CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   rhoCentralFoam not reflecting shock in Shock Tube? (

Astaria October 23, 2011 17:02

rhoCentralFoam not reflecting shock in Shock Tube?
Disclaimer: I am brand new to OpenFoam and a fairly poor Ubuntu user.

I've been playing around with OpenFoam while taking a class in compressible flow theory. I've been taking a look at the shock tube tutorials because we covered that topic in class and they seemed rather simple to set up.

When I ran the shock tube found in the sonicFoam folder, everything looked good qualitatively. A shock formed, proceeded down the tube, reflected off of the wall. An expansion wave did the same in the other direction. HOWEVER, when I looked at the velocity profile, I saw that the velocity behind the reflected shock was not zero (like our textbook says it should be). Looking into this further, I saw several posts describing sonicFoam as unreliable for subsonic flows.

So then I tried rhoCentralFoam in the rhoCentralFoam folder. I get the shock and expansion waves, but they don't reflect off of the walls at the end of the tube. It's almost as if there are no walls there?:confused:

Unfortunately I still haven't learned how to read most of the setup files. I know only enough to be dangerous and screw things up :). If anyone has the patience to deal with a beginner such as myself, I would be incredibly grateful as this looks like an awesome tool, and I look forward to using it in my mischief making ways.

Linse October 24, 2011 09:47

Hi Sean,

I don't know the shockTube-tutorial by heart, but sometime ago I did some simulations which reflected nicely. So I guess it really is the setup of the tutorial case. Let's analyse it for the basic conditions:

- Check the output of your blockMesh: Does it tell anything about undefined patches being added to an "empty" patch? If these are your tube-ends among these undefined patches? If yes, go to the next step.
- Look into the constant/polyMesh/blockMeshDict: Are the ends contained in a patch that is called walls or something similar? If this is not the case, try to find the definitions of these patches within the blockMeshDict and add them to the walls-patch that is there.
- If the endings are contained in the walls-patch, check the files in the 0-folder. See if they are described with a wall-condition or if they are something like inlet, outlet, zeroGradient,...

I guess, these should be the steps that most probably cause the problem - and moreover are correctable even without too nerdy knowledge about the intestines of OpenFOAM. ;-)

Let us know if it works or where the problems are situated!

PS: If there is a correct way to start OpenFOAM, I guess you chose one of them! ;-)

Astaria October 27, 2011 01:12

Well I've checked the blockMeshDict files in both of the shock tube cases...nothing different that I can tell. Since I've last posted, I tried moving ALL of the sonicFoam files into the rhoCentralFoam/shockTube folder...with the result that I've now destroyed my rhoCentral/shockTube case :(. I'll try to rebuild it from another case, but so far things aren't looking good for my shock tube.

Linse October 27, 2011 04:21

Well, there should be a shocktube-case in the tutorials for rhoCentralFoam. Unfortunately it did not work out of the box the last time I tried, but surely it is a good starting point...

But how strong was the shock? Are the reflections strong enough to be seen via the used postprocessing?
How about trying a stronger shock?

In case problems stay, maybe you could post your basic case within a .tar.gz-archive here? Then people here could check for problems as well.

Don't forget to remove all but the blockMeshDict from constant/polyMesh before uploading it. The other files are big but easily produced by a simple blockMesh-run.
(As you are new to linux: "tar czf newfilename.tar.gz file-to-be-compressed" is the command for getting the socalled tarball, which you can attach via the attachment-menu in this forum.)

Astaria March 3, 2012 22:13


I solved my problem and I'm resurrecting this thread so others can fix their tutorials as well.

The problem lies in the velocity boundary conditions at the walls. The shocktube tutorials for both sonicFoam and rhoCentralFoam have zeroGradient as the velocity (U) boundary condition at the walls.


The boundary condition should be set to fixedValue with the value being "uniform (0 0 0)"

The boundary condition for magU needs to be set the same as U (uniform 0, since it's a scalar)

Making these changes should result in a shocktube result that looks closer to the analytical solutions. I've only looked at the results qualitatively.


alberto March 4, 2012 04:07

There is no error in the tutorial, which is a case of Sod's shock tube, in which there are no walls.

All times are GMT -4. The time now is 21:52.