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

Go to the source code of this file.

Functions/Subroutines

real *8 function calc_residual_wye (pt1, Tt1, xflow1, xflow2, pt2, Tt2, ichan_num, A1, A2, A_s, dh1, dh2, alpha, zeta_fac, kappa, R, ider, iflag)
 

Function/Subroutine Documentation

◆ calc_residual_wye()

real*8 function calc_residual_wye ( real*8  pt1,
real*8  Tt1,
real*8  xflow1,
real*8  xflow2,
real*8  pt2,
real*8  Tt2,
integer  ichan_num,
real*8  A1,
real*8  A2,
real*8  A_s,
real*8  dh1,
real*8  dh2,
real*8  alpha,
real*8  zeta_fac,
real*8  kappa,
real*8  R,
integer  ider,
integer  iflag 
)
23 !
24  implicit none
25 !
26  integer icase,ichan_num,icrit1,icrit2,ider,iflag
27 !
28  real*8
29 ! In- and Output
30  &f,
31  &r,
32 !
33 ! Kappa stuff
34  &kappa,
35 !
36  &pt1,
37  &pt2,
38  &tt1,
39  &tt2,
40  &xflow1,
41  &xflow2,
42 !
43  &zeta,
44 !
45  &a1,
46  &a2,
47  &a_s,
48 !
49  &ts1,
50  &ts2,
51  &ts_s,
52  &dh1,
53  &dh2,
54  &alpha,
55  &q_crit,
56  &pspt_crit,
57  &q0,
58  &q1,
59  &q2,
60  &pspt0,
61  &pspt1,
62  &w1,
63  &w2,
64  &w1w2,
65  &w2w1,
66  &vsv1,
67  &pi,
68  &z2d390,
69  &z1p090,
70  &z60,
71  &z90,
72  &hq,
73  &ts0,
74  &zeta_fac,
75  &m1,
76  &m2,
77  &pspt2
78 !
79  real*8 table_a(2,11)
80 !
81  icrit1 = 0
82  icrit2 = 0
83 !
84 ! setting icase (always adiabatic)
85  icase=0;
86 !
87  pi=4.d0*datan(1.d0)
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  q0 = xflow1*dsqrt(tt1)/pt1/a1
93  q1 = xflow2*dsqrt(tt1)/pt1/a2
94  if(q1.ge.q_crit) then
95  q1 = q_crit
96  icrit1 = 1
97  write(*,*)'*WARNING in Wye:'
98  write(*,*)'Critical conditions at 1'
99  endif
100  q2 = xflow2*dsqrt(tt1)/pt2/a2
101  if(q2.ge.q_crit) then
102  q2 = q_crit
103  icrit2 = 1
104  write(*,*)'*WARNING in Wye:'
105  write(*,*)'Critical conditions at 2'
106  endif
107 !
108 ! Flow velocity at inlet
109  ts0=tt1
110 
111  call ts_calc(xflow1,tt1,pt1,kappa,r,a1,ts0,icase)
112  pspt0 = (ts0/tt1)**(kappa/(kappa-1))
113  call wpi(w1, pspt0, q0,
114  & dsqrt(tt1),kappa,r)
115 !
116 ! Flow velocity at outlet
117  call ts_calc(xflow2,tt1,pt1,kappa,r,a2,ts1,icase)
118  pspt1 = (ts1/tt1)**(kappa/(kappa-1))
119  call wpi(w2, pspt1, q1,
120  & dsqrt(tt1),kappa,r)
121 !
122  w2w1=w2/w1
123  w1w2=w1/w2
124 !
125 ! Zeta calculation
126 ! Main branch
127  if(ichan_num.eq.1) then
128 ! Zeta as in Calculix and old ACC tool
129  zeta=0.4d0*(1-w2w1)**2
130  zeta=zeta*(w1w2)**2
131 !
132 ! Branch
133  elseif(ichan_num.eq.2) then
134  hq=dh2/dh1
135 !
136 ! Interpolation as in CalculiX
137  if(alpha.le.60.or.hq.le.2.d0/3.d0) then
138  zeta=0.95d0*((w2w1-2d0*dcos(alpha*pi/180))
139  & *w2w1+1.d0)
140  zeta=zeta*(w1w2)**2
141  else
142  z2d390=0.95d0*((w2w1-2d0*dcos(90.d0*pi/180))
143  & *w2w1+1.d0)
144 !
145  z1p090=0.95*(0.34d0+w2w1**2)
146 !
147  z90=z2d390+(3*hq-2.d0)*(z1p090-z2d390)
148 !
149  z60=0.95d0*((w2w1-2d0*dcos(60.d0*pi/180))
150  & *w2w1+1.d0)
151 !
152  zeta=z60+(alpha/30.d0-2.d0)*(z90-z60)
153  zeta=zeta*(w1w2)**2
154  endif
155  endif
156 !
157  zeta = zeta*zeta_fac
158 !
159  if(icrit2.ne.1) then
160  if(icrit1.ne.1) then
161  f = pt2 - pt1*pspt1**zeta
162  else
163  f = xflow2*dsqrt(tt1)/pt1/a2-q_crit
164  endif
165  else
166  f = xflow2*dsqrt(tt1)/pt2/a2-q_crit
167  endif
168 !
170 
171  if(iflag.eq.4) then
172 ! Calculate Mach numbers
173  call machpi(m1,pspt0,kappa,r)
174  call ts_calc(xflow2,tt2,pt2,kappa,r,a2,ts2,icase)
175 ! Pressure ratio
176  pspt2 = (ts2/tt2)**(kappa/(kappa-1))
177  call machpi(m2,pspt2,kappa,r)
178 
179  write(1,80)'Inlet: Tt1= ',tt1,
180  & ', pt1= ',pt1,', M1= ',m1
181 
182  write(1,77)'mass flow = ',xflow2,', kappa = ',kappa,
183  & ', zeta= ',zeta
184 
185  write(1,80)'Outlet: Tt2= ',tt2,
186  & ', pt2= ',pt2,', M2= ',m2
187 
188  80 format(3x,a,f10.6,a,f10.2,a,f10.6)
189  77 format(3x,a,f10.6,a,f10.2,a,f10.6)
190  endif
191 !
192  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_wye(pt1, Tt1, xflow1, xflow2, pt2, Tt2, ichan_num, A1, A2, A_s, dh1, dh2, alpha, zeta_fac, kappa, R, ider, iflag)
Definition: calc_residual_wye.f:23
Hosted by OpenAircraft.com, (Michigan UAV, LLC)