CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   using #calc in parallel with openFOAM 2.2.2 (

Pascal_doran February 26, 2014 18:56

using #calc in parallel with openFOAM 2.2.2
Hi all,

Does anyone had problem using using #calc in parallel with openFOAM 2.2.2? I use #calc to evaluate algebraic expressions in a file which is read by the controlDict and blockMeshDict. Everything seems to work just fine when I run with 1 processor but in parallel the simulation stop while evaluating some #calc expressions like that :


ptX0  -4.00 ;
ptX1    4.00 ;
ptY0    0.00 ;
ptY1    4.00 ;
ptZ0    0.00 ;
ptZ1    4.00 ;
Nx      144  ;
Ny      72  ;
Nz      72  ;
Lx      #calc"$ptX1 - $ptX0";
Ly      #calc"$ptY1 - $ptY0";
Lz      #calc"$ptZ1 - $ptZ0";
dx      #calc"$Lx/$Nx";
dy      #calc"$Ly/$Ny";
dz      #calc"$Lz/$Nz";

But if I write this :

Lx      8;
Ly      4;
Lz      4;
dx      0.0555555555555555;
dy      0.0555555555555555;
dz      0.0555555555555555;

Everything is just fine on a serial or parallel run. Note that this :

Lx      #calc"8";
Ly      #calc"4";
Lz      #calc"4";
dx      0.0555555555555555;
dy      0.0555555555555555;
dz      0.0555555555555555;

still doesn't work on a parallel run. I have no error message at all time.

Anyone has notice such a behavior using #calc with OF 2.2.2?

Thank you,

jona March 19, 2014 10:35


I am experiencing the same issue. The #calc directives work flawless when run on a single processor, but as soon, as they are called in a parallel run, the solver stucks without any activity or any messages.

Is this a bug or misusage?

Have a nice day,


wyldckat March 23, 2014 13:14

Greetings to all!

Can any of you provide a simple test case, based on one of OpenFOAM's tutorials? It would make it faster and easier for someone else to diagnose this issue.

Best regards,

jona March 25, 2014 11:46

1 Attachment(s)
Of course. The example is the cavity from the tutorials but decomposed for two processors. So in order to run the case you need to

mpirun -np 2 icoFoam -parallel

When executing icoFoam, it stucks after the lines

Using #calcEntry at line 30 in file ...
Using #codeStream with ...

Thanks a lot for your help,


PS: The #calc entry is in the system/controlDict

wyldckat April 5, 2014 19:58

Hi jona,

I've finally managed to give a look into this. I've reproduced the issue and it seems to be a bug that has already been fixed in OpenFOAM 2.3.x, which was present in OpenFOAM 2.3.0. Mmm... I guess this was an issue back in OpenFOAM 2.2.2 as well...

Now, if I could only figure out which commit fixed this issue... Found it, it's fixed in commit 8199b97e4a7ab5daa684abe27bdac2610cfb52a3:

Now, to apply this fix, it will depend on how you installed OpenFOAM.

Best regards,

jona April 8, 2014 12:44

Hello Bruno,

great, thanks a lot for looking into it and resolving the issue!

Have a nice day,


All times are GMT -4. The time now is 16:53.