Dear FreFem++ community and developers:
The “setBC” function for enforcing Dirichlet boundary condition is very useful in solid mechanics field, just like that shown in the examples/3d/Elasticity-simple-support-BC.edp.
I have tested several tutorials using this feature, and it works well in the sequential cases.
But when I turn to a parallel version, especially using the macro_ddm.idp and PETSc, it is sometimes not stable enough.
The error is “Assertion fail: (IA[k]-fortran>=0 ) && (IA[k]-fortran<=nn), from line 1009 of HashMatrix.cpp”, something like that the index number is not within the range between its minimum and maximum values.
A typical template code is as follows:
load “PETSc”
macro dimension() 3 //
include “macro_ddm.idp”func Pk3 = [P2, P2, P2];
macro def(u) [u, u#B, u#C] //
macro init(u) [u, u, u] //// Mesh
mesh3 Th = readmesh3(“./mesh/mesh.msh”);// Domain decomposition
Mat A;
DmeshCreate(Th);
MatCreate(Th, A, Pk3);// FE space
fespace Vh(Th, Pk3);
Vh [u1, u2, u3];// Variational formulation
varf vA([u1, u2, u3], [v1, v2, v3])
= int3d(Th)(epsV(u1, u2, u3)’ * C * epsV(v1, v2, v3));varf vb([u1, u2, u3], [v1, v2, v3])
= int3d(Th)(rho * (gravity’ * [v1, v2, v3]));varf vbp([u1, u2, u3], [v1, v2, v3])
= on(nDr0, u1 = 1, u2 = 1, u3 = 1);// Matrix form
matrix Aloc = vA(Vh, Vh);
real[int] b = vb(0, Vh);// Dirichlet boundary condition
real[int] bp = vbp(0, Vh, tgv = 1);// Enforce Dirichlet boundary condition
setBC(Aloc, bp, -2);
b = bp ? 0 : b;// PETSc matrix
A = Aloc;// Solve problem
set(A, sparams = “-pc_type hypre”);
u1 = A^-1 * b;
The error usually occurs at the line “setBC(Aloc, bp, -2);” or “A = Aloc;”.
Is it because in the local problem in mpi process i, the dof id in the array “bp“ exceeds the limits of the dof index set of local mesh?