COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ccalcstdatmos.f
Go to the documentation of this file.
1 ! Calculate standard atmospher constants.
2 ! stdatmos1.d is used to compute the consts.
3 !
4 ! This program outputs the following quantity, which may be saved in
5 ! stdatmos2.d which in turn is used by cstdatmos0.f to manage
6 ! atmosphere in the vertical direction.
7 !
8 ! height, temperature, pressure, rho, alfa, d0, dsum, H
9 !
10 ! all in mks unit.
11 ! dsum: amount of atmospher above the node.
12 ! d0: see the formula below.
13 ! alfa: a in the formula below.
14 !
15 ! The scale height is approximated by a
16 ! number of stright lines as a function of height. The data in
17 ! stdatmos1.d gives height, temperatur, etc at each nodal point.
18 !
19 ! The scale height, H, is expressed by H = H0 + a(z-z0)
20 ! = kT/mg
21 ! in each region.
22 ! We neglect height dependence of gravitational accelleration g,
23 ! and the average mass of air molecules, m.
24 ! Since the data table gives T(z)= T0 + b(z-z0) at the nodal points,
25 ! we can first get b,
26 ! and then a by a = dH/dz = k/mg * b. H at a nodal point, z,
27 ! is obtained as H(z) =kT(z)/mg.
28 ! The density is given by
29 ! rho = rho0 * (1+ a(z-z0)/H(z0))**(-1-1/a) (a != 0)
30 ! = rho0 * exp(- (z-z0)/H) (a =0; hence H is const)
31 !
32 ! The gramage between given heights, z1 and z2 is by
33 !
34 ! d = d0 *(fd(z1) - fd(z2)) where
35 !
36 ! fd(z) = (1+ a(z-z0)/H(z0))**(-1/a) (a != 0)
37 !
38 ! = exp(-(z-z0)/H ) (a = 0)
39 !
40 ! where d0 = rho0*H(z0)
41 !
42 !
43  implicit none
44 #include "Zmanagerp.h"
45 #include "Zglobalc.h"
46 #include "Zearth.h"
47 
48  integer nodes ! real number of nodal points given in the table.
49  integer icon, i,ios
50 
51  real*8 z(maxnodes), t(maxnodes), p(maxnodes), rho(maxnodes)
52  real*8 scaleh(maxnodes), alfa(maxnodes), beta(maxnodes),
53  * d0(maxnodes)
54  real*8 m, g, k, nuc, c2, kbymg, dtdz, dsum(maxnodes)
55 ! m: avrage molecule mass number of air
56 ! g: gravitational acceleration.
57 ! k: Boltzman's const.
58 ! c2: c**2
59  parameter( m=14.5 *2, nuc =938.3e6, g=9.80665, c2=c*c,
60  * k= 8.617e-5, kbymg = k*c2/(m*nuc*g))
61 
62 ! read basic data
63  call copenf(tempdev, "stdatmos1%d", icon)
64  if(icon .ne. 0) stop 9999
65  call cskipcomment(tempdev, icon)
66  if(icon .ne. 0) stop 9999
67 !
68  nodes = 0
69  do while(1 .gt. 0 )
70  read(tempdev, *, iostat=ios)
71  * z(nodes+1), t(nodes+1), p(nodes+1), rho(nodes+1)
72  if(ios .ne. 0) goto 10
73  nodes = nodes + 1
74  enddo
75  10 continue
76  close(tempdev)
77  write(*, *) " # of nodal points =", nodes, " kbymg=", kbymg
78 
79  do i =1, nodes-1
80  dtdz = (t(i+1) - t(i))/ (z(i+1) - z(i))
81  scaleh(i) = kbymg * t(i) ! at z(i)
82  beta(i) = dtdz
83  alfa(i) = kbymg * beta(i)
84  d0(i) = rho(i) * scaleh(i)
85 ! write(*, *) z(i), d0(i), alfa(i), beta(i), scaleh(i)
86  enddo
87 
88  dsum(nodes-1) = d0(nodes-1)
89 
90  do i = nodes-2, 1, -1
91  if(alfa(i) .eq. 0.) then
92 ! exponential atmosphere
93  dsum(i) = dsum(i+1) +
94  * d0(i)*(1.0- exp(-(z(i+1) - z(i))/scaleh(i)))
95  else
96  dsum(i) = dsum(i+1) +
97  * d0(i)*
98  * (1.0 -
99  * (1.0+alfa(i)*(z(i+1) -z(i))/scaleh(i))
100  * **(-1./alfa(i))
101  * )
102  endif
103  enddo
104 ! height, temp, pres, rho, alfa, d0, dsum, H
105 ! dsum is the grammage above the node. all in mks unit.
106  write(*,*)"# height, temp, press, rho, alfa, d0, dsum, H"
107  write(*,*) "#-----------------------------------------"
108  do i = 1, nodes-1
109  write(*,
110  * '(8g14.5)')
111  * sngl(z(i)),sngl(t(i)),sngl( p(i)), sngl(rho(i)),
112  * sngl(alfa(i)), sngl( d0(i)), sngl(dsum(i)), sngl(scaleh(i))
113  enddo
114 ! do zx = 0., 11.d3, 1.d3
115 ! write(*, *)
116 ! * rho(1)*(1 + alfa(1)*(zx - 0.)/scaleh(1))**(-1.-1./alfa(1))
117 ! enddo
118  end
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
nodes z
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
nodes i
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine copenf(io, fnin, icon)
Definition: copenf.f:8
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data m
Definition: ZlatfitBD.h:35
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
nodes t
subroutine cskipcomment(io, icon)
Definition: cskipComment.f:19
dE dx *! Nuc Int sampling table c
Definition: cblkMuInt.h:130