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

Full energy equation for enthalpy

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 4 Post By hartinger
  • 2 Post By david_h
  • 1 Post By isabelle

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 8, 2006, 07:22
Default Hi, i've implemented the fu
  #1
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17
hartinger is on a distinguished road
Hi,

i've implemented the full energy equation for enthalpy without neglecting anything and put it into sonicLiquidFoam.

I would like to post it here to check whether i got the physics right, and to discuss whether the discretisation is correct and appropriate.
I've tested it and the results look alright. Code and testcase is attached.
I'm sure it can be improved, any comments welcome.

testCaseAndCode.tar

So, here we go:

energy equation:
rho Dh/Dt = - grad(k div(T)) - tau && grad(U) + DpDt

enthalpy:
h = u + p/rho // u - internal energy
// enthalpy - temperature relation for liquids
h = Cp(T-T0) // T0 - ambient temperature | Cp - heat capacity

substantial derivatives:
('d' being partial differential)
Dh/Dt = dh/dt + U & grad(h)

Dp/Dt = dp/dt + U & grad(p)
with U & grad(p) = div(pU) - p div(U)
Dp/Dt = dp/dt + div(pU) - p div(U)

conduction term:
grad(k div(T)) = grad(k/Cp div(h))

that translated into foamSpeak:

volTensorField gradU = fvc::grad(U);

volTensorField tau =
- mu * (gradU + gradU.T())
+
(2.0/3.0 * mu * fvc::div(U)) * I;

volScalarField tauGradU = tau && gradU;

solve
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(kl/Cp, h)
==
fvc::ddt(p)
+ fvc::div(p*U)
- p * fvc::div(U)
- tauGradU
);

T = T0 + h / Cp;

thank you
markus
hartinger is offline   Reply With Quote

Old   June 8, 2006, 10:03
Default Markus, I see 3 things whic
  #2
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Markus,

I see 3 things which you might look at:

1) Is the enthalpy of formation included in the definition of enthalpy(i.e.):
h = h_0 + cp*(T - T0)
Certain thermodynamic classes include this in
the definition of enthalpy.

2) There is a function to fvc:DDt() to calculate
the equivalent of:
fvc::ddt(p)
+ fvc::div(p*U)
- p * fvc::div(U)
(look at pEqn.H in rhoTurbFoam)
should the last term be "-U & grad(p)" ?

3) You might also try discretizing tauGradU as:
div( phi/interplate(rho) & interpolate(tau) ) - U & div(tau)
(I believe this is similar to procedure used for calculating the U & grad(p) term in the DDt() )

David H.
david_h is offline   Reply With Quote

Old   June 8, 2006, 10:14
Default Ignore my comment after point
  #3
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Ignore my comment after point 2
Dave H.
david_h is offline   Reply With Quote

Old   June 8, 2006, 13:35
Default David, thanks for your remarks
  #4
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17
hartinger is on a distinguished road
David, thanks for your remarks.

to 1)
personally i won't do any reaction, so should be alright to assume the enthalpy of formation to be zero.

to 2)
i wasn't aware of that function, thanks

> should the last term be "-U & grad(p)" ?
what do you mean? i replaced "U & grad(p)" with "div(pU) - p div(U)" to have a more conservative form. that's correct, isn't?

thank you
Markus
hartinger is offline   Reply With Quote

Old   June 12, 2006, 11:20
Default Marcus, Below I derived an
  #5
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Marcus,

Below I derived an internal energy equation in terms of pressure and internal enthalpy by subtracting the kinetic energy equation from the total energy equation (Kuo,Combustion). I get a "non-conservative" form for the pressure:
ddt(p) + U & grad(p)

and a "conservative" form for the stress:
div( phi/rho & tau ) - U & div(tau)

derivation:

total energy equation:
ddt(rho,h_T) + div(phi,h_T) - ddt(p) =
div(-q) + div(phi/rho & tau )

h_T = h + K
K ~ mean kinetic energy
h_T ~ total enthalpy

1) ddt(rho,h) + div(phi,h) - ddt(p) -
ddt(rho,K) + div(phi,K) = div(-q) + div(phi/rho & tau )

kinetic energy equation
ddt(rho,K) = U & ddt(rhoU) + K ddt(rho)

2) ddt(rho,K) + U & div(phi,U) + U & grad(p)
+ K & div(phi) = U & div(tau)

subtracting 2) from 1) give an internal energy:

3) ddt(rho,h) + div(phi,h)
- ( ddt(p) + U & grad(p) ) = div(-q) +
( div( phi/rho & tau) - U & div(tau) )

Dave
david_h is offline   Reply With Quote

Old   June 13, 2006, 09:46
Default yep, looks good. I guess it i
  #6
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17
hartinger is on a distinguished road
yep, looks good.
I guess it is a good idea to replace 'tau && grad(U)' with 'div( phi/rho & tau ) - U & div(tau)' as you suggested

markus
hartinger is offline   Reply With Quote

Old   July 17, 2007, 08:19
Default I've got a question regarding
  #7
Member
 
sradl's Avatar
 
Stefan Radl
Join Date: Mar 2009
Location: Graz, Austria
Posts: 82
Rep Power: 18
sradl is on a distinguished road
I've got a question regarding the flux calculation in Markus' programm (which is the same as in the sonicLiquidFoam solver).

Obviously phi is the surface mass flux. in the sonicLiquidEnergyFoam however, a new surface flux is introduced: phid. This should be something like a volume flux as it is multiplied with a pressure - howevever only something like a volume...

So can anybode explain what does is the meaning of phid in the code section:

surfaceScalarField phid = psi*
(
(fvc::interpolate(rho*U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)/fvc::interpolate(rho);

phi = (rho0/psi - p0)*phid;

cheers
Stefan
sradl is offline   Reply With Quote

Old   July 17, 2007, 09:45
Default Hi Stefan, have a look here
  #8
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17
hartinger is on a distinguished road
Hi Stefan,

have a look here, might help
http://www.cfd-online.com/OpenFOAM_D...ges/1/104.html

regards
markus
hartinger is offline   Reply With Quote

Old   July 31, 2007, 10:55
Default Hi, I have a question about
  #9
New Member
 
isabelle choquet
Join Date: Mar 2009
Location: trollhättan, västra götaland, sweden
Posts: 3
Rep Power: 17
isabelle is on a distinguished road
Hi,

I have a question about the enthalpy equation implemented in various solvers of openFOAM-1.4,
such as buoyantFoam, sonicTurbFoam or dieselEngineFoam for instance. If I understand correctly, it seems that the viscous heating term "tauGradU", that was in Markus test (1st message above) is not accounted for in OpenFoam-1.4. Is it because viscous heating can often be assumed negligible or is there any other reason ?

Best regards,
Isabelle
sharonyue likes this.
isabelle is offline   Reply With Quote

Old   July 31, 2007, 11:09
Default Hi Isabelle, yes, for gases
  #10
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17
hartinger is on a distinguished road
Hi Isabelle,

yes, for gases usually negligible.

regards
markus
hartinger is offline   Reply With Quote

Old   July 31, 2007, 11:21
Default Dear Foamers, I've combined
  #11
Member
 
sradl's Avatar
 
Stefan Radl
Join Date: Mar 2009
Location: Graz, Austria
Posts: 82
Rep Power: 18
sradl is on a distinguished road
Dear Foamers,

I've combined Markus' code with a new Non-Newtonian models and Heat Transfer in the surrounding solid. If someone is interested for testing, I can send him the package via email (however, it would be a quite big package of libraries, solvers and boundary conditions).

The heat of dissipation in my problem (polymer flow) plays a significant role: the temperature profile has quite significant gradients with DT = 7 [K].

br
Stefan Radl
sradl is offline   Reply With Quote

Old   August 28, 2007, 13:32
Default Hi David, I would like an ex
  #12
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
Hi David,
I would like an explanation about something you wrote sometime ago in this thread:

tau && grad(U) = div( phi/interplate(rho) & interpolate(tau) ) - U & div(tau);

I would have written something like:
tau && grad(U) = div( U & tau ) - U & div(tau)

In other terms how can you do (scalar & tensor)? what does that mean? (I tried something like that but I didn't manage even to compile it)

I'm asking you this because I'm implementing a solver for total enthalpy so I directly need to model the div( U & tau ) term. I would prefer to make it dependent on mass flux instead of velocity. How can I do it?
Thanks
Cosimo
__________________
Cosimo Bianchini

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   August 30, 2007, 10:20
Default Cosimo, I made a mistake in
  #13
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Cosimo,

I made a mistake in writing the first term of the equation. I used phi as though it represented the "mass flow rate vector" at the face center instead of the "mass flow rate" (scalar) at the face center normal to the face. The second term in the equation comes from subtracting the relevant term from momentum equation dotted with the velocity vector.

I would revise the term as:

uFace = interpolate(U,phi,"methodString");
uFace = uFace + ( phi/interpolate(rho) - uFace & mesh.Sf() ) * mesh.Sf()/mesh.magSf()/mesh.magSf();

viscDiss = div( uFace & interpolate(tau) & mesh.Sf() ) - U & div(tau)

The reasoning of the above was to derive the viscous dissipation term using the discretized forms of the "total energy" and "momentum" equations as opposed to discretizing the viscous dissipation term in the "internal energy" equation from its continuous representation (tau && grad(U) ).

The method as outlined above implies an inconsistency in how the stress is calculated in the momentum and energy equations. The stress used in the momentum equation is calculated directly (nearly) at the face. Whereas the above expression interpolates the stress at the face from the stress evaluated at the cell centers.

Dave
david_h is offline   Reply With Quote

Old   August 31, 2007, 11:45
Default Hi David, thanks for the answe
  #14
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
Hi David, thanks for the answer.

Just a couple of questions more:

1) Markus said viscous heating = tau && gradU is usually negligible for gases.
However I'm solving for total enthalpy where viscous dissipation = div(U & tau) = tau && gradU + U & div(tau). Is the error for neglecting such term of the same order of magnitude as using the static enthalpy formulation or not?

2) I'm not sure wether or not turbulent stress R should be added to tau in case of turbulent flows?

Thanks a lot,
Cosimo
__________________
Cosimo Bianchini

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   September 1, 2007, 06:40
Default Hey Cosimo, 1) whether visc
  #15
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17
hartinger is on a distinguished road
Hey Cosimo,

1) whether viscous heating is negligible is determined by the physics. A dimensional analysis should tell you. The way you implement it doesn't really matter.

2) look at sonicTurbFoam, the turbulent fluxes need to be modeled, which is done there using the effective turbulent thermal diffusivity. If you consider viscous heating you should use the effective turbulent viscosity.

regards
markus
hartinger is offline   Reply With Quote

Old   September 3, 2007, 09:21
Default Hi Markus and thanks for the r
  #16
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
Hi Markus and thanks for the reply but I need further clarification.

1) Maybe my question was not very clear. I was asking if on the same case (same physics) the error for neglecting viscous work was bigger in case of static enthalpy equation or total enthalpy equation.
The source terms for these two different conservation equations are not the same:
staticEnthalpy = tau && gradU
totalEnthalpy = div(U & tau) = tau && gradU + U & div(tau)
Is there a general rule to establish which one is bigger?

2) Thanks you confirm what I have implemented was correct.

regards
Cosimo
__________________
Cosimo Bianchini

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   April 22, 2009, 07:24
Default nonNewtonianFoam with energy eqn
  #17
Member
 
Join Date: Mar 2009
Posts: 41
Rep Power: 17
mehulkumar is on a distinguished road
Hey..
I have a case wich require nonNewtonianFoam solver with energy equation.
As mentioned here..I am intrested to test this solver.
Can any body provide me code for this???

Thanks
Mehulkumar
Email: patel.mehulkumar.l@gmail.com
mehulkumar is offline   Reply With Quote

Old   May 21, 2010, 08:43
Default how to implement this in OpenFoam
  #18
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16
Chrisi1984 is on a distinguished road
Quote:
Originally Posted by david_h View Post
Cosimo,

I made a mistake in writing the first term of the equation. I used phi as though it represented the "mass flow rate vector" at the face center instead of the "mass flow rate" (scalar) at the face center normal to the face. The second term in the equation comes from subtracting the relevant term from momentum equation dotted with the velocity vector.

I would revise the term as:

uFace = interpolate(U,phi,"methodString");
uFace = uFace + ( phi/interpolate(rho) - uFace & mesh.Sf() ) * mesh.Sf()/mesh.magSf()/mesh.magSf();

viscDiss = div( uFace & interpolate(tau) & mesh.Sf() ) - U & div(tau)

The reasoning of the above was to derive the viscous dissipation term using the discretized forms of the "total energy" and "momentum" equations as opposed to discretizing the viscous dissipation term in the "internal energy" equation from its continuous representation (tau && grad(U) ).

The method as outlined above implies an inconsistency in how the stress is calculated in the momentum and energy equations. The stress used in the momentum equation is calculated directly (nearly) at the face. Whereas the above expression interpolates the stress at the face from the stress evaluated at the cell centers.

Dave
Hi,

I now that this read is old, but i would like to know how I should implement this

uFace = interpolate(U,phi,"methodString");
uFace = uFace + ( phi/interpolate(rho) - uFace & mesh.Sf() ) * mesh.Sf()/mesh.magSf()/mesh.magSf();

viscDiss = div( uFace & interpolate(tau) & mesh.Sf() ) - U & div(tau)

in OpenFoam (1.6) speech?

I didn't succed.

Regards Chrisi
Chrisi1984 is offline   Reply With Quote

Old   April 23, 2012, 08:31
Default
  #19
New Member
 
Join Date: Dec 2011
Posts: 12
Rep Power: 14
SiCaRiUs is on a distinguished road
Hi,

is it possible to integrate these terms into the simpleFoam solver to get the heat due to friction in an moving liquid?

Thanks!
SiCaRiUs is offline   Reply With Quote

Reply


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
Full Energy Equation sergio OpenFOAM Running, Solving & CFD 0 May 19, 2008 17:43
Full Potential Equation Alberto Main CFD Forum 0 February 19, 2007 07:47
Enthalpy for Energy Daniel Main CFD Forum 2 October 21, 2005 18:51
Energy equation and Enthalpy Martin FLUENT 1 January 25, 2001 18:11
What is the effective to compute full NS equation zhanglei Main CFD Forum 2 June 5, 2000 00:56


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