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

FaceID from code to FaceSet from FaceID is not properly obtained.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 10, 2021, 01:55
Default FaceID from code to FaceSet from FaceID is not properly obtained.
  #1
Member
 
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 82
Rep Power: 7
sunagra27 is on a distinguished road
Dear all,


I have a 3D domain which consists of 3 patches in total.


I wanted to extract the faceID of one particular patch and convert to faceSet so that I could obtain BC using createPatch for that faceSet.


I obtained faceID from the below 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;
            std::ofstream file;
            file.open("faceID.txt");
            for (int facei = 0; facei < mesh.boundaryMesh()[patch].size(); facei++)
            {
            
                const label& face = boundaryMesh[patch].start() + facei;
                Info << face << endl;
                file << face << endl;
                file << nl << endl;
            
            }
        
            file.close();

        }
I have outputted to file and created faceSet using topoSet. Then, I created this faceSet to VTK format using foamToVTK -faceset "name".



All these are working fine.



But, when I visualize in paraview, the patch is taking faceIDs from different patch too, even though the length of the facelabels is same as the current patch. How is this possible? What wrong am I doing?


I have attached two images, one with what faceSet has been obtained from code and the other with what I needed ( the one with complete plain structure).


1. Original which I wanted from code:
https://drive.google.com/file/d/1_9A...ew?usp=sharing


2. What I have obtained from code:
https://drive.google.com/file/d/14QM...ew?usp=sharing


Any leads will be appreciated.


Regards,


Sunag R A.
sunagra27 is offline   Reply With Quote

Reply

Tags
boundary condition, faceset, openfoam, programming, toposet


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
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 16:56
What is the Better Way to Do CFD? John C. Chien Main CFD Forum 54 April 23, 2001 09:10
Open source CFD code development, possible? Dr. Yazid Bindar Main CFD Forum 27 July 18, 2000 01:18
State of the art in CFD technology Juan Carlos GARCIA SALAS Main CFD Forum 39 November 1, 1999 15:34
What kind of Cmmercial CFD code you feel well? Lans Main CFD Forum 13 October 27, 1998 11:20


All times are GMT -4. The time now is 12:49.