CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   running rhoSimpleFoam to simulate real gas through nozzle (https://www.cfd-online.com/Forums/openfoam-solving/187687-running-rhosimplefoam-simulate-real-gas-through-nozzle.html)

enginpower May 12, 2017 12:54

running rhoSimpleFoam to simulate real gas through nozzle
 
Dear all,
I want to simulate a flow through a nozzle connecting two concentric tubes. I created a very simplified 2D geometry of the real case as starting step.

The case is a steady-state flow and the real condition to simulate are:
  • inlet: p=20bar, mass-flow=100kg/s
  • outlet: p=6bar
I specified the real gas properties in the thermophysicalProperties file.
To start the simulation I set the boundary conditions with very low inlet pressure and mass flow. It will be worthful to make run the simulation with this conditions and then high the value more and more up to the real ones



My problem is that running rhoSimpleFoam it just runs very few iterations before stopping. It's not clear to me what is wrong to run the simulation.


The flow should not reach Mach>1 but it's not sure.



Could someone expert watch my case and help me explaining what I wronged to set in the solver?


CheckMesh reports it is all ok.


The error I get is:

Code:

Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  ? in "/lib/x86_64-linux-gnu/libm.so.6"
#4  pow in "/lib/x86_64-linux-gnu/libm.so.6"
#5  Foam::PengRobinsonGas<Foam::specie>::Z(double, double) const at ??:?
#6  Foam::PengRobinsonGas<Foam::specie>::h(double, double) const at ??:?
#7  Foam::heThermo<Foam::psiThermo, Foam::pureMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleInternalEnergy> > > >::he(Foam::Field<double> const&, Foam::Field<double> const&, Foam::List<int> const&) const at ??:?
#8  Foam::gradientEnergyFvPatchScalarField::updateCoeffs() at ??:?
#9  Foam::fvMatrix<double>::fvMatrix(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) at ??:?
#10  Foam::tmp<Foam::fvMatrix<double> > Foam::fv::optionList::operator()<double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) at ??:?
#11  ? at ??:?
#12  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13  ? at ??:?
Floating point exception (core dumped)

You can download the complete case from here



I read a lot about rhoSimpleFoam and I tried a lot of combinations to make stable the simulation but now I think I don't know what else to do.

Let me know what else you need to know to give me some useful hints



I hope you can help or give me some useful hints.


Thanks

Tobi May 18, 2017 05:45

Dear Saverio,

I got your message on research gate and checked your case. After 1 iteration, your solver blows up because the velocity already reaches 750 m/s. Doing some simple tests:
  • BC - I am not an expert of compressible flow but you should get shockwaves. The characteristics of the equations are elliptic or hyperbolic (I always mix them). Therefore, you should set U and p on the inlet (in my case it helped to get at least 6 iterations done).
  • Mesh - the problem of abort is your mesh. It is numerically a bad one (aspect ratio) fine to extreme large one (here you get the problems)
  • Relaxation factors
  • ...


I would suggest you to create a uniform mesh first. 4-5 cells in the connection part. If this works, you can refine locally (but not with blockMesh). Otherwise you will get the problem you have now.

Good luck.

enginpower May 18, 2017 06:59

Hey,

Quote:

Quote:

After 1 iteration, your solver blows up because the velocity already reaches 750 m/s
It will be very helpful if you could explain me how you got this information. In the log file I can't find it. Where is written that value?
You can set the write interval to 1 iteration in the controlDict. Based on the fact that at least one iteration is calculated, you will get all numerical results that can be checked out in paraview. That's why I know where you problem is located :) and of course the value.

Quote:

Quote:

The characteristics of the equations are elliptic or hyperbolic (I always mix them)
I know the mathematical difference, but I don't know what are in this specific simulation. How can you say they are elliptic, hyperbolic or parabolic in this simulation? Does it depend on the solver, that is the SIMPLE? Or does it depend on the flow (you're considering it is supersonic)? Or how?
Normally it is not easy to determine the characteristic of the problem. Ferziger and Peric mention that in most of the simulations we have a combination of the three. Anderson (Computational fluid dynamics) give an very good explanation to that topic. I cannot remember directly but you will find good things there. The main point is that different equations has to be solved differently (OF already treats them correctly). However, also the boundary conditions are influenced by that. I remember a slide of my professor based on different flow pattern - subsonic, supersonic etc.)... But as I said, I have no experience with that kind of flows.

Quote:

Quote:

Therefore, you should set U and p on the inlet (in my case it helped to get at least 6 iterations done)
Did you set fixed values for U and p at inlet, and zeroGradient for U and p at the outlet? Do you mean that? Or what? I read somewhere it's better to set U on the inlet and p on the outlet. Where do I wrong?
No that is right but normally for Ma < 0.3 (if I am not wrong - incompressible). But again, I have no idea with compressible one.

Quote:

If the aspect ratio is 68, which limit do you suggest to reach a good mesh?Thanks very much about these interesting points. If you could answer about at least one of my points, I'm sure I'll do great steps forward in knowledge and to get the solution.
Cannot tell you any value. But the transision should be smooth (factor ~ 0.8).


Good luck and if there is some compressible expert - I would be glad to have also new input.

enginpower May 18, 2017 10:33

Hey Tobi,
thanks a lot about answering to my points directly in my message.

The procedure you explained to get last value is effectively very useful!

Waiting for some compressible experts, I'd like to address the problem of the mesh. It is a very huge problem to me getting a good mesh using open source tools. I do a lot of trials in the past but with low level of success. I followed also some of your tutorials.
Maybe I've just given up soon or I started directly with a complex geometry.

About this case, what do you suggest?
I have to create the same geometry in Salome, mesh simply it in Salome, extrude it in Salome, export all the patches each by one as stl files.
Then I have to configure snappyHexMeshDict file to get a good mesh.

Is it this procedure correct?

Let me do this further trial :(

Tobi May 18, 2017 11:11

I have to say that I never used mergeMesh and other good tools in FOAM. That's why I would do it as follow:
  • Build the geometry in Salome
  • Build your boundary faces
  • Mesh the boundary faces using triangles
  • Export the the single boundaries as STL (ascii)
  • Build a regionSTL
  • Back to Salome
  • Build a bounding box
  • Scale the bounding box with some factor > 1 (like 1.05)
  • Mesh the bounding box with pure hexaeder (use local length)
  • Build your sHMDict; maybe add some box refinement in the connection part
  • Mesh it using sHM
  • Check the boundary types
  • Flatten the mesh
  • Extrude the front or back to get a 2D mesh


You can also use some 2D tutorial that I already uploaded. Appropriate cases would be
  • Magnus Effect
  • Hydraulic Jump
  • ...
There are more cases where you can see how I created a 2D mesh with sHM. You can check the list here:


https://openfoamwiki.net/index.php/S...als_and_Guides

hk318i May 30, 2017 04:54

1 Attachment(s)
Hello,

As Tobi pointed out, it is a mesh problem. Please see the attached image, it is clear that this velocity jump is around the nozzle inlet where you have a huge mesh expansion ratio. Actually, there is no expansion ratio at all, it is a sudden jump in cell volumes.

Regarding the BCs and the solver, I can see that you have very small inlet velocity but you have to make sure which type of flow range is expected for this case. Based on your BCs Mach number is very very small, which means the flow is incompressible. Anyway, the mesh should be fixed fist and I think it is possible to create a good mesh using blockMesh for this case.

Best Regards,
Hassan

enginpower July 21, 2017 10:34

Hello,
I improved globally the mesh to have uniform cells with lenght sides of about 1e-3.

I also did some trials changing the gas properties.

In the case of perfect gas, it diverges after 33 iterations but I've not undestood why. Pressure, velocity, etc...and all other parameters seem to be in reasonable range, apart from the omega value. What's the problem?

In the case of real gas, it diverges after 1 iteration. Pressure reaches a value of 430 bar.

So what's the problem with these case now? Is my mesh improvement enough? Where or what can I improve using blockmeshdict?

You can download the two cases, with different settings but same mesh, from here: perfect_gas and real_gas

I hope you can help me easily

Thanks

libi.macek August 15, 2017 07:44

Hello enginpower,

have you find out converging solution? I am making similar calculation, but i cannot cross critical pressure of nozzle.
I am using rhoSimpleFoam and limit is flow from 2.3 bar to atmosphere (1 bar). I tried few meshes, but solution is still unreal and oscillatory. Transient solvers have similar problem, except of sonicFoam, which is diverging.
Transonic option of rhoSimpleFoam has problem with pressure equation and diverging after 3 iterations

enginpower August 21, 2017 11:26

Hi @libi.macek,
I've not found a solution yet.

But I know that the mesh is an important stuff so I'm trying to improve more that. The problem is how to create a good mesh with open source tools.
I tried a lot Salome on complicated geometries but I've not found good for that. Mainly it is due to the fact it is hard to create connected meshed surfaces. What I mean is that it's difficult to connect different surfaces composing a 3D model. Then there is the problem you should mesh in 3D more with snappyhexmesh... up to now I've not succeeded!

I hope soon will update here a better mesh of my 2D model and maybe news about simulation.
Keep in touch!

What about your problem?

libi.macek August 23, 2017 00:33

Hey enginpower, make pressure inicialization to value of maximal pressure, i earn interesting results using this. Then text me, if it was successful


Sent from my iPhone using CFD Online Forum mobile app

enginpower August 23, 2017 10:06

What do you mean with:
'make pressure inicialization to value of maximal pressure'?

Put the pressure on the inlet to the maximum?
Which maximum? Explain better this point.

I have already some fixed boundary conditions. :confused:

Do you want to suggest a procedure to follow. changing boundary conditions, to improve stability and get convergence? How do you make start another simulation from another one.
If yes, be more precise about this procedure.

Thanks

David Christopher August 24, 2017 22:09

boundary conditions
 
As the previous commentators have said, the mesh is crucial. A very coarse mesh that does not refine anything will work (poor results) or a very fine mesh (can be slow). A moderate mesh will not work well.
I suggest that you start with subsonic flow, with the inlet pressure just 0.5 bar above the outlet pressure. You mentioned getting pressures of 450 bar, I think this is due to the inertia of the fluid, so you first need to get the fluid moving. So you need subsonic flow (for steady calculations) or very, very small time steps for transient flow at the desired inlet P.
I also recommend first doing the calculation with ideal gas and then switching to a real gas. I am using Fluent and the real gas model will not work for me for inlet P > 20 bar.

Hillie August 25, 2017 02:50

Hey all, to my knowledge all solvers apart from rhoCentralFoam and rhoSonicFoam are not hyperbolic solvers. This basically means that they will crash once the flow goes supersonic.

SonicFoam and rhoCentralFoam can both achieve nice supersonic flows, so if the solution diverges that probably means the BC's aren't correctly setup. The downside of sonicfoam is that is doesn't have the viscous stress term in the energy equations, and so the temperature profile in the boundary layer will be wrong. rhoCentralFoam is quite nice, just slow. With local time stepping it is oke ish, but you will still have to wait a bit for the solution.

I also agree that the first step should be to get a case running with an ideal gas before you switch to any real gas effects.

libi.macek August 25, 2017 03:02

Quote:

Originally Posted by enginpower (Post 661599)
What do you mean with:
'make pressure inicialization to value of maximal pressure'?

Put the pressure on the inlet to the maximum?
Which maximum? Explain better this point.

I have already some fixed boundary conditions. :confused:

Do you want to suggest a procedure to follow. changing boundary conditions, to improve stability and get convergence? How do you make start another simulation from another one.
If yes, be more precise about this procedure.

Thanks

Hey Enginpower,

I meant InternalField in O/ files. If you think about it in physical way, you will not develop so critical pressure wave at start of the calculation (its not stupid, if it works :D ) And maximal pressure i meant the maximal pressure in your case (if you have 20 bar at inlet and 5 bar in outlet, then maximal pressure is 20 bar)

Start one simulation from another one you can make by mapFields, if you have similar geometry and different mesh.

Best regards


All times are GMT -4. The time now is 06:39.