CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Patch Extraction through code is giving a problem

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   June 12, 2021, 10:46
Default Patch Extraction through code is giving a problem
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 69
Rep Power: 4
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


        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;

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

4. Images

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

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

Any leads will be appreciated.

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


development, mesh manipulation, openfoam, patch, toposet

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:08.