"Failed to factorize matrix" error

1,081 views
Skip to first unread message

Avery Schiff

unread,
Jun 12, 2017, 7:35:15 PM6/12/17
to Dedalus Users

Hi everyone,


I’m trying to use Dedalus to simulate a magnetic flux tube in the solar corona. I believe that I was able to simulate hydrostatic equilibrium, so I started trying to introduce a changing temperature profile. I consider radiative cooling, conductive heating, and a heating function that is related to MHD turbulence. When I treat the spatial derivative of the temperature as a separate variable, I run into a strange error:


“RuntimeError: failed to factorize matrix at line 100 in file scipy/sparse/linalg/dsolve/SuperLU/SRC/dsnode_bmod.c”


Has anyone run into this error before? Is there an obvious mistake that I am making?


I’ve attached my code and the files that you would need to run it. The call to the relevant function is at the bottom of the code. Please let me know if you have any questions. I did my best to clean up the code but there might still be a few strange parts. A few quick things to mention:


1) I realize that the characteristic temperature that is used to normalize the system is far too large to be physical. This is my sort of kludgy solution to problems with the sharpness of the temperature profile. You’ll notice that the temperature terms still expand to a large number of terms.


2) Viscosity in the corona isn’t really relevant, especially in this problem, hence the extremely large Reynold’s number.


3) The temperature, pressure, and radiative cooling terms are all created with fitted functions.


Thank you very much!

Avery Schiff

schiff_corona.zip

Keaton Burns

unread,
Jun 13, 2017, 12:21:49 PM6/13/17
to dedalu...@googlegroups.com
Hi Avery,

The linear portion of the equations, as they’ve been entered, is singular, which you can check by looking at the condition number of the combined LHS matrices.

One issue is that I think you may be imposing too many boundary conditions — in the first order formulation, you should replace the dr(ur) terms on the LHS of your equations with your first-order variable ur_r, which renders your energy and mass conservation equations spatially algebraic (no spatial derivatives in the LHS).  You should generally have the same number of boundary conditions as (spatially) differential equations in the first order formulation, so the boundary conditions on ln_E and ln_rho1 may be redundant.

There are a few other things I’m not sure about.  For instance T_r is defined as problem variable, but doesn’t appear in the LHS of any of the equations, just one BC.  You may need to change variables to ln_T, or similar, to be able to express the equation of state as a linear constraint, if you want to use a temperature boundary condition.  However, I’m not sure you need a thermal variable / boundary condition, perhaps only velocity boundary conditions, since there’s no e.g. thermal conduction here?

-Keaton
--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To post to this group, send email to dedalu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dedalus-users/8dee3fbf-a2c9-4ca1-ae14-c20ba2b3cb17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Avery Schiff

unread,
Jun 13, 2017, 3:39:24 PM6/13/17
to Dedalus Users
Hi Keaton,

Thanks for the help! I tried moving T_r around and realized that it should have been on the LHS of the last equation. That actually alone ended the matrix factorization error. The code is still crashing so I may have to look into our boundary conditions some more. I believe the temperature BC is justified by the conductive heating term, but it makes that some of the equations are algebraic rather than differential.

Either way, thank you for the input! I'll need to play around with some things to get it working but at least I can run without an error now.

Avery

Keaton Burns

unread,
Jun 13, 2017, 4:05:14 PM6/13/17
to dedalu...@googlegroups.com
Hi Avery,

Unfortunately, failing to trigger the factorization error doesn’t mean that the problem is well posed, just that the solver did not detect that the finite-precision matrix is exactly singular.  For a resolution of 128, moving T_r from the right to the left changes the condition number from 1e49 to 1e18, so I think it’s still singular, and that’s why it runs but crashes.

Best,
-Keaton

Avery Schiff

unread,
Jun 14, 2017, 1:45:26 PM6/14/17
to Dedalus Users
Hi Keaton,

Do you have any sense of why the matrix is singular? It seems like intuitively, there should be four boundary conditions since there are three differential equations, one of which has a second order derivative. However, I am currently running into an error where the matrix is exactly singular.

I thought it would help to use the velocity flux (u*r^2) and conductive heat flux as variables, but that seems to accomplish nothing. In fact, trial and error suggests I will run into the "matrix is exactly singular" error unless I reduce the equations down to two boundary conditions, neither of which can involve the energy variable. At that point, the code quickly diverges and crashes. Let me know if you have any thoughts. I have also attached the new version of the code to this message.

Thank you again,
Avery
schiff_corona.zip
Reply all
Reply to author
Forward
0 new messages