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

Go to the source code of this file.

Functions/Subroutines

subroutine wye (node1, node2, nodem, nelem, lakon, kon, ipkon, nactdog, identity, ielprop, prop, iflag, v, xflow, f, nodef, idirf, df, cp, r, physcon, numf, set, mi, ider, ttime, time, iaxial)
 

Function/Subroutine Documentation

◆ wye()

subroutine wye ( integer  node1,
integer  node2,
integer  nodem,
integer  nelem,
character*8, dimension(*)  lakon,
integer, dimension(*)  kon,
integer, dimension(*)  ipkon,
integer, dimension(0:3,*)  nactdog,
logical  identity,
integer, dimension(*)  ielprop,
real*8, dimension(*)  prop,
integer  iflag,
real*8, dimension(0:mi(2),*)  v,
real*8  xflow,
real*8  f,
integer, dimension(*)  nodef,
integer, dimension(*)  idirf,
real*8, dimension(*)  df,
real*8  cp,
real*8  r,
real*8, dimension(*)  physcon,
integer  numf,
character*81, dimension(*)  set,
integer, dimension(2)  mi,
integer  ider,
real*8  ttime,
real*8  time,
integer  iaxial 
)
22 !
23 ! A wye split element(zeta calculation according to Idel'chik)
24 ! Written by Yavor Dobrev
25 ! For an explanation of the parameters see tee.f
26 !
27 ! author: Yannick Muller
28 !
29  implicit none
30 !
31  logical identity
32 !
33  character*81 set(*)
34  character*8 lakon(*)
35 !
36  integer nelem,nactdog(0:3,*),node1,node2,nodem,nodem1,numf,kon(*),
37  &ipkon(*),ielprop(*),nodef(*),idirf(*),index,iflag,inv,mi(2),
38  &nelem1,ichan_num,ider,icase,i,iaxial
39 !
40  real*8 prop(*),v(0:mi(2),*),xflow,f,df(*),kappa,r,tt1,tt2,pt1,pt2,
41  &cp,physcon(*),km1,kp1,kdkm1,pt2pt1,pt1pt2,pt2pt1_crit,tdkp1,
42  &a,a1,a2,a_s,calc_residual_wye,dh1,dh2,alpha,xflow1,xflow2,
43  &pi,zeta_fac,ts0,pspt0,pspt2,m1,m2,ts2,ttime,time
44 !
45  index=ielprop(nelem)
46 !
47  if (iflag.eq.0.d0) then
48  identity=.true.
49  if(nactdog(2,node1).ne.0)then
50  identity=.false.
51  elseif(nactdog(2,node2).ne.0)then
52  identity=.false.
53  elseif(nactdog(1,nodem).ne.0)then
54  identity=.false.
55  endif
56 !
57  elseif (iflag.eq.1)then
58 !
59  kappa=(cp/(cp-r))
60  kp1=kappa+1d0
61  km1=kappa-1d0
62  kdkm1=kappa/km1
63  tdkp1=2.d0/kp1
64 !
65  if(nelem.eq.nint(prop(index+2))) then
66  a=prop(index+4)
67  elseif(nelem.eq.nint(prop(index+3)))then
68  a=prop(index+6)
69  endif
70 !
71  pt1=v(2,node1)
72  pt2=v(2,node2)
73 !
74  if(pt1.ge.pt2) then
75  inv=1
76  tt1=v(0,node1)-physcon(1)
77  tt2=v(0,node2)-physcon(1)
78  else
79  inv=-1
80  pt1=v(2,node2)
81  pt2=v(2,node1)
82  tt1=v(0,node2)-physcon(1)
83  tt2=v(0,node1)-physcon(1)
84  endif
85 !
86  pt1pt2=pt1/pt2
87  pt2pt1=1/pt1pt2
88 !
89  pt2pt1_crit=tdkp1**kdkm1
90 !
91  if(pt2pt1.gt.pt2pt1_crit) then
92  xflow=inv*pt1*a*dsqrt(2.d0*kdkm1*pt2pt1**(2.d0/kappa)
93  & *(1.d0-pt2pt1**(1.d0/kdkm1))/r)/dsqrt(tt1)
94  else
95  xflow=inv*pt1*a*dsqrt(kappa/r)*tdkp1**(kp1/(2.d0*km1))/
96  & dsqrt(tt1)
97  endif
98  xflow=xflow/50
99 !
100  elseif (iflag.eq.2)then
101 !
102  numf=6
103 !
104  kappa=(cp/(cp-r))
105  pi=4.d0*datan(1.d0)
106 !
107 ! Inlet conditions are the same for both branches
108 !
109 ! Determining the previous element as
110 ! the incoming mass flow is defined there
111 !
112  nelem1=nint(prop(index+1))
113  nodem1=kon(ipkon(nelem1)+2)
114 !
115 ! Inlet conditions
116 !
117  pt1=v(2,node1)
118  tt1=v(0,node1)-physcon(1)
119  xflow1=v(1,nodem1)*iaxial
120  a1 = prop(index+4)
121 !
122 ! Outlet conditions
123 !
124  tt2=v(0,node2)
125  xflow2=v(1,nodem)*iaxial
126  pt2=v(2,node2)
127 !
128  if(nelem.eq.nint(prop(index+2))) then
129 !
130  a2 = a1
131  a_s = prop(index+6)
132 !
133  dh1 = prop(index+9)
134  if(dh1.eq.0.d0) then
135  dh1 = dsqrt(4*a1/pi)
136  endif
137 !
138  dh2 = dh1
139  alpha = 0
140  ichan_num = 1
141  zeta_fac = prop(index+13)
142 !
143  elseif(nelem.eq.nint(prop(index+3))) then
144 !
145  ichan_num = 2
146  a2 = prop(index+6)
147 !
148  dh1 = prop(index+9)
149  if(dh1.eq.0.d0) then
150  dh1 = dsqrt(4*a1/pi)
151  endif
152 !
153  dh2 = prop(index+10)
154  if(dh2.eq.0.d0) then
155  dh2 = dsqrt(4*a2/pi)
156  endif
157 !
158  alpha = prop(index+8)
159  zeta_fac = prop(index+14)
160 !
161  endif
162 !
163 ! Set the node numbers for the degrees of freedom
164  nodef(1)=node1
165  nodef(2)=node1
166  nodef(3)=nodem1
167  nodef(4)=nodem
168  nodef(5)=node2
169  nodef(6)=node2
170 !
171 ! Sets the types of the degrees of freedom
172  idirf(1)=2
173  idirf(2)=0
174  idirf(3)=1
175  idirf(4)=1
176  idirf(5)=2
177  idirf(6)=0
178 !
179  if(ider.eq.0.d0) then
180 ! Residual
181  f=calc_residual_wye(pt1,tt1,xflow1,xflow2,pt2,
182  &tt2,ichan_num,a1,a2,a_s,dh1,dh2,alpha,zeta_fac,kappa,r,ider,iflag)
183  else
184 ! Derivatives
185  call calc_ider_wye(df,pt1,tt1,xflow1,xflow2,pt2,
186  &tt2,ichan_num,a1,a2,a_s,dh1,dh2,alpha,zeta_fac,kappa,r,ider,iflag)
187  endif
188 !
189  elseif(iflag.eq.3) then
190 !
191  kappa=(cp/(cp-r))
192 ! setting icase (always adiabatic)
193  icase=0;
194 !
195  pi=4.d0*datan(1.d0)
196 !
197 ! Inlet conditions are the same for both branches
198 !
199 ! Determining the previous element as
200 ! the incoming mass flow is defined there
201  nelem1=nint(prop(index+1))
202  nodem1=kon(ipkon(nelem1)+2)
203 !
204 ! Inlet conditions
205  pt1=v(2,node1)
206  tt1=v(0,node1)-physcon(1)
207  xflow1=v(1,nodem1)*iaxial
208  a1 = prop(index+4)
209 !
210 ! Outlet conditions
211  tt2=v(0,node2)
212  xflow2=v(1,nodem)*iaxial
213  pt2=v(2,node2)
214 !
215  if(nelem.eq.nint(prop(index+2))) then
216 !
217  a2 = a1
218  a_s = prop(index+6)
219 !
220  dh1 = prop(index+9)
221  if(dh1.eq.0.d0) then
222  dh1 = dsqrt(4*a1/pi)
223  endif
224 !
225  dh2 = dh1
226  alpha = 0
227  ichan_num = 1
228  zeta_fac = prop(index+13)
229 !
230  elseif(nelem.eq.nint(prop(index+3))) then
231 !
232  ichan_num = 2
233  a2 = prop(index+6)
234 !
235  dh1 = prop(index+9)
236  if(dh1.eq.0.d0) then
237  dh1 = dsqrt(4*a1/pi)
238  endif
239 !
240  dh2 = prop(index+10)
241  if(dh2.eq.0.d0) then
242  dh2 = dsqrt(4*a2/pi)
243  endif
244 !
245  alpha = prop(index+8)
246  zeta_fac = prop(index+14)
247 !
248  endif
249 !
250 ! Write the main information about the element
251 !
252 ! Flow velocity at inlet
253  call ts_calc(xflow1,tt1,pt1,kappa,r,a1,ts0,icase)
254  pspt0 = (ts0/tt1)**(kappa/(kappa-1))
255 ! Calculate Mach numbers
256  call machpi(m1,pspt0,kappa,r)
257  call ts_calc(xflow2,tt2,pt2,kappa,r,a2,ts2,icase)
258 ! Pressure ratio
259  pspt2 = (ts2/tt2)**(kappa/(kappa-1))
260  call machpi(m2,pspt2,kappa,r)
261 !
262  write(1,*) ''
263  write(1,55) ' from node ',node1,
264  & ' to node ', node2,': air massflow rate= ',xflow
265 !
266  write(1,56)' Inlet node ',node1,': Tt1= ',tt1,
267  & ' , Ts1= ',ts0,' , Pt1= ',pt1,
268  & ', M1= ',m1
269  write(1,*)' Element ',nelem,lakon(nelem)
270  & ,', Branch ',ichan_num
271 !
272  55 format(1x,a,i6,a,i6,a,e11.4,a)
273  56 format(1x,a,i6,a,e11.4,a,e11.4,a,e11.4,a,e11.4)
274 !
275 ! Set ider to calculate the residual
276  ider = 0
277 !
278 ! Calculate the element one last time with enabled output
279  f=calc_residual_wye(pt1,tt1,xflow1,xflow2,pt2,
280  & tt2,ichan_num,a1,a2,a_s,dh1,dh2,alpha,zeta_fac,
281  & kappa,r,ider,iflag)
282 !
283  write(1,56)' Outlet node ',node2,': Tt2= ',tt2,
284  & ' , Ts2= ',ts2,' , Pt2= ',pt2,
285  & ', M2= ',m2
286 !
287  endif
288 !
289  xflow=xflow/iaxial
290  df(3)=df(3)*iaxial
291  df(4)=df(4)*iaxial
292 !
293  return
subroutine df(x, u, uprime, rpar, nev)
Definition: subspace.f:133
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
static double * e11
Definition: radflowload.c:42
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
subroutine calc_ider_wye(df, pt1, Tt1, xflow1, xflow2, pt2, Tt2, ichan_num, A1, A2, A_s, dh1, dh2, alpha, zeta_fac, kappa, R, ider, iflag)
Definition: calc_ider_wye.f:22
Hosted by OpenAircraft.com, (Michigan UAV, LLC)