HPDDM 3D periodic Cube

Hi,

I’m trying to use the HPDDM solver by PETSC on a full periodic cube in 3D. So far I tried to orient myself on this example:


If I use the unbalanced one the mesh creation takes like forever.
Unfortunately, it is not working. Has somebody tried this or even has code for this. I mean the periodic cube should be the easiest example.

Are all of your faces using periodic boundary conditions? What is you 3D script, and what are its performance? There are things that can be improved in this example, it will depend on your exact geometry.

Yes all faces use periodic BC. The simple starting example is:

// run with MPI: ff-mpirun -np 4 script.edp
// NBPROC 4

load “PETSc” // PETSc plugin
macro dimension()3// EOM // 2D or 3D
include “macro_ddm.idp” // additional DDM functions
include “cube.idp”
macro def(i)[i, i#B, i#C, i#D]// // vector field definition
macro init(i)[i, i, i, i]// EOM // vector field initialization
macro grad(u)[dx(u), dy(u), dz(u)]//// two-dimensional gradient
real Sqrt = sqrt(2.);
macro div(u)(dx(u) + dy(u#B) + dz(u#C))// EOM
int[int] labPeriodic = [1, 3, 2, 4, 5, 6 ];
macro Pk() [P1,P1,P1,P1], periodic=[[labPeriodic[0],x,z], [labPeriodic[1],x,z],[labPeriodic[2],y,z],[labPeriodic[3],y,z],[labPeriodic[4],x,y],[labPeriodic[5],x,y]]// EOM

int[int] LL = [1,2,3,4,5,6];
real a=128.0;
int ref = 128;
mesh3 Th = cube(ref,ref,ref,[ax,ay,a*z],label=LL);

fespace Wh(Th, Pk); // local finite element space
int[int][int] intersection; // local-to-neighbors renumbering
real[int] D; // partition of unity
{
buildPeriodic(Th, 1, intersection, D, Pk, mpiCommWorld, labPeriodic)
}
//fespace Wh(Th, Pk); // local finite element space
varf vPb([u, uB, uC, p], [v, vB, vC, q]) = intN(Th)(grad(u)’ * grad(v) + grad(uB)’ * grad(vB) + grad(uC)’ * grad(vC) - div(u) * q - div(v) * p + 1e-10 * p * q);
matrix Loc = vPb(Wh, Wh);
real[int] rhs = vPb(0, Wh);
Mat A(Loc, intersection, D);

set(A, sparams = “-pc_type lu -pc_factor_mat_solver_type mumps”);
Wh def(u);

A = Loc;
u[] = A^-1 * rhs;

macro def1(u)u// EOM
plotMPI(Th, u, P2, def1, real, cmm = “Global solution”)

In this way it takes several hours only for the partion of the mesh and space. Later I want to upgrade to more complex porblems, but for start this one is quite nice.

How about the “balanced” equivalent, have you implemented it yourself?