- #1
Saladsamurai
- 3,020
- 7
I am freaking out man I have this program and in it I have the variable nPT declared as Integer. Somehow, after nPT is passed to subroutine, its value changes to a very large negative integer value. I cannot make sense of it. In the subroutine pasted at the bottom, the value of N (which is passed the value nPT in the subroutine) has the value of 452 immediately before the Do loop and a value of -1992004147 immediately after the Do loop.
I have not done anything to the value of N in the Do loop within this subroutine, so I do not know how it is changing.
Here is the pertinent part of the Main Program
The Subroutine v_unburned is as follows:
Any thoughts
I have not done anything to the value of N in the Do loop within this subroutine, so I do not know how it is changing.
Here is the pertinent part of the Main Program
Code:
nPT = j [B]! At this point nPT = 452[/B]
c ********************Calculate Thermodynamic Properties****************
[B]! At this point nPT = 452 still[/B]
c Unburned Gas Temperature
Call T_unburned(nPT,T_0,P_0,P,a_mix,R_mix,T_u)
[B]! At this point nPT = 452 still[/B]
c Unburned Gas Specific Volume
Call v_unburned(nPT,T_u,P,R_mix,v_u)
[COLOR="Red"] [B]! At this point nPT = -1992004147[/B][/COLOR]
The Subroutine v_unburned is as follows:
Code:
Subroutine v_unburned(N,T,P,R,v)
c////////////////////////////////////////////////////////////////////
c This subroutine calculates the specific volume (m**3/kg) of
c the nuburned gas using the ideal gas equation of state:
c pv = RT
c
c INPUT:
c
c P = pressure array
c T = temperature array
c R = gas constant of mixture
c N = number of elements
c
c OUTPUT:
c
c v = specific volume (m**3 / kg) array
c
c////////////////////////////////////////////////////////////////////
Real*8 T(1000),P(1000),v(1000),R
Integer i, N
[B]! At this point N = 452 [/B] N is nPT in the subroutine
Do i = 1,N
v(i)=R * T(i) / (P(i) * 101.325 / 14.7)
End Do
[COLOR="Red"] [B]! At this point nPT = -1992004147[/B][/COLOR]
Return
End
Any thoughts