CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Accessing Themo Data on a Boundary Patch (http://www.cfd-online.com/Forums/openfoam/95103-accessing-themo-data-boundary-patch.html)

maninthemail December 6, 2011 06:14

Accessing Themo Data on a Boundary Patch
 
Hello

Simple-ish question, this. I'm writing a boundary condition for reactingFoam. Typically, when I want to get values on said boundary, I do something like this,

Code:

const fvPatchField<scalar>& p = patch().lookupPatchField<volScalarField, scalar>("p");
const fvPatchField<vector>& U = patch().lookupPatchField<volVectorField, vector>("U");

Which works fine (see endless examples in $FOAM_SRC/finiteVolume/fields/fvPatchFields/derived).

I can't seem use this method to get the specific heat, Cp. If I try I get the error,

Code:

--> FOAM FATAL ERROR:
    request for volScalarField Cp from objectRegistry region0 failed
    available objects of type volScalarField are

followed by a list of all the variables I can access this way. Cp is not in said list.

Does anyone know how can I get Cp (and by extension other thermophysical data) on a boundary patch in this sort of context?

Many thanks in advance

maninthemail December 16, 2011 05:25

Bump. Still none the wiser. Anyone? Is this even possible? How about getting thermophysical values in the cells adjacent to the boundary?

mturcios777 December 16, 2011 15:17

I think Cp is one of those that needs to be calculated from your mixture. You might need to do something like this (this is rough pseudocode ).

Code:

fvPatchField<scalarField> Cp = 0;
forAll(Y,specI)
{
    Cp+=Y[speci].thePatchFieldYouWant*Cp.listOfSpecies[index for specI]
}

I think Cp lives in thermo somewhere, but I'm not 100% sure. Maybe look up a BC for alpha or alphat, as I think that would have access to what you need.

Nikhilcfd April 13, 2012 17:56

Hello

I know this is an old post. Just in case..

I guess you need to add 'Cp' as a volScalarField in createFields.H file and update it every iteration.

Hope this helps.


All times are GMT -4. The time now is 03:25.