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.

Safty check for matrix inversion

More
4 years 6 months ago #1925 by Guosheng Fu
Hello,

When umfpack direct solver fails to factorize the linear system (due to singularity), the code simply crashes.
Is there a safer way to proceed other than producing the following error message and exit the code?
Code:
netgen.libngpy._meshing.NgException: UmfpackInverse: Numeric factorization failed.
I noticed pardiso solver will still proceed with the factorization, but producing nan values.


Best,
Guosheng
More
4 years 6 months ago #1927 by mneunteufel
Hi Guosheng,

you can use the try - except syntax of Python

Code:
try: a.mat.Inverse(fes.FreeDofs(), inverse="umfpack") except: print("Singular matrix") #...

Then the code does not exit.

Best,
Michael
Time to create page: 0.153 seconds