CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM

About LUsolve

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

LinkBack Thread Tools Search this Thread Display Modes
Old   August 17, 2022, 06:49
Default About LUsolve
New Member
Join Date: May 2022
Posts: 15
Rep Power: 2
gmori is on a distinguished road

I would like to use the OpenFOAM function LUsolve, but I don't know how to use it.

After studying the code in which LUsolve is used, it seems that, for example, if one wants to solve the simultaneous linear equation Ax=b, one can use the statement LUsolve(A,x), where b is added to x in such a way that it is transferred to the left side. I do not understand why b is added to x. The code for the viewfactor method I referred to is as follows

if (Pstream::master())
// Variable emissivity
if (!constEmissivity_)
scalarSquareMatrix C(totalNCoarseFaces_, 0.0);

for (label i=0; i<totalNCoarseFaces_; i++)
for (label j=0; j<totalNCoarseFaces_; j++)
const scalar invEj = 1.0/E[j];
const scalar sigmaT4 =

if (i==j)
C(i, j) = invEj - (invEj - 1.0)*Fmatrix_()(i, j);
q[i] +=
(Fmatrix_()(i, j) - 1.0)*sigmaT4 + qrExt[j];
C(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
q[i] += Fmatrix_()(i, j)*sigmaT4;


Info<< "Solving view factor equations for band :"
<< bandI << endl;

// Negative coming into the fluid
LUsolve(C, q);
Here it is trying to solve the equation Cq=b,
Cij = deltaij/Ej - (1/Ej - 1)Fij
q = heat flux
b = A eb - Ho
eb = sigma*T^4
Ej = emissivity
Aij = deltaij - Fij
Fij = view factor matrix

Can someone please tell me how to use LUsolve in detail?
Thank you in advance.
gmori is offline   Reply With Quote

Old   August 28, 2022, 13:14
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 649
Rep Power: 20
jherb is on a distinguished road
Have a look at this thread: How to solve linear equations in codedFixedValue boundary?

It shows two different ways for solving linear equations in OpenFOAM. One if you want to solve for a vector in each cell of your mesh based on a 3x3 matrix and a vector and another for a generic square matrix.
jherb is offline   Reply With Quote

Old   August 29, 2022, 12:13
New Member
Join Date: May 2022
Posts: 15
Rep Power: 2
gmori is on a distinguished road
Thank you for your reply.
I will refer to the thread you indicated.
gmori is offline   Reply With Quote


lusolve, openfoam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntaxproblem LU decomposition of a matrix kathrin_kissling OpenFOAM Running, Solving & CFD 2 January 20, 2009 13:46

All times are GMT -4. The time now is 23:24.