CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Study of the EEqn.H in rhoPimpleDyMFoam.

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

Like Tree4Likes
  • 3 Post By Horacio Aguerre
  • 1 Post By Horacio Aguerre

Reply
 
LinkBack Thread Tools Display Modes
Old   May 27, 2013, 08:03
Default Study of the EEqn.H in rhoPimpleDyMFoam.
  #1
New Member
 
Join Date: May 2013
Location: Santa Fé, Argentina
Posts: 4
Rep Power: 4
Horacio Aguerre is on a distinguished road
Hi,

I'm working with the solver "rhoPimpleDyMFoam" from the OpenFOAM 2-2-x version. In specific i was trying to replicate the polytropic process in an adiabatic compression.
The case i studied is a pistone-cylinder sistem where air is compressed by the pistone patch which is a moving wall. The pistone velocity is adjusted to 0,1(m/s) to aproximate a reversible process.

When i choose energy "he" as internal energy i could reproduce the polytropic process in an adiabatic compression.

However when i choose energy "he" as entalphy I couldn't achieve the theoretical expression pV^{1,4}=constant for air. Instead the system looks as it would be non adiabatic or like the conversion between work and internal energy was not made properly.

Therefore i started to study the EEqn.H.

I compare the theoretical balance of total energy in terms of entalphy with what is written in the EEqn.H.

Balance of a tensorial property in an arbritary moving domain.

\dfrac{d}{dt} \int_{V}\rho \phi dV + \int_{S}\rho \phi\left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds}=-\int_{S}\rho \mathbf{Q_{\phi}} \cdot \mathbf{ds}+\int_{V}S_{\phi}dV

Balance of mechanical energy.

\phi \equiv \frac{\mathbf{v} \cdot \mathbf{v}}{2} = K

\dfrac{d}{dt} \int_{V}\rho K dV + \int_{S}\rho K \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds} =-\int_{S}\left(p\mathbf{v}+ \boldsymbol{\tau} \cdot \mathbf{v}\right) \cdot \mathbf{ds} + \int_{V} \left[p \left(\boldsymbol{\nabla} \cdot \mathbf{v}\right)+\boldsymbol{\tau}:\boldsymbol{\nabla v}\right] dV+ \int_{V}\rho\left(\mathbf{v} \cdot \mathbf{g}\right) dV


Balance of internal energy.

\phi \equiv \widehat{u}


\dfrac{d}{dt} \int_{V}\rho \widehat{u} dV + \int_{S}\rho \widehat{u} \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds}=-\int_{S} \mathbf{q} \cdot \mathbf{ds}-\int_{V} \left[p \left(\boldsymbol{\nabla} \cdot \mathbf{v}\right)+\boldsymbol{\tau}:\boldsymbol{\nabla v}\right] dV


The balance of internal energy can be expressed in terms of entalphy.

\widehat{h}=\widehat{u}+\frac{p}{\rho}\implies \widehat{u}=\widehat{h}-\frac{p}{\rho}

Replacing in the balance of internal energy.

\dfrac{d}{dt} \int_{V}\rho \left(\widehat{h}-\frac{p}{\rho}\right) dV + \int_{S}\rho \left(\widehat{h}-\frac{p}{\rho}\right) \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds}=-\int_{S} \mathbf{q} \cdot \mathbf{ds}-\int_{V} \left[p \left(\boldsymbol{\nabla} \cdot \mathbf{v}\right)+\boldsymbol{\tau}:\boldsymbol{\nabla v}\right] dV

\dfrac{d}{dt} \int_{V}\rho \widehat{h} dV+ \int_{S}\rho \widehat{h} \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds}-\dfrac{d}{dt} \int_{V}p dV - \int_{S} p \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds}=-\int_{S} \mathbf{q} \cdot \mathbf{ds}-\int_{V} \left[p \left(\boldsymbol{\nabla} \cdot \mathbf{v}\right)+\boldsymbol{\tau}:\boldsymbol{\nabla v}\right] dV


Balance of total energy.

The sum of the balances of mechanical and internal energy results in the balance of total energy.

\dfrac{d}{dt} \int_{V}\rho \left(\widehat{h}+ K \right) dV + \int_{S}\rho \left(\widehat{h}+ K\right) \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds} -\dfrac{d}{dt} \int_{V}p dV - \int_{S} p \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds}=-\int_{S} \mathbf{q} \cdot \mathbf{ds}-\int_{S}\left(p\mathbf{v}+ \boldsymbol{\tau} \cdot \mathbf{v}\right) \cdot \mathbf{ds} + \int_{V}\rho\left(\mathbf{v} \cdot \mathbf{g}\right) dV

If the terms of work of viscous forces and the gravity are neglected, the balance is:

\dfrac{d}{dt} \int_{V}\rho \left(\widehat{h}+ K \right) dV + \int_{S}\rho \left(\widehat{h}+ K\right) \left(\mathbf{v}-\mathbf{v_{b}}\right) \cdot \mathbf{ds} -\dfrac{d}{dt} \int_{V}p dV + \int_{S} p \mathbf{v_{b}} \cdot \mathbf{ds}=
-\int_{S} \mathbf{q} \cdot \mathbf{ds}

rhoPimpleDyMFoam: EEqn.H

The balance of total energy in the EEqn.H file with he considered as entalphy \widehat{h} is:
Code:
fvm::ddt(rho, he) + fvm::div(phi, he) + fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt - fvm::laplacian(turbulence ->alphaEff(), he) == fvOptions(rho, he)
Where, \phi=\rho_{f} \left(\mathbf{v}-\mathbf{v_{b}}\right)_{f} \cdot \mathbf{S_{f}}, is relative to the mesh.

If fvOptions(rho, he) are considered as zero, the term \int_{S} p \mathbf{v_{b}} \cdot \mathbf{ds} from the final balance is no considered in EEqn.H.

Then i try adding in the EEqn.H the therm \int_{S} p \mathbf{v_{b}} \cdot \mathbf{ds}.

Code:
fvm::ddt(rho, he) + fvm::div(phi, he) + fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt + fvc::div(fvc::meshPhi(U),p) - fvm::laplacian(turbulence ->alphaEff(), he) == fvOptions(rho, he)
The result was correct. As in the first case (he=internal energy) the adiabatic compression was reproduced with the relation pV^{1,4}=constant.

The question is,

should the term \int_{S} p \mathbf{v_{b}}  \cdot \mathbf{ds} be introduced in any way in fvOptions(rho, he) or it must be explicit in the EEqn.H?

Thanks,

Horacio
mturcios777, fredo490 and mgg like this.
Horacio Aguerre is offline   Reply With Quote

Old   June 12, 2013, 22:15
Default
  #2
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
Any clues?. It seems we have to upload the question to the bug tracker.

Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar
santiagomarquezd is offline   Reply With Quote

Old   July 8, 2013, 18:43
Default
  #3
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
http://www.openfoam.org/mantisbt/view.php?id=909
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar
santiagomarquezd is offline   Reply With Quote

Old   August 20, 2013, 08:33
Default
  #4
ALU
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 5
ALU is on a distinguished road
Hi,

I'm trying to simulate exactly the same case, but I get very unphysical solutions even using the internal energy formulation. I also tried your proposal concerning the EEqn.H file without any success.

You said you were able to reproduce the adiabatic compression, so I would appreciate it if you had a look at my settings or if you shared me your case.
Attached Files
File Type: gz KammerExp.tar.gz (4.6 KB, 13 views)
ALU is offline   Reply With Quote

Old   September 4, 2013, 12:37
Default rhoPimpleDyMFoam: Adiabatic expansion
  #5
New Member
 
Join Date: May 2013
Location: Santa Fé, Argentina
Posts: 4
Rep Power: 4
Horacio Aguerre is on a distinguished road
Quote:
Originally Posted by ALU View Post
Hi,

I'm trying to simulate exactly the same case, but I get very unphysical solutions even using the internal energy formulation. I also tried your proposal concerning the EEqn.H file without any success.

You said you were able to reproduce the adiabatic compression, so I would appreciate it if you had a look at my settings or if you shared me your case.
Hi ALU,

I tried your case without modifying it and i get bad results too.

I made the following modifications,

File: /0$ U

If you want to reproduce an expansion, you should set for the "top" velocity the same velocity of the "patch", in this case, 0.1 m/s for the third coordinate.

Remember that the type "fixedValue" indicates absolute velocities. If you want to set relative to domain velocities you can use type "movingWallVelocity".

File: /system$ fvSolution

I added in the subdictionary PIMPLE the flag "correctPhi" equal to "no".

The correctPhi equation makes the linear solver to diverge.

For compressible fluids, i think that this equation is no necessary as the non conservative effects due to the mesh change in the flux are absorbed by the density equation.

I run the case with a time step of 0.001s from time 0 to time 1s and the adiabatic expansion was obtained successfully.

Quote:
Originally Posted by ALU View Post
I also tried your proposal concerning the EEqn.H file without any success
The modification of the EEqn.H is necessary when you set, in the dictionary "thermophysicalProperties" (in thermoType{}), the energy to sensibleEnthalpy, but we have here sensibleInternalEnergy.

I hope this can help you,

Regards,

Horacio
Attached Files
File Type: gz KammerExp-2.tar.gz (35.7 KB, 20 views)
ALU likes this.
Horacio Aguerre is offline   Reply With Quote

Old   September 5, 2013, 02:20
Default
  #6
ALU
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 5
ALU is on a distinguished road
Hi Horacio Aguerre,

thank you very much for the correction of my case and the detailed explanation, this really helps a lot!

Regards
ALU is offline   Reply With Quote

Old   September 11, 2013, 00:32
Default
  #7
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 3
zqlhzx is on a distinguished road
Hi ,Horacio Aguerre
could you see my problem and tell some thing?I think you can answer my question.I moves fireFoam of 2.0.1 to 2.2.1,then rewrite hEqn according to the EEqn.H in fireFoam of 2.2.1 and other necessary codes.But ,when I wmake my rewrited fireFoam,it gives me errors:undefine div(phi,h) in fvscheme.
The following is codes of EEqn.H:
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + fvm::div(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ (
he.name() == "e"
? fvc::div
(
fvc::absolute(phi/fvc::interpolate(rho), U),
p,
"div(phiv,p)"
)
: -DpDt
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
fvOptions(rho, he)
);
EEqn.relax();
fvOptions.constrain(EEqn);
EEqn.solve();
fvOptions.correct(he);
thermo.correct();
Info<< "T min/max = " << min(T).value() << ", " << max(T).value() << endl;
}
There is div(phi,he) insteading of div(phi,h),So It should be no need to define (phi,h) in fvshceme,but define div(phi,he).However,I see the fvsheme in smallpoolfire2D of 2.2.1,there indeed is div(phi,h).In fact,there is the term of "div(phi,he)" in EEqn.H,why define div(phi,h) in fvsheme?I think I have some thing not understand.!


zqlhzx is offline   Reply With Quote

Old   September 11, 2013, 09:11
Default Energy variables
  #8
New Member
 
Join Date: May 2013
Location: Santa Fé, Argentina
Posts: 4
Rep Power: 4
Horacio Aguerre is on a distinguished road
Quote:
Originally Posted by zqlhzx View Post
Hi ,Horacio Aguerre
could you see my problem and tell some thing?I think you can answer my question.I moves fireFoam of 2.0.1 to 2.2.1,then rewrite hEqn according to the EEqn.H in fireFoam of 2.2.1 and other necessary codes.But ,when I wmake my rewrited fireFoam,it gives me errors:undefine div(phi,h) in fvscheme.
The following is codes of EEqn.H:
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + fvm::div(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ (
he.name() == "e"
? fvc::div
(
fvc::absolute(phi/fvc::interpolate(rho), U),
p,
"div(phiv,p)"
)
: -DpDt
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
fvOptions(rho, he)
);
EEqn.relax();
fvOptions.constrain(EEqn);
EEqn.solve();
fvOptions.correct(he);
thermo.correct();
Info<< "T min/max = " << min(T).value() << ", " << max(T).value() << endl;
}
There is div(phi,he) insteading of div(phi,h),So It should be no need to define (phi,h) in fvshceme,but define div(phi,he).However,I see the fvsheme in smallpoolfire2D of 2.2.1,there indeed is div(phi,h).In fact,there is the term of "div(phi,he)" in EEqn.H,why define div(phi,h) in fvsheme?I think I have some thing not understand.!


Hi zqlhzx,

The EEqn is able to solve the energy balance in terms of enthalpy ("h") or internal energy ("e"). Both balances have common expresions. For this expresions it is used the generic energy variable "he". However the expresions differ. Then appears the conditional statement that selects the appropiate source term for the respective form of energy.


Code:
 he.name() == "e"
Then "he" is like as a generic energy that is used in the definition of the EEqn, but in fact it is "h" or "e".

In fvSchemes and in fvSolution you must set for the energy parameters the name "he.name()"

If you choose enthalpy "he.name()=h" you must define "div(phi,h)" in fvSchemes.
If you choose internal energy "he.name()=e" you must define "div(phi,e)" in fvSchemes.


In the OpenFOAM official web site there is an explanation on how to set up the thermophysical properties.
HTML Code:
http://www.openfoam.org/docs/user/thermophysical.php
Regards,

Horacio
Horacio Aguerre is offline   Reply With Quote

Old   September 12, 2013, 04:05
Default
  #9
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 3
zqlhzx is on a distinguished road
Thanks ,Horacio Aguerre!It is kind of you!
zqlhzx is offline   Reply With Quote

Old   September 13, 2013, 09:34
Default
  #10
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 3
zqlhzx is on a distinguished road
Dear Horacio Aguerre:
Thank you for your last reply!I have another problem I would like to consult you.In my thermophysicalPropertise,I want to define thermo type like this:
thermoType
{
type hePsiThermo;
mixture reactingMixture;
transport sutherland;
thermo janaf;
energy absoluteEnthalpy;
equationOfState perfectGas;
specie specie;
}I want use "absoluteEnthalpy;",but when I run my case,it tells me have no this thermo combination.I found just "psiuReactionThermo" Class can use absoluteEnthalpy. "psiReactionThermo"and "rhoReactionThermo"can not use absoluteEnthalpy.They only have sensibleEnthalpy.My case have chemical reaction and I must use absoluteEnthalpy,can you give me advise how to change my thermo type?Thanks again!
zqlhzx is offline   Reply With Quote

Old   October 11, 2013, 13:43
Default
  #11
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
Henry changed the code using the snippet suggested by Horacio, but in pEqn.H

https://github.com/OpenFOAM/OpenFOAM...d6c6406b07d7bb

Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar
santiagomarquezd is offline   Reply With Quote

Reply

Tags
rhopimpledymfoam

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
grid study, important question hamid1 FLUENT 1 August 4, 2013 00:14
[ANSYS Meshing] grid study, important questions hamid1 ANSYS Meshing & Geometry 2 February 10, 2012 14:28
Loop outlet data to inlet of new study pggow FLUENT 0 December 21, 2011 15:31
dpm study of solid-liquid study. bhanwar Main CFD Forum 0 September 29, 2011 08:21
Study Mario Main CFD Forum 0 August 24, 2009 09:59


All times are GMT -4. The time now is 01:14.