CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[mesh manipulation] How to extract faceLabels from a patch?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 31, 2021, 23:39
Default How to extract faceLabels from a patch?
  #1
Member
 
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 82
Rep Power: 6
sunagra27 is on a distinguished road
Dear all,


I want to extract faceLabels from a patch, so I wrote the code as shown below.

But, I get the patch with incomplete faces when visualized, although it shows the exact no of faces present in the patch.


1. I saved the faceLabels in a ".txt" file.
2. I used this facelabel in topoSet as "LabelToFace" and converted to VTK using "foamToVTK" for visualization.

3. What is wrong in the code, so that it shows incomplete patch faces although it shows correct amount of faces and also I believe that the faceLabel alignment is not proper.

4. Code

Code:
code
       #{

    
        const fvPatch& mesh = this->patch();
        const fvBoundaryMesh& boundaryMesh = mesh.boundaryMesh();
        
    
        for (int patch = 0; patch < 1; patch++)
        {
        
            const word& patchName = mesh.boundaryMesh()[patch].name();
            Info << patchName << endl;
            const fvPatch& cPatch = mesh.boundaryMesh()[patch];
            std::ofstream file;
            file.open("faceID.txt");

            forAll (cPatch, faceI)
            {
                label faceId = cPatch.start() + faceI;
                //Info << faceId << endl;
                file<< faceId << endl;
                file<< nl << endl;
            }
            file.close();
        }


        #};
5. Images

a. Patch I needed: Below is the patch that I needed. This image is taken after snappyHexMesh.

https://drive.google.com/file/d/1KUq...ew?usp=sharing

b. Patch I am obtaining: Below is the patch based on code. We can see it has incomplete faces.


https://drive.google.com/file/d/1Rdi...ew?usp=sharing

Any leads will be appreciated.


Thanks and Regards,
Sunag R A.
sunagra27 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OLAFLOW] The OLAFLOW Thread Phicau OpenFOAM Community Contributions 457 March 27, 2024 00:59
[Other] Wedge patch '*' is not planar LilumDaru OpenFOAM Meshing & Mesh Conversion 6 January 12, 2021 05:55
[Commercial meshers] Fluent3DMeshToFoam simvun OpenFOAM Meshing & Mesh Conversion 50 January 19, 2020 15:33
chtMultiRegionFoam Tutorial m.nichols19 OpenFOAM 12 September 9, 2010 11:56
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 08:19


All times are GMT -4. The time now is 13:06.