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

Thermophysical models and chemistry models

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 8, 2010, 16:44
Exclamation Thermophysical models and chemistry models
  #1
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Dear Foamers,

I am modifying rhoReactingFoam solver (OpenFOAM 1.6). I want implement Eddy break-up model. I have no problem with the reaction rate. My main problem is the energy equation source term. I need to access the specieThermo to get Hc() (I think it is the enthalpy of formation).
I cannot access it. I think, I am not understand how to access the thermophysical and chemistry models.
How are the thermophysical and chemistry models implemented in the solve? How can I access it?
hk318i is offline   Reply With Quote

Old   July 9, 2010, 05:18
Default
  #2
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi hk318i,

I'm not sure if this answers your question because I'm not sure where you need the thermophysical properties (e.g. the solver or the chemistry model template)

In the solver (as an expample I use rhoSimpleFoam, where hPsiThemro is used), the thermophsyical model is loaded in the "createFields.H" file. The imported lines are:

Info<< "Reading thermophysical properties\n" << endl;

autoPtr<basicPsiThermo> pThermo
(
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();

now lets say you want to get the enthalpy so the function is: "your variable = thermo.h();"

This function can be found in the file (OpenFoam/src/thermophysicalModels/basic/psiThemro/hPsiThemro.H). The function is

virtual const volScalarField& h() const
{
return h_;
}

These functions could also be in the following files: "basicThemro.H" and "psiBasicThermo.H".

So, if you need to get hc in the solver, you first have to make sure that a function like the one above (of course for hc) exist in your themrophysical model.

Regards,
Christian
Chris Lucas is offline   Reply With Quote

Old   July 9, 2010, 06:26
Default
  #3
New Member
 
Join Date: May 2010
Location: Cologne
Posts: 27
Rep Power: 16
marcbest is on a distinguished road
hi chris

i've a question to your reply:

Quote:
Originally Posted by Chris Lucas View Post
now lets say you want to get the enthalpy so the function is: "your variable = thermo.h();"
is it: yourvariable = thermo.h(); or: yourvariable = thermo.h_(); (with underscore like below?

Quote:
Originally Posted by Chris Lucas View Post

virtual const volScalarField& h() const
{
return h_;
}
and must i include:
#include basicPsiThermo
at the beginning?

thanks for your help
regards marc
marcbest is offline   Reply With Quote

Old   July 9, 2010, 07:19
Default
  #4
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi Marc

the correct term is "volScalarField& h = thermo.h();" (Have a look at the source code of rhoSimpleFoam). The other possibility that might work is:
"volScalarField& h = thermo.h_;". However, I think the variable h_ is protected, so it won't work.

h_ is the variable(field) used in the thermophysicalProperties and the function h() simply returns h_.


You have to include " #include "basicPsiThermo.H" ". In the case of rhoSimpleFoam, you can find the line in the file "rhoSimpleFoam.C"


Regards,
Christian
Chris Lucas is offline   Reply With Quote

Old   July 9, 2010, 07:21
Default
  #5
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Dear Chirs,

rhoReactingFoam uses chemistry model not a thermophysical model as the following;

Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<rhoChemistryModel> pChemistry
(
rhoChemistryModel::New(mesh)
);
rhoChemistryModel& chemistry = pChemistry();

hsReactionThermo& thermo = chemistry.thermo();

the variable which I am looking for is specieThermo.Hc()

my the Thermophysicalproperties is
thermoType hsRhoMixtureThermo<reactingMixture<gasThermoPhysic s>>;

my chemistryproperties is
rhoChemistryModel ODEChemistryModel<gasThermoPhysics>;

I have no idea what is gasThermoPhysics?

Thanks
hk318i is offline   Reply With Quote

Old   July 9, 2010, 10:40
Default
  #6
New Member
 
Join Date: May 2010
Location: Cologne
Posts: 27
Rep Power: 16
marcbest is on a distinguished road
hi hassan,

as i understood chemistry is a part of thermophysicalModels, because you need alway a "...Thermo"-file to get T,p, h, etc..
And in the file rhoReactingFoam.C there is
#include "hReactionThermo.H"
used, which then actually returns hc()

00134 //- Chemical enthalpy [J/kg]
00135 virtual tmp<volScalarField> hc() const = 0;

so you can use this

regards marc
marcbest is offline   Reply With Quote

Old   July 9, 2010, 11:06
Default
  #7
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Dear Marc,
my hReactionThermo.H member functions as the following;

// Member functions

//- Return the composition of the multi-component mixture
virtual basicMultiComponentMixture& composition() = 0;

//- Return the composition of the multi-component mixture
virtual const basicMultiComponentMixture& composition() const = 0;


// Access to thermodynamic state variables

//- Enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& h()
{
return h_;
}

//- Enthalpy [J/kg]
virtual const volScalarField& h() const
{
return h_;
}


//- Update properties
virtual void correct() = 0;
};

I cannot find hc(). Actually all I need to access the enthalpy of formation to make the energy equ source term which is a function of reaction rate (which I calculated based on my model) and specie enthalpy of formation (like Hc() in specieThermo)

Regards Hassan
hk318i is offline   Reply With Quote

Old   July 9, 2010, 15:42
Default
  #8
Member
 
M. Mahdi Salehi
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 50
Rep Power: 17
smehdi609 is on a distinguished road
Just a quick note:
In reactingFoam, a transport equation for "total enthalpy " is solved. Total enthalpy is the sensible enthalpy plus the chemical enthalpy. Thus, the transport equation for this variable does not contain any chemical reaction source term, it is conserved in an adiabatic flame. The chemical reaction source terms are provided for the species mass fractions. Once you get the species mass fractions, the "thermo->correct();" method will calculate the heat of formation and desctruction of different species.
smehdi609 is offline   Reply With Quote

Old   July 9, 2010, 15:53
Default
  #9
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
I am using OpenFOAM 1.6 which reactingFoam and rhoReactingFoam solve transport equation for sensible enthalpy not the total enthalpy.
Do you think I should use transport equation for total enthalpy instead of sensible enthalpy?
hk318i is offline   Reply With Quote

Old   July 9, 2010, 15:59
Default
  #10
Member
 
M. Mahdi Salehi
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 50
Rep Power: 17
smehdi609 is on a distinguished road
This is the hEqn.h in reactingFoam in Openfoam1.6:

{
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ mvConvection->fvmDiv(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
);

hEqn.relax();
hEqn.solve();

thermo.correct();
}

I do not see any source term, I do not think that it solves for sensible enthalpy, are you sure?
smehdi609 is offline   Reply With Quote

Old   July 9, 2010, 16:10
Default
  #11
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
My version uses hs with source term as the following;

{
fvScalarMatrix hsEqn
(
fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs)
==
DpDt
+ chemistrySh
);

hsEqn.relax();
hsEqn.solve();

thermo.correct();

Info<< "T gas min/max = " << min(T).value() << ", "
<< max(T).value() << endl;
}


I am using OpenFoam1.6.x which I think it is like OpenFoam 1.7 use sensible enthalpy instead of total enthalpy
hk318i is offline   Reply With Quote

Old   July 9, 2010, 16:18
Default
  #12
Member
 
M. Mahdi Salehi
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 50
Rep Power: 17
smehdi609 is on a distinguished road
yes, I downloaded openfoam1.7 and I see now ! it's great, they finally make this. I needed this ! Thanks
smehdi609 is offline   Reply With Quote

Old   July 9, 2010, 16:28
Default
  #13
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Actually I am little bit confused about using chemistry and thermophysical models. How can I access the data? How can I change the model inside the solver? and what is the "Selector" ? :-O
hk318i is offline   Reply With Quote

Old   July 9, 2010, 17:59
Default
  #14
Member
 
M. Mahdi Salehi
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 50
Rep Power: 17
smehdi609 is on a distinguished road
For "selecting" you may read this:
http://openfoamwiki.net/index.php/Op...tion_mechanism

You cannot have access to everything, unless you change the source code for thermo and chemistry objects. However, you have access to reaction rates, heat release, ... .
smehdi609 is offline   Reply With Quote

Old   July 9, 2010, 18:19
Default
  #15
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
so I cannot access to something like enthalpy of formation of each specie.
hk318i is offline   Reply With Quote

Old   July 11, 2010, 12:31
Default
  #16
hut
New Member
 
Anh Le
Join Date: Jul 2010
Posts: 5
Rep Power: 16
hut is on a distinguished road
Hi everyone,
I am trying to simulate a incompressible, laminar fluid flow model with adding temperature field. I used air to be the inlet gas. Assuming that "basicPsiThemo" is only used for compressible, turbulence flow, hence I want to use "basicThermo" model only. And I was writing into the "createFields.H" like that:

line 1 Info<< "Reading thermophysical properties\n" << endl;
line 2
line 3 autoPtr<basicThermo> pThermo
line 4 (
line 5 basicThermo::New(mesh)
line 6 );
line 7 basicThermo& thermo = pThermo();
line 8 volScalarField& h = thermo.h(); ...

And then compile the code. An error is shown:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:5: error: no matching function for call to ‘Foam::dictionary::New(Foam::fvMesh&)’
/home/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/dictionary.H:218: note: candidates are: static Foam::autoPtr<Foam::dictionary> Foam::dictionary::New(Foam::Istream&)

So what is the right one I have to declare? What does it mean about the line 5? And how can I check the declaration of basicThermo mode?

Please give me a hint?
hut is offline   Reply With Quote

Old   July 12, 2010, 09:32
Default
  #17
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Dear Anh,
I am new OpenFoam user and I am not fully aware about this problem.
As I know you cannot basicThermo like as you mentioned because basicThermo class does not have a selector function like basicpsiThermo.
hk318i is offline   Reply With Quote

Old   July 12, 2010, 16:08
Default
  #18
hut
New Member
 
Anh Le
Join Date: Jul 2010
Posts: 5
Rep Power: 16
hut is on a distinguished road
Quote:
Originally Posted by hk318i View Post
Dear Anh,
I am new OpenFoam user and I am not fully aware about this problem.
As I know you cannot basicThermo like as you mentioned because basicThermo class does not have a selector function like basicpsiThermo.
Thanks. I got that. However, what is basicThermo function to use? Can basicpsiThermo quantities be used for incompressible, laminar flow? If not, what is the right one?
hut is offline   Reply With Quote

Old   July 12, 2010, 16:47
Default
  #19
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
you can check the openFoamwiki below likw which descripe how to add temperature to icoFoam solver.
http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam
hk318i is offline   Reply With Quote

Old   July 15, 2010, 07:09
Default
  #20
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Dear All,

Anyone knows what is the CompType in ODEChemistryModel and other chemistry models?
I am still looking how to access the enthalpy of formation of each species. any ideas?

Regards,
Hassan
hk318i 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
Equilibrium Reaction Rates/Gas Chemistry Greg Perkins FLUENT 6 January 6, 2017 03:59


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