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, Anode, d0, dsum, H
9 !
10 ! all in mks unit.
11 ! dsum: amount of atmospher above the node.
12 ! d0: see the formula below.
13 ! Anode: 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 ! (We employ H(z0) as the scale height in the segment)
33 ! The gramage between given heights, z1 and z2 is by
34 !
35 ! d = d0 *(fd(z1) - fd(z2)) where
36 !
37 ! fd(z) = (1+ a(z-z0)/H(z0))**(-1/a) (a != 0)
38 !
39 ! = exp(-(z-z0)/H ) (a = 0)
40 !
41 ! where d0 = rho0*H(z0)
42 !
43 !
44  implicit none
45 
46 #include "Zmanagerp.h"
47 #include "Zglobalc.h"
48 #include "Zearth.h"
49 #include "Zatmos.h"
50 
51  integer icon, i,ios
52 
53 
54 
55  real*8 m, g, k, nuc, c2, kbymg, dtdz
56 ! m: avrage molecule mass number of air
57 ! g: gravitational acceleration.
58 ! k: Boltzman's const.
59 ! c2: c**2
60  parameter( m=14.5 *2, nuc =938.3e6, g=9.80665, c2=c*c,
61  * k= 8.617e-5, kbymg = k*c2/(m*nuc*g))
62 
63 #include "Zstdatmosf.h"
64 
65 
66 ! read basic data
67  call copenf(tempdev, "../Data/Atmos/stdatmos1.d", icon)
68  if(icon .ne. 0) stop 9999
69  call cskipcomment(tempdev, icon)
70  if(icon .ne. 0) stop 9999
71 !
72  nodes = 0
73  do while(1 .gt. 0 )
74  read(tempdev, *, iostat=ios)
75  * znode(nodes+1), tnode(nodes+1), pnode(nodes+1),
76  * rhonode(nodes+1)
77  if(ios .ne. 0) goto 10
78  nodes = nodes + 1
79  enddo
80  10 continue
81  close(tempdev)
82  write(*, *) "# of nodal points =", nodes, " kbymg=", kbymg
83 
84  do i = 1, nodes-1
85  dtdz = (tnode(i+1) - tnode(i))/ (znode(i+1) - znode(i))
86  scalehnode(i) = kbymg * tnode(i) ! at Znode(i)
87  bnode(i) = dtdz
88  anode(i) = kbymg * bnode(i)
89  d0node(i) = rhonode(i) * scalehnode(i)
90 ! write(*, *)
91 ! * Znode(i), D0node(i), Anode(i), Bnode(i), Scalehnode(i)
92  enddo
93 
94  dsumnode(nodes) = 0.
95 
96  do i = nodes-1, 1, -1
97  if(anode(i) .eq. 0.) then
98 ! exponential atmosphere
99  dsumnode(i) = dsumnode(i+1) +
100  * d0node(i)*
101 ! * (1.0- exp(-(Znode(i+1) - Znode(i))/Scalehnode(i)))
102  * (1.0- fd0(znode(i+1), znode(i), scalehnode(i)))
103  else
104  dsumnode(i) = dsumnode(i+1) +
105  * d0node(i)*
106  * (1.0 -
107  * fd1(znode(i+1), anode(i),znode(i), scalehnode(i) ) )
108 
109 ! * (1.0+Anode(i)*(Znode(i+1) -Znode(i))/Scalehnode(i))
110 ! * **(-1./Anode(i))
111 ! * )
112  endif
113  enddo
114 ! height, temp, pres, Rhonode, Anode, D0node, Dsumnode, H
115 ! Dsumnode is the grammage above the node. all in mks unit.
116  write(*,'(a)')
117  * "# Height Temp Press Rhonode',
118  * ' Anode D0node Dsumnode H"
119  write(*,'(a)') "#-----------------------------------------"
120  do i = 1, nodes-1
121  write(*,
122  * '(8g14.5)')
123  * sngl(znode(i)), sngl(tnode(i)), sngl( pnode(i)),
124  * sngl(rhonode(i)), sngl(anode(i)), sngl( d0node(i)),
125  * sngl(dsumnode(i)), sngl(scalehnode(i))
126  enddo
127  end
128 
129 
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
nodes i
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
! to be included just before the execution code ! density as a function of height real * fd1
Definition: Zstdatmosf.h:3
subroutine cskipcomment(io, icon)
Definition: cskipComment.f:19
dE dx *! Nuc Int sampling table c
Definition: cblkMuInt.h:130