Line data Source code
1 : ! ***********************************************************************
2 : !
3 : ! Copyright (C) 2010-2019 The MESA Team
4 : !
5 : ! This program is free software: you can redistribute it and/or modify
6 : ! it under the terms of the GNU Lesser General Public License
7 : ! as published by the Free Software Foundation,
8 : ! either version 3 of the License, or (at your option) any later version.
9 : !
10 : ! This program is distributed in the hope that it will be useful,
11 : ! but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 : ! See the GNU Lesser General Public License for more details.
14 : !
15 : ! You should have received a copy of the GNU Lesser General Public License
16 : ! along with this program. If not, see <https://www.gnu.org/licenses/>.
17 : !
18 : ! ***********************************************************************
19 :
20 : module atm_def
21 :
22 : use const_def, only: dp
23 :
24 : implicit none
25 :
26 : ! T-tau relations
27 :
28 : integer, parameter :: ATM_T_TAU_EDDINGTON = 1
29 : integer, parameter :: ATM_T_TAU_SOLAR_HOPF = 2
30 : integer, parameter :: ATM_T_TAU_KRISHNA_SWAMY = 3
31 : integer, parameter :: ATM_T_TAU_TRAMPEDACH_SOLAR = 4
32 :
33 : ! Tables
34 :
35 : integer, parameter :: ATM_TABLE_TAU_100 = 100
36 : integer, parameter :: ATM_TABLE_TAU_10 = 101
37 : integer, parameter :: ATM_TABLE_TAU_1 = 102
38 : integer, parameter :: ATM_TABLE_TAU_1M1 = 103
39 : integer, parameter :: ATM_TABLE_PHOTOSPHERE = 104
40 : integer, parameter :: ATM_TABLE_WD_TAU_25 = 105
41 : integer, parameter :: ATM_TABLE_DB_WD_TAU_25 = 106
42 :
43 : integer, parameter :: table_atm_version = 5
44 :
45 : ! Atmosphere structure info
46 :
47 : integer, parameter :: atm_xm = 1 ! mass of atm exterior to this point (g)
48 : integer, parameter :: atm_delta_r = atm_xm+1 ! radial distance above base of envelope (cm)
49 : integer, parameter :: atm_lnP = atm_delta_r+1
50 : integer, parameter :: atm_lnd = atm_lnP+1
51 : integer, parameter :: atm_lnT = atm_lnd+1
52 : integer, parameter :: atm_gradT = atm_lnT+1
53 : integer, parameter :: atm_kap = atm_gradT+1
54 : integer, parameter :: atm_gamma1 = atm_kap+1
55 : integer, parameter :: atm_grada = atm_gamma1+1
56 : integer, parameter :: atm_chiT = atm_grada+1
57 : integer, parameter :: atm_chiRho = atm_chiT+1
58 : integer, parameter :: atm_cv = atm_chiRho+1
59 : integer, parameter :: atm_cp = atm_cv+1
60 : integer, parameter :: atm_lnfree_e = atm_cp+1
61 : integer, parameter :: atm_dlnkap_dlnT = atm_lnfree_e+1
62 : integer, parameter :: atm_dlnkap_dlnd = atm_dlnkap_dlnT+1
63 : integer, parameter :: atm_lnPgas = atm_dlnkap_dlnd+1
64 : integer, parameter :: atm_tau = atm_lnPgas+1
65 : integer, parameter :: atm_gradr = atm_tau+1
66 :
67 : integer, parameter :: num_results_for_build_atm = atm_gradr
68 :
69 : ! Derived-type definitions
70 :
71 : type Atm_Info
72 : integer :: id
73 : integer :: nZ
74 : integer :: ng
75 : integer :: nT
76 : integer :: ilinT
77 : integer :: iling
78 : real(dp), pointer :: Teff_array(:)
79 : real(dp), pointer :: logg_array(:)
80 : real(dp), pointer :: Teff_bound(:)
81 : real(dp), pointer :: logZ(:)
82 : real(dp), pointer :: alphaFe(:)
83 : real(dp), pointer :: Pgas_interp1(:)
84 : real(dp), pointer :: T_interp1(:)
85 : real(dp), pointer :: Pgas_interp(:,:,:,:)
86 : real(dp), pointer :: T_interp(:,:,:,:)
87 : character(len=8), pointer :: atm_mix(:)
88 : character(len=40), pointer :: table_atm_files(:)
89 : logical, pointer :: have_atm_table(:)
90 : end type Atm_Info
91 :
92 : ! Atmosphere tables
93 :
94 : type (Atm_Info), target, save :: &
95 : ai_two_thirds, ai_100, ai_10, ai_1, &
96 : ai_1m1, ai_wd_25, ai_db_wd_25
97 :
98 : logical :: table_atm_is_initialized = .false.
99 :
100 : logical :: star_debugging_atm_flag = .false.
101 : real(dp) :: atm_test_partials_val, atm_test_partials_dval_dx
102 : real(dp) :: atm_test_partials_L_lo, atm_test_partials_L_hi
103 : real(dp) :: atm_test_partials_R_lo, atm_test_partials_R_hi
104 : real(dp) :: atm_test_partials_M_lo, atm_test_partials_M_hi
105 :
106 : abstract interface
107 :
108 : ! Callback routine for EOS evaluation
109 :
110 : subroutine atm_eos_iface( &
111 : lnP, lnT, &
112 : lnRho, res, dres_dlnRho, dres_dlnT, &
113 : ierr)
114 : use const_def, only: dp
115 : implicit none
116 : real(dp), intent(in) :: lnP
117 : real(dp), intent(in) :: lnT
118 : real(dp), intent(out) :: lnRho
119 : real(dp), intent(out) :: res(:)
120 : real(dp), intent(out) :: dres_dlnRho(:)
121 : real(dp), intent(out) :: dres_dlnT(:)
122 : integer, intent(out) :: ierr
123 : end subroutine atm_eos_iface
124 :
125 : ! Callback routine for opacity evaluation
126 :
127 : subroutine atm_kap_iface( &
128 : lnRho, lnT, res, dres_dlnRho, dres_dlnT, &
129 : kap, dlnkap_dlnRho, dlnkap_dlnT, &
130 : ierr)
131 : use const_def, only: dp
132 : implicit none
133 : real(dp), intent(in) :: lnRho
134 : real(dp), intent(in) :: lnT
135 : real(dp), intent(in) :: res(:)
136 : real(dp), intent(in) :: dres_dlnRho(:)
137 : real(dp), intent(in) :: dres_dlnT(:)
138 : real(dp), intent(out) :: kap
139 : real(dp), intent(out) :: dlnkap_dlnRho
140 : real(dp), intent(out) :: dlnkap_dlnT
141 : integer, intent(out) :: ierr
142 : end subroutine atm_kap_iface
143 :
144 : end interface
145 :
146 0 : end module atm_def
|