# code for solving block tridiagonal system

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

 March 14, 2001, 19:04 code for solving block tridiagonal system #1 cfd Guest   Posts: n/a I am looking for a code to solve a block tridigonal system. In the book of Anderson "computational Fluid Mechanics and Heat tranfer", there is a code in the appedix, but seems it does not work. If anyone knows any info about any code to solve it, pls post it. Thanks a lot.

 March 16, 2001, 11:59 Re: code for solving block tridiagonal system #2 Kang, Seok Koo Guest   Posts: n/a I guess the code works. I'm sure. The problem is whether you are good at coding or not.

 March 16, 2001, 18:27 Re: code for solving block tridiagonal system #3 cfd Guest   Posts: n/a I just found an obvious error in the code. In the subroutine LUDECO, it should be integer order dimension A(order,1) other than dimension A(order,1) integer order Can you guess? Don't say anything before testing by yourself.

 March 16, 2001, 19:29 Re: code for solving block tridiagonal system #4 John C. Chien Guest   Posts: n/a (1). order is integer, so it should be iorder. (2). ordsq is order*order, is also integer, so it should be iordsq. (2). So, you can change order to iorder, ordsq to iordsq, and remove integer order, integer ordsq from the code. (3). When writing Fortran code, try to use the original convention. That is i,j,k,l,m,n are reserved for the first character of a integer name. (4). Let me know whether you can get it to work with these changes. I don't have time to check it out myself.

 March 17, 2001, 22:47 Re: code for solving block tridiagonal system #5 Kang, Seok Koo Guest   Posts: n/a Hmm~~ You became a little angry right?? First, I'm sorry if I made you angry. But, it is obvious that no one in this forum are concerned about whether the code you said works or not. This is not a forum for basic FORTRAN lecture. I know the code may have an error. If it does not work, then just try to use another code or you correct it. The fact that the code have an error is not important at all. Most of people have no problems in solving the problem you stated.

 March 18, 2001, 00:21 Re: code for solving block tridiagonal system #6 cfd Guest   Posts: n/a pls look the post http://www.cfd-online.com/Forum/main.cgi?read=15311 one more example. seems you have some connect with the authors of the book or the code.

 March 18, 2001, 01:15 Re: code for solving block tridiagonal system #7 John Calisch Guest   Posts: n/a Both of subroutine ludeco and lusolv have the same error. It appears that the code has not been tested in the form as in the book before publication of the book.

 March 18, 2001, 01:28 Re: code for solving block tridiagonal system #8 Eric Chang Guest   Posts: n/a From your judgement, there is some possibility that the code contains other errors

 March 18, 2001, 05:06 Re: code for solving block tridiagonal system #9 Kang, Seok Koo Guest   Posts: n/a Hm.. I don't have any connection with the author. As I said before, whether the code have an error or not is not important. Even middle school student can find the error if he is good at FORTRAN. It does not matter. If Anderson's tridiagonal solver contatins an error, use other program. Anderson's is not a FORTRAN book. The book can contain errors.

 March 18, 2001, 07:52 Re: code for solving block tridiagonal system #10 andy Guest   Posts: n/a Assuming there is a line break in the two statements, both pairs of statements are correct Fortran. From the specification of Fortran: "The names of variables, arrays, constants, statement functions, intrinsic functions, and dummy procedures have a scope of a program unit." Note this does not say the rest of the program unit after the declaration statement! Only a few Fortran complilers will reject the former pair of statements but one widely used one is gnu's Fortran compiler. I have also come across some HP Fortran compilers with the same problem. I suspect there are others. The source is probably a C mindset in the compiler writer (the main author of g77 quite happily admits to not being a Fortran programmer - this is not meant as a slight on the author by the way since the chances of g77 existing at all if the main author programmed principally in Fortran has got to be about zero!). So my advice would be to change your "Fortran" compiler rather than your CFD book!

 March 18, 2001, 12:30 Re: code for solving block tridiagonal system - PS #11 andy Guest   Posts: n/a If you have a Linux system and want (or need) to avoid this bug you can use the older Fortran compiler based on the f2c program which seems to parse Fortran a bit more accurately. Some systems have this older compiler under the name "fort77" fort77 fortranfile.f -o prog or if this is not there then you can use: f2c fortranfile.f > cfile.c gcc -lf2c cfile.c -o prog Note that you need to include the f2c library when linking. Mixing object code from the two compilers does not work. The names "f77" and "g77" will use the newer compiler.

 March 19, 2001, 22:25 Re: code for solving block tridiagonal system #12 John C. Chien Guest   Posts: n/a (1). The subroutines appeared in the Appendix B of the book has the opening statement: "The subroutine described here for solving block tridiagonal systems of equations were provided by Sukumar R. Chakravarthy of Rockwell International Science Center." (2). It appears that Mr. Chakravarthy is one of the vendor sponsor of the forum. So, it might be easier to get the answer directly from him. In this way, we might be able to get it settled down once for all. (3). So, if Mr. Chakravarthy is reading this forum, we would like to hear from him about the subroutine errors.

 March 20, 2001, 07:59 GOOD NEWS #13 A.M.Yang Guest   Posts: n/a Hi, The errors in Anderson's book are two subroutines (lusolv,ludeco).If you change those,you will work well. I have tested it.

 March 20, 2001, 12:12 Re: GOOD NEWS #14 john Calisch Guest   Posts: n/a Whether those discussed above are the errors you corrected?

 March 20, 2001, 12:43 Re: code for solving block tridiagonal system #15 cfd Guest   Posts: n/a From this site, it appears that you are a student in Civil Engineering. My advise to you is that you need to learn more about scientific attitudes, rather than civil engineering. You may find that will benifit you a lot.

 March 20, 2001, 13:19 Re: GOOD NEWS #16 cfd Guest   Posts: n/a same question as John Calisch's

 March 21, 2001, 00:29 Re: code for solving block tridiagonal system #17 Kang, Seok Koo Guest   Posts: n/a Thanks for your advice ~ My advice to you is that you need to learn more about CFD and FORTRAN, rather than finding faults with other people's remark. Regards. Seok Koo, Kang. Graduate Student, Civil Engineering, Hanyang University, Seoul, Korea.

 March 21, 2001, 08:48 Re: GOOD NEWS #18 A.M.Yang Guest   Posts: n/a Yes,only the two subroutines are error

 March 23, 2001, 02:54 Re: code for solving block tridiagonal system #19 A. Al-Otaiby Guest   Posts: n/a Try the routine listed in the book" Computational Fluid Dynamics for Engineers--Volume I" by Hoffman and Chian...I tried it, it is working...Good luck.

 March 26, 2001, 02:42 Re: code for solving block tridiagonal system #20 Mohsen Mahbubi Fard Guest   Posts: n/a I have started to work on it too.I wanted to ask you if you can email me the original code for further work.You know it's typing is difficult and boring! I will announce you about my work. Thank's in advance!