CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   outputting averaged quantities to a text file in parallel execution (

zhengzh5 January 31, 2013 18:08

outputting averaged quantities to a text file in parallel execution

I am currently working with OpenFOAM-2.0.x, and trying to do some engine simulations. I want to calculate average quantities such as meanPressure, meanTemperature at every time step and output them to, say, summaryLog file.

In serial execution, I have

totalV = sum(mesh.V().field());
sumMass = fvc::domainIntegrate(rho).value();
pPistonMean = fvc::domainIntegrate(p).value()/totalV;
aveT = fvc::domainIntegrate(rho*Tu).value()/sumMass;
summaryLog << pPistonMean << " "<<aveT <<endl;

and things seem to work fine. But when I try to run the code in parallel with 4 processors, the output doesn't make sense to me anymore.

For instance, all 4 summaryLog files (1 per processor) will show the same sumMass when the mass contained in each decomposed domain should be different since the domain size varies a lot between processors. (I use scotch for domain decomposition) My questions are:

1. if each processor stores their own copy of mesh and internal fields such as, pressure, temperature, density.
2. when writing data to a text file, does each processor output the individual data it's holding, or does a certain processor does the task for all 4 processors.

Any help is appreciated. thanks a lot!


All times are GMT -4. The time now is 03:11.