CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Solver and density function for high speed vapour (https://www.cfd-online.com/Forums/openfoam-solving/59746-solver-density-function-high-speed-vapour.html)

 christian March 22, 2007 12:02

I've recently started using Op

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

 hartinger March 22, 2007 12:53

Hey, 1) rhoSonicFoam, sonic

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

 christian March 23, 2007 10:22

Ok. I'm a bit confused regardi

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:

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

 hartinger March 23, 2007 11:28

Hey Christian, i) all of th

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

 christian March 26, 2007 10:10

I'm interested in the rhoSimpl

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.

 hartinger March 26, 2007 11:44

In general, where can I find t

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

 christian March 27, 2007 04:55

I'm looking at the thermophysi

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<PureMixture<constTransport<specieThermo<h ConstThermo<perfectGas". What does this mean? I'm reading on page 93 in the manual but I can't understand the entry above ("...").

6)I want to set up a steady-state compressible solver. I've found a solver called rhoSimpleFoam. There is no tutorial nor the ability to select it in FoamX however. In what specific file am I supposed to find how to set up the
i) thermphysicalProperties
ii) fvSchemes

7) I want to set up a case according to how it was set up in Fluent. It is a compressible, turbulent case. In Fluent the following parameters were needed:
Cp
mu
M(olar mass)
k (conductivity)
I assume this would correspond to the rhoSimpleFoam solver. But what about the thermophysicalProperties model???

---

I'm sure that everything is there in the tutorials, manuals and source code. However, I'm a beginner using FOAM and need to be guided where to find the answers specifically. I would be very grateful to anyone helping me out with the questions above.

Best regards,
Christian Svensson

 hjasak March 27, 2007 05:50

Sounds like you need some seri

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)
);

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<puremixture<consttransport<speciethermo<hc onstthermo<perfectgas>>>>>;

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)
{
}

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

 christian March 27, 2007 06:18

I will go into the code thorou

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

 christian March 28, 2007 04:13

I'm trying to set up a case us

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

 christian March 28, 2007 05:29

I managed to sort out the erro

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

 hartinger March 28, 2007 06:47

did you specify underrelaxatio

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

 hartinger March 28, 2007 06:48

pitzDaily of the simpleFoam tu

pitzDaily of the simpleFoam tutorial for the underrelaxation factors

 gschaider March 28, 2007 07:06

Hi Christian! One of the mo

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

 christian April 10, 2007 05:49

I've been struggling for some

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:
div: Gauss upwind
laplace: Gauss linear corrected
interpolation: linear
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
div: upwind
laplace: Gauss linear corrected
interpolation: linear
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

 christian April 11, 2007 09:16

Is there really no one who can

Is there really no one who can help me in some way to attack this problem?

Best regards,
Christian

 lillberg April 11, 2007 10:10

Yes there is! ;-) I actuall

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

 christian April 12, 2007 02:41

Hi Eric, Thank you for your

Hi Eric,