CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   magSf() on boundaries (https://www.cfd-online.com/Forums/openfoam-programming-development/98590-magsf-boundaries.html)

lichmaster March 14, 2012 09:53

magSf() on boundaries
 
Hi FOAMers,

how do I get magSf() on bounday faces?

I noticed that mesh.magSf()[faceI] gives correct results on internal faces, but when faceI is on a face, it gives ~1e-320...

Code:

label startFace = mesh.boundaryMesh()[ib].start();
label nFaces    = mesh.boundaryMesh()[ib].size();
for (label faceI = startFace; faceI < startFace + nFaces; faceI++)
    {
...
vector normal = mesh.Sf()[faceI]/mesh.magSf()[faceI]; \\floating point error
      }

What's wrong ?

lichmaster March 15, 2012 04:22

I've solved this problem, simply taking

mag(mesh.Sf()[faceI]);

However, I really can't understand why there isn't a mesh.magSf() method for boundary faces when there is a mesh.Sf() method defined on them...

ngj March 15, 2012 04:30

Hi

You should be able to access the data in any of the following manners:

Code:

const scalarField magnitude0 = Foam::mag( mesh.Sf().boundaryField()[patchi] );
const scalarField & magnitude1 = mesh.magSf().boundaryField()[patchi];

This gives you the magnitude of the normal vectors on a given patch through its index patchi.

Best regards,

Niels


All times are GMT -4. The time now is 14:43.