dimanche 20 novembre 2016

Calling the value of an array in subroutine in fortran 77

I am a beginner trying to do some engineering experiments using fortran 77. I am using Force 2.0 compiler and editor. I want to call the value of the existing array [KM(1:M)] on the following subroutine to be used in the calculation in the main program [EIKM(1:M)], but the values obtained are not in accordance with the value of the array. Can you tell me what is wrong and what should I do?

Thank you

  PROGRAM GENERATES_EIKM

  IMPLICIT NONE

  INTEGER I, M, N
  PARAMETER (M=65, N=3)
  REAL EIKM(1:M)

  REAL ALFA, EPSILON, NU, PI
  REAL U2RMS, KE, KEFISIENSI, KALI, KALE
  REAL KM(1:M), LS

  REAL KMLOW, KMHIGH, DELTAKM

  KMLOW=100
  KMHIGH = 10000
  DELTAKM = (KMHIGH-KMLOW)/(M-1)

  PI = 3.14
  ALFA = 1.453
  EPSILON = 10
  NU = 7
  LS = 23
  KE = ALFA*9*PI/(55*LS)
  KEFISIENSI = (EPSILON**(1/4))/(NU**(-3/4))


  CALL CALLING_THE_VALUE_OF_KM (M)

  WRITE (*,*) 'CHECKING THE VALUE OF KM AT DATA NUMBER 2 : ', KM(2)

  DO I=1,M
     U2RMS = (2/3*KM(I))**2
     KALI = KM(I)/KE
     KALE = KM(I)/KEFISIENSI
     EIKM(I) = ALFA*(U2RMS/KE)*((KALI**4)/((1+KALI**2)**(17/6)))*
 &           EXP(-2*(KALE**2))
     WRITE (*,*) 'THE VALUE OF EIKM AT (I) ', I, EIKM(I)
  END DO

  PAUSE
  END



  SUBROUTINE CALLING_THE_VALUE_OF_KM (M)

  REAL KM(1:M)
  INTEGER I
  REAL KMLOW, KMHIGH, DELTAKM
  KMLOW=100
  KMHIGH = 10000
  DELTAKM = (KMHIGH-KMLOW)/(M-1)

  WRITE(*,*) 'START OF CALLING_THE_VALUE_OF_KM'
  DO I=1,M
     KM(I) = KMLOW + DELTAKM*(I-1)
     WRITE(*,*) I, KM(I)
  END DO
  WRITE(*,*) 'END OF CALLING_THE_VALUE_OF_KM'
  WRITE(*,*) '--------------------'

  RETURN
  END




Aucun commentaire:

Enregistrer un commentaire