Line data Source code
1 : ! ***********************************************************************
2 : !
3 : ! Copyright (C) 2010-2019 Pablo Marchant & 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 :
21 : module binary_irradiation
22 :
23 : use const_def, only: dp, pi, lsun
24 : use star_lib
25 : use star_def
26 : use math_lib, only: safe_log10, pow2
27 : use binary_def
28 :
29 : implicit none
30 :
31 : contains
32 :
33 0 : subroutine adjust_irradiation(b)
34 : type (binary_info), pointer :: b
35 0 : real(dp) :: Lx
36 : integer :: ierr
37 : type (star_info), pointer :: s
38 : include 'formats'
39 0 : ierr = 0
40 0 : s => b% s_donor
41 0 : if (b% col_depth_for_eps_extra <= 0) return
42 0 : if (b% accretion_powered_irradiation) then
43 0 : Lx = b% accretion_luminosity
44 0 : s% irradiation_flux = min(b% max_F_irr, Lx/(4*pi*pow2(b% separation)))
45 0 : write(*,2) 'lg F_irr', s% model_number, safe_log10(s% irradiation_flux)
46 0 : else if (b% use_accretor_luminosity_for_irrad) then
47 0 : if (.not. b% evolve_both_stars) then
48 0 : write(*,*) "Can't use accretor luminosity for irradiation without evolving both stars."
49 0 : return
50 : end if
51 0 : Lx = (b% s_accretor% L_phot)*Lsun
52 0 : s% irradiation_flux = min(b% max_F_irr, Lx/(4*pi*pow2(b% separation)))
53 0 : write(*,2) 'lg F_irr', s% model_number, safe_log10(s% irradiation_flux)
54 : else
55 0 : if (b% irrad_flux_at_std_distance <= 0) return
56 : s% irradiation_flux = b% irrad_flux_at_std_distance * &
57 0 : pow2(b% std_distance_for_irradiation/b% separation)
58 : end if
59 0 : s% column_depth_for_irradiation = b% col_depth_for_eps_extra
60 : end subroutine adjust_irradiation
61 :
62 : end module binary_irradiation
|