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

Accessing thermoPhysical Property Functions - e.g. mixture_.rho(scalar p, scalar T)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 23, 2015, 01:32
Default Accessing thermoPhysical Property Functions - e.g. mixture_.rho(scalar p, scalar T)
  #1
New Member
 
Will Logie
Join Date: Sep 2010
Location: ANU, Canberra, Australia
Posts: 21
Rep Power: 16
will.logie is on a distinguished road
I am looking to post-process buoyantPimpleFoam (perfectGas rho, Sutherland mu, JANAF Cp) results and extract some heat transfer characteristics for a wall [patchi] based on the Rayleigh Number:

Code:
     Ra.boundaryField()[patchi]
  = (
        gravity * betaFilm.value()
      / (
            muFilm.value() 
          / rhoFilm.value()
          * alphaFilm.value()
        )
    )
  * (T.boundaryField()[patchi] - T_ref.value()) * pow(L.value(), 3);
The scalar values betaFilm, muFilm, rhoFilm and alphaFilm should be calculated from the film temperature (T_wall + T_ref) / 2 and L is the characteristic length loaded from a dictionary file.

Has anyone done this before or can give me some tips; for example, how best to access the member function:

Code:
template<class Specie>
inline Foam::scalar Foam::perfectGas<Specie>::rho(scalar p, scalar T) const
{
    return p/(this->R()*T);
}
from within a solver or post-processor (i.e. without going via the heRhoThermo class)?

My awareness of C++ is insufficient.

Thank you,
Will.
will.logie is offline   Reply With Quote

Old   June 23, 2015, 06:35
Default
  #2
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
You need to get access to the thermo object which is used in the solver.
In the solver this is very simple, it's usually stored in a variable called thermo or something similar. Read your solver code for this.

In a different program you need to instantiate it the same way as it's done in the solver first.
chriss85 is offline   Reply With Quote

Old   June 24, 2015, 00:38
Default
  #3
New Member
 
Will Logie
Join Date: Sep 2010
Location: ANU, Canberra, Australia
Posts: 21
Rep Power: 16
will.logie is on a distinguished road
I'm aware that I can access any [celli] within the simulated thermo variable field which in turn is calculated from the pressure and temperature of that particular cell.

But what I am asking is how does one "calculate" one's own viscosity or density given some "reference" or desired pressure and temperature?

For example if I know my film temperature to be 467K at atmospheric pressure, I could calculated film values for density, viscosity and specific heat by way of the respective member functions - I imagine to look like rhoFilm = perfectGas.rho(1e5, 467)

Are you implying I could use thermo.rho() in this way, and if so how?
will.logie is offline   Reply With Quote

Reply

Tags
janaf, memberfunctions, perfectgas, sutherland


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
[openSmoke] libOpenSMOKE Tobi OpenFOAM Community Contributions 562 January 25, 2023 10:21
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 08:15
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 02:47
accessing thermophysical properties on a lower level romant OpenFOAM Programming & Development 4 October 28, 2013 09:25


All times are GMT -4. The time now is 18:55.