CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Solving Linear System of Equations in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2010, 02:28
Default Solving Linear System of Equations in UDF
  #1
Member
 
MOHSEN Zendehbad
Join Date: Aug 2009
Posts: 35
Rep Power: 17
mohsen zendehbad is on a distinguished road
Somewhere in my UDF i should solve linear system of equations(Ax = b), where i have A matrix and b vector and i need to compute x vector,
Now do any one know if there is an internal linear solver in fluent udf that i can use to compute x vector?

REGARDS
mohsen zendehbad is offline   Reply With Quote

Old   April 25, 2010, 10:05
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
I think I've seen in one of the *.h files of Fluent a declaration for a Gauss solver (I don't have a Fluent installed on this machine to give you an exact name).

However I'm sure you can find on Internet a simple Gauss solver in pure C, you can simply use this function in your UDF.

Do
DoHander is offline   Reply With Quote

Old   April 26, 2010, 15:56
Default
  #3
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
Precisely the above mentioned code is in linalg.h in your Fluent directory, this is a piece of code from the file:

void Gauss_Elimination(const int n_rows, const int n_cols, real A[], real X[], real B[], int swap_rows)

This is what you need ! (I hope)

Do
DoHander is offline   Reply With Quote

Old   April 26, 2010, 19:42
Default
  #4
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,286
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by mohsen zendehbad View Post
Somewhere in my UDF i should solve linear system of equations(Ax = b), where i have A matrix and b vector and i need to compute x vector,
Now do any one know if there is an internal linear solver in fluent udf that i can use to compute x vector?

REGARDS

why you want to use fluent. Do you need this as a part of simulation.

if you do not need it as part of simultion than there are many libraries that would do it for you.
arjun is offline   Reply With Quote

Old   May 8, 2010, 08:48
Default
  #5
Member
 
MOHSEN Zendehbad
Join Date: Aug 2009
Posts: 35
Rep Power: 17
mohsen zendehbad is on a distinguished road
Isn't there any iterative method (such as GMRES or conjugate gradient) since gauss elimination is not responding to huge matrices?

REGARDS
MZ
mohsen zendehbad is offline   Reply With Quote

Old   May 8, 2010, 11:39
Default
  #6
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
Hello,

I've found only Gauss, but you can search in all Fluent's *.h files from the udf's directory, maybe I've missed something (probably there are less then 100 *.h files so you can do a quick check).

If you want a more complex solver I'm sure you can link your udf with an open source math library (I said open source because you will need to compile this just like you compile your own UDF). Unfortunately you need a pure C library, I think GSL ( http://www.gnu.org/software/gsl/ ) may be a good choice, not sure how easy it will be for you to recompile it.

Or you can write a C wrapper for Lapack which is a state of the art linear algebra library, probably this will be more feasible for any operating system (Lapack is written in Fortran).

Do you use Linux or Windows ?

Do
DoHander is offline   Reply With Quote

Reply


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
convergence problem when use pisoFoam, LES for wind tunnel case Forrest_Lei OpenFOAM 3 July 19, 2011 07:00
Unknown error sivakumar OpenFOAM Pre-Processing 9 September 9, 2008 13:53
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58
advice needed in solving linear system yf yap Main CFD Forum 5 February 5, 2001 01:21


All times are GMT -4. The time now is 20:30.