Problem with functionObjects in parallel
I'm using this functionObjects in controlDict so I can extract them later via foamLog to check some qualities of my solution:
Code:
functions Code:
reduce(TKE,sumOp<scalar>()); I'm doing this manually now which is Info << TKE/16.0 << endl; and I know that I can use dict.lookup but that involves reading file in every single time step which is heavily inefficient |
Code:
const volScalarField& p = mesh().lookupObject<volScalarField>("p"); or.... you could simply write Code:
scalar pAv = gAverage(p); |
Thanks niklas but my problem is not with the calculation, my problem is in the parallel case, the calculations you have mentioned would be calculated on every sub-domain which one would be printed out in the screen when you use Info<< ? Obviously you should reduce it among different processes and THIS is my problem, if I use sumOp it should be divided to number of processes or I should use some other operator other than sumOp.
|
just try my code. Did you try it?
Did you notise the g in front of sum, gSum. Can you guess what the g stands for. The Info stream is only for processor 0, you also have an Sout stream, then it will write the statement for every processor. I think that you are not using the -parallel flag when you are running the parallel case. |
Thanks niklas, that all make sense now but unfortunately it does not work in functionobjects of libutilityFunctionObjecs.so
btw: I use -parallel flag |
All times are GMT -4. The time now is 13:32. |