CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

code for solving block tridiagonal system

Register Blogs Community New Posts Updated Threads Search

Closed Thread
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 14, 2001, 20:04
Default 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.
 

Old   March 16, 2001, 12:59
Default 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.

 

Old   March 16, 2001, 19:27
Default 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.
 

Old   March 16, 2001, 20:29
Default 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.
 

Old   March 17, 2001, 23:47
Default 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.
 

Old   March 18, 2001, 01:21
Default 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.
 

Old   March 18, 2001, 02:15
Default 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.
 

Old   March 18, 2001, 02:28
Default 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
 

Old   March 18, 2001, 06:06
Default 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.
 

Old   March 18, 2001, 08:52
Default 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!

 

Old   March 18, 2001, 13:30
Default 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.

 

Old   March 19, 2001, 23:25
Default 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.
 

Old   March 20, 2001, 08:59
Default 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.
 

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

Old   March 20, 2001, 13:43
Default 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.
 

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

Old   March 21, 2001, 01:29
Default 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.
 

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

Old   March 23, 2001, 03:54
Default 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.
 

Old   March 26, 2001, 03:42
Default 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!
 

Closed Thread


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
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 19:56
Fastest parallel solver for tridiagonal system Arpiruk Main CFD Forum 16 August 28, 2007 06:14
free code about "system identification" ztdep Main CFD Forum 1 April 14, 2007 21:58
Block Tridiagonal Solver Abdulhafid M. Elfaghi Main CFD Forum 2 December 23, 2006 13:20
Code with reliable free surface capability in a rotating system Subhasish Roy Choudhury Main CFD Forum 1 September 4, 1998 19:47


All times are GMT -4. The time now is 04:08.