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

Access processor patches in parallel run

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

Like Tree4Likes
  • 4 Post By chriss85

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 11, 2016, 10:03
Default Access processor patches in parallel run
  #1
New Member
 
Join Date: Jan 2016
Posts: 19
Rep Power: 10
mheinz is on a distinguished road
Hello together,

I am currently working with the wallDist functionality to compute the distance of each cell to its nearest wall. After that I want to cut the data regarding some criterions. Everything works fine, when I calculate on one processor. However, when performing a parallel run, I need to access the patches that connect the seperated meshes of each processor. That's where I need help.
Here is some of the code, that needs fixing:

Code:
cellDist = wallDist(mesh).y();

const fvPatchList& patches = mesh.boundary();
forAll (patches, iPatch)
{
    const fvPatch& singlePatch = patches[iPatch];
    forAll (singlePatch, iFace)
    {
        label iFaceCell = singlePatch.faceCell()[iFace];
        cellDist[iFaceCell] = 0.0;
    }
}
This way, I tried to access all boundary patches (mesh.boundary()), but the "processor patches" are not recognized as such.

I'm thankful for any advice.

Michael
mheinz is offline   Reply With Quote

Old   February 12, 2016, 03:54
Default
  #2
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
You can combine lists from separate processors using the following function. This can be used for face positions, areas, field values etc..
Code:
template<class Type>
    void combineFields(Field<Type>& field)
    {
        List<Field<Type> > allValues(Pstream::nProcs());

        allValues[Pstream::myProcNo()] = field;

        Pstream::gatherList(allValues);
        Pstream::scatterList(allValues);

        field =
        ListListOps::combine<Field<Type> >
        (
            allValues,
            accessOp<Field<Type> >()
        );
    }
chriss85 is offline   Reply With Quote

Reply

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
Error running simpleFoam in parallel Yuby OpenFOAM Running, Solving & CFD 14 October 7, 2021 04:38
Some questions about a multi region case run in parallel zfaraday OpenFOAM Running, Solving & CFD 5 February 23, 2017 10:25
Case running in serial, but Parallel run gives error atmcfd OpenFOAM Running, Solving & CFD 18 March 26, 2016 12:40
parallel Grief: BoundaryFields ok in single CPU but NOT in Parallel JR22 OpenFOAM Running, Solving & CFD 2 April 19, 2013 16:49
Unable to run OF in parallel on a multiple-node cluster quartzian OpenFOAM 3 November 24, 2009 13:37


All times are GMT -4. The time now is 20:38.