Access boundaryMesh / boundaryField on cellZone
Hi all:
I have a question similar to one posed in an earlier thread regarding the manipulation of cellZones. I would like to calculate the wall shear stress on the boundary of a cellZone which I have created using topoSet. I think this would be something like: Code:
const label cellZoneID = mesh.cellZones().findZoneID("myCellZone"); Can anyone give me some guidance on how to proceed? Thanks! -Nuc P.S. Relevant thread: http://www.cfd-online.com/Forums/ope...ne-volume.html Quote:
|
Just a short question: Are there multiple boundary patches in the cellZone?
|
Quote:
Is it possible to query a patch within a cellZone? |
Why don't you create a faceZone that solely contains the boundary faces and just loop over them?
|
Quote:
I tried this, but the faceSet I created included internal faces in my bounding box.If I can create a faceSet from a patch, that would work, so I'll look into that. Thanks! |
*EDIT: I got it - see bottom
Okay, I was able to create a faceSet of boundary faces only via the following topoSetDict code (the key - use of "action subSet"): Code:
{ Meanwhile, mesh.magSf().boundaryField() allows for accessing boundary faces by patch ID and local face ID, not global face ID. How would I instead query the face area of the faces in my faceZone, which are boundary faces? Thanks again! Code:
// Example Code: *SOLUTION: To convert between global faceID and local, patch-based faceID, you can use the 'whichPatch' and 'whichFace' functions. So, something like the following: Code:
scalar zoneFaceArea(0); Thanks for the help jhoepken! I hope your book is coming along well - it looks interesting. |
Great that you've figured it out! I was busy and could not answer, sorry :).
|
I am interested of this topic.
I made faceZone with snappyHexMesh using stl file like: Code:
faceZone1 |
Andy,
Can you post your code so we can see what's going on? You need to setup a few things before you can access faceZone data. |
It not easy because there is no way to see it in my project now. I tried different variants.
Code:
label zID = mesh.facesZone().findZoneID(zName); |
Do you have any idea?
|
Can you post your error message too? I'll dig up my code later and see how the syntax differs.
BTW: you have a typo in your code: facezZone[zID] facesZone[zID] |
PrintStack error. I think it is because faceZone length array and numder iteration in cycle is different
Code:
facezZone[zID] |
Maybe there is function in mesh which get faceID and return cellID?
|
I solved this problem but it is not work in parallel. Because there are boundaryfaces on processor and faces are duplicate. How can I delete duplicate faces on processor?
|
Hi to all,
I'm also interested to the topic. How did you solve the PrintStack error? Thanks Giacomo |
Spanwise averaging fields within a cellSet.
Ken
Are you ware of the spanwise averaging utility "postSpanwiseAverage" posted by some one on this forum. I need to use it, but wish to calculate the spanwise average of a field in particular cellSet. Do know how to do that |
Hi Nucleophobe,
I managed to follow all your steps successfully to loop over all faces of a facezone which was created as a subset. However, I cant seem to be able to run in parallel (edit: or series) even though im using the reduce(facesum, sunOp<scalar>()) .The solver crashes with the following error: [1] #0 Foam::error::printStack(Foam::Ostream&) at ??:? [1] #1 Foam::sigSegv::sigHandler(int) at ??:? [1] #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" [1] #3 Foam::OutputInfoFunctionObject::execute() at ~/OpenFOAM/OpenFOAM-v1612+/src/OpenFOAM/lnInclude/polyPatch.H:392 [1] #4 Foam::functionObjectList::execute() at ??:? [1] #5 Foam::Time::run() const at ??:? [1] #6 ? at ??:? [1] #7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" [1] #8 ? at ??:? [mne-alra12:22426] *** Process received signal *** [mne-alra12:22426] Signal: Segmentation fault (11) [mne-alra12:22426] Signal code: (-6) [mne-alra12:22426] Failing at address: 0x3ea0000579a My code: const label stagID = mesh().faceZones().findZoneID("StagZone"); const faceZone& zone = mesh().faceZones()[stagID]; const faceZoneMesh& zonemesh = zone.zoneMesh(); const labelList& stagcells = zonemesh[stagID]; forAll( stagcells, facei) { label facePatchID = mesh().boundaryMesh().whichPatch(facei); label faceID = mesh().boundaryMesh()[facePatchID].whichFace(stagcells[facei]); faceArea += (mesh().magSf().boundaryField()[facePatchID][faceID]); } reduce(faceArea,sumOp<scalar>()); |
All times are GMT -4. The time now is 23:47. |