Some questions about using PETSc to solve 3D elasticity problems

Hey FreeFem++ team, as you suggest in our last discussion, I decided to add nullspace to apply the rigid body motion to my code; I test it with simple cantilever case which is working good; However, when I change the mesh to the wing model [some thin film], the residual is no long converged; I guess I have this issue is because that I do not understand the nullspace matrix very well;
Wh<real> def(Rb)[6]; [Rb[0], RbB[0], RbC[0]] = [1, 0, 0]; [Rb[1], RbB[1], RbC[1]] = [0, 1, 0]; [Rb[2], RbB[2], RbC[2]] = [0, 0, 1]; [Rb[3], RbB[3], RbC[3]] = [y, x, 0]; [Rb[4], RbB[4], RbC[4]] = [z, 0, x]; [Rb[5], RbB[5], RbC[5]] = [0, z, y];
I also attached my script here for your information; Thank you;3D_ELASTICITY_PETSc.edp (3.3 KB)
Because the format, I can not upload the input gmsh file of the wing

Is it any better if you assemble both your RHS and matrix using tgv = -2?

Thx for the replay, it is not working; what does tgv = -2 mean here.

See “symmetric elimination” from my tutorial. I’ll need your mesh file for helping you out further. You could probably upload it somewhere or send it to me directly via private message.

Thx, after some debugging, I believe the problem is from the mesh file; It seems like the “-pc_type lu” direct solver gives me the similar strange displacement like the iteration solver. Moreover, when I switch it to the structure mesh, the problem is gonna.So I do not think the issue is from the solver. I think I can solve this issue by myself; Thx for your time;

For more details about it; the binary file and the ascii file of my mesh result this issue. It sounds strange, but that’s what I find out. I do not know if this problem comes from gmsh or FreeFem; could you please let me know how to send those mesh files to you from the private message.

I’ve run the script, with both mesh files. It seems the solver converge, what is the exact issue you are seeing on your end, please?

Yes, the KSP converged in both cases.if you plot the displacement, you will see the issue; the ASCII file gives the correct displacement since I clamped it on the right-hand side; however, the binary file gives me the wrong displacement;

Thanks, you are showcasing an obvious bug in the Gmsh FreeFEM reader.
The easy solution: use PETSc DMPlex reader. Replace:

mesh3 Th = gmshload3("wing_unst_1300_bi.msh");


DM plex("wing_unst_1300_bi.msh", communicator = mpiCommSelf); // also handles Gmsh v4 format
mesh3 Th = plex; //gmshload3("wing_unst_1300_ac.msh");

I will try this, and let you know if this solves my problems. thanks for your help Prj.

I tested my code, every thing good now, Thx for the help;