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

Patch Extraction through code is giving a problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 12, 2021, 10:46
Default Patch Extraction through code is giving a problem
  #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 a patch from the domain, so I wrote the code as shown below. Basically, the domain consists of 2 patches. I want to extract a particular patch for which the code is correct.



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



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


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

3. 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();
        }


        #};
4. Images

a. Patch I needed: Below is the patch that I needed.


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 is an incomplete patch.


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

Tags
development, mesh manipulation, openfoam, patch, 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
steadyUniversalMRFFoam Tutorial fails in MixingPlane HenrikJohansson OpenFOAM Bugs 0 February 14, 2019 04:48
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 13:48
[Commercial meshers] Using starToFoam clo OpenFOAM Meshing & Mesh Conversion 33 September 26, 2012 04:04
CheckMeshbs errors ivanyao OpenFOAM Running, Solving & CFD 2 March 11, 2009 02:34
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51


All times are GMT -4. The time now is 16:33.