is there any way to get cell surface area?
I know that magSf() function can calculate individual face area. However, I want to know the surface area of a cell just like we can get cell volume by using mesh.V().
Does anyone know how to get the cell surface area? Thanks in advance ! |
I don't know where that would normally be needed, so there is no such functionality. However, writing it yourself is not actually too hard I think.
The basic algorithm would entail the following:
|
Hello olesen,
Thank you for your response ! I just want to know where I would need to write this code? in src/OpenFOAM/meshes/primitiveMesh/ there are two files namely primitiveMeshCellCentresAndVols.C and primitiveMeshFaceCentresAndAreas.C . Do I need to write the code in one of these files or I have to create separate .C file. |
Foam::tmp<Foam::scalarField> Foam::cellQuality::cellSurfaceArea() const
{ tmp<scalarField> tresult ( new scalarField ( mesh_.nCells(), 0.0 ) ); scalarField& result = tresult.ref(); scalar sumCellArea; forAll(result,celli) { const labelList& cellFaces = mesh_.cells()[celli]; //with this line, I expect to access the faces belonging to cell under consideration. const vectorField& areas = mesh_.faceAreas(); forAll(cellFaces,facei) { sumCellArea=0; sumCellArea+=mag(areas[facei]); } result[celli]=sumCellArea; } return tresult; } I am trying to find cell surface area. For this, I am trying to access faces belonging to the particular cell and sum their face areas and assign the sum value to 'result' scalar Field whose size is equal to nCells. Please let me know, if the way I have written code is correct logically. |
All times are GMT -4. The time now is 12:20. |