Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
24 Views

Code not converging, help

Hello, i'm a engineer student and never used fortran before. I'm  using it at a class, and we have to solve a 2D transient heat transfer problem. When I run my code, the solution does not converge. I think I am calculating the RMS wrong. Could you give me a hand?

 

 

0 Kudos
3 Replies
Highlighted
New Contributor II
24 Views

Probably nobody will be willing to trace through your code to find your problem, and there is a general reluctance to help students with class assignments.

My advice is to learn to use debugging write statements:

write(*,'(a,i6,2e12.3)') 'This is a debugging message about: ivar, avar, bvar: ',ivar,avar,bvar

Inserting such write statements into your code should help you to find where variables are not taking the values that you expect.

0 Kudos
Highlighted
24 Views

Thank you

 

gib wrote:

Probably nobody will be willing to trace through your code to find your problem, and there is a general reluctance to help students with class assignments.

My advice is to learn to use debugging write statements:

write(*,'(a,i6,2e12.3)') 'This is a debugging message about: ivar, avar, bvar: ',ivar,avar,bvar

Inserting such write statements into your code should help you to find where variables are not taking the values that you expect.

0 Kudos
Highlighted
24 Views

You have a tolerance (tol) that is fixed, real, at 9.0D-3

*** Note, both RMS and tol are declared (in all places) as REAL and not REAL(8) (or DOUBLE PRECISION)

You to not state the typical magnitude(s) of RMS.

REAL (single precision) floating point has 7+fraction digits of precision. Assume for the moment your tolerance is 1.0D-2. This means if your RMS is larger than 99999.nn or so, you may never converge.

I suggest you uncomment the write(*,*) residuo statements, then

a) using a data set that converges, make a run, saving the output.
b) then using a data set  that does not converge, make a run, saving the output.

then compare the two outputs. Either the RMS will never converge do to an incorrupt assumption that convergence is at 9.0E-3, or you data is corrupt and producing unusual values.

Jim Dempsey

 

0 Kudos