Access cell volume from boundry condition
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 |
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]]; } |
Thanks! It did the job.
|
All times are GMT -4. The time now is 14:13. |