|
[Sponsors] |
March 7, 2011, 10:48 |
Access cell volume from boundry condition
|
#1 |
Member
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 15 |
Hej there!
I'm struggling with a probably little problem. I want to access the volume of the first cell normal to a boundry from within the boundry condition. For example like rho*CellVolume for mass of the first cell normal to a boundary. Probably it's just one line of code, but I don't get, since I'm quite new to OpenFoam programming. Thanks and greetings Jim |
|
March 7, 2011, 12:33 |
|
#2 |
Member
Ivor Clifford
Join Date: Mar 2009
Location: Switzerland
Posts: 94
Rep Power: 17 |
The functionality isn't directly available (at least not in the older versions of OF). Maybe theres a better way in OF-1.6 or newer, but this should do the trick.
From with xxxFvPatchField<type>::someFunc() const fvPatchScalarField& rhop = patch().lookupPatchField<volScalarField, scalar>("rho"); const scalarField& V = patch().boundaryMesh().mesh().V(); const unallocLabelList& faceCells = this->patch().faceCells(); scalarField rhoVp(this->size()); forAll(faceCells, faceI) { rhoVp[faceI] = rhop[faceI]*V[faceCells[faceI]]; } |
|
March 10, 2011, 05:29 |
|
#3 |
Member
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 15 |
Thanks! It did the job.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
FvMatrix coefficients | shrina | OpenFOAM Running, Solving & CFD | 10 | October 3, 2013 15:38 |
how to access each cell of a face? (user fortran) | Katariina | CFX | 3 | January 28, 2008 10:16 |
wall boundry condition | fred | FLUENT | 0 | August 19, 2004 13:10 |
calculate cell volume, center...? | Paul | Main CFD Forum | 5 | June 21, 2003 13:55 |
How to caculate cell volume | Tareq Al-shaalan | Main CFD Forum | 2 | November 4, 2002 09:48 |