Another "Expected a right parenthesis in expression at (1)"

1.8k views Asked by At

I'm trying to compile some code with Fortran 95 but get the following error:

 f(3,mx+1) = (f(1,mx+1)/(gamma1-1d0))*(0.25d0*(4d0&                
                                                   1
 Error: Expected a right parenthesis in expression at (1)

I thought it was a line continuation problem, so I tried to fix it by including the "&" symbol at the end of each line to continue to the next:

f(3,mx+1) = (f(1,mx+1)/(gamma1-1d0))*(0.25d0*(4d0&
 +rhow*(gamma21*f(2,mx+1)**2 + gamma21*f(2,mx+1)&
 + gamma21*0.25d0)+ sqrt(rhow)*(f(2,mx+1)&
 + 0.5d0)*(rhow*(f(2,mx+1)**2 + f(2,mx+1)&
 + 0.25d0) + rhow*(gamma21**2)*(f(2,mx+1)**2 + f(2,mx+1)&
 + 0.25d0) + gamma21*sqrt(16d0 + 2d0*rhow*f(2,mx+1)**2&
 + 2d0*rhow*f(2,mx+1) + 0.5d0*rhow)))) + 0.5d0*(f(2,mx+1)**2)

 f(3,mx+2) = 6*f(3,mx) - 8*f(3,mx-1) + 3*f(3,mx-2)

but that didn't seem to make a difference.

Any help would be much appreciated!

1

There are 1 answers

1
user2996697 On

Using the & symbol is not the correct way to continue lines in fixed-form Fortran95. In column 6 of any source line, any symbol excluding blank or 0 is a line continuation.