bnmurphy / PMCAMx-2008

This Repository is for testing version control between SU, Patras, and CMU
Other
3 stars 1 forks source link

recoursive function calls in xyadvec.f #20

Closed sebarn closed 10 years ago

sebarn commented 10 years ago

After I got hadvppm.f03 compiled in the fortran 2003 standard, I'm trying to do the same with xyadvec.f03 (check out my branch).

Somehwere around line 170 in xyadvec.f03, the code reads:

IF( lipr ) THEN
    !-----Change from X-direction horizontal advection
    l = 1
    DO i=i1+1,i2-1
        l = l+1
       IF( ipa_cel(i,j,k) .GT. 0 ) THEN
          ipa_idx = ipa_cel(i,j,k)
          !-----Flux at west boundary
          cipr(IPR_WADV, ipa_idx, ispc) = cipr(IPR_WADV, ipa_idx, ispc) + fc1(l)/dy/depth(i,j,k)          
          !-----Flux at east boundary
          cipr(IPR_EADV, ipa_idx, ispc) = cipr(IPR_EADV, ipa_idx, ispc) + fc2(l)/dy/depth(i,j,k)
          !-----Average volume
          cipr(IPR_VOL, ipa_idx, ispc) = cipr(IPR_VOL, ipa_idx, ispc) + dx(j)*dy*depth(i,j,k)
          npastep(ipa_idx,ispc) = npastep(ipa_idx,ispc) + 1
          END IF
    END DO
END IF

the compiler gives this output message as an error:

gfortran -std=f2003  -c -g -o build/Debug/GNU-Linux-x86/xyadvec.o xyadvec.f03
xyadvec.f03:177.42:

          cipr(IPR_WADV, ipa_idx, ispc) = cipr(IPR_WADV, ipa_idx, ispc) + fc1(l
                                          1
Error: Statement function at (1) is recursive

to be honest, I've never seen such a sloppy definition of a recursive function. I really don't understand what this code is supposed to achieve and why it's written like that. can you help me out?

sebarn commented 10 years ago

fyi

http://stackoverflow.com/questions/19752080/fortran-function-calls-raise-error-statement-function-at-1-is-recursive-at-co

sebarn commented 10 years ago

problem solved with help of stackoverflow; see link in comment above