CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Bad parallelization. Has this ever happened to you??? :O (

rucky96 November 23, 2019 14:40

Bad parallelization. Has this ever happened to you??? :O
2 Attachment(s)

I was trying to solve the problem of a magnetically confined conductive fluid in a periodic cylinder. The results for a serial simulation gives resonable results... But when I run the simulation for 2 processors one can distinguish 2 zones in the cylinder (one per processor). If I am using 3 one can distinguish 3 zones. Same for 4.

I suppose that there is a problem in the comunication between the cells at the boundaries of each processors zone. I am using scotch method.

I tried (it did not work):
  1. Change the method to simple.
  2. Add a correctBoundaryConditions() in the equation for B in mhdFoam.

I suppose that the problem is in the solver that I am using (a mhdFoam slightly modified). mhdFoam works well with parallelization. But when one wants to add a external magnetic field one has to modify the equation for B (with \mathbf B\left(\mathbf r,t\right)=\mathbf B_{variable}\left(\mathbf r,t\right)+\mathbf B_{fixed}\left(\mathbf r\right), \mathbf B_{fixed}\left(\mathbf r\right) is the same for all t).
  • Induction equation in mhdFoam looks like:

            while (bpiso.correct())
                fvVectorMatrix BEqn // the magnetic induction equation, calculates the magnetic field taking into account the influence of the velocity.
                  + fvm::div(phi, B)
                  - fvm::laplacian(DB, B)
                  - fvc::div(phiB, U)

                phiB = fvc::flux(B);//phiB is calculated at faces.
                while (bpiso.correctNonOrthogonal())
                    fvScalarMatrix pBEqn //A Poisson equation is derived for the fictitious magnetic pressure pB and solved
                        fvm::laplacian(pB) == fvc::div(phiB)


                    if (bpiso.finalNonOrthogonalIter()) //The variable distribution is then employed to correct the phiB values
                        phiB -= pBEqn.flux();
                }// The loop exits after the prescribed iterations stated in the fvSolution file.
                #include "magneticFieldErr.H" //print magnetic field divergence deviation from null value

  • My induction equation in modified mhdFoam looks like

            #include "readBFixed.H"
            while (bpiso.correct())
                fvVectorMatrix BVbleEqn
                  + fvm::div(phi,BVble)
                  + fvc::div(phi,BFixed)
                  - fvc::div(phiBVble,U)
                  - fvc::div(phiBFixed,U)
                  - fvm::laplacian(lambda,BVble)
                  - fvc::laplacian(lambda,BFixed)
                phiBVble = fvc::flux(BVble);

                while (bpiso.correctNonOrthogonal())
                    fvScalarMatrix pBVbleEqn
                        fvm::laplacian(pBVble) == fvc::div(phiBVble)


                    if (bpiso.finalNonOrthogonalIter())
                        phiBVble -= pBVbleEqn.flux();
                #include "magneticFieldErr.H"

            phiB = fvc::flux(B);

Maybe the problem is to sum B=BVble+BFixed in this way??

Attachment 73469

Attachment 73470

rucky96 November 28, 2019 08:58

I tried the same case with the OF series solver for MHD. I used the same configuration and the same magnetic field profile but without an external magnetic field source at t> 0, that is, it is an MHD decay. The result has been the same as with the modified solver.

I have tried the same thing in a box with periodic conditions on the sides and I have not seen anything unusual.

It seems that the quality of the parallelization in OF depends on how simple the mesh is. If it is a bit complicated it seems that parallelization does not work so well. If this is true is an OF internal issue and I cannot do anything.

Am I right?

HPE November 28, 2019 16:49

yes you can. submit an issue ticket in gitlab repo.

rucky96 November 29, 2019 12:22


Thanks for answering. I do not understand what you mean :(

HPE November 29, 2019 12:43

My apologies. I wrote that while I was in bed. :)

>> If this is true is an OF internal issue and I cannot do anything.

I meant that if you think that there is an internal issue in OF, you can submit a bug ticket in gitlab repository, so that the developers can have a look at the issue, and evaluate it for you.

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