# Solver and density function for high speed vapour

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

 March 22, 2007, 12:02 I've recently started using Op #1 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 I've recently started using OpenFOAM and so far I've been encouraged to continue. OpenFOAM seems very promising to me. I would however need help regarding a particular case. I need to run a case where water vapour will pass a valve. The pressure will drop significantly so that density is greatly affected. The speed of the fluid will be around the speed of sound. My interest is to see the pressure distribution on the valve surface. I will have inlet and outlet pressure boundaries. 1) What solver would you recommend? How is the density calculated in that solver? 2) How do I make my own density function (of pressure and temperature/enthalpy)? 3) What kind of solver and settings do I have to use to obtain a i) compressible solver using the ideal gas law for density ii) incompressible solver using the ideal gas law for density 4) How do I specify a total pressure (i.e. static + dynamic) on a boundary? Best regards, Christian

 March 22, 2007, 12:53 Hey, 1) rhoSonicFoam, sonic #2 Senior Member   Markus Hartinger Join Date: Mar 2009 Posts: 102 Rep Power: 9 Hey, 1) rhoSonicFoam, sonicFoam and rhopSonicFoam - rhoSonic solves for density, pressure is explictly calcuclated - sonicFoam solves for pressure, density is explicilty calculated - rhopSonicFoam does both and is most suitable for trans-sonic flows all solvers are using ideal gas 2) the coefficients for the ideal gas assumptions are user defined. If you mean non-linear behaviour, that is possible but would need some progamming. For that you would need to understand the implementation of the codes above 3) i) 4) There is the boundary condition totalPressure, have a look in the manual

 March 23, 2007, 10:22 Ok. I'm a bit confused regardi #3 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 Ok. I'm a bit confused regarding the compressible solvers though. Can anyone help me with the following: 1) rhopSonicFoam 2) rhoSimpleFoam 3) rhoSonicFoam 4) rhoTurbFoam 5) sonicFoam 6) sonicTurbFoam Characterize the solvers above in terms of: i) Steady-state / transient ii) Laminar / turbulent / non-viscous iii) Solving pressure/density iv) Which one is suitable in what situations? v) What is the proper solver for me? My case concerns the flow past a valve where Mach 1 will be reached. The pressure at the inlet is 70 bar and between 3 and 30 bar at the outlet depending on the case. Best regards, Christian

 March 23, 2007, 11:28 Hey Christian, i) all of th #4 Senior Member   Markus Hartinger Join Date: Mar 2009 Posts: 102 Rep Power: 9 Hey Christian, i) all of them are transient ii) the *Turb* ones are turbulent, sonicFoam is viscous, rhopSonicFoam is invicid. You can easily check by looking "constant/transportProperties" in the tutorials. Better, you have a look at the codes iii) the "rho" ones solve for density, the "sonic" ones for pressure, "rhop" for both, start looking in to the code, its not that difficult to understand. iv) the "rho" for supersonic (they don't work well if the actual compression is very small), the "sonic" for subsonic, "rhop" for trans-sonic. v) "rhopSonicFoam" will be your first choice, tightest coupling between pressure and density and most stable regards markus

 March 26, 2007, 10:10 I'm interested in the rhoSimpl #5 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 I'm interested in the rhoSimpleFoam solver. This is a compressible turbulent steady-state solver. There is no tutorial for this solver nor the ability to select it in FoamX. Therefore, I'm wondering how to get the proper look of my fvSchemes and fvSolution files? Maybe I can use the files for sonicTurbFoam? In general, where can I find the options for the settings of the fvSchemes, fvSolution and controlDict files? I would like a complete list of settings/arguments.

March 26, 2007, 11:44
In general, where can I find t
#6
Senior Member

Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 9
Quote:
 In general, where can I find the options for the settings of the fvSchemes, fvSolution and controlDict files? I would like a complete list of settings/arguments.
well, that's all there, start with the existing tutorials, read the manual, look into the source code

 March 27, 2007, 04:55 I'm looking at the thermophysi #7 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 I'm looking at the thermophysicalProperties of the tutorials: rhopSonicFoam: Cv and R is specified. No viscosity which means that this is an inviscid model. rhoSonicFoam: Cv and R is specified. No viscosity which means that this is an inviscid model. sonicFoam: Cv and R is specified. This is a laminar model and viscosity is specified. rhoTurbFoam: thermoType and mixture is specified. Turbulence is modelled. sonicTurbFoam: thermoType and mixture is specified. Turbulence is modelled. 1) For the last two ones, why isn't there an option to specify Cv, R, mu and turbulence model only? I need help understanding the thermophysical model of the last two models. I'm supposed to give: 2) mixtureName: What is the purpose of this? 3) nMoles: ??? I have a fluid entering and leaving a domain. Number of moles??? 4) deltaH: What is this? Enthalpy difference??? 5) The thermoType option is set to "hThermo

 March 27, 2007, 05:50 Sounds like you need some seri #8 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,783 Rep Power: 22 Sounds like you need some serious support. To give you an idea of what is going on, let's take a look at a couple of the solvers you are interested in. 1) sonicFoam readThermodynamicProperties.H reads R and CV - this is sufficient to set up the simplest equation of state Looking at the momentum equation: fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(phi, U) - fvm::laplacian(mu, U) ); solve(UEqn == -fvc::grad(p)); I see a term - fvm::laplacian(mu, U). That is obviously a visous drag: therefore, this solver does indeed have a viscous term. Now we can easily find where the viscosity is read in: readTransportProperties.H! You can also see here that all material properties are constant, that Prandtl number is hard-coded to one and that ideal gas equation of state is used (try to find those bits in the code). Also, there is no mention of a turbulence model and the viscous term in the momentum equation uses mu only: thus, no turbulence. Clear so far? 2) rhoTurbFoam As you know, in real materials properties depend on the current state, e.g. (p, T) for example. Therefore I cannot write my equations using the "simple relations" like in sonicFoam because for example T is no longer equal to h/Cp. Also, mu, thermal conductivity etc. all depend on (p, T), which would make a mess in the top-level code. Looking at createFields.H you can see that the code creates an object of type basicThermo, which will take care of the material properties. Regarding the type of relationship, it will be given in constant/thermophysicalProperties in the case (I wonder who is the bright spark who set up a cavity as a tutorial for a compressible flow case...), e.g. thermoType hThermo>>>>; You should be able to work out what various components are. Further from that, there is a turbulence model, which says there will be a viscosity (picked up as a part of real material properties). You can see that from the form of the momentum equation: fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(phi, U) + turbulence->divRhoR(U) ); if (momentumPredictor) { solve(UEqn == -fvc::grad(p)); } I don't want to get into the details of the numerics, but this should give you an idea on what is going on. Better now? Hrv __________________ Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk

 March 27, 2007, 06:18 I will go into the code thorou #9 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 I will go into the code thorougly as soon as I can. In the meantime I wonder if you could give me piece of advice. Previuosly I've been doing incompressible flow. My knowledge regarding compressible flow is very limited. So I'm wondering if you could give some recommendations regarding discretisation schemes in compressible flow as well as solving tactics, especially initially. Regards, Christian

 March 28, 2007, 04:13 I'm trying to set up a case us #10 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 I'm trying to set up a case using the rhoSimleFoam solver. There is no possibility to select this solver in FoamX. There is neither a tutorial. Therefore I did the following: 1) I set up my case in FoamX selecting the rhoTurbFoam solver. 2) I changed the application of the controlDict file to rhoSimpleFoam. 3) I changed the ddtSchemes of the fvSchemes file to steadyState. 4) I replaced the fvSolution file with the corresponding file from the tutorial of the SimpleFoam solver, i.e. SIMPLE instead of PISO. When I run the case a message appears: "--> FOAM FATAL IO ERROR : keyword U is undefined in dictionary "solvers" file: solvers From function dictionary::lookupEntry(const word& keyword) const in file db/dictionary/dictionary.C at line 152" Anyone who can help me? Best regards, Christian Svensson

 March 28, 2007, 05:29 I managed to sort out the erro #11 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 I managed to sort out the error in the last message. Instead I had the same error message concerning "h", i.e. enthalpy. So I simply added h in the solvers list in the fvSolution file. Now, I immediately get "solution singularity". Anyone who might help me? Best regards, Christian Svensson

 March 28, 2007, 06:47 did you specify underrelaxatio #12 Senior Member   Markus Hartinger Join Date: Mar 2009 Posts: 102 Rep Power: 9 did you specify underrelaxation factors?: absolutely necassary. If not look at the pitzDaily example (system/fvSolution) and specify them for h, p and U. play with them. boundary conditions: what test-case are you using? what are the boundary conditions? markus

 March 28, 2007, 06:48 pitzDaily of the simpleFoam tu #13 Senior Member   Markus Hartinger Join Date: Mar 2009 Posts: 102 Rep Power: 9 pitzDaily of the simpleFoam tutorial for the underrelaxation factors

 March 28, 2007, 07:06 Hi Christian! One of the mo #14 Assistant Moderator   Bernhard Gschaider Join Date: Mar 2009 Posts: 3,952 Rep Power: 41 Hi Christian! One of the most popular causes for "Solution Singularities" in compressible cases is specifying a pressure that is zero (either the internal field or on a boundary). But that is only a guess based on the information you have given us __________________ Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 April 10, 2007, 05:49 I've been struggling for some #15 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 I've been struggling for some time now with the following case. There is a main pipe with a fixed mass flow and a pressure of 70 bar. This pipe has a T junction leading to a valve which is open in this case to simulate pressure relief. The aim is to find the pressure distribution on the valve cone. My boundary conditions are the following: i) The inlet of the main pipe is set to a fixed velocity. ii) The outlet of the main pipe is set to a fixed pressure (70 bar). iii) The outlet of the relief valve pipe is set to a fixed pressure. In reality this is approximately 5 bar but I was given the advice to set it to 30 bar. This way, the computation will be easier in terms of shocks. The first shock will appear downstream of the valve cone whose pressure distribution is of interest. The case has earlier, in Fluent, been found by another person to be more or less steady-state. So my first intention is to use a steady-state solver; rhoSimpeFoam. My second intention is to use a non-viscous transient solver; rhopSonicFoam or rhoSonicFoam. The steady-state solver rhoSimpleFoam doesn't work with the boundary conditions stated above. Instead, I set the relief valve pipe outlet pressure to 65 bar keeping the main pipe pressure outlet pressure to 70 bar. Then I succesively decreased the relief valve pipe outlet pressure. This worked for 50 bar, but 45 bar did not work. I get a negative pressure. Someone told me this solver only works for low compressibility. I've tried under-relaxation down to 0.003. Instead I continued the work using the transient solvers rhopSonicFoam and rhoSonicFoam. They work for some time but sooner or later they always crash. The Courant number gets really high. I have to use a small time step; 1*10^-6. This leads to a maximum Courant number of about 0.1 before running into trouble. I don't know how to proceed. Any help is appreciated. For the steady-state solver rhoSimpleFoam I'm using the following schemes: grad: Gauss linear div: Gauss upwind laplace: Gauss linear corrected interpolation: linear snGrad: corrected fluxRequired: no The solution part is as follows: p ICCG 1e-06 0.01 U BICCG 1e-05 0.1 h BICCG 1e-05 0.1 nNonOrthogonalCorrectors 1 relaxation down to 0.003 For the transient solvers rhopSonicFoam and rhoSonicFoam I'm using the following schemes: ddt: Euler grad: Gauss linear div: upwind laplace: Gauss linear corrected interpolation: linear snGrad: corrected fluxRequired: no The solution part is as follows: p ICCG 1e-06 0 U BICCG 1e-06 0 h BICCG 1e-06 0 nOuterCorrectors 1 nCorrectors 1 HbyAblend 0.0 How do you recommend me to attack this problem? Best regards, Christian Svensson

 April 11, 2007, 09:16 Is there really no one who can #16 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 Is there really no one who can help me in some way to attack this problem? Best regards, Christian

 April 11, 2007, 10:10 Yes there is! ;-) I actuall #17 Member     Eric Lillberg Join Date: Mar 2009 Location: Stockholm Posts: 80 Rep Power: 9 Yes there is! ;-) I actually tried your boundary conditions on a 2D pipe case with 70 bar in the main pipe and a 5 bar outlet pressure at the end of the side branch (have I understood your problem correct?) using sonicFoam but wheren't able to reproduce the problems you are experiencing. I didn't have any valve geometry though. Have you tried using pressureTransmissive boudary conditions on the 5 bar outflow patch downstream of the valve cone? Regards //Eric Can you please specify your

 April 12, 2007, 02:41 Hi Eric, Thank you for your #18 Member   Christian Lindbäck Join Date: Mar 2009 Posts: 55 Rep Power: 9 Hi Eric, Thank you for your effort. Yesterday I accidently read a thread where Henry Weller gave an advice to use the PISO option "transSonic" with the rhoTurbFoam solver. I'm currently trying this and so far so good. I have no idea though what it means which of course is not good. I believe it is stabilising somehow. I wonder if this is an option for all transient compressible solvers, like rhopSonicFoam e.g.? I will try. Now to your suggestion. I can't say I'm very familiar with compressible flows. Could you develop what the boundary condition "pressureTransmissive" is?

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Mac CD-adapco 2 July 1, 2008 07:39 John FLUENT 0 January 15, 2008 12:17 Nari Main CFD Forum 7 October 11, 2007 11:53 Raj FLUENT 4 January 10, 2006 05:14 hadi FLUENT 2 September 21, 2004 06:37

All times are GMT -4. The time now is 09:29.