Help with these Fortran Compiler Errors please

In summary, you have a mismatch between the number of left and right parenthesis, and there may also be an error above that one.
  • #1
Chaitanya_90
3
0
TL;DR Summary
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: 160
Technology news on Phys.org
  • #2
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.
 
  • #3
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 berkeman
  • #4
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.
 
  • #5
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 Vanadium 50 and berkeman
  • #6
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 jedishrfu
  • #7
Vanadium 50 said:
Or not.
We can't tell.
Because we can't see the code that produced these errors.
 
  • Like
Likes jedishrfu
  • #8
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 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 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 jedishrfu

1. What are Fortran compiler errors?

Fortran compiler errors are errors that occur during the process of compiling a Fortran program. These errors can be caused by syntax errors, logic errors, or other issues in the code that prevent the program from being compiled successfully.

2. How do I fix Fortran compiler errors?

The first step to fixing Fortran compiler errors is to carefully read the error messages and identify the line or lines of code that are causing the error. Then, check the syntax and logic of those lines of code to find and fix any errors. It can also be helpful to consult the documentation for your specific Fortran compiler for more information on common errors and how to fix them.

3. Why am I getting Fortran compiler errors?

There can be several reasons for getting Fortran compiler errors. Some common causes include syntax errors, such as missing or incorrect punctuation, logic errors that cause the program to behave unexpectedly, or issues with the compiler itself. It's important to carefully review the code and error messages to pinpoint the specific cause of the errors.

4. Can I prevent Fortran compiler errors?

While it's impossible to completely prevent Fortran compiler errors, there are steps you can take to minimize their occurrence. These include writing clean and well-structured code, testing your program as you write it, and using a reliable and up-to-date Fortran compiler.

5. Are there resources available for troubleshooting Fortran compiler errors?

Yes, there are many resources available for troubleshooting Fortran compiler errors. These include online forums and communities where experienced Fortran programmers can offer assistance, as well as official documentation and tutorials provided by the creators of the Fortran compiler you are using.

Similar threads

Replies
6
Views
1K
  • Programming and Computer Science
Replies
12
Views
2K
  • Nuclear Engineering
Replies
6
Views
1K
  • Programming and Computer Science
Replies
22
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
13
Views
2K
  • Programming and Computer Science
Replies
2
Views
829
  • Programming and Computer Science
Replies
5
Views
982
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
2
Views
620
Back
Top