CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

running rhoSimpleFoam to simulate real gas through nozzle

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By hk318i

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 12, 2017, 13:54
Question running rhoSimpleFoam to simulate real gas through nozzle
  #1
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 8
enginpower is on a distinguished road
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

Last edited by enginpower; May 30, 2017 at 04:34. Reason: update link
enginpower is offline   Reply With Quote

Old   May 18, 2017, 06:45
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,495
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   May 18, 2017, 07:59
Exclamation
  #3
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 8
enginpower is on a distinguished road
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.

Last edited by Tobi; May 18, 2017 at 09:07.
enginpower is offline   Reply With Quote

Old   May 18, 2017, 11:33
Default
  #4
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 8
enginpower is on a distinguished road
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
enginpower is offline   Reply With Quote

Old   May 18, 2017, 12:11
Default
  #5
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,495
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   May 30, 2017, 05:54
Default
  #6
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 239
Rep Power: 14
hk318i is on a distinguished road
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
Attached Images
File Type: png UafterOneStep.png (114.8 KB, 80 views)
Tobi and enginpower like this.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 21, 2017, 11:34
Default
  #7
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 8
enginpower is on a distinguished road
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
enginpower is offline   Reply With Quote

Old   August 15, 2017, 08:44
Default
  #8
New Member
 
Libor Macek
Join Date: Mar 2017
Location: Brno, Czech republic
Posts: 6
Rep Power: 5
libi.macek is on a distinguished road
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
libi.macek is offline   Reply With Quote

Old   August 21, 2017, 12:26
Cool
  #9
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 8
enginpower is on a distinguished road
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?

Last edited by enginpower; August 22, 2017 at 08:48.
enginpower is offline   Reply With Quote

Old   August 23, 2017, 01:33
Default
  #10
New Member
 
Libor Macek
Join Date: Mar 2017
Location: Brno, Czech republic
Posts: 6
Rep Power: 5
libi.macek is on a distinguished road
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
libi.macek is offline   Reply With Quote

Old   August 23, 2017, 11:06
Default
  #11
Member
 
power
Join Date: Jun 2014
Posts: 86
Rep Power: 8
enginpower is on a distinguished road
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.

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
enginpower is offline   Reply With Quote

Old   August 24, 2017, 23:09
Default boundary conditions
  #12
New Member
 
Dave Christopher
Join Date: Dec 2009
Posts: 26
Rep Power: 13
David Christopher is on a distinguished road
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.
David Christopher is offline   Reply With Quote

Old   August 25, 2017, 03:50
Default
  #13
Member
 
Hilbert
Join Date: Aug 2015
Location: Australia
Posts: 52
Rep Power: 7
Hillie is on a distinguished road
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.
Hillie is offline   Reply With Quote

Old   August 25, 2017, 04:02
Default
  #14
New Member
 
Libor Macek
Join Date: Mar 2017
Location: Brno, Czech republic
Posts: 6
Rep Power: 5
libi.macek is on a distinguished road
Quote:
Originally Posted by enginpower View Post
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.

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 ) 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
libi.macek is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Supersonic real gas flows David Christopher FLUENT 1 August 23, 2017 11:08
Evaporating Multicomponent Spray Sqnderby Fluent UDF and Scheme Programming 6 June 17, 2016 22:14
Real gas and compressible flow seanmike31 Main CFD Forum 0 March 20, 2015 17:06
Problems in air flow udf - divergence PJT Fluent UDF and Scheme Programming 0 May 28, 2013 11:01
UDF for Turbulent Viscosity Lourival Fluent UDF and Scheme Programming 3 October 13, 2012 04:09


All times are GMT -4. The time now is 05:00.