CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
calc_residual_tee.f File Reference

Go to the source code of this file.

Functions/Subroutines

real *8 function calc_residual_tee (pt1, Tt1, xflow1, xflow2, pt2, Tt2, A1, A2, zeta_fac, kappa, R, ider, iflag)
 

Function/Subroutine Documentation

◆ calc_residual_tee()

real*8 function calc_residual_tee ( real*8  pt1,
real*8  Tt1,
real*8  xflow1,
real*8  xflow2,
real*8  pt2,
real*8  Tt2,
real*8  A1,
real*8  A2,
real*8  zeta_fac,
real*8  kappa,
real*8  R,
integer  ider,
integer  iflag 
)
20 !
21 ! Function for calculating the residual of both branches of a tee
22 !
23 ! author: Yannick Muller
24 !
25  implicit none
26 !
27  integer
28 ! Isothermal/adiabatic
29  &icase,
30 ! Residual/Derivatives
31  &ider,
32 ! Critical conditions at inlet or outlet
33  &icrit1,
34  &icrit2,
35 ! Where we are in the program
36  &iflag
37 !
38  real*8
39 ! Residual
40  &f,
41 ! Kappa stuff
42  &kappa,
43  &r,
44 ! State variables
45  &pt1,
46  &pt2,
47  &tt1,
48  &tt2,
49  &ts0,
50  &ts1,
51  &ts2,
52  &xflow1,
53  &xflow2,
54 !
55  &pt2_lim,
56 !
57  &zeta,
58  &zeta_fac,
59 !
60 ! Areas
61  &a1,
62  &a2,
63 ! Reduced mass flows
64  &q0,
65  &q1,
66  &q2,
67  &q_crit,
68 ! Pressure ratios
69  &pspt_crit,
70  &pspt0,
71  &pspt1,
72  &pspt2,
73 ! Flow velocities
74  &w1,
75  &w2,
76  &w1w2,
77  &w2w1,
78 ! Mach numbers,
79  &m1,
80  &m2
81 !
82  icrit1 = 0
83  icrit2 = 0
84 ! setting icase (always adiabatic)
85  icase=0;
86 !
87 ! Critical values
88  q_crit = dsqrt(kappa/r)*
89  & (1+0.5d0*(kappa-1))**(-0.5d0*(kappa+1)/(kappa-1))
90  pspt_crit = (2/(kappa+1)) ** (kappa/(kappa-1))
91 !
92 ! These reduced mass flows are equivalent
93 ! (reduced mass flow at inlet)
94  q0 = xflow1*dsqrt(tt1)/pt1/a1
95  q1 = xflow2*dsqrt(tt1)/pt1/a2
96  if(q1.ge.q_crit) then
97  q1 = q_crit
98  icrit1 = 1
99  write(*,*)'*WARNING in Tee:'
100  write(*,*)'Critical conditions at 1'
101  endif
102 ! Reduced mass flow at outlet
103  q2 = xflow2*dsqrt(tt1)/pt2/a2
104  if(q2.ge.q_crit) then
105  q2 = q_crit
106  icrit2 = 1
107  write(*,*)'*WARNING in Tee:'
108  write(*,*)'Critical conditions at 2'
109  endif
110 !
111 ! Flow velocity at inlet
112 ! Static temperature
113  ts0=tt1
114  call ts_calc(xflow1,tt1,pt1,kappa,r,a1,ts0,icase)
115 ! Pressure ratio
116  pspt0 = (ts0/tt1)**(kappa/(kappa-1))
117 ! Velocity
118  call wpi(w1, pspt0, q0,
119  & dsqrt(tt1),kappa,r)
120 !
121 ! Flow velocity at outlet
122 ! Static temperature
123  call ts_calc(xflow2,tt1,pt1,kappa,r,a2,ts1,icase)
124 ! Pressure ratio
125  pspt1 = (ts1/tt1)**(kappa/(kappa-1))
126 ! Velocity
127  call wpi(w2, pspt1, q1,
128  & dsqrt(tt1),kappa,r)
129 !
130 ! Velocity ratio
131  w2w1=w2/w1
132  w1w2=w1/w2
133 !
134 ! Zeta calculation
135  zeta=1.d0+0.3d0*w2w1**2
136  zeta=zeta*(w1w2)**2
137 !
138  zeta = zeta_fac*zeta
139 !
140 ! Residual calculation
141  if(icrit2.ne.1) then
142  if(icrit1.ne.1) then
143  f = pt2 - pt1*pspt1**zeta
144  else
145  f = xflow2*dsqrt(tt1)/pt1/a2-q_crit
146  endif
147  else
148  f = xflow2*dsqrt(tt1)/pt2/a2-q_crit
149  endif
150 !
151  if(iflag.eq.3) then
152 !
153  write(1,57)' zeta= ',zeta
154  57 format(1x,a,f9.4)
155 !
156  else if (iflag.eq.4) then
157 
158 ! Calculate Mach numbers
159  call machpi(m1,pspt0,kappa,r)
160  call ts_calc(xflow2,tt2,pt2,kappa,r,a2,ts2,icase)
161 ! Pressure ratio
162  pspt2 = (ts2/tt2)**(kappa/(kappa-1))
163  call machpi(m2,pspt2,kappa,r)
164 
165  write(1,80)'Inlet: Tt1= ',tt1,
166  & ', pt1= ',pt1,', M1= ',m1
167 
168  write(1,77)'mass flow = ',xflow2,', kappa = ',kappa,
169  & ', zeta= ',zeta
170 
171  write(1,80)'Outlet: Tt2= ',tt2,
172  & ', pt2= ',pt2,', M2= ',m2
173 
174  80 format(3x,a,f10.6,a,f10.2,a,f10.6)
175  77 format(3x,a,f10.6,a,f10.2,a,f10.6)
176  endif
177 !
179 !
180  return
subroutine wpi(W, PI, Q, SQTT, kappa, RGAS)
Definition: wpi.f:23
subroutine ts_calc(xflow, Tt, Pt, kappa, r, A, Ts, icase)
Definition: ts_calc.f:20
subroutine machpi(MACH, PI, kappa, rgas)
Definition: machpi.f:23
real *8 function calc_residual_tee(pt1, Tt1, xflow1, xflow2, pt2, Tt2, A1, A2, zeta_fac, kappa, R, ider, iflag)
Definition: calc_residual_tee.f:20
Hosted by OpenAircraft.com, (Michigan UAV, LLC)