CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Field concatenation in parallel (https://www.cfd-online.com/Forums/openfoam-solving/58835-field-concatenation-parallel.html)

johndeas June 5, 2008 09:27

Hi, I would like to concate
 
Hi,

I would like to concatenate vectorFields created on parallel threads at runtime. The problem is that, they have the same name, but are located on different processors.

listListOps has been mentionned in another thread, but I have no idea how to refere to the variables since they have the same name.

I would also write the result, not in a processor subdirectory, but in the root directory. The problem is that runTime.path() returns the processor directory which correspond to the thread. I thought of using something like runTime.path()/".." but this might not be the most elegant solution (besides maybe not working)

johndeas June 6, 2008 11:27

Hi, as a test, I tried to c
 
Hi,

as a test, I tried to create a different vectorField per processor, and then merge it with this code:

vectorField myVecFld(1,vector(Pstream::myProcNo(),0,0));
List<vectorfield> gatheredData(Pstream::nProcs());
gatheredData[Pstream::myProcNo()] = myVecFld;
Pstream::gatherList(gatheredData);

vectorField combinedFld
(
ListListOps::combine<vectorfield>
(
gatheredData,
vectorField::operator[]
)
);

As I understand the code, I need to provide "combine" an "access operator to access the individual elements". Needless to say, the operator I proposed above does not work.

Which one should I use ?


All times are GMT -4. The time now is 12:14.