From: Benjamin Kirk <benjamin.kirk@na...>  20080213 02:14:08

> Now, I am wondering how algebraic method constrains hanging nodes. Whether > does it set the values at hanging nodes to zero? I output the matrix > assembled in libmesh using PetSC function, I find lots of zero values in > matrix. Because the matrix in Petsc is stored using sparse compressed strage > format, zero values should not appear. Could you give me some hints? The constraint u_f = 1/2 u_c1 + 1/2 u_c2 is a typical constraint  it says the fine value is the average of the coarse values on an edge. It can be imposed through the linear system by zeroing the entire row for u_f and the righthandside entry and replacing it with [u_c1] [ 0 ... 1/2 1 1/2 ...0 ] [u_f ] = [0] [u_c2] Strictly speaking, you could eliminate the u_f row & column from the sparse matrix and the resulting linear system would be 1 dof smaller. In practice though that is more trouble than it is worth. It would take a pathological case (like everyother element in a checkerboard pattern is refined) for the savings gained by reducing the size of the linear system to be worth the effort. Now, the reason there are a number of zeros in that row is simple... In 2D for linear quadrilateral elements a typical row will have 9 nonzero entries, and this is what gets allocated for that row. A typical linear constraint only involves 3 dofs, though, so you are left with some zeros. A quadratic Lagrange quadrilateral typically has 25 nonzeros on a row, but a constraint involves 4 dofs. So, there are 21 stored zeros in that row. This functionality is implemented in the DofMap::constrain_element_matrix_an_vector() function  see http://libmesh.sourceforge.net/doxygen/classDofMap.php It takes the element matrix and vector written in terms of unconstrained dofs and alters them so that they are written entirely in terms of unconstrained dofs. Finally, Is PETSc outputting a compressed matrix, or is it giving you the square matrix and padding with zeros itself? Ben 