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

Access cell volume from boundry condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 7, 2011, 10:48
Default Access cell volume from boundry condition
  #1
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 16
JimKnopf is on a distinguished road
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
JimKnopf is offline   Reply With Quote

Old   March 7, 2011, 12:33
Default
  #2
Member
 
Ivor Clifford
Join Date: Mar 2009
Location: Switzerland
Posts: 94
Rep Power: 17
cliffoi is on a distinguished road
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]];
}
cliffoi is offline   Reply With Quote

Old   March 10, 2011, 05:29
Default
  #3
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 16
JimKnopf is on a distinguished road
Thanks! It did the job.
JimKnopf is offline   Reply With Quote

Reply


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
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


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