# How to solve an algebraic system of equations

 Register Blogs Members List Search Today's Posts Mark Forums Read

July 13, 2020, 09:50
How to solve an algebraic system of equations
#1
Senior Member

Agustín Villa
Join Date: Apr 2013
Posts: 308
Rep Power: 13
Hi,

I have a system of linear equations like A·X=B that I am able to solve by the expression:
Code:
`X = inv(A) * B`
That I assume is the correct expression. During my steady-state simulations I have to relax the X calculated value as it tends to grow, but at the end it stabilizes. This happens when I am using a k-epsilon model. The tensor A takes into account the gradient of velocity, k and epsilon.

However, when I move to a Reynolds stress model and I try to compute X it always diverges. Checking on the internet, I found the condition number of a matrix (the closest to 1, the easier is to have a reasonable result for X), and this value is more or less ok when running the k-epsilon model, but it explodes whan applying the Reynolds stress model. (Please see attached figures)

I have read that preconditioners are used to reduce the condition number when running numerical simulations. OpenFOAM has already some of then and they are applied before solving the PDE's iteratively. In my case I only have to solve it once has I do not have non linear elements. Is it possible to call a solver to use ir for linear equations?
Attached Images
 cond_number_impingingJet_kepsilon.png (43.5 KB, 9 views) cond_number_impingingJet_ebrsm.png (11.2 KB, 8 views)

Last edited by agustinvo; July 13, 2020 at 10:56.

 July 14, 2020, 11:31 #2 Senior Member   Agustín Villa Join Date: Apr 2013 Location: Fuenlabrada Posts: 308 Rep Power: 13 I have been playing around with different methods to solve the system of equations (using the Test-Matrix inside the OF code), but the problem persists. I think the problem is more related to the A matrix values rather than a numerical problem. I have been checking the results given by to different simulations: Eddy viscosity model: the ratio k/epsilon (time scale) is around 5 Reynolds stress model: the ratio grows up to 10 ¿The reason? the calculated epsilon value at that location is much lower on the Reynolds Stress model The next movement should be revise the epsilon calulation

 July 14, 2020, 14:42 #3 Senior Member   Agustín Villa Join Date: Apr 2013 Location: Fuenlabrada Posts: 308 Rep Power: 13 I found out the problem: inside the volTensorField A there where negative elements on the diagonal, and computing the inverse of it was giving errors (large condition number for tensor A). I changed the coefficient model that affects the tensor construction and it works well! I might be a configuration to be taken into account when using Reynolds stress models instead of eddy-viscosity models. I hoped you enjoyed this thread as much as I when guessing the error. Cheers, Agustín