'mockupGasCell' simulation project by mreponen


I created a new simulation project called 'mockupGasCell':

just a test case

More of my public projects can be found here.


Hello @mreponen

I got directed by by SimScale colleagues to your interesting project. I hope that my short comment might help you move forward with this simulation :wink:

The job is a compressible flow simulation through a small opening.
There are two main aspects of the whole project that cause it to break.

First it is the mesh. It is very important for compressible flows to have a sufficient mesh refinement in the most crucial areas. In case of this project, it will be the small opening between the two domains.
The mesh “fullCell mesh Good” at first glance seems very fine, but when you take a closer look at the narrow passage and the beams in the big domain, you will immediately notice that the mesh is much, much too coarse there.
We definitely need to get a better mesh close to the narrow passage and next to the long beams.
You could try to go for an automatic meshing with “very fine” choice, but I doubt that the resulting mesh will be good enough.
I highly advise you to try out the manual snappyHexMesh. It might seem a bit overwhelming at the beginning, but I assure that you will get the idea very quickly. Here you can find some awesome materials that describe how snappyNexMesh works.

The second issue we have to deal with is the simulation setup.
While looking at the case you prepared one thing immediately drove my attention. You put fix velocity boundary condition on both sides of the domain. One of them is a positive volume flux (inflow) and the second one is negative (which makes it outflow). I assume that the overall flow rate are balanced. Although in principle this seems a good approach, it makes the numerical solver struggle a lot. With a fixed velocities, the solver has no change of accounting for numerical errors and imperfections of mesh representation. In the end the continuity error accumulates and breaks the whole run.
To avoid that, I highly recommend to use a fix pressure outlet on the side where the flow goes away from the system.

I hope that this helps you a bit with getting the job to run!


Hi Pawel,

Thank you for the advice. I was at some point worried about the mesh coarsens at but once I got the thing running I did not bother myself about it nor the more advanced options in the meshing. Would the right way then to be to define some specific refinement region in the nozzle area? On my own computer I have usually managed to make either a coarse mesh or a super dense mesh all around which fills up the available memory.

I tried the setup with fixed pressure on the inlet side and flow rate on the exit, which did not work, probably because I attempted a steady-state solver in these cases. I tried the steady-state with various boundary conditions and none of the got me too far. With the current set-up the transient solver worked fine from the first go, at least up to SimFlow stopped the simulation with no obvious error from openFoam.

That said there are other issues that may make the simulation infeasible in a long run. The primary thing that I can think of is that in reality the flow would be supersonic with the pressure in the first chamber being in atmosphere and in the other chamber about 2000 hPa, meaning that in any case the initial conditions for one of the chambers are off quite a bit.I don’t know if rhoPimplefoam can solve this kind of situations or would it require some other solver, or a complete splitting of the case. At least judging from the time step evolution, it would seem that getting to a realistic condition, the computing would take a very long time.

Would you think it would be possible to utilize the , somewhat in the right direction, calculated flow field as a initial condition for a steady-state solver? With pressure in, flow-rate out boundary conditions?

In any case, thank you for advance already, I will see about the meshing again next week, and test other boundary conditions if they allow the steady-state solver to work. In general I am not interested if the supersonic flow is described in super detail. I rather want to see the pressure differences between the chambers, as well as velocity and temperature and the general geometry of the the outgoing gas flow as they are crucial in the next stages. I can give you links to related publications where similar situations are discussed if you are interested?

Best regards,


Hello Mikael (@mreponen),

Definitely you can make a mesh that will be refined in a specific region and coarse in the bulk of the domain. SnappyHexMesh gives lots of flexibility: surface, region, feature refinements, layer additions and more. The link to the documentation that shows how to use it is in my last post.

We definitely can handle supersonic flows with OpenFOAM. First you should always try with the steady state on. In case of trouble with convergence, you can ramp the inlets and decrease relaxation factors. Finally if nothing helps you can try with the transient one.

The most stable configuration will always be: fixed velocity at inlets and fixed pressure at outlets.
I highly advise to start with the following configuration:
Velocity: Inlet velocity (any kind: fixed value, mass flow or volume flow)
Pressure: Pressure outlet with fixed pressure

Unfortunately right now you can not initialize the flows with the results from another simulations. We are working to enable this in the future.

Let us know how did the next tires go! Good luck!