COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cl2tTblA.f
Go to the documentation of this file.
1 ! This version is faster than cl2tT and accurracy is comparable.
2 !
3 ! *********************************************
4  real*8 function clen2thickta(z, leng)
5 !
6 ! z: real*8. input. vertical height in m.
7 ! leng: real*8. input. length along cosz direction.
8 ! function value. thickness of air in kg/m2. for leng
9  implicit none
10 #include "Zatmos.h"
11  real*8 z, leng
12  real*8 s1, t1, s2, t2
13 
14 ! get slant length along cosz for z: s1
15 ! get slant length ; s2 = s1 + leng
16 ! get thickness <-- by T vs slant length
17  call cl2tintp(heighttbl, lentbl, z, s1)
18  call cl2tintp(lentbl, thicktbl, s1, t1)
19  s2 = s1 + leng
20  call cl2tintp(lentbl, thicktbl, s2, t2)
21  clen2thickta = t2 - t1
22  if(clen2thickta .le. 0.) then
23 ! actually case of < 0 dose not happen.
24 ! when particle comes to the last segment of
25 ! the table, this happens. and the
26 ! particle does not move at all. To avoid this
27 ! give some thikness. (actually this is not
28 ! used but this is for comfort only)
29  clen2thickta = 10.
30  endif
31  end
32 !
33  subroutine cl2tintp(x, y, xx, ans)
34  implicit none
35 #include "Zatmos.h"
36 
37  real*8 x(*) ! input.
38  real*8 y(*) ! input.
39  real*8 xx ! input. some value inside x(*).
40  real*8 ans ! output. interpolated value of y at xx.
41 
42  real*8 error
43  integer m
44  integer loca, k
45  parameter(m = 3) ! old value was 5
46 ! where is xx in x
47  call kdwhereis(xx, numstep, x, 1, loca)
48  if(loca .ge. numstep) then
49 ! give arbitray large value.
50  ans = y(numstep)
51  else
52 ! use max of m points around loca for interpolation
53  k = min(max(loca - (m-1)/2,1), numstep+1-m)
54  ! max of m points from k
55  call kpolintp(x(k), 1, y(k), 1, m, xx, ans, error)
56  endif
57  end
58 ! get slant length corresponding to slant thickness
59 !
60  real*8 function ct2lta(z, t)
61  implicit none
62 #include "Zatmos.h"
63 
64  real*8 z ! input vertical height in m
65  real*8 t ! input. thickness of air in kg/m^2 along cosz
66 !
67  real*8 t1, t2, s1, s2
68 ! z ---> thick
69  call cl2tintp(heighttbl, thicktbl, z, t1)
70  call cl2tintp(heighttbl, lentbl, z, s1)
71  t2 = t1 + t
72  call cl2tintp(thicktbl, lentbl, t2, s2)
73  ct2lta = s2- s1
74  if(ct2lta .le. 0.) then
75 ! actually case of < 0 dose not happen.
76 ! when a particle comes to an end segment of
77 ! a table, this happnes and the particle
78 ! cannot move. To avoid this, give some
79 ! finite value to move it.
80 ! clen2thickTA a thickness corresponding to this length
81 ! but is not used since the particle reaches
82 ! the bottom observation depth.
83  ct2lta = 10.
84  endif
85  end
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
subroutine kpolintp(xa, xstep, ya, ystep, n, x, y, error)
Definition: kpolintp.f:163
subroutine kdwhereis(x, in, a, step, loc)
Definition: kdwhereis.f:27
subroutine cl2tintp(x, y, xx, ans)
Definition: cl2tTblA.f:34
real *8 function clen2thickta(z, leng)
Definition: cl2tTblA.f:5
real *8 function ct2lta(z, t)
Definition: cl2tTblA.f:61