|
[Sponsors] |
the global index for cells and facess in parallel computation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 27, 2020, 06:15 |
|
#41 |
Member
David Andersson
Join Date: Oct 2019
Posts: 46
Rep Power: 7 |
Hi @mkraposhin,
I am facing a similar challange as openfoammaofnepo did however, mine is a bit different. I am writing a functionObject that I use for parallel computing. I define one or a few patches (let's say I select Building from Inlet, Outlet, Tunnel & Building) and I read the face pressure values on that patch. Then I do some computations and lastly write that to a custom made field. My problem is that I don't know how to refer the pressure value of a face on one processor with the global face ID. Meaning I could read the p-value on face A, do my computations and then write my new value to face C. I found this thread and it seams to be more or less my answer however, I do have some quesitions: 1) How would I implement a patch selection? I have a dict file where I define some patch names and that files is read into the list patchSet, which is a list of integers. 2) Can I implement your example code directly in my functionObject or do I need to do that in a solver? I would be very gratefull for your help on this. Cheers, David |
|
April 27, 2020, 06:17 |
|
#42 |
Member
David Andersson
Join Date: Oct 2019
Posts: 46
Rep Power: 7 |
Hi @mkraposhin,
I am facing a similar challange as openfoammaofnepo did however, mine is a bit different. I am writing a functionObject that I use for parallel computing. I define one or a few patches (let's say I select Building from Inlet, Outlet, Tunnel & Building) and I read the face pressure values on that patch. Then I do some computations and lastly write that to a custom made field. My problem is that I don't know how to refer the pressure value of a face on one processor with the global face ID. Meaning I could read the p-value on face A, do my computations and then write my new value to face C. I found this thread and it seams to be more or less my answer however, I do have some quesitions: 1) How would I implement a patch selection? I have a dict file where I define some patch names and that files is read into the list patchSet, which is a list of integers. 2) Can I implement your example code directly in my functionObject or do I need to do that in a solver? I would be very gratefull for your help on this. Cheers, David |
|
April 11, 2024, 11:06 |
|
#43 | |
Member
bany
Join Date: Nov 2019
Posts: 50
Rep Power: 8 |
Quote:
The error can be solved by : Code:
const fvMesh& localMesh(mesh); Code:
gatherList Code:
List<List<label>> processCellToGlobalAddr_; List<label> globalCellToProcessAddr_; if (Pstream::parRun()) { processCellToGlobalAddr_.resize(Pstream::nProcs()); const fvMesh& localMesh(mesh); //read local cell addressing labelIOList localCellProcAddr ( IOobject ( "cellProcAddressing", localMesh.facesInstance(), localMesh.meshSubDir, localMesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); processCellToGlobalAddr_[Pstream::myProcNo()] = localCellProcAddr; Pstream::gatherList(processCellToGlobalAddr_); } |
||
|
|