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

How to transfer the modified data in serial process to other processes?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 26, 2022, 04:21
Default How to transfer the modified data in serial process to other processes?
  #1
New Member
 
yunyu_wang
Join Date: Oct 2020
Posts: 1
Rep Power: 0
wyunyu is on a distinguished road
Hello, everyone!
I recently encountered a problem. I need to insert a serial operation into parallel computing. And I used some functions in MPI to do it as the following codes. But I found that the modified data in serial process is not passed to other processes. So how can I make the modified data in the serial pass to other processes? Thank you!
Code:
int main(int argc, char *argv[])
{

 int i(0);
 int numprocs;
 int myid;
 MPI_Status stat;
 MPI_Init(&argc, &argv);
 MPI_Comm_size(MPI_COMM_WORLD,&numprocs);  
 MPI_Comm_rank(MPI_COMM_WORLD,&myid);

// there is N data altogether in testNumber
volScalarField testNumber
(
    IOobject
    (
        "testNumber",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);

if(myid==0)
{

  for(i=0;i<N;i++)
  {
    testNumber[i]=i;
  }

}

testNumber.write();
// It is found that only the testNumber in the 0 process has been modified, 
//and the testNumber of other processes remains unchanged.

}
wyunyu is offline   Reply With Quote

Reply

Tags
mpi, openfoam, serial in parallel


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
modified version of timeVaryingMappedFixedValue BC for looping through data syavash OpenFOAM Programming & Development 13 November 3, 2023 18:38
Initializing transient analysis using static analysis in two-way FSI simulation Daniel_Khazaei ANSYS 50 September 12, 2017 10:56
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 10:52
post process to get an arbitrary face data oniboy Siemens 2 February 28, 2008 22:12
Data transfer H. P. LIU Main CFD Forum 5 May 19, 2003 10:47


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