-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathfang_run.f90
More file actions
62 lines (45 loc) · 2.01 KB
/
Copy pathfang_run.f90
File metadata and controls
62 lines (45 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module ionrate
!! these are convenience wrappers for the low-level Fang procedures
!! for if you didn't already have a background atmosphere from the big simulations.
use phys_consts, only: wp
use, intrinsic:: iso_fortran_env, only: sp=>real32
use ionize_fang, only: fang2008, fang2010, gravity_accel, erg2kev
implicit none
private
public :: ionization_fang2008, ionization_fang2010
contains
impure elemental real(wp) function ionization_fang2008(Q0_erg, E0_keV, alt_km, f107, f107a, Ap, glat, glon, doy, UTsec) result(Qtot)
real(wp), intent(in) :: Q0_erg, E0_keV, alt_km, f107, f107a, Ap, glat, glon, UTsec
integer, intent(in) :: doy
real(wp) :: massden_gcm3, meanmass_g
real(sp) :: stl, d(9),T(2), sw(25), Ap7(7)
!! MSIS setup
Ap7 = real(Ap, sp)
stl = real(UTsec/3600 + glon/15, sp)
call meters(.false.)
sw = 1
call tselec(sw)
call gtd7(doy, real(UTsec, sp), real(alt_km, sp), real(glat, sp), real(glon, sp), stl, &
real(f107a, sp), real(f107, sp), Ap7, 48, d, T)
massden_gcm3 = d(6) ! [g cm^-3]
meanmass_g = massden_gcm3 / (sum(d(1:5)) + sum(d(7:8)))
Qtot = fang2008(Q0_erg*erg2kev, E0_keV, real(T(2), wp), massden_gcm3, meanmass_g, real(gravity_accel(alt_km), wp))
end function ionization_fang2008
impure elemental real(wp) function ionization_fang2010(Q0_erg, E0_keV, alt_km, f107, f107a, Ap, glat, glon, doy, UTsec) result(Qtot)
real(wp), intent(in) :: Q0_erg, E0_keV, alt_km, f107, f107a, Ap, glat, glon, UTsec
integer, intent(in) :: doy
real(wp) :: massden_gcm3, meanmass_g
real(sp) :: stl, d(9),T(2), sw(25), Ap7(7)
!! MSIS setup
Ap7 = real(Ap, sp)
stl = real(UTsec/3600 + glon/15, sp)
call meters(.false.)
sw = 1
call tselec(sw)
call gtd7(doy, real(UTsec, sp), real(alt_km, sp), real(glat, sp), real(glon, sp), stl, &
real(f107a, sp), real(f107, sp), Ap7, 48, d, T)
massden_gcm3 = d(6) ! [g cm^-3]
meanmass_g = massden_gcm3 / (sum(d(1:5)) + sum(d(7:8)))
Qtot = fang2010(Q0_erg*erg2kev, E0_keV, real(T(2), wp), massden_gcm3, meanmass_g, real(gravity_accel(alt_km), wp))
end function ionization_fang2010
end module