CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Access cell properties (

Smed September 26, 2012 15:48

Access cell properties
Hoes does one access cell properties such as pressure and temperature? I can't seem to find this in the programmer's guide.

Chris Lucas September 28, 2012 03:06


have a look at src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C


Smed September 28, 2012 11:43

Thanks Christian. I'm using the sprayFoam solver, so I think in my case I use the SLGThermo.H. I'm still not sure how to use the thermo models, but I found that cell pressure and temperature variables are defined in createFields.H by the following line:
volScalarField& p = thermo.p();

When I run my code in gdb, I can print out this cell pressure while in the main loop using,
"print p[cellnumber]"
But when I enter the parcels.evolve() function, I'm no longer able to access the "p" variable. This is where I'm hoping to actually use the cell properties, so I'm not sure where to go from here.

T.Matrix October 6, 2012 07:38

Hello, everyone:

Recently, I read the source code about oscillatingFixedValue. It is a useful BCs, and provides a convenience for users. Because of a new in OpenFOAM, there are some questions I hard to understand for class oscillatingFixedValue.
1. For implementing of private member function currentScale(), there is a program statement as follow:
const scalar t= this->db().time().timeOutputValue(). I don't know what does the this->db() mean?
2. From within constructors function
template<class Type>
oscillatingFixedValueFvPatchField<Type>::oscillati ngFixedValueFvPatchField
const oscillatingFixedValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
what's the meaning of iF? We just need to set the value on BCs, why does it need this auxiliary parameter iF?

3. who can describe some details of Mapping functions?

thank you.

All times are GMT -4. The time now is 12:52.