1 year ago

#374163

test-img

Tessa

Invalid character in name at 1; spacing to blame?

I'm debugging some Fortran code. I should note I'm not familiar with Fortran (the code was someone else's that I'm modifying for a different project). It's basically a list of chemical reaction rates for a simulation.

The rate I'm having trouble implementing is as follows:

  if (CHEMJ(1,J).EQ.'HNO3'.AND.CHEMJ(2,J).EQ.'OH') THEN
   A(J,I) = 2.4E-14*EXP(460./T(I))+6.5E-34 *exp(1335./T(I)) *
   ((1+6.5E-34) * EXP(-1335./T(I))/2.7E-17 *EXP(2199./T(I)))
  endif

However, this keeps triggering the following error:

  285 |    A(J,I) = 2.4E-14*EXP(460./T(I))+6.5E-34 *
      |                         1
  Error: Invalid character in name at (1)

I'm not sure why 460. is being read as invalid, though I'm guessing it has something to do with the fact the code wraps around. I've tried adding an &, but that didn't seem to help, either. Since this is legacy code, I can't easily change the file from .f to .f90, so I'm stuck with dealing with the older style of wrap-around.

Any ideas how to fix this particular bug?

fortran

0 Answers

Your Answer

Accepted video resources