Confusion face-addressing for surfaceField
Hi all
I am confused with respect to the addressing of boundary face values for surfaceFields. Assume that the index "fLabelGlobal" is for a face on a boundary in terms of global indexing and "fLabelLocal" is targeting the same face, however in term of index locally on the boundary field. Then I can produce identical results with: mesh.Cf()[fLabelGlobal] and scalarField cf = mesh.Cf().boundaryField()[correctIndex]; cf[fLabelLocal]; However trying to do phi[fLabelGlobal] produces garbage whereas scalarField phiw = phi.boundaryField()[correctIndex]; phiw[fLabelLocal]; produces the correct result. Both mesh.Cf() and phi are surfaceFields, however they appear to behave differently, what am I doing wrong? By the way, I am working on cell level and need to target phi on all faces irrespectively of them being internal or boundary faces. I have made a hack to yield phi correctly, however it is painfully slow, thus any help is appreciated. Best regards, Niels |
Hi Niels,
the only difference I see is that phi is a surfaceScalarField while mesh.Cf() is a surfaceVectorField. Might this be the problem? Maybe there is a special boundary treatment for surfaceScalarFields only. I'll keep on trying. Regards Stefan |
Hi Niels,
Did you ever figure out the issue? I'm struggling with the same issue, trying to map faces on a boundaryField from a subMesh back to the full mesh. I have an fvMeshSubset called evaluationMesh and it shares common faces on patch 3 with the full mesh. Code:
volVectorField u(IOobject("u", runTime.timeName(), evaluationMesh.subMesh(), IOobject::NO_READ, IOobject::AUTO_WRITE), evaluationMesh.subMesh(), Foam::vector(0,0,0)); Any insight? Thanks! |
Hi
As you do note, you merely need to get hold on the global face-count for facei, then you will get a global faceI which needs to be transformed into a local patch faceI. I have recently done something like that: Code:
const fvPatchList & patches = cMesh_.boundary(); I hope this can help you overcome your problems. Best regards, Niels P.S. Note that you need to consider the directions of the patch normals when mapping phi. This is due to the definition of a surface normal vector pointing to the outside on a patch, however a face on the global mesh being turned into a patch face has not been constructed originally with this constraint, hence it might be pointing in the wrong direction as a patch face. |
Hi Niels,
That fixed it! The two pieces of information I needed where that you can access the global starting index (of course you can!) and that the globalIndex = startIndex + localIndex (of course it does!). Thanks again. |
addressing in surfacescalarfield
Do you guys know how the elements of surfacescalarfield are addressed? for example which which position does phi[celli] exactly refer to?
|
All times are GMT -4. The time now is 08:34. |