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

Looking for cella adjacent to wall patches

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 16, 2021, 05:46
Default Looking for cella adjacent to wall patches
  #1
New Member
 
Join Date: May 2017
Posts: 8
Rep Power: 9
ec91 is on a distinguished road
Let’s suppose that I have a volScalarField that must be zero everywhere except for cells adjacent to wall patches, where it is expected to be 1 (only near walls, not other types of patches).

Is there a way to loop over cells and identify those being next to a wall?

Thank you.
ec91 is offline   Reply With Quote

Old   February 16, 2021, 10:43
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
Yes there is -- I think in the past I've done something similar by looping over patches, checking if the patches are walls, and if so looping over patch face cells. It would look something like :

Code:
    //Patch list
    const fvPatchList& patches = mesh.boundary();

    //Patch loop
    forAll(patches, patchi)
    {
        //Current patch
        const fvPatch& currPatch = patches[patchi];

        //Is wall?
        if (mesh.boundary()[patchi].type() == "wall")
        {
            //Patch face cells
            forAll(currPatch,facei)
            {
                    //Current face cell
                    label faceCelli = currPatch.faceCells()[facei];
                    //Do something here with faceCelli
            }
        }
    }
Hopefully this will be enough to get you started.

Caelan
clapointe is offline   Reply With Quote

Old   February 21, 2021, 04:11
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by clapointe View Post
Yes there is -- I think in the past I've done something similar by looping over patches, checking if the patches are walls, and if so looping over patch face cells. It would look something like :

Code:
    //Patch list
    const fvPatchList& patches = mesh.boundary();

    //Patch loop
    forAll(patches, patchi)
    {
        //Current patch
        const fvPatch& currPatch = patches[patchi];

        //Is wall?
        if (mesh.boundary()[patchi].type() == "wall")
        {
            //Patch face cells
            forAll(currPatch,facei)
            {
                    //Current face cell
                    label faceCelli = currPatch.faceCells()[facei];
                    //Do something here with faceCelli
            }
        }
    }
Hopefully this will be enough to get you started.

Caelan

Don't use literal strings to check the boundary condition type!! You want isA<wallPolyPatch> which checks based on the class inheritance.
olesen is offline   Reply With Quote

Old   February 21, 2021, 14:52
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
Absolutely -- good catch. This was old code and should be updated if used.

Caelan
clapointe 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
Problem using AMI vinz OpenFOAM Running, Solving & CFD 298 November 13, 2023 09:19
temperature correction limited- Star ccm+ LpSingh STAR-CCM+ 15 September 29, 2020 12:06
Expert Parameters in CFX-pre ebrahem FLUENT 0 December 20, 2019 03:39
[mesh manipulation] mergeMeshes problem Attesz OpenFOAM Meshing & Mesh Conversion 3 July 29, 2015 05:15
[ICEM] Meshing adjacent wall geometry and simple ICEM questions everdimension ANSYS Meshing & Geometry 25 June 20, 2012 05:25


All times are GMT -4. The time now is 04:36.