Help with these Fortran Compiler Errors please

Click For Summary

Discussion Overview

The discussion revolves around troubleshooting compilation errors in Fortran code. Participants are seeking to identify the reasons for these errors, particularly focusing on issues related to mismatched parentheses and the presentation of code snippets.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • Some participants suggest that there may be a mismatching parenthesis error in the code, advising to count the parentheses to ensure they match.
  • Others point out that there are likely additional errors not visible in the provided code snapshot, indicating that the first error should be addressed before moving on to others.
  • One participant emphasizes the importance of viewing the first error in a stream of errors to potentially resolve subsequent issues.
  • There is a suggestion that the errors could be due to code that is not shown in the image, leading to uncertainty about the source of the compilation issues.
  • Some participants express frustration regarding the use of images to present code instead of directly pasting it into the forum post.
  • Technical questions are raised about specific terms in the code, such as the nature of "parenthesis" and the limits on "exponents" in reals.

Areas of Agreement / Disagreement

Participants generally agree that there are issues with the code related to parentheses and the presentation format. However, there is no consensus on the exact nature of the errors or how to resolve them, as multiple competing views and uncertainties remain.

Contextual Notes

Limitations include the absence of the complete code that produced the errors, which affects the ability to diagnose the issues accurately. The discussion also highlights the potential for new errors to arise when fixing existing ones.

Chaitanya_90
Messages
3
Reaction score
0
TL;DR
Please tell me the reason for error in following image of Fortran code
What is the reason for error while compilation
 

Attachments

  • IMG_20200826_221135.jpg
    IMG_20200826_221135.jpg
    78.4 KB · Views: 219
Technology news on Phys.org
Welcome to PhysicsForums. :smile:
Chaitanya_90 said:
Summary:: Please tell me the reason for error in following image of Fortran code

What is the reason for error while compilation
Looks like you at least have a mismatching parenthesis error. Try counting the number of left and right parenthesis to be sure that they match.
 
You're nicer than I would have been to someone who didn't even bother to type - paste, really - in his code.

Unfortunately, there also appears to be an error above that one.
 
  • Like
Likes   Reactions: berkeman
Chaitanya_90 said:
What is the reason for error while compilation

As @Vanadium 50 has remarked, you are not supposed to post code, or problem statements in general, as images. You are supposed to put your code directly into your post, inside a "CODE" block--see the "BBCode Guide" link at the bottom left of the post window for more details.
 
It seems you have a statement not shown in your snapshot that is missing a right parenthesis.Go back and look at your function calls and expressions.

Often when you get a stream of errors, it pays to look at the first one only and fix it and then recompile to see what remaining ones you still have.
 
  • Like
Likes   Reactions: Vanadium 50 and berkeman
jedishrfu said:
Often when you get a stream of errors, it pays to look at the first one only and fix it and then recompile to see what remaining ones you still have.

This. The fact we are seeing unbalanced parentheses might be due to something upstream.
Or not.
We can't tell.
 
  • Like
Likes   Reactions: jedishrfu
Vanadium 50 said:
Or not.
We can't tell.
Because we can't see the code that produced these errors.
 
  • Like
Likes   Reactions: jedishrfu
Vanadium 50 said:
This. The fact we are seeing unbalanced parentheses might be due to something upstream.
Or not.
We can't tell.

thats why I said: ...not shown in your snapshot...
 
  • #10
"parenthesis" - is v an array ?
"exponent" - what's the upper limit on exponents in reals ?
"unclassifiable" - does Fortran use interpuncts ?
 
  • #11
Fix the first error before you look at the others as they may go away.
 
  • Like
Likes   Reactions: Wrichik Basu and FactChecker
  • #12
jedishrfu said:
Fix the first error before you look at the others as they may go away.

Or change. Or sometimes you get new ones.
 
  • #13
Fortran:
*deck wenos
c-----------------------------------------------------------
csssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
c
       subroutine wenos(idirex)
       implicit none
c
c------------------------------------------------------------
       include 'com_main.h'
       include 'params.h'
c------------------------------------------------------------
c 
       integer idirex
       integer j     , i  
       integer ip    , I am    , jp    , jm
c
       real*8 ucon , vcon , ftx  , fty  , eno   ,
     &        tc   , tr   , tl   , tf   , ta    ,
     &        dtr  , dtl  , d2tcx, d2tlx, d2trx ,
     &        dtrr , dtll , dtff , dtaa ,
     &        dtf  , dta  , d2tcy, d2tfy, d2tay , 
     &        ur   , ul   , vf   , va   , rmnmd,
     &        trr  , tll  , tff  , taa
       real*8 S1,S2,S3,v1,v2,v3,v4,v5,phix1,phix2,phix3
       real*8 a11,a22,a33,a1,a2,a3,epss,tlll,taaa,trrr
       real*8 tfff,dtrrr,dtlll ,phixr,phixl,phixt,phixb
       real*8 dtfff,dtaaa,tempp,tempq,tempr,temps,tempt,tempu
c
c-----all parameters used here are defined----------------------------------------------------------------
c
       eno = one
c
       do 1000 j = 2, jbp1
c      
         jp = j + 1
         jm = j - 1
c
       do 1000 i = 2, ibp1
c     
         ip = i + 1   
         I am = i - 1

         ur = u(i ,j )
         ul = u(im,j )
         vf = v(i ,j )
         va = v(i ,jm)
c
         tc  = lsfn(i   ,j   )
         tr  = lsfn(ip  ,j   )
         tl  = lsfn(im  ,j   )
         tf  = lsfn(i   ,jp  )
         ta  = lsfn(i   ,jm  )
         trr = lsfn(ip+1,j   )
         tll = lsfn(im-1,j   )
         tff = lsfn(i   ,jp+1)
         taa = lsfn(i   ,jm-1)
         tlll = lsfn(im-2,j)
         taaa = lsfn(i,jm-2)
         trrr = lsfn(ip+2,j)
         tfff = lsfn(i,jp+2)
c
c------------------------------------------------------------
c >>> x-sweep
c------------------------------------------------------------
c
         if( idirex .eq. 1 ) then
c
           ucon = half*( ul + ur )
c
           dtr = rdxy * (tr - tc)
           dtl = rdxy * (tc - tl)
c
           if( i .lt. ibr ) then
             dtrr = (trr - tr) * rdxy
           else
             dtrr = dtr
           endif
c
           if( i .gt. 2 ) then
             dtll = (tl - tll) * rdxy
           else
             dtll = dtl
           endif
c
           if( i .gt. 3 ) then
             dtlll = (tll - tlll) * rdxy
           else
             dtlll = dtll
           endif
c
           if( i .lt. ibr-1 ) then
             dtrrr = (trrr - trr) * rdxy
           else
             dtrrr = dtrr
           endif
c
           v1 = dtlll
           v2 = dtll
           v3 = dtl
           v4 = dtr
           v5 = dtrr
           tempp = v1 − 2.0d0*v2 + v3
           tempq = v1 − 4.0d0*v2 + 3.0d0*v3
           tempr = v2 − 2.0d0*v3 + v4
           temps = v2 − v4
           tempt = v3 − 2.0d0*v4 + v5
           tempu = 3.0d0*v3 − 4.0d0*v4 + v5
           S1=(13./12.)*(tempp**2.)+(1./4.)*(tempq**2.)
           S2=(13./12.)*(tempr**2.)+(1./4.)*(temps**2.)
           S3=(13./12.)*(tempt**2.)+(1./4.)*(tempu**2.)
           phix1=(v1/6.)-(7.*v2/6.)+(11.*v3/6.)
           phix2=(-v2/6.)-(5.*v3/6.)+(v4/3.)
           phix3=(-v3/3.)-(5.*v4/6.)+(v5/6.)
           tempu=max(v1**2,v2**2,v3**2,v4**2,v5**2)
           epss=(10.0d-6)*tempu + (10.0d-99)
           a11=0·1/((S1+epss)**2)
           a22=0·6/((S2+epss)**2)
           a33=0·3/((S3+epss)**2)
           a1=a11/(a11+a22+a33)
           a2=a22/(a11+a22+a33)
           a3=a33/(a11+a22+a33)
           phixl=a1*phix1+a2*phix2+a3*phix3
c        
           v1=dtll
           v2=dtl
           v3=dtr
           v4=dtrr
           v5=dtrrr
           tempp=v1 − 2.0d0*v2 + v3
           tempq=v1 − 4.0d0*v2 + 3.0d0*v3
           tempr=v2 − 2.0d0*v3 + v4
           temps=v2 − v4
           tempt=v3 − 2.0d0*v4 + v5
           tempu=3.0d0*v3 − 4.0d0*v4 + v5
           S1=(13./12.)*(tempp**2.)+(1./4.)*(tempq**2.)
           S2=(13./12.)*(tempr**2.)+(1./4.)*(temps**2.)
           S3=(13./12.)*(tempt**2.)+(1./4.)*(tempu**2.)
           phix1=(v1/6.)-(7.*v2/6.)+(11.*v3/6.)
           phix2=(-v2/6.)-(5.*v3/6.)+(v4/3.)
           phix3=(-v3/3.)-(5.*v4/6.)+(v5/6.)
           tempu=max(v1**2,v2**2,v3**2,v4**2,v5**2)
           epss=(10.0d-6)*tempu + (10.0d-99)
           a11=0·1/((S1+epss)**2)
           a22=0·6/((S2+epss)**2)
           a33=0·3/((S3+epss)**2)
           a1=a11/(a11+a22+a33)
           a2=a22/(a11+a22+a33)
           a3=a33/(a11+a22+a33)
           phixr=a1*phix1+a2*phix2+a3*phix3
c
           if( ucon .gt. zero ) then
             ftx = ucon * phixl
           else
             ftx = ucon * phixr
           endif
c
           lsf(i,j) = lsfn(i,j) - dt * ftx
c
         endif
c------------------------------------------------------------
c >>> y-sweep
c------------------------------------------------------------
c
         if ( idirex .eq. 2 ) then
c
           vcon = half*( va + vf )
c
           dtf = rdxy * (tf - tc)
           dta = rdxy * (tc - ta)
c
           if( j .lt. jbp1 ) then
             dtff = (tff - tf) * rdxy
           else
             dtff = dtf
           endif
c
           if( j .gt. 2 ) then
             dtaa = (ta - taa) * rdxy
           else
             dtaa = dta
           endif
c
           if( j .gt. 3 ) then
             dtaaa = (taa - taaa) * rdxy
           else
             dtaaa = dtaa
           endif
c
           if( j .lt. jbr-1 ) then
             dtfff = (tfff - tff) * rdxy
           else
             dtfff = dtff
           endif
c
           v1=dtaaa
           v2=dtaa
           v3=dta
           v4=dtf
           v5=dtff
           tempp=v1 − 2.0d0*v2 + v3
           tempq=v1 − 4.0d0*v2 + 3.0d0*v3
           tempr=v2 − 2.0d0*v3 + v4
           temps=v2 − v4
           tempt=v3 − 2.0d0*v4 + v5
           tempu=3.0d0*v3 − 4.0d0*v4 + v5
           S1=(13./12.)*(tempp**2.)+(1./4.)*(tempq**2.)
           S2=(13./12.)*(tempr**2.)+(1./4.)*(temps**2.)
           S3=(13./12.)*(tempt**2.)+(1./4.)*(tempu**2.)
           phix1=(v1/6.)-(7.*v2/6.)+(11.*v3/6.)
           phix2=(-v2/6.)-(5.*v3/6.)+(v4/3.)
           phix3=(-v3/3.)-(5.*v4/6.)+(v5/6.)
           tempu=max(v1**2,v2**2,v3**2,v4**2,v5**2)
           epss=(10.0d-6)*tempu + (10.0d-99)
           a11=0·1/((S1+epss)**2)
           a22=0·6/((S2+epss)**2)
           a33=0·3/((S3+epss)**2)
           a1=a11/(a11+a22+a33)
           a2=a22/(a11+a22+a33)
           a3=a33/(a11+a22+a33)
           phixb=a1*phix1+a2*phix2+a3*phix3
c        
           v1=dtaa
           v2=dta
           v3=dtf
           v4=dtff
           v5=dtfff
           tempp=v1 − 2.0d0*v2 + v3
           tempq=v1 − 4.0d0*v2 + 3.0d0*v3
           tempr=v2 − 2.0d0*v3 + v4
           temps=v2 − v4
           tempt=v3 − 2.0d0*v4 + v5
           tempu=3.0d0*v3 − 4.0d0*v4 + v5
           S1=(13./12.)*(tempp**2.)+(1./4.)*(tempq**2.)
           S2=(13./12.)*(tempr**2.)+(1./4.)*(temps**2.)
           S3=(13./12.)*(tempt**2.)+(1./4.)*(tempu**2.)
           phix1=(v1/6.)-(7.*v2/6.)+(11.*v3/6.)
           phix2=(-v2/6.)-(5.*v3/6.)+(v4/3.)
           phix3=(-v3/3.)-(5.*v4/6.)+(v5/6.)
           tempu=max(v1**2,v2**2,v3**2,v4**2,v5**2)
           epss=(10.0d-6)*tempu + (10.0d-99)
           a11=0·1/((S1+epss)**2)
           a22=0·6/((S2+epss)**2)
           a33=0·3/((S3+epss)**2)
           a1=a11/(a11+a22+a33)
           a2=a22/(a11+a22+a33)
           a3=a33/(a11+a22+a33)
           phixt=a1*phix1+a2*phix2+a3*phix3
c
c           d2tcy = rdxy  * (dtf  - dta)
c           d2tfy = rdxy  * (dtff - dtf)
c           d2tay = rdxy  * (dta  - dtaa)
c
           if( vcon .gt. zero ) then
             fty = vcon * phixb
           else
             fty = vcon * phixt
           endif
c
           lsf(i,j) = lsfn(i,j) - dt * fty
c
         endif
c____________________________________________________________
c
1000  continue
c
      return
 
Last edited by a moderator:
  • #14
Your code listing doesn't match the error report line numbers. The error on line 112 is shown in your code listing at line 102. Have you dropped some lines from your code listing.

Also screenshots are very poor ways of conveying this info. You could instead capture your error report to a file.

Lastly, we aren't here to debug your program for you. Earlier we asked you to focus on the first error and if you checked your parenthesis balancing prior to line 112 in your error report. Have you done these things yet?
 
  • #15
paranthesis i checked again its fine but i don't know the reason for error, maybe spaces or indentation might be causing the error
 
  • #16
What is the first error message?
 
  • Like
Likes   Reactions: Vanadium 50 and Wrichik Basu
  • #17
The OP has let the Mentors know via PM that s/he found their mistake. Thanks to all who tried to help; the thread is now closed.
 
  • Like
Likes   Reactions: jedishrfu

Similar threads

  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K