Empty Rows and Zeros in Assembled Matrix after Mesh Refinement

Hello,
The attached file solves the mixed formulation of the diffusion equation. Immediately after I define a mesh, I refine it before creating anything else.

mesh = Mesh(unit_square.GenerateMesh(maxh = 0.5))
mesh.Refine()

When I print a.mat, I see that the first 13 rows are empty. I noticed the following line of output when the mesh was being refined:

used 276, unused = 13, total = 289

Can someone explain to me what is going on? Also, why are there so many explicit zeros and values that are basically zero (10e-16).
Thanks,
Barry

Attachment: mixed.py

Hi,
which version of NGSolve are you using? When I run your file using a current (NGSolve-6.2.2001) version I just get the following output:

Generate Mesh from spline geometry
 Mesh bisection
 Bisection done
u error:  0.018523434635164145
u error:  0.01852343463516412
sigma error:  0.00560065234552778
sigma error:  0.00516680958449743
Finished executing mixed.py

Best
Christopher

Hi, Christopher.
Thanks for your reply. I was using NGSolve-6.2.1907. I just built the current version from source, and here is the output:

importing NGSolve-6.2.2001-11-g0929bd80
 Generate Mesh from spline geometry
 Boundary mesh done, np = 8
 CalcLocalH: 8 Points 0 Elements 0 Surface Elements
 Meshing domain 1 / 1
 load internal triangle rules
 Surface meshing done
 Edgeswapping, topological
 Smoothing
 Split improve
 Combine improve
 Smoothing
 Edgeswapping, metric
 Smoothing
 Split improve
 Combine improve
 Smoothing
 Edgeswapping, metric
 Smoothing
 Split improve
 Combine improve
 Smoothing
 Update mesh topology
 Update clusters
 Mesh bisection
 resetting marked-element information
 Update mesh topology
 Update clusters
 Bisection done
 Update clusters
setvalues element 16/16                                 
assemble VOL element 24/24                                 
assemble VOL element 24/24                                 
assemble BND element 16/16                                 
call umfpack ... done
setvalues element 24/24                                 
setvalues element 24/24                                 
u error:  0.018523434635164145
u error:  0.01852343463516412
sigma error:  0.005600652345527711
sigma error:  0.005166809584497282

(By the way, do you know how to suppress some of the output?) The first 13 rows of the matrix are still empty:

>>> print(a.mat)
Row 0:
Row 1:
Row 2:
Row 3:
Row 4:
Row 5:
Row 6:
Row 7:
Row 8:
Row 9:
Row 10:
Row 11:
Row 12:
Row 13:   13: 0.333333   14: 5.41928e-15   15: -5.55198e-15   46: 5.67255e-15 ...

Also, you can see the entries shown are basically zero.
Thanks,
Barry

Hi Barry,

When refining the mesh might save also information from the coarse grid and thus the unused dofs yielding to empty rows. With the command Compress

V = Compress(HDiv(mesh, order = order_flux, dirichlet = 'top'))
Q = Compress(L2(mesh, order = order_flux - 1))
fes = FESpace([V,Q])

the unused dofs are kicked off and the resulting matrix does not have empty rows anymore.

The output can be suppressed by setting the message level ( 0 - 7 I think)

ngsglobals.msg_level = 0

Best,
Michael
https://ngsolve.org/media/kunena/attachments/889/mixed.py

Attachment: mixed.py