Fortran Help with these Fortran Compiler Errors please
Click For Summary
The discussion centers around troubleshooting compilation errors in Fortran code. Key points include the identification of a mismatched parenthesis error, with advice to check the balance of parentheses and to examine the first error in a stream of errors for resolution. Participants emphasize the importance of posting code directly in the forum rather than as images, which can obscure critical details. It is noted that unbalanced parentheses may stem from earlier code not visible in the provided snapshot. The conversation highlights the need for clarity in error reporting and the potential impact of formatting issues, such as spaces or indentation, on compilation errors. Ultimately, the original poster acknowledged their mistake after receiving guidance, leading to the closure of the thread.
Technology news on Phys.org
berkeman
Admin
- 69,298
- 24,520
Welcome to PhysicsForums. 
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.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
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
Gold Member
Dearly Missed
- 35,003
- 21,715
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.
Unfortunately, there also appears to be an error above that one.
PeterDonis
Mentor
- 49,414
- 25,455
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.
jedishrfu
Mentor
- 15,581
- 10,339
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.
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.
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
Gold Member
Dearly Missed
- 35,003
- 21,715
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.
Mark44
Mentor
- 38,069
- 10,588
Because we can't see the code that produced these errors.Vanadium 50 said:Or not.
We can't tell.
jedishrfu
Mentor
- 15,581
- 10,339
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...
berkeman
Admin
- 69,298
- 24,520
Mark44 said:Because we can't see the code that produced these errors.
Wait, what? I just ping my good friend Johnny...
https://en.wikipedia.org/wiki/Carnac_the_Magnificent
hmmm27
Gold Member
- 1,249
- 675
"parenthesis" - is v an array ?
"exponent" - what's the upper limit on exponents in reals ?
"unclassifiable" - does Fortran use interpuncts ?
"exponent" - what's the upper limit on exponents in reals ?
"unclassifiable" - does Fortran use interpuncts ?
jedishrfu
Mentor
- 15,581
- 10,339
Fix the first error before you look at the others as they may go away.
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
Gold Member
Dearly Missed
- 35,003
- 21,715
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.
Chaitanya_90
- 3
- 0
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:
jedishrfu
Mentor
- 15,581
- 10,339
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?
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?
Chaitanya_90
- 3
- 0
paranthesis i checked again its fine but i don't know the reason for error, maybe spaces or indentation might be causing the error
DrClaude
Mentor
- 8,477
- 5,694
What is the first error message?
berkeman
Admin
- 69,298
- 24,520
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.
Similar threads
Fortran
Passing variables in FORTRAN
- · Replies 25 ·
- Replies
- 25
- Views
- 3K
- · Replies 5 ·
- Replies
- 5
- Views
- 2K
- · Replies 2 ·
- Replies
- 2
- Views
- 2K
- · Replies 8 ·
- 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