MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
cylprop.f90
Go to the documentation of this file.
1 
7 module cylprop
8  use constants
9  use solidprop
10  use specfun
11  implicit none
12  private
13  public trextcoeffintstrut,extcoeffintstrut,scattcoeffintstrut,cylconst
14 contains
15 !********************************BEGINNING*************************************
21 subroutine cylconst(lambda,theta,radius,Qs,Qt,gcyl)
22  real(dp), intent(in) :: lambda
23  real(dp), intent(in) :: theta
24  real(dp), intent(in) :: radius
25  real(dp), intent(out) :: Qs
26  real(dp), intent(out) :: Qt
27  real(dp), intent(out) :: gcyl
28  integer :: &
29  i,k,kmax,nwaw=1001
30  real(dp) :: &
31  x,& !diffraction parameter
32  tol=1e-10_dp,& !tolerance for calculation of Bessel functions
33  phi,& !scattered angle
34  s1,s2,qte,qth,qse,qsh!,mue,muh
35  complex(dp) :: &
36  m,& !complex index of refraction
37  u,v,s,Dk,Rk,Ak1,Akm,Bk1,Bkm,Deltak
38  complex(dp) :: &
39  T1,T2,T3,T4
40  real(dp), dimension(:), allocatable :: &
41  adsr !angular distribution of scattered radiation
42  complex(dp), dimension(:), allocatable :: &
43  ae,ah,be,bh,ju,dju,yu,dyu,jv,djv,yv,dyv,h1v,dh1v,h2v,dh2v
44  call optconst(lambda,n2,k2)
45 ! n2=1.6_dp
46 ! k2=0.01_dp
47  m=cmplx(n2,-k2,kind=dp)
48  x=2*pi*radius/lambda
49  u=x*sqrt(m**2-sin(theta)**2)
50  v=x*cos(theta)
51  s=1/u**2-1/v**2
52  kmax=nint(x+4*x**(1/3.0_dp)+2)+2 !+2 for safety (also there is most likely
53  ! a mistake in Mackowski code on this place)
54  if (kmax>50) kmax=50
55 ! write(*,*) kmax
56  allocate(ae(0:kmax),ah(0:kmax),be(0:kmax),bh(0:kmax),ju(0:kmax),dju(0:kmax),&
57  yu(0:kmax),dyu(0:kmax),jv(0:kmax),djv(0:kmax),yv(0:kmax),dyv(0:kmax),&
58  h1v(0:kmax),dh1v(0:kmax),h2v(0:kmax),dh2v(0:kmax))
59  call bessel(kmax,u,tol,ju,dju,yu,dyu)
60  call bessel(kmax,v,tol,jv,djv,yv,dyv)
61  call hankel(kmax,v,tol,h1v,dh1v,h2v,dh2v)
62  do k=0,kmax
63  dk=k*s*sin(theta)
64  rk=jv(k)/h2v(k)
65  ak1=dh2v(k)/(v*h2v(k))-dju(k)/(u*ju(k))
66  akm=dh2v(k)/(v*h2v(k))-m**2*dju(k)/(u*ju(k))
67  bk1=djv(k)/(v*jv(k))-dju(k)/(u*ju(k))
68  bkm=djv(k)/(v*jv(k))-m**2*dju(k)/(u*ju(k))
69  deltak=akm*ak1-dk**2
70  ae(k)=iu*dk*rk*(bk1-ak1)/deltak
71  ah(k)=rk*(akm*bk1-dk**2)/deltak
72  be(k)=rk*(ak1*bkm-dk**2)/deltak
73  bh(k)=-ae(k)
74  enddo
75  qte=real(0.5_dp*be(0),kind=dp)
76  qth=real(0.5_dp*ah(0),kind=dp)
77  qse=real(0.5_dp*be(0)*conjg(be(0)),kind=dp)
78  qsh=real(0.5_dp*ah(0)*conjg(ah(0)),kind=dp)
79  do k=1,kmax
80  qte=qte+real(be(k),kind=dp)
81  qth=qth+real(ah(k),kind=dp)
82  qse=qse+real(ae(k)*conjg(ae(k))+be(k)*conjg(be(k)),kind=dp)
83  qsh=qsh+real(ah(k)*conjg(ah(k))+bh(k)*conjg(bh(k)),kind=dp)
84  enddo
85  qte=4/x*qte
86  qth=4/x*qth
87  qse=4/x*qse
88  qsh=4/x*qsh
89  qs=(qse+qsh)/2
90  qt=(qte+qth)/2
91 ! write(*,*) Qte,Qse,Qte-Qse
92 ! write(*,*) Qth,Qsh,Qth-Qsh
93  !see Kaemmerlen, 2010: 10.1016/j.jqsrt.2009.11.018
94 ! Qs=Qs*(0.0015_dp*(lambda/(2*radius))**3-0.0219_dp*(lambda/(2*radius))**2+&
95  ! 0.0688_dp*(lambda/(2*radius))+0.7639_dp)
96 ! Qt=Qt*(0.0015_dp*(lambda/(2*radius))**3-0.0219_dp*(lambda/(2*radius))**2+&
97  ! 0.0688_dp*(lambda/(2*radius))+0.7639_dp)
98 
99  ! asymmetry factor is not needed, we need gcyl according to Placido,
100  ! calculated as Dombrovsky
101 ! mue=Qse*sin(theta)**2*x/(4*cos(theta)**2)
102 ! muh=Qsh*sin(theta)**2*x/(4*cos(theta)**2)
103 ! do k=0,kmax-1
104 ! mue=mue+real(ae(k)*conjg(ae(k+1))+be(k)*conjg(be(k+1)),kind=dp)
105 ! muh=muh+real(ah(k)*conjg(ah(k+1))+bh(k)*conjg(bh(k+1)),kind=dp)
106 ! enddo
107 ! mue=mue*4*cos(theta)**2/x
108 ! muh=muh*4*cos(theta)**2/x
109 ! mu=(mue+muh)/(Qse+Qsh) !mue is actually mue*Qse
110 
111  allocate(adsr(nwaw))
112  do i=1,nwaw
113  phi=(i-1)*pi/(nwaw)
114  t1=be(0)
115  t2=ah(0)
116  t3=0
117  t4=0
118  do k=1,kmax
119  t1=t1+2*be(k)*cos(k*phi)
120  t2=t2+2*ah(k)*cos(k*phi)
121  t3=t3-2*iu*ae(k)*sin(k*phi)
122  t4=-t3
123  enddo
124  adsr(i)=(abs(t1)**2+abs(t2)**2)/(pi*x*qs)
125  adsr(i)=(abs(t1)**2+abs(t2)**2+abs(t3)**2+abs(t4)**2)/2
126  enddo
127  s1=adsr(1)*cos(0e0_dp)+adsr(nwaw)*cos(pi)
128  s2=adsr(1)+adsr(nwaw)
129  do i=2,nwaw-1
130  phi=(i-1)*pi/(nwaw-1)
131  s1=s1+2*adsr(i)*cos(phi)
132  s2=s2+2*adsr(i)
133  enddo
134  s1=s1*pi/(2*(nwaw-1))
135  s2=s2*pi/(2*(nwaw-1))
136  gcyl=s1/s2
137 ! write(*,*) theta,s2*lambda/pi**2/radius,Qs
138 ! write(*,*) s1/s2,mu
139 ! phi=pi/2
140 ! T1=be(0)
141 ! T2=ah(0)
142 ! T3=0
143 ! T4=0
144 ! do k=1,kmax
145 ! T1=T1+2*be(k)*cos(k*phi)
146 ! T2=T2+2*ah(k)*cos(k*phi)
147 ! T3=T3-2*iu*ae(k)*sin(k*phi)
148 ! T4=-T3
149 ! enddo
150 ! write(*,*) abs(T1)**2/Qs,abs(T2)**2/Qs,abs(T3)**2/Qs
151 
152 ! Qs=abs(be(0))**2+abs(ah(0))**2 !according to Modest, doesn't work
153 ! do i=1,kmax
154 ! Qs=Qs+abs(be(i))**2+abs(ah(i))**2+abs(bh(i))**2+abs(ae(i))**2
155 ! enddo
156 ! Qs=Qs/x
157 ! write(*,*) Qs
158 ! write(*,*) abs(T1)**2/Qs
159  deallocate(adsr)
160 end subroutine cylconst
161 !***********************************END****************************************
162 
163 
164 !********************************BEGINNING*************************************
166 real(dp) function trextcoeffintstrut ( theta )
167  real(dp), intent(in) :: theta
168  real(dp) :: Qs,Qt,gcyl
169  call cylconst(lambda,theta,dstrut/2,qs,qt,gcyl)
170  trextcoeffintstrut=(qt-qs*sin(theta)**2-gcyl*qs*cos(theta)**2)*cos(theta)
171 end function trextcoeffintstrut
172 !***********************************END****************************************
173 
174 
175 !********************************BEGINNING*************************************
177 real(dp) function extcoeffintstrut ( theta )
178  real(dp), intent(in) :: theta
179  real(dp) :: Qs,Qt,gcyl
180  call cylconst(lambda,theta,dstrut/2,qs,qt,gcyl)
181  extcoeffintstrut=qt*cos(theta)
182 end function extcoeffintstrut
183 !***********************************END****************************************
184 
185 
186 !********************************BEGINNING*************************************
188 real(dp) function scattcoeffintstrut ( theta )
189  real(dp), intent(in) :: theta
190  real(dp) :: Qs,Qt,gcyl
191  call cylconst(lambda,theta,dstrut/2,qs,qt,gcyl)
192  scattcoeffintstrut=qs*cos(theta)
193 end function scattcoeffintstrut
194 !***********************************END****************************************
195 end module cylprop
double lambda
Latent heat of blowing agent, J/kg.