CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

pfhan

Register Blogs Community New Posts Updated Threads Search

Old

Faces of a cell

Posted September 20, 2014 at 11:31 by pfhan

openfoam loop cell faces of a cell and get the corresponding cell face normal, noting that the normal vector direction points from low cell ID to the higher one

Quote:
Originally Posted by kuczmas View Post
Dear forumers,

I decided to post my question inside this thread, as it is also somehow connected with looping over faces in a given cell. What I try to achieve is to get the face normal vector at every face in the cell, regardless it is a boundary cell or internal.
I produced the following code...:
...
New Member
Posted in Uncategorized
Views 1858 Comments 0 pfhan is offline Edit Tags
Old

Memory protection in OpenFOAM / combinig with FORTRAN

Posted September 20, 2014 at 11:27 by pfhan

combine the interFoam solver with an external solver written in FORTRAN
openfoam call fortran subroutines example

Quote:
Originally Posted by botp View Post
I am trying to combine the interFoam solver with an external solver written in FORTRAN. I had no problem combining the FORTRAN code with C++, but there seems to be something "OpenFOAM specific" corrupting the data of the FORTRAN solver. My best guess is that the automatic memory handling in OpenFOAM, unintended is freeing the memory of the FORTRAN
...
New Member
Posted in Uncategorized
Views 1495 Comments 0 pfhan is offline Edit Tags
Old

How to loop over cell faces

Posted September 17, 2014 at 12:09 by pfhan

How to loop over cell faces qoute

Quote:
Originally Posted by fumiya View Post
Hi Marshak,

I think it is better to start another thread for being easy to search later.
Regarding your question, the following is my sample code:

Code:
scalar sumA = 0.0; //Sum of areas of all faces of a cell
const cell& cFaces = mesh.cells()[yourCellIndex];

forAll(cFaces, i)
{
    sumA += mag(mesh.Sf()[cFaces[i]]); //cFaces[i]: face label of a cell
}

scalar Length = mesh.V()[yourCellIndex]/sumA;
...
New Member
Posted in Uncategorized
Views 1521 Comments 0 pfhan is offline Edit Tags

All times are GMT -4. The time now is 22:56.