From: Kyunghoon Lee <aeronova.mailing@gm...>  20120706 07:27:04

Hi all, I have a quick question about printing elements of a stiffness matrix of a linear elasticity problem (I'm using the ex5 of reduced_basis, Reduced Cantilever Problem). I thought I can do the following const unsigned int n_u_dofs = c.dof_indices_var[0].size(); const unsigned int n_v_dofs = c.dof_indices_var[1].size(); for (unsigned int i=0; i<n_u_dofs + n_v_dofs; i++) { for (unsigned int j=0; j<n_u_dofs + n_v_dofs; j++) { std::cout << (*c.elem_subjacobians[0][0])(i,j) << '\t'; } std::cout << std::endl; } to print out Kuu, a submatrix of the stiffness matrix K. With a very simple mesh with 4 nodes (thus n_u_dofs = n_v_dofs = 3) I got the following : 0.384615 0.384615 0.384615 0 0 0 0.384615 0.384615 0.384615 0 0 0 0.384615 0.384615 0.384615 0 0 0 0 0 0 1.34615 1.34615 1.34615 0 0 0 1.34615 1.34615 1.34615 0 0 0 1.34615 1.34615 1.34615 for an isotropic material with nu = 0.3. The numbers are confusing since I was hopping to get Kuu such tat 1.34615 1.34615 1.34615 0 0 0 1.34615 1.34615 1.34615 0 0 0 1.34615 1.34615 1.34615 0 0 0 0 0 0 0.384615 0.384615 0.384615 0 0 0 0.384615 0.384615 0.384615 0 0 0 0.384615 0.384615 0.384615 since C1111 = 1.34615 and C1211 = 0.384615. (and C1112 = C1211 = 0). I wonder what I miss here in understanding the elements of a stiffness matrix. The other question is about getting the full elements of a stiffness matrix. I thought const unsigned int n_u_dofs = c.dof_indices_var[0].size(); const unsigned int n_v_dofs = c.dof_indices_var[1].size(); for (unsigned int i=0; i<2*(n_u_dofs + n_v_dofs); i++) { for (unsigned int j=0; j<2*(n_u_dofs + n_v_dofs); j++) { std::cout << c.elem_jacobian(i,j) << '\t'; } std::cout << std::endl; } will do the job for a 2D case, but almost a half of numbers were garbage, which indicates I'm using wrong indexes. I wonder how I can fix the index problem. Regards, K. Lee. 