Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Code not converging, help

fritoli__giovani
Beginner
413 Views

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
gib
New Contributor II
413 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
fritoli__giovani
Beginner
413 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
jimdempseyatthecove
Honored Contributor III
413 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
Reply