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

OpenFoam vs CFX5 mass balance in OpenFoam

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 30, 2006, 06:46
Default Hello, I ran my case with b
  #1
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
Hello,

I ran my case with both OpenFoam (sonicTurbFoam) and CFX5 and compared
results by generating graphs of temperature, pressure, mass and mass flow rate
as well as some contour screenshots (see attached images). In principle,
the axisymmetric-2D-system is a simple volume with an inlet. For OpenFoam
a 5° sector was used with wedges.

I found that temperature and pressure of OpenFoam are lower than the corresponding
results of CFX-5. Additionally, in OpenFoam the overall mass in the closed volume
is lower than the integral value of the inlet mass flow rate. Thus, it looks as if
mass is lost during the calculation. Note, the massflow input (and also the
total temperature) at inlet is nearly the same as in CFX5. The mesh was the same,
of course.

I have checked a lot of things: turbulence model, boundary conditions, thermal
properties, etc, but haven't found the reason why in OpenForm the mass balance (and
consequently the energy balance) is not fulfilled. The schemes I used are:

================================================== ============================
ddtSchemes
{
default CrankNicholson 0.5;
}

gradSchemes
{
default Gauss linear;
}

divSchemes
{
default none;
div(phi,U) Gauss limitedLinearV 1;
div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div(phi,R) Gauss upwind;
div(R) Gauss linear;
div(phid,p) Gauss limitedLinear 1;
div(phiU,p) Gauss limitedLinear 1;
div(phi,h) Gauss limitedLinear 1;
div((muEff*dev2(grad(U).T()))) Gauss linear;
}

laplacianSchemes
{
default none;
laplacian(muEff,U) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DREff,R) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian((rho*1|A(U)),p) Gauss linear corrected;
laplacian(alphaEff,h) Gauss linear corrected;
}

interpolationSchemes
{
default linear;
}

snGradSchemes
{
default corrected;
}

fluxRequired
{
default no;
p;
}
================================================== ============================

I've also used Euler time discretisation, but nothing changed. So far, I didn't
change the spatial discretisation, it's still the default setting from prism.
The solution settings are:

================================================== ============================
solvers
{
p BICCG 1e-12 0;
rho ICCG 1e-12 0;
U BICCG 1e-12 0;
h BICCG 1e-12 0;
k BICCG 1e-12 0;
epsilon BICCG 1e-12 0;
R BICCG 1e-12 0;
}

PISO
{
momentumPredictor yes;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
================================================== ============================

Thus, does anybody have an idea where the problem could be? The unconserevd
energy and mass balance make me uncomfortable ;-(



tangd is offline   Reply With Quote

Old   August 30, 2006, 07:13
Default Don't you need CrankNicholson
  #2
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 338
Rep Power: 9
lr103476 is on a distinguished road
Don't you need CrankNicholson 1.0 for fully second order accuracy?

Regards, Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   August 30, 2006, 07:26
Default I also used Euler here, it doe
  #3
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
I also used Euler here, it doesn't matter so much I think. Other ideas?
tangd is offline   Reply With Quote

Old   August 30, 2006, 08:11
Default How did you calculate the syst
  #4
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 8
david_h is on a distinguished road
How did you calculate the system mass, m, the dotted curve in the t vs. (m0 - m) plot ?
Dave
david_h is offline   Reply With Quote

Old   August 30, 2006, 08:24
Default The system mass is calculated
  #5
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
The system mass is calculated by using pV=mRT, p and T are the mean values within the volume. Then I get the mass(m) value for each saved step, subtract the initial mass m0.
tangd is offline   Reply With Quote

Old   August 30, 2006, 09:30
Default If I understood correctly you
  #6
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 8
david_h is on a distinguished road
If I understood correctly you are calculating the mass as m = V/R {p}/{T}. Where { } denotes the volume average. Have you tried calculating the mass as m = V/R {p/T} ?
david_h is offline   Reply With Quote

Old   August 31, 2006, 03:41
Default Yes, your idea turned out to b
  #7
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
Yes, your idea turned out to be correct! I have checked the (m-m0) again by using your proposal m = V/R {p/T}, the mass is now conserved. Thanks a lot! But any idea about the pressure and Temperature?
tangd is offline   Reply With Quote

Old   August 31, 2006, 03:42
Default If you really want to integrat
  #8
Member
 
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 8
olwi is on a distinguished road
If you really want to integrate the influx, you should look at *exactly* what goes in. That is exactly what's on the boundary patch. Not what's in the cell next to it... In addition, your own way of integarting plays a role. Is *your* integration 100% identical with the OpenFOAM time integration? For example using mid-point values matching the CN scheme?

It's relatively easy to assure mass conservation in a fv code like OpenFOAM, and from the quality in detail I've seen so far in OpenFOAM it would be profoundly surprising if you found a lack of mass conservation. "Surprising" is too weak a word, actually.

/Ola
olwi is offline   Reply With Quote

Old   August 31, 2006, 04:04
Default You are right! My incorrect po
  #9
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
You are right! My incorrect postprocessing calculation introduced the error. Now mass is conserved. But there are still problems during the simulation that make temperature and pressure smaller than that of CFX-5. any further suggestion?
tangd is offline   Reply With Quote

Old   August 31, 2006, 04:23
Default Then remains to compare exactl
  #10
Member
 
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 8
olwi is on a distinguished road
Then remains to compare exactly how much influx of enthalpy you have in the two codes. If I understood correclty, there's no heat production inside? If the mass inventory is the same in both codes at time t, then you only need to look for the enthalpy influx. Same here: I doubt they've missed conservation in CFX5 or OpenFOAM... It's likley a matter of how sources or inlet properties are defined. Even if you think you do they same in both codes, the codes may have different conventions for how things are defined on the boundary.
olwi is offline   Reply With Quote

Old   September 1, 2006, 08:42
Default The finding is that the enthal
  #11
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
The finding is that the enthalpy flow of OpenFOAM is very close to that of CFX5.

Here, we have checked the static part, mdot*h_static, as well as the kinetic part mdot*uČ/2. Both are the same on the inlet for OpenFoam and CFX.

I inspected this by considering each cell at inlet then summing up them. Using the same method, I also checked the pressures and velocities at inlet from both tools. They are nearly the same. The inlet calculation seems to be no problem. But I still cannot figure out what kind of problem causes the different pressure and temperature values within the volume. Can you give me more suggestions?
tangd is offline   Reply With Quote

Old   September 1, 2006, 08:54
Default Did you run CFX with viscous d
  #12
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 8
david_h is on a distinguished road
Did you run CFX with viscous dissipation. The energy equation in sonicTurbFoam, "hEqn.H", does not appear to have a viscous dissipation term, which might explain a few degrees of temperature difference.
david_h is offline   Reply With Quote

Old   September 1, 2006, 09:14
Default In the setting of heat transfe
  #13
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
In the setting of heat transfer model "Total Energy" in CFX5, option "Incl. viscous Work Term" was _not_ activated.
tangd is offline   Reply With Quote

Old   September 2, 2006, 09:08
Default Have you done the same check o
  #14
Member
 
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 8
olwi is on a distinguished road
Have you done the same check on energy/enthalpy conservation as you did for the mass? (total energy in the flow domain before/after in relation to the enthalpy influx.) If energy is conserved, then I guess there's only the consitutive relationship, etc., relating pressure to temperature and enthalpy...
olwi is offline   Reply With Quote

Old   September 4, 2006, 04:00
Default Now the situation is that if I
  #15
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
Now the situation is that if I subtract the mean temperature <t> of OpenFoam with 293 and multiply with gamma (gamma=cp/cv), then I get almost the same temperature as in CFX5. So I guess the wrong equation is being used in calculating temperature in OpenFOAM. Any suggestion?
tangd is offline   Reply With Quote

Old   September 4, 2006, 06:04
Default It's a bit hard to say OpenFOA
  #16
Member
 
Ola Widlund
Join Date: Mar 2009
Location: Sweden
Posts: 87
Rep Power: 8
olwi is on a distinguished road
It's a bit hard to say OpenFOAM solves the "wrong" equation, isn't it? Sounds to me OF uses SI units for temperature (Kelvin), while CFX5 uses something else. The factor gamma can be explained if someone used cv instead of cp, or vice versa. Sounds to me it's more a question of reading in the manuals/case files to know what is actually calculated and ensuring you use the same physical properties and units in both codes. That's obviously the user's responsability. Should be easy enough in OF, just have a look in the source code.
olwi is offline   Reply With Quote

Old   September 5, 2006, 06:18
Default http://www.cfd-online.com/Open
  #17
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road

tangd is offline   Reply With Quote

Old   September 5, 2006, 13:31
Default One other thing you might take
  #18
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 8
david_h is on a distinguished road
One other thing you might take look at is the turbulence model. For example in:
/src/turbulenceModels/compressible/kEpsilon/kEpsilon.C,
the R() function includes a "(2/3)*k" term, however divRhoR() does not include this term.

The quickest fix is to add
-(2/3)*fvc::grad(rho*turbulence->k() )
after the fvc::grad(p) term when the momentum equation is solved.

Dave
david_h is offline   Reply With Quote

Old   September 6, 2006, 06:12
Default Thank you so much. I have chan
  #19
Member
 
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 8
tangd is on a distinguished road
Thank you so much. I have changed the code by using your suggestion. But unfortunately, the result is nearly the same as before.

I'm still thinking the "gamma" plays the key role here. So please give me more hints based on my previous post. Thanks again!
tangd is offline   Reply With Quote

Old   September 6, 2006, 08:05
Default Can someone comment if David i
  #20
Member
 
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 8
chris1980 is on a distinguished road
Can someone comment if David is right because this would be a potential bug!
chris1980 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check Heat Balance in heat transfer like mass balance for flow mahendra OpenFOAM Post-Processing 15 February 8, 2012 11:19
CheckMesh error using a tutorial from OpenFOAM 114 with openFOAM 13 martapajon OpenFOAM Native Meshers: blockMesh 7 January 21, 2008 13:52
OpenFOAM users in Munich OpenFOAM benutzer in M%c3%bcnchen jaswi OpenFOAM 0 August 3, 2007 13:11
A new Howto on the OpenFOAM Wiki Compiling OpenFOAM under Unix mbeaudoin OpenFOAM Installation 2 April 28, 2006 08:54
Mass Balance in CFX5.7 KKA CFX 5 March 9, 2005 22:54


All times are GMT -4. The time now is 23:08.