# Convergence of Conjugate Gradient Algorithm

I am trying to solve a linear elasticity model using finite element discretization in a rectangle domain [0,1]x[0,1]. For the solution of the the linear system $$Ku=F$$ I am using the CG algorithm. However, I have noticed some weird behaviour of the algorithm. For small grids (e.g 2x2 or 3x3 or 2x1 ...) the algorithm fails and doesn't converge while if the grid becomes larger(10x10 or 25x25 ...) the algorithm converges and the results seem reasonable.My first thought was If the application of homogeneous BC leads to an ill-conditioned matrix ,since I zero the columns and rows accosiated with BC and put 1 in diagonals, but this make no sense if the algorithm converges for some grids right? Any idea why is this happening?

• Can you try with a direct solver? Does it work then?
– knl
Oct 12 '20 at 8:24
• I tried only with CG.The funny thing is for grids larger than 3x3 converges and the results are the same as the ones if I impement my model in abaqus Oct 12 '20 at 13:05
• Can you print out a numerical example of your small matrices? Oct 12 '20 at 15:44
• @knl makes the right suggestion: Try with a direct solver. The point is that you don't know whether the matrix is wrong or the CG implementation is wrong. If you use a direct solver, you can eliminate one of these two causes. Oct 12 '20 at 23:43