First of all thank you for developing amgcl. Without it, I would've probably never started this little project.
I am trying to use amgcl to solve the linear elasticity problem using hexahedral elements. I have been following the documentation and the examples in the example folder and roughly speaking I do the following
The matrix is a boost compressed matrix. The vector a boost vector. The system I try to solve is for a single element (24 dof) and I computed by hand the correct values I expect for the result. I use np.linalg.solve
from python to check that the matrix is assembled correctly and python does indeed, when I copied the printed matrix and vector from my C++ code to python yield the correct results. But my C++ does not yield the correct result.
((3.49524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,3.49524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0,0,3.49524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0.349524,0.611667,-0.174762,3.49524,1.22333,-1.22333,-0.524286,0.087381,-0.087381,0.349524,0.174762,-0.611667,-1.04857,-0.087381,1.22333,-0.699048,-0.174762,0.174762,-0.87381,-0.611667,0.611667,-1.04857,-1.22333,0.087381),(0.611667,0.349524,-0.174762,1.22333,3.49524,-1.22333,-0.087381,-1.04857,1.22333,-0.174762,-0.699048,0.174762,0.087381,-0.524286,-0.087381,0.174762,0.349524,-0.611667,-0.611667,-0.87381,0.611667,-1.22333,-1.04857,0.087381),(0,0,0,0,0,3.49524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(0.349524,-0.174762,0.611667,-0.524286,-0.087381,0.087381,3.49524,-1.22333,1.22333,0.349524,-0.611667,0.174762,-1.04857,1.22333,-0.087381,-0.87381,0.611667,-0.611667,-0.699048,0.174762,-0.174762,-1.04857,0.087381,-1.22333),(0.174762,-0.699048,0.174762,0.087381,-1.04857,1.22333,-1.22333,3.49524,-1.22333,-0.611667,0.349524,-0.174762,1.22333,-1.04857,0.087381,0.611667,-0.87381,0.611667,-0.174762,0.349524,-0.611667,-0.087381,-0.524286,-0.087381),(0,0,0,0,0,0,0,0,3.49524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(-0.524286,-0.087381,-0.087381,0.349524,-0.174762,-0.611667,0.349524,-0.611667,-0.174762,3.49524,-1.22333,-1.22333,-0.87381,0.611667,0.611667,-1.04857,1.22333,0.087381,-1.04857,0.087381,1.22333,-0.699048,0.174762,0.174762),(0.087381,-1.04857,-1.22333,0.174762,-0.699048,-0.174762,-0.611667,0.349524,0.174762,-1.22333,3.49524,1.22333,0.611667,-0.87381,-0.611667,1.22333,-1.04857,-0.087381,-0.087381,-0.524286,0.087381,-0.174762,0.349524,0.611667),(0,0,0,0,0,0,0,0,0,0,0,3.49524,0,0,0,0,0,0,0,0,0,0,0,0),(-0.699048,0.174762,0.174762,-1.04857,0.087381,1.22333,-1.04857,1.22333,0.087381,-0.87381,0.611667,0.611667,3.49524,-1.22333,-1.22333,0.349524,-0.611667,-0.174762,0.349524,-0.174762,-0.611667,-0.524286,-0.087381,-0.087381),(-0.174762,0.349524,0.611667,-0.087381,-0.524286,0.087381,1.22333,-1.04857,-0.087381,0.611667,-0.87381,-0.611667,-1.22333,3.49524,1.22333,-0.611667,0.349524,0.174762,0.174762,-0.699048,-0.174762,0.087381,-1.04857,-1.22333),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.49524,0,0,0,0,0,0,0,0,0),(-1.04857,0.087381,-1.22333,-0.699048,0.174762,-0.174762,-0.87381,0.611667,-0.611667,-1.04857,1.22333,-0.087381,0.349524,-0.611667,0.174762,3.49524,-1.22333,1.22333,-0.524286,-0.087381,0.087381,0.349524,-0.174762,0.611667),(-0.087381,-0.524286,-0.087381,-0.174762,0.349524,-0.611667,0.611667,-0.87381,0.611667,1.22333,-1.04857,0.087381,-0.611667,0.349524,-0.174762,-1.22333,3.49524,-1.22333,0.087381,-1.04857,1.22333,0.174762,-0.699048,0.174762),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.49524,0,0,0,0,0,0),(-1.04857,-1.22333,0.087381,-0.87381,-0.611667,0.611667,-0.699048,-0.174762,0.174762,-1.04857,-0.087381,1.22333,0.349524,0.174762,-0.611667,-0.524286,0.087381,-0.087381,3.49524,1.22333,-1.22333,0.349524,0.611667,-0.174762),(-1.22333,-1.04857,0.087381,-0.611667,-0.87381,0.611667,0.174762,0.349524,-0.611667,0.087381,-0.524286,-0.087381,-0.174762,-0.699048,0.174762,-0.087381,-1.04857,1.22333,1.22333,3.49524,-1.22333,0.611667,0.349524,-0.174762),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.49524,0,0,0),(-0.87381,-0.611667,-0.611667,-1.04857,-1.22333,-0.087381,-1.04857,-0.087381,-1.22333,-0.699048,-0.174762,-0.174762,-0.524286,0.087381,0.087381,0.349524,0.174762,0.611667,0.349524,0.611667,0.174762,3.49524,1.22333,1.22333),(-0.611667,-0.87381,-0.611667,-1.22333,-1.04857,-0.087381,0.087381,-0.524286,0.087381,0.174762,0.349524,0.611667,-0.087381,-1.04857,-1.22333,-0.174762,-0.699048,-0.174762,0.611667,0.349524,0.174762,1.22333,3.49524,1.22333),(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.49524))
So it seems that my C++ setup does compute most entries of the result vector correctly but fails for others? If it wasn't for python I would've assumed that parts of my matrix are incorrect, but this does not seem to be the case.