Von Mises elasto-plasticity in Parallel

I am trying to reproduce the Von Mises elasto-plasticity Tutorial on multiple processors.

I was able to run the same code on 1 processor but when I switch to multiple processors I faced two problems:

I solved the problem with mesh initialisation in different processors using

msh, cell_tags, facet_tags = gmshio.read_from_msh("arc.msh", MPI.COMM_WORLD, 0, gdim=2)

The arc.msh file (which equivalent to the mesh generated in the tutorial) was generated using Gmsh:

// Mesh size parameter
lc = 0.3;

// Define points in the x-y plane (z=0)
// Points on the inner circle:
Point(1) = {1, 0, 0, lc};      // at angle 0 (inner circle)
Point(4) = {0, 1, 0, lc};      // at angle 90° (inner circle)

// Points on the outer circle:
Point(2) = {1.3, 0, 0, lc};    // at angle 0 (outer circle)
Point(3) = {0, 1.3, 0, lc};    // at angle 90° (outer circle)

// Center of the circles (used for circular arcs)
Point(5) = {0, 0, 0, lc};

// Create curves
// Radial edge along the x-axis (from inner to outer circle)
Line(1) = {1, 2};   // Horizontal radial edge (Lx)

// Outer circular arc (from (1.3,0) to (0,1.3) along circle of radius 1.3)
Circle(2) = {2, 5, 3};   // Outer arc (outer)

// Radial edge along the y-axis (from outer to inner circle)
Line(3) = {3, 4};   // Vertical radial edge (Ly)

// Inner circular arc (from (1,0) to (0,1) along circle of radius 1)
// Note: In the line loop we use the reverse of this arc (-4) to maintain consistent orientation.
Circle(4) = {1, 5, 4};   // Inner arc (inner)

// Define the closed line loop for the quarter annulus
Line Loop(1) = {1, 2, 3, -4};

// Create the 2D surface (the quarter annulus)
Plane Surface(1) = {1};

// Define physical groups with the desired names
Physical Line("Lx",1)   = {1};
Physical Line("outer",4) = {2};
Physical Line("Ly",2)   = {3};
Physical Line("inner",3) = {4};

Physical Surface("all") = {1};

Field[1] = Box;
Field[1].VIn = 0.3;
Field[1].VOut = 0.3;
Field[1].XMin = -1.0;
Field[1].XMax = 5.0;
Field[1].YMin = -1.0;
Field[1].YMax = 1.0;
Field[1].ZMin = 0.0;
Field[1].ZMax = 0.0;
Field[1].Thickness = 1;

Field[6] = Min;
Field[6].FieldsList = {1};
Background Field = 6;

Mesh.ElementOrder = 1;
Mesh 2;
Mesh.MshFileVersion = 2.0;
Save "arc.msh";

Now that the issue with mesh is fixed the code is giving me garbage results. I am assuming the problem is with how the solvers are written. The same code works fine on one processor using the same msh file.

Any help to solve this issue would be appreciated, thanks!

1 Like