Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Empty Rows and Zeros in Assembled Matrix after Mesh Refinement

More
4 years 3 months ago #2338 by bfadness
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.
Code:
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:
Code:
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
Attachments:
More
4 years 3 months ago - 4 years 3 months ago #2340 by christopher
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:
Code:
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
Last edit: 4 years 3 months ago by christopher.
More
4 years 3 months ago #2341 by bfadness
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:
Code:
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:
Code:
>>> 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
More
4 years 3 months ago #2342 by mneunteufel
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
Code:
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)
Code:
ngsglobals.msg_level = 0

Best,
Michael

File Attachment:

File Name: mixed.py
File Size:1 KB
Attachments:
The following user(s) said Thank You: bfadness
Time to create page: 0.112 seconds