Hello! I've been looking at
I've been looking at different parts of the source code to try to figure out how surfaceScalarFields are addressed. I'm not really sure how they work, because if we take phi as an example, it can be addressed by cell. However, which of the faces does this value belong to?
Is there any way to retrieve the other faces value belong to the same cell?
surfaceScalarField is a face b
surfaceScalarField is a face based field. phi belongs to face 1, it can not be addressed by cell. You must have misinterpreted something.
To figure out which cells share the face:
label faceOwnerCell = mesh.owner();
label faceNeighbourCell = mesh.neighbour();
Examine fvMesh.H, polyMesh.H and primitiveMesh.H to figure out what kind of face owner/neighbour access is available. The functions above only address internal faces for example.
Nope, not like that. A surfac
Nope, not like that. A surfaceScalarField is defined on the faces of the mesh, so phi gives you the flux in the second face in the mesh. Face ordering is defined by the faces file in polyMesh. For each of the faces, you can get the owner/neigbour cell info by asking the mesh.
In surfaceScalarFields, the internal faces belong to the internalField() and patch fields are done in the usual way. Note the limitations on the patch field types: you cannot have, say, a zeroGradient patch field on the surfaceScalarField.
By doiung phi, you are really getting phi.internalField() because the Geometric field is derived from the internal field.
Thanks for your help. I want t
Thanks for your help. I want to ask another thing before I make an ugly piece of code.
I want to evaluate the mass flow in a cut-section.
So I need:
1. Evalute physical properties on faces, no problem
2. Evalute the area of the face in the flow direction. This is the part I'm not sure about how to do.
I'm only considering cartesian meshes, and I know the mesh.Sf() funciton will aid me. I also know which cells I have cut out for my plane. What I don't know is:
How to know which faces surrounds these cells, disregarding which cell the faces belongs to?
I know mesh.owner() would give me the faces the cells own, but if the faces the cell owns is not in the flow direction, things get complicated because then I have to iterate around in the surrounding cells checking who owns the flow direction face.
Is there any easier way to just find out which faces surround a cell? Something like findFaces()?
Ok the problem was resolved af
Ok the problem was resolved after some local collaborations. However, we noticed something peculiar. I want the face area normals, so I do:
const surfaceVectorField faceNormals = mesh.Sf();
then at a later stage when I have selected a particular face, I want this face's normal. So I do:
but this gives me the wrong answer sometimes, I think it gives the wrong when I'm on a boundary face. However, if I do:
I get the correct boundary, no matter what type of face it is, internal or boundary. Why is this?
Have you run it through valgri
Have you run it through valgrind? Could be a problem with 'slicedSurfaceVectorField' which is holds the surface areas.
Try and use the primitiveMesh::faceAreas() instead.
about your problem: slicedSurf
about your problem: slicedSurfaceVectorFields cannot be copied into a surfaceScalarField. Can't you hold a reference instead of copying it?
2) evaluate the area of the face in the flow direction: something like:
fvc::interpolate(U) & mesh.Sf()
or use phi (don't know if this works):
phi * mesh.Sf()
3) faces surrounding a cell: mesh.cells()[cellI]
Look in primitiveMesh for all the addressing available. Anything more complicated you'll have to iterate yourself
|All times are GMT -4. The time now is 07:47.|