Need help resolving INTEGER based and "out of bounds" errors please
Need help resolving INTEGER based and "out of bounds" errors please
(OP)
Quite a newbie here with fortran and require some assistance with the few errors that I am unable to resolve after quite a lot of efforts put into reading and understanding similar problems. Would be great if someone is able to help me out :)
The code file can be found here: sysden.com/Trial.f
CODE -->
$ make Trial1 gfortran Trial1.f -o Trial1 Trial1.f:16.24: INTEGER IER,IW,K,J 1 Error: Symbol 'j' at (1) already has basic type of INTEGER Trial1.f:47.11: IW = 1500 1 Warning: Extension: Conversion from INTEGER(4) to LOGICAL(4) at (1) Trial1.f:164.12: DO 18, K=1,1000 1 Error: Loop variable at (1) must be INTEGER Trial1.f:267.10: Fxr(2) = (Ex(2)/psi)*(FR(2)/ER(2)) 1 Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1 Trial1.f:268.10: Fyr(2) = (Ey(2)/phi)*(FR(2)/ER(2)) 1 Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1 Trial1.f:283.30: F(3) = (-S(2)-2.0d0*Fxr(2)-FT(2)*X(5))/mw 1 Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1 Trial1.f:284.32: F(4) = (-S(4)-2.0d0*a*Fyr(2))/Iwy 1 Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1 <builtin>: recipe for target 'Trial1' failed make: *** [Trial1] Error 1
The code file can be found here: sysden.com/Trial.f
RE: Need help resolving INTEGER based and "out of bounds" errors please
Basically, until you gain more experience fix one error at a time...the first, every time. And THEN see what happens next.
I hope you know what you are doing when you say "IMPLICIT LOGICAL (A-Z)"
RE: Need help resolving INTEGER based and "out of bounds" errors please
RE: Need help resolving INTEGER based and "out of bounds" errors please
xwb, this is part of my project work and have been asked to code as per Fortran 77. Don't really have an option there. :)
- I removed the "J" from line 16. Should have spotted that earlier. Don't know how I missed that out.
- Also changed "IMPLICIT LOGICAL (A-Z)" to "IMPLICIT NONE" which helped me get rid of the IW error and the DO loop error based on some advise.
- Managed to get rid of the Fxr and Fyr errors by changing Fxr(2) to Fxr(1) and similarly.
This has popped out a few more errors though.
I searched for all the "COMMON /PARAM/ V" entries and it seems that there are no other variables mentioned alongside. Don't know what exactly the error telling me to be honest.
Any help is greatly appreciated!
RE: Need help resolving INTEGER based and "out of bounds" errors please
RE: Need help resolving INTEGER based and "out of bounds" errors please
But common /param/ V in subroutine FCN has V being declared as a scalar.
In subroutine, they do calculate two creep forces, namely, front and rear axles...so Fxr(2), Fyr(2) was the intended thing to do on the left hand side of those equations...the fix was to go back to the declaration of those arrays and make them be 2 entries long and not just 1.
RE: Need help resolving INTEGER based and "out of bounds" errors please
When programming in this style, I typically keep variable names the same everywhere in my program so that I can type declarations and common blocks once and then copy and paste wherever else I need them.