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

Rho %3d thermorho what does it do

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 8, 2007, 10:34
Default Hi can someone enlighten m
  #1
Member
 
O R
Join Date: Mar 2009
Posts: 50
Rep Power: 7
arkangel is on a distinguished road
Hi

can someone enlighten me ?
rho = thermo->rho();
in the Xoodles solver, after calculating the pressure field in the time for, I am almost sure this update the rho field using the gas ideal equation.

Is that true ?
arkangel is offline   Reply With Quote

Old   June 12, 2007, 10:16
Default Depends on the thermoModel you
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,840
Rep Power: 38
gschaider will become famous soon enoughgschaider will become famous soon enough
Depends on the thermoModel you're using. But in general: yes
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is online now   Reply With Quote

Old   July 11, 2007, 06:06
Default Hi guys I want to know about
  #3
New Member
 
morteza
Join Date: Mar 2009
Posts: 18
Rep Power: 7
morteza is on a distinguished road
Hi guys
I want to know about the exact effect of thermo->rho() or thermo->p() and thermo->correct() on codes.
As mentioned above thermo->rho() update the rho field using the gas ideal equation, but i studied "hThermo.c","hThermo.H", "basicThermo.c" and "basicThermo.H" and found no ideal gas relation.

Am i looking into incorrect files?
How does thermo->rho() update ideal gas relation?
thanks in advance

Morteza
morteza is offline   Reply With Quote

Old   July 11, 2007, 07:18
Default Hi Morteza! What you are en
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,840
Rep Power: 38
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Morteza!

What you are encountering is the technical wonder called polymorphism (a thing that makes object oriented programming so attractive).

basicThermo for instance declares the method p() as virtual which basically says: "I have no idea how to calculate a pressure, but there will come at least one subclass that knows how to do it". The call thermo->p() says: "Hey thermo, you are an instance of a subclass of basicThermo. How does your type calculate p()?" What actually gets calculated depends on the concrete type of thermo (which is defined by the thermoType parameter in constant/thermophysicalProperties), it may be a perfect gas relation, it may be something different (but perfect gas is implemented in $FOAM_SRC/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H)

Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is online now   Reply With Quote

Old   July 11, 2007, 09:24
Default Hi Bernard Thanks for your re
  #5
New Member
 
morteza
Join Date: Mar 2009
Posts: 18
Rep Power: 7
morteza is on a distinguished road
Hi Bernard
Thanks for your reply.

I have put it in two different lacations just for more attention. But your right.

Morteza
morteza is offline   Reply With Quote

Old   July 12, 2007, 10:50
Default Hi , that was really good i
  #6
Member
 
O R
Join Date: Mar 2009
Posts: 50
Rep Power: 7
arkangel is on a distinguished road
Hi ,

that was really good information , but can we go a bit further, because i was looking for the actual implementation of the ideal gas equation and i couldnt find it , so let's take for example a solver: coodles

there is an instance call thermo of (either basicThermo, hThermo or something else) and somewhere in the coodles code there is a declaration of this kind:
basicThermo thermo(init param ) ;
maybe using an autoPrt or the like (The idea is that there is an instance call thermo of either basicThermo , hThermo or whatever)

inside the basicThermo.H there is a "p" public function :

volScalarField& p()
{
return p_;
}
in coodles.C file without knowing how p_ is calculated i now this is clear

p=thermo->p();
which says in words: "The Pressure field P in the coodles solver is equal to the pressure calculated by basicThermo.p()

Well here is the difficult part for me.

basicThermo.p() returns a protected term p_ and in this solver "coodles" in particular I cannot find the implementation of the the pressure calculation based on temperature and density. i.e. How p_ is calculated and this is exactly what i want to know.

for example here
http://foam.sourceforge.net/doc/Doxy...sicThermo.html

i cannot find any clue where it is , so , in short , in this particular example (coodles) where can I find the implementation of the gas ideal equation ? and most importantly , how can i found the relationship between the declaration and the actual implementation? that means if I would like to find the ideal gas equation for species used in Xoodels how can I find the implementation ?

Regards

Rivera
arkangel is offline   Reply With Quote

Old   January 9, 2008, 15:16
Default Hi Rivera, See the include
  #7
New Member
 
C.E.M.
Join Date: Mar 2009
Posts: 16
Rep Power: 7
evan is on a distinguished road
Hi Rivera,

See the include statements here:

thermophysicalModels/basic/basicThermo/basicThermos.C

Hope that helps,
Evan
evan is offline   Reply With Quote

Old   April 21, 2008, 09:27
Default Hi Foamers, I am trying
  #8
Member
 
O R
Join Date: Mar 2009
Posts: 50
Rep Power: 7
arkangel is on a distinguished road
Hi Foamers,


I am trying to write a solver like coodles ,


in coodles in the hEqu.H, the enthalpy is transported , when this equation is solved , a new enthalpy field is found.

then comes : thermo.correct(); the simplest implementation of this virtual function is in hThermo/hThermo.C one directory up , the constructor calls (in line 71) a function calculate() (see what is below "===" line).

the implementation of calculate() begins in line 86(hThermo.C). Several values, boundary conditions , etc are updated


Can anyone tell me what is updated, Honestly i am pretty lost. is Temperature updated using the new h , and pressure , and psi ?

My question is , in C++/foam language:

solve( fvm::ddt(rho, h)+ fvm::div..........);
thermo->correct();

is equivalent to (paper/physic language)

solve a transport eq for h ;
T=(h-0.5*U^2)/Cp;
psi = 1/(R*T);

?

or what does calculate() do?



Regards


==================================================
template<class>
void hThermo<mixturetype>::calculate()
{
forAll(T_, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);

T_[celli] = mixture_.TH(h_[celli], T_[celli]);
psi_[celli] = mixture_.psi(p_[celli], T_[celli]);

mu_[celli] = mixture_.mu(T_[celli]);
alpha_[celli] = mixture_.alpha(T_[celli]);
}

forAll(T_.boundaryField(), patchi)
{
fvPatchScalarField& pp = p_.boundaryField()[patchi];
fvPatchScalarField& pT = T_.boundaryField()[patchi];
fvPatchScalarField& ppsi = psi_.boundaryField()[patchi];

fvPatchScalarField& ph = h_.boundaryField()[patchi];

fvPatchScalarField& pmu = mu_.boundaryField()[patchi];
fvPatchScalarField& palpha = alpha_.boundaryField()[patchi];

if (pT.fixesValue())
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);

ph[facei] = mixture_.H(pT[facei]);

ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alpha(pT[facei]);
}
}
else
{
forAll(pT, facei)
{
const typename MixtureType::thermoType& mixture_ =
this->patchFaceMixture(patchi, facei);

pT[facei] = mixture_.TH(ph[facei], pT[facei]);

ppsi[facei] = mixture_.psi(pp[facei], pT[facei]);
pmu[facei] = mixture_.mu(pT[facei]);
palpha[facei] = mixture_.alpha(pT[facei]);
}
}
}
}
===============
arkangel 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
Thermorho morteza OpenFOAM Running, Solving & CFD 1 July 11, 2007 07:19


All times are GMT -4. The time now is 17:40.