DART-Ray
|
Contains all the subroutines to calculate the stellar and dust emission SEDs. More...
Functions/Subroutines | |
subroutine | calc_sed |
Calculates stellar or dust emission SED from the i_obs() arrays. If keyword print_sed is not set TRUE, then it just returns. More... | |
subroutine | create_sed_arr |
Allocates sed arrays sed_arr(), sed_arr_dir(), sed_arr_sca(). More... | |
subroutine | calc_sed_arrays |
! Sums up the i_obs at different wavelengths to obtain the total output sed in the input directions. Used only for the "sed" algorithm. More... | |
subroutine | sum_i_obs (il, sed_arr) |
Sums i_obs arrays to obtain emission SED. More... | |
subroutine | set_dust_emission |
Calculates the dust emission luminosity density and stores it into dens_stars_arr(). More... | |
subroutine | check_dens_stars_arr |
Compare the newly calculated dens_stars_arr() with dens_stars_arr_prev(). If the relative difference is smaller than conv_en_lim(), it assigns TRUE to cnflag_dust(), thus stopping the dust heating iterations. It not, it subtracts from dens_stars_arr() the luminosity already processed in the previous dust heating iterations and it updates dens_stars_arr_prev(). More... | |
subroutine | convert_ufield_ifield |
Calculates the constant factor conv_ufield_ifield(). Then transforms the stellar emission radiation field energy density u_final_uv_opt() into the integrated radiation field intensity in units of W/m^2/m. More... | |
subroutine | calc_dens_dustem |
Calculates the dust emission luminosity density in the case of the effective grain mode. More... | |
subroutine | calc_dens_dustem_equ |
Calculates the equilibrium emission for the grain mixture case. More... | |
subroutine | allocate_sto_arrays |
Allocates arrays used within the stochastically heated dust emission routines calc_dens_dustem_sto() and calc_dens_dustem_sto_lib(). More... | |
subroutine | deallocate_sto_arrays |
Deallocates arrays used within the stochastically heated dust emission routines calc_dens_dustem_sto() and calc_dens_dustem_sto_lib(). More... | |
subroutine | calc_dens_dustem_sto |
Calculates the stochastically heated emission at each position. More... | |
subroutine | calc_dens_dustem_sto_lib |
Calculates the stochastically heated emission at each position using the SED adaptive library approach of Natale et al.(2015). More... | |
subroutine | calc_t_dust_equil (qabs_arr, dust_size, rf_stars, rf_dust, t_dust, abs_en) |
Calculates the equilibrium dust temperature given the absorption Q coefficient, the radiation field intensity of the stellar emission and of the dust emission in [W/m/m^2]. The input qabs_arr coefficient can also have units [e.g. m^2], as for the effective grain emission calculation, without changing the output equilibrium temperature. The output absorbed energy abs_en is in units of W/m^2 times the units of the input qabs_arr. More... | |
subroutine | calc_rd_arr (dust_size) |
Calculates the moments of the dosage function (see Voit 1991, ApJ, 379, 122, needed for the dust stochastically heated calculation). More... | |
subroutine | set_units_dens_stars_arr |
Sets the units of dens_stars_arr() in the dust RT algorithms. These units are W/m/pc^3 where meters refers to the wavelength. More... | |
real(kind=real64) function | abs_en_diff (t_dust, kabs_arr_planck, abs_en, em_int) |
Calculates the difference between absorbed and emitted energy given the temperature T_dust. More... | |
real(kind=real64) function | bplanck (T_source, la) |
Returns black body specific intensity in W/m^2/m/sr at wavelength la [m] and for temperature T_source [K] (SI units) More... | |
subroutine | set_lambda_arr_si |
Sets the lambda array in the mks units ( lambda_arr_SI()). It also sets delta_lambda_bin(), delta_lambda_bin_stars() and delta_lambda_bin_dust(). More... | |
real(kind=real64) function | zbrent_tdust (kabs_arr_planck, abs_en) |
Finds equilibrium dust temperature using Brent's method (modified version of the Van Wijngaarden–Dekker–Brent Method, see Numerical recipes in Fortran 77, Press et al.). More... | |
subroutine | prepare_dust_model |
Reads the input dust model files. Derive the dust model optical properties used in the calculation, interpolated at the same wavelengths as in lambda_arr() and same grain sizes as in the input grain size distributions. More... | |
subroutine | load_opacity_param |
Loads the Qabs, Qsca, Qext and gsca factors from the tables in the dust opacity directory (from the TRUST benchmark project) and interpolate them to the input wavelength grid. Note that a further interpolation is needed to match the grain sizes to the values of the input tables. This is done in interpolate_q_grain_fa(). More... | |
subroutine | load_fa_arr |
Loads the grain size distribution from the standard TRUST tables or from user provided files. More... | |
subroutine | interpolate_q_grain_fa |
Interpolate the qabs, qsca, qext and gsca arrays to the same grain sizes of the input grain size distribution tables. More... | |
subroutine | load_ct_ht_tables |
Loads specific enthalphy and specific heat capacity as a function of grain temperature from the input tables. In the standard mode, the tables are those provided in the TRUST RT benchmark project. Alternatively input tables can also be used, provided that they are in the same form as the TRUST tables. More... | |
subroutine | value_locate (val, array, ig0, ig1, reverse_order) |
Finds indeces of an array corresponding to the array value bin containing the input value val(). Note that the array should normally be sorted in ascending order. In case val is lower than array(0), it returns the indeces of the first two elements. If val is higher than array(size(array)-1), it returns indeces of last two elements. The input array can be in the reversing order if the reverse_order keyword is set TRUE. More... | |
subroutine | lin_interpolate (y0, y1, x0, x1, x, y) |
Interpolates linearly at a position x within the bin [x0,x1] given the boundary values y0=f(x0) and y1=f(x1). y0 and y1 are defined as arrays, so the subroutine can be used for multiple values provided that the x coordinates x0, x1 and x are the same. More... | |
subroutine | calc_total_opacity |
Calculates integrated opacity coefficients kabs_arr(), ksca_arr(), kext_arr() and scattering phase function parameter gsca_arr() from the tabulated opacity parameters and the input grain size distributions. The resulting values for the integrated coefficients depends slightly on the specific interpolation scheme. For this reason, we add the option to upload these values from an input file as well using the keyword load_av_opacities() and file_int_opacities(). In this case, the code checks that the values obtained by this routine and those uploaded through the input file file_av_opacities() do not vary more than 5%. This is necessary to guarantee consistency between the dust emission and the stellar emission calculations within a few percents. More... | |
subroutine | read_av_opacities |
If keyword input_av_opacities is TRUE, it reads input table of integrated/averaged opacity coefficients kext(), kabs(), kext() and scattering phase function gsca. Interpolates factors to input wavelength grid lambda_arr() and to reference wavelength lambda_ref(). Checks values are within 5% of those derived directly by integration/average of grain opacities coefficients. More... | |
subroutine | calc_planck_av_qabs |
Calculates planck averaged Qabs for the grains in the input grain size distributions and for a set of temperatures. More... | |
subroutine | calc_photon_energy |
Calculates energy of photons as a function of wavelength for the set of wavelength stored in lambda_arr_SI. The energy is in [J]. More... | |
subroutine | calc_gaussian_fe (t_dust, ic, ig) |
Calculates pt() in the large grain energy approximation (see section 4.4 Voit 1991). In case 1) the mean photon energy is very small compared to the grain equilibrium energy and 2) the width of the Gaussian approximation is more than 10% the equilibrium dust temperature, the code assign large_grain_energy = .FALSE. So the stochastically heated emission is calculated numerically from the current grain size to smaller sizes. More... | |
subroutine | calc_full_fe (ic, ig) |
Calculates the temperature probability distribution pt() using the numerical method of Gahathakurta & Draine 1989 with the modification of Voit 1991 (section 4.5). More... | |
subroutine | make_log_array (xmin, xmax, xarr) |
Makes array of values between xmin and xmax, equally spaced in logarithmic space. More... | |
subroutine | make_delta_array (xarr, delta_xarr_bin) |
Makes array of bin sizes that can be used for integration. More... | |
subroutine | convert_e_arr_to_t_arr (E_arr, T_arr, ic, ig) |
Converts grain enthalpy array into temperature array. More... | |
subroutine | interpolate_qabs_arr_planck (T_arr, qp_arr, ic, ig) |
Interpolates Planck averaged emissivity table at the set of input temperatures. More... | |
subroutine | calc_integrals_photon_abs_rate (dust_size) |
Calculates integrals of the photon absorbtion rate from a minimum lambda up to all the other possible values. More... | |
subroutine | calc_transition_matrices |
Calculates transitions matrices AA() and BB(). More... | |
subroutine | calc_edot_arr (dust_size, T_arr) |
Calculates cooling rate at all temperatures in Tarr. It also calculates continuous cooling term BB(i,i+1). More... | |
subroutine | calc_dosage_function_moment_integrals |
Calculates dosage function by differentiating the integrals of the photon absorption rate. These integrals are stored in the Rd_integrated array for the energies corresponding to the wavelength grid. The dosage function has to be calculated at the energies corresponding to the enthalpy difference for the levels defined by the grain temperature grid. So, first an interpolation of the Rd_integrated array is necessary. Then differentiation. Then calculation of moments of dosage function is performed up to all energies corresponding to the energy bins. More... | |
subroutine | interpolate_array (num, xarr_in, yarr_in, xarr_out, yarr_out) |
Performs linear interpolation for all the values in the arrays xarr_out and yarr_out given the values in the arrays xarr_in and yarr_in. More... | |
subroutine | interpolate_rd_integrated (num, delta_E_arr_in, rd_interpol_in) |
Interpolates Rd_integrated() array at the energies corresponding to the transitions between grain enthalphy levels. More... | |
subroutine | make_linear_array (xmin, xmax, xarr) |
Makes array of values between xmin and xmax, equally spaced in linear space. More... | |
subroutine | convert_t_arr_to_e_arr (T_arr, E_arr, ic, ig) |
Converts temperature array into grain enthalpy array (reverse of convert_E_arr_to_T_arr). More... | |
subroutine | prepare_stellar_emission_library |
Reads and interpolates stellar emission library defined in the input (see file_stellar_library() and stellar_library()). More... | |
subroutine | interpolate_lum_to_mass_lib |
Interpolates the values of the stellar luminosity-to-mass ratio in lum_to_mass_lib() to the wavelengths in the wavelength grid lambda_arr(). It stores the values in lum_to_mass_int() and deallocate lum_to_mass_lib(). More... | |
subroutine | bilinear_interpolation (xarr, yarr, farr, x, y, fout) |
Performs bilinear interpolation given the function farr, evaluated at the points (x1,y1), (x2,y1), (x1, y2), (x2,y2), and the output value coordinates (x,y). More... | |
subroutine | set_star_particle_luminosity (lambda_in) |
Sets stellar particle luminosities star_lum() for an input wavelength lambda_in. More... | |
subroutine | find_lambda_index (lambda_in, il) |
Finds index in lambda_arr corresponding to the input wavelength lambda_in. More... | |
subroutine | bin_rad_field |
Calculates integrals of the stellar emission radiation field spectra in the UV (<4430 A) and optical (> 4430) and assign each cell to a 2-dim bin of radiation field total intensity. Used in the SED library approach for the stochastically heated dust emission. More... | |
Variables | |
real(kind=real64), parameter | t0 =0 |
real(kind=real64), parameter | t1 =1E4 |
real(kind=real64), parameter | tol =1E-8 |
real(kind=real64) | conv_ufield_ifield |
real(kind=real64), dimension(:), allocatable | phot_energy |
real(kind=real64), dimension(:), allocatable | abs_int_rad_stars |
real(kind=real64), dimension(:), allocatable | abs_int_rad_dust |
real(kind=real64), dimension(0:2) | rd_arr |
logical | large_grain_energy |
real(kind=real64) | emin |
real(kind=real64) | emax |
real(kind=real64) | tmin |
real(kind=real64) | tmin_prev |
real(kind=real64) | tmax |
real(kind=real64) | tmax_prev |
real(kind=real64), dimension(:), allocatable | e_arr |
real(kind=real64), dimension(:), allocatable | t_arr |
real(kind=real64), dimension(:), allocatable | pt |
real(kind=real64), dimension(:), allocatable | qp_arr |
real(kind=real64), dimension(:), allocatable | delta_e_arr_bin |
integer, parameter | n_temp_pt = 300 |
real(kind=real64), dimension(:), allocatable | rd_integrated |
real(kind=real64), dimension(:,:), allocatable | aa |
real(kind=real64), dimension(:,:), allocatable | bb |
real(kind=real64), dimension(:), allocatable | re0 |
real(kind=real64), dimension(:), allocatable | re1 |
real(kind=real64), dimension(:), allocatable | re2 |
real(kind=real64), dimension(:), allocatable | edot_arr |
real(kind=real64), dimension(:), allocatable | tot_dust_em |
real(kind=real64), dimension(:,:), allocatable | dust_em_arr_fa |
real(kind=real64), dimension(:), allocatable | int_rf_uv |
real(kind=real64), dimension(:), allocatable | int_rf_opt |
real(kind=real64), dimension(:), allocatable | rf_uv_arr |
real(kind=real64), dimension(:), allocatable | rf_opt_arr |
real(kind=real64), dimension(:,:,:), allocatable | u_av_uv_opt |
real(kind=real64), dimension(:,:,:), allocatable | u_av_dust |
real(kind=real64), dimension(:,:), allocatable | count_spectra_uv_opt |
Contains all the subroutines to calculate the stellar and dust emission SEDs.
real(kind=real64) function sed_routines::abs_en_diff | ( | real(kind=real64) | t_dust, |
real(kind=real64), dimension(0:) | kabs_arr_planck, | ||
real(kind=real64) | abs_en, | ||
real(kind=real64), dimension(0:) | em_int | ||
) |
Calculates the difference between absorbed and emitted energy given the temperature T_dust.
subroutine sed_routines::allocate_sto_arrays | ( | ) |
Allocates arrays used within the stochastically heated dust emission routines calc_dens_dustem_sto() and calc_dens_dustem_sto_lib().
subroutine sed_routines::bilinear_interpolation | ( | real(kind=real64), dimension(2) | xarr, |
real(kind=real64), dimension(2) | yarr, | ||
real(kind=real64), dimension(2,2) | farr, | ||
real(kind=real64) | x, | ||
real(kind=real64) | y, | ||
real(kind=real64) | fout | ||
) |
Performs bilinear interpolation given the function farr, evaluated at the points (x1,y1), (x2,y1), (x1, y2), (x2,y2), and the output value coordinates (x,y).
subroutine sed_routines::bin_rad_field | ( | ) |
Calculates integrals of the stellar emission radiation field spectra in the UV (<4430 A) and optical (> 4430) and assign each cell to a 2-dim bin of radiation field total intensity. Used in the SED library approach for the stochastically heated dust emission.
real(kind=real64) function sed_routines::bplanck | ( | real(kind=real64) | T_source, |
real(kind=real64) | la | ||
) |
Returns black body specific intensity in W/m^2/m/sr at wavelength la [m] and for temperature T_source [K] (SI units)
subroutine sed_routines::calc_dens_dustem | ( | ) |
Calculates the dust emission luminosity density in the case of the effective grain mode.
subroutine sed_routines::calc_dens_dustem_equ | ( | ) |
Calculates the equilibrium emission for the grain mixture case.
subroutine sed_routines::calc_dens_dustem_sto | ( | ) |
Calculates the stochastically heated emission at each position.
subroutine sed_routines::calc_dens_dustem_sto_lib | ( | ) |
Calculates the stochastically heated emission at each position using the SED adaptive library approach of Natale et al.(2015).
subroutine sed_routines::calc_dosage_function_moment_integrals | ( | ) |
Calculates dosage function by differentiating the integrals of the photon absorption rate. These integrals are stored in the Rd_integrated array for the energies corresponding to the wavelength grid. The dosage function has to be calculated at the energies corresponding to the enthalpy difference for the levels defined by the grain temperature grid. So, first an interpolation of the Rd_integrated array is necessary. Then differentiation. Then calculation of moments of dosage function is performed up to all energies corresponding to the energy bins.
subroutine sed_routines::calc_edot_arr | ( | real(kind=real64) | dust_size, |
real(kind=real64), dimension(0:) | T_arr | ||
) |
Calculates cooling rate at all temperatures in Tarr. It also calculates continuous cooling term BB(i,i+1).
subroutine sed_routines::calc_full_fe | ( | integer | ic, |
integer | ig | ||
) |
Calculates the temperature probability distribution pt() using the numerical method of Gahathakurta & Draine 1989 with the modification of Voit 1991 (section 4.5).
SeE | source function defined in Equ. 53 of Voit 1991 |
n_temp_sub | Number of points for the integration of Fe1 (see Equ. 50 voit 1991). |
E_arr_sub | Energy array for the sampling of the energy bin [E-e, E] |
pt_sub | Temperature probability distribution on the grid defined by E_arr_sub |
cc1 | Argument of first exponential in the analytical solution for pt_sub(). |
cc2 | Argument of second exponential in the analytical solution for pt_sub(). |
delta_E_arr_sub | Bin sizes for E_arr_sub. |
f0 | first boundary condition for solving the pt_sub equation |
f0 | second boundary condition for solving the pt_sub() equation (see Equ. 54 Voit 1991) |
c2 | coefficient differential equation pt_sub(). |
d2 | coefficient differential equation pt_sub(). |
a2 | coefficient differential equation pt_sub(). |
b2 | coefficient differential equation pt_sub(). |
rd_interpol | Interpolated values of rd_integrated(). |
percT | percentage factor used to vary temperature range. |
subroutine sed_routines::calc_gaussian_fe | ( | real(kind=real64) | t_dust, |
integer | ic, | ||
integer | ig | ||
) |
Calculates pt() in the large grain energy approximation (see section 4.4 Voit 1991). In case 1) the mean photon energy is very small compared to the grain equilibrium energy and 2) the width of the Gaussian approximation is more than 10% the equilibrium dust temperature, the code assign large_grain_energy = .FALSE. So the stochastically heated emission is calculated numerically from the current grain size to smaller sizes.
t_dust | T_dust Equilibrium dust temperature |
ct | heat capacity C_T at equilibrium dust temperature |
Em | Grain enthalpy at equilibrium dust temperature |
Qp | Planck-averaged Qabs() at equilibrium dust temperature. |
dqp_dt | dQp/dT at equilibrium temperature. Used to calculate dEdot/dE |
dEdot_dE | dEdot/dE at equilibrium temperature. This is the derivative of the cooling rate with respect to the grain enthalpy. |
sig | Sigma of the gaussian derived for f(E) (the grain enthalpy probability distribution). |
sigT | Sigma of the gaussian derived for f(T) (the grain temperature probability distribution). |
vol | Grain volume |
subroutine sed_routines::calc_integrals_photon_abs_rate | ( | real(kind=real64) | dust_size | ) |
Calculates integrals of the photon absorbtion rate from a minimum lambda up to all the other possible values.
subroutine sed_routines::calc_photon_energy | ( | ) |
Calculates energy of photons as a function of wavelength for the set of wavelength stored in lambda_arr_SI. The energy is in [J].
subroutine sed_routines::calc_planck_av_qabs | ( | ) |
Calculates planck averaged Qabs for the grains in the input grain size distributions and for a set of temperatures.
subroutine sed_routines::calc_rd_arr | ( | real(kind=real64) | dust_size | ) |
Calculates the moments of the dosage function (see Voit 1991, ApJ, 379, 122, needed for the dust stochastically heated calculation).
subroutine sed_routines::calc_sed | ( | ) |
Calculates stellar or dust emission SED from the i_obs() arrays. If keyword print_sed is not set TRUE, then it just returns.
subroutine sed_routines::calc_sed_arrays | ( | ) |
! Sums up the i_obs at different wavelengths to obtain the total output sed in the input directions. Used only for the "sed" algorithm.
subroutine sed_routines::calc_t_dust_equil | ( | real(kind=real64), dimension(0:) | qabs_arr, |
real(kind=real64) | dust_size, | ||
real(kind=real64), dimension(0:) | rf_stars, | ||
real(kind=real64), dimension(0:) | rf_dust, | ||
real(kind=real64) | t_dust, | ||
real(kind=real64) | abs_en | ||
) |
Calculates the equilibrium dust temperature given the absorption Q coefficient, the radiation field intensity of the stellar emission and of the dust emission in [W/m/m^2]. The input qabs_arr coefficient can also have units [e.g. m^2], as for the effective grain emission calculation, without changing the output equilibrium temperature. The output absorbed energy abs_en is in units of W/m^2 times the units of the input qabs_arr.
subroutine sed_routines::calc_total_opacity | ( | ) |
Calculates integrated opacity coefficients kabs_arr(), ksca_arr(), kext_arr() and scattering phase function parameter gsca_arr() from the tabulated opacity parameters and the input grain size distributions. The resulting values for the integrated coefficients depends slightly on the specific interpolation scheme. For this reason, we add the option to upload these values from an input file as well using the keyword load_av_opacities() and file_int_opacities(). In this case, the code checks that the values obtained by this routine and those uploaded through the input file file_av_opacities() do not vary more than 5%. This is necessary to guarantee consistency between the dust emission and the stellar emission calculations within a few percents.
subroutine sed_routines::calc_transition_matrices | ( | ) |
Calculates transitions matrices AA() and BB().
subroutine sed_routines::check_dens_stars_arr | ( | ) |
Compare the newly calculated dens_stars_arr() with dens_stars_arr_prev(). If the relative difference is smaller than conv_en_lim(), it assigns TRUE to cnflag_dust(), thus stopping the dust heating iterations. It not, it subtracts from dens_stars_arr() the luminosity already processed in the previous dust heating iterations and it updates dens_stars_arr_prev().
subroutine sed_routines::convert_e_arr_to_t_arr | ( | real(kind=real64), dimension(0:) | E_arr, |
real(kind=real64), dimension(0:) | T_arr, | ||
integer | ic, | ||
integer | ig | ||
) |
Converts grain enthalpy array into temperature array.
subroutine sed_routines::convert_t_arr_to_e_arr | ( | real(kind=real64), dimension(0:) | T_arr, |
real(kind=real64), dimension(0:) | E_arr, | ||
integer | ic, | ||
integer | ig | ||
) |
Converts temperature array into grain enthalpy array (reverse of convert_E_arr_to_T_arr).
subroutine sed_routines::convert_ufield_ifield | ( | ) |
Calculates the constant factor conv_ufield_ifield(). Then transforms the stellar emission radiation field energy density u_final_uv_opt() into the integrated radiation field intensity in units of W/m^2/m.
subroutine sed_routines::create_sed_arr | ( | ) |
Allocates sed arrays sed_arr(), sed_arr_dir(), sed_arr_sca().
subroutine sed_routines::deallocate_sto_arrays | ( | ) |
Deallocates arrays used within the stochastically heated dust emission routines calc_dens_dustem_sto() and calc_dens_dustem_sto_lib().
subroutine sed_routines::find_lambda_index | ( | real(kind=real64) | lambda_in, |
integer | il | ||
) |
Finds index in lambda_arr corresponding to the input wavelength lambda_in.
subroutine sed_routines::interpolate_array | ( | integer | num, |
real(kind=real64), dimension(0:) | xarr_in, | ||
real(kind=real64), dimension(0:) | yarr_in, | ||
real(kind=real64), dimension(0:) | xarr_out, | ||
real(kind=real64), dimension(0:) | yarr_out | ||
) |
Performs linear interpolation for all the values in the arrays xarr_out and yarr_out given the values in the arrays xarr_in and yarr_in.
subroutine sed_routines::interpolate_lum_to_mass_lib | ( | ) |
Interpolates the values of the stellar luminosity-to-mass ratio in lum_to_mass_lib() to the wavelengths in the wavelength grid lambda_arr(). It stores the values in lum_to_mass_int() and deallocate lum_to_mass_lib().
subroutine sed_routines::interpolate_q_grain_fa | ( | ) |
Interpolate the qabs, qsca, qext and gsca arrays to the same grain sizes of the input grain size distribution tables.
subroutine sed_routines::interpolate_qabs_arr_planck | ( | real(kind=real64), dimension(0:) | T_arr, |
real(kind=real64), dimension(0:) | qp_arr, | ||
integer | ic, | ||
integer | ig | ||
) |
Interpolates Planck averaged emissivity table at the set of input temperatures.
subroutine sed_routines::interpolate_rd_integrated | ( | integer | num, |
real(kind=real64), dimension(0:) | delta_E_arr_in, | ||
real(kind=real64), dimension(0:) | rd_interpol_in | ||
) |
Interpolates Rd_integrated() array at the energies corresponding to the transitions between grain enthalphy levels.
subroutine sed_routines::lin_interpolate | ( | real(kind=real64), dimension(0:) | y0, |
real(kind=real64), dimension(0:) | y1, | ||
real(kind=real64) | x0, | ||
real(kind=real64) | x1, | ||
real(kind=real64) | x, | ||
real(kind=real64), dimension(0:) | y | ||
) |
Interpolates linearly at a position x within the bin [x0,x1] given the boundary values y0=f(x0) and y1=f(x1). y0 and y1 are defined as arrays, so the subroutine can be used for multiple values provided that the x coordinates x0, x1 and x are the same.
subroutine sed_routines::load_ct_ht_tables | ( | ) |
Loads specific enthalphy and specific heat capacity as a function of grain temperature from the input tables. In the standard mode, the tables are those provided in the TRUST RT benchmark project. Alternatively input tables can also be used, provided that they are in the same form as the TRUST tables.
subroutine sed_routines::load_fa_arr | ( | ) |
Loads the grain size distribution from the standard TRUST tables or from user provided files.
subroutine sed_routines::load_opacity_param | ( | ) |
Loads the Qabs, Qsca, Qext and gsca factors from the tables in the dust opacity directory (from the TRUST benchmark project) and interpolate them to the input wavelength grid. Note that a further interpolation is needed to match the grain sizes to the values of the input tables. This is done in interpolate_q_grain_fa().
subroutine sed_routines::make_delta_array | ( | real(kind=real64), dimension(0:) | xarr, |
real(kind=real64), dimension(0:) | delta_xarr_bin | ||
) |
Makes array of bin sizes that can be used for integration.
subroutine sed_routines::make_linear_array | ( | real(kind=real64) | xmin, |
real(kind=real64) | xmax, | ||
real(kind=real64), dimension(0:) | xarr | ||
) |
Makes array of values between xmin and xmax, equally spaced in linear space.
subroutine sed_routines::make_log_array | ( | real(kind=real64) | xmin, |
real(kind=real64) | xmax, | ||
real(kind=real64), dimension(0:) | xarr | ||
) |
Makes array of values between xmin and xmax, equally spaced in logarithmic space.
subroutine sed_routines::prepare_dust_model | ( | ) |
Reads the input dust model files. Derive the dust model optical properties used in the calculation, interpolated at the same wavelengths as in lambda_arr() and same grain sizes as in the input grain size distributions.
subroutine sed_routines::prepare_stellar_emission_library | ( | ) |
Reads and interpolates stellar emission library defined in the input (see file_stellar_library() and stellar_library()).
subroutine sed_routines::read_av_opacities | ( | ) |
If keyword input_av_opacities is TRUE, it reads input table of integrated/averaged opacity coefficients kext(), kabs(), kext() and scattering phase function gsca. Interpolates factors to input wavelength grid lambda_arr() and to reference wavelength lambda_ref(). Checks values are within 5% of those derived directly by integration/average of grain opacities coefficients.
subroutine sed_routines::set_dust_emission | ( | ) |
Calculates the dust emission luminosity density and stores it into dens_stars_arr().
subroutine sed_routines::set_lambda_arr_si | ( | ) |
Sets the lambda array in the mks units ( lambda_arr_SI()). It also sets delta_lambda_bin(), delta_lambda_bin_stars() and delta_lambda_bin_dust().
subroutine sed_routines::set_star_particle_luminosity | ( | real(kind=real64) | lambda_in | ) |
Sets stellar particle luminosities star_lum() for an input wavelength lambda_in.
subroutine sed_routines::set_units_dens_stars_arr | ( | ) |
Sets the units of dens_stars_arr() in the dust RT algorithms. These units are W/m/pc^3 where meters refers to the wavelength.
subroutine sed_routines::sum_i_obs | ( | integer | il, |
real(kind=real64), dimension(0:,0:) | sed_arr | ||
) |
Sums i_obs arrays to obtain emission SED.
subroutine sed_routines::value_locate | ( | real(kind=real64) | val, |
real(kind=real64), dimension(0:) | array, | ||
integer | ig0, | ||
integer | ig1, | ||
logical | reverse_order | ||
) |
Finds indeces of an array corresponding to the array value bin containing the input value val(). Note that the array should normally be sorted in ascending order. In case val is lower than array(0), it returns the indeces of the first two elements. If val is higher than array(size(array)-1), it returns indeces of last two elements. The input array can be in the reversing order if the reverse_order keyword is set TRUE.
real(kind=real64) function sed_routines::zbrent_tdust | ( | real(kind=real64), dimension(0:lnum-1) | kabs_arr_planck, |
real(kind=real64) | abs_en | ||
) |
Finds equilibrium dust temperature using Brent's method (modified version of the Van Wijngaarden–Dekker–Brent Method, see Numerical recipes in Fortran 77, Press et al.).
real(kind=real64), dimension(:,:), allocatable sed_routines::aa |
aa | The elements of this matrix are the photon absorption rate per unit energy interval. Do not confuse this with A matrix in Gahathakurta & Draine. This term is only used to calculate source term SeE (equ 53 Voit 1991). |
real(kind=real64), dimension(:), allocatable sed_routines::abs_int_rad_dust |
abs_int_rad_dust | Same as abs_int_rad_stars() but for the radiation field produced by dust emission. |
real(kind=real64), dimension(:), allocatable sed_routines::abs_int_rad_stars |
abs_int_rad_stars | Absorbed energy flux for a given radiation field produced by stellar radiation. It is in W/m/m^2 when calculating the equilibrium dust temperature but it can be transformed to photons/s/m/m^2 when calculating the moments of the dosage function (the latter is needed only for the dust stochastically heated calculation) |
real(kind=real64), dimension(:,:), allocatable sed_routines::bb |
bb | Energy level transition matrix as defined in Gahathakurta & Draine 1989. BB(i,j) gives the total transition rate from level j to all levels >=i. |
real(kind=real64) sed_routines::conv_ufield_ifield |
conv_ufield_ifield | Factor to be applied to the stellar emission radiation field energy density in order to obtain the radiation field intensity integrated over the entire solid angle. |
real(kind=real64), dimension(:,:), allocatable sed_routines::count_spectra_uv_opt |
count_spectra_uv_opt | Counter of spectra contained in each UV and optical radiation field bin defined by rf_uv_arr() and rf_opt_arr(). |
real(kind=real64), dimension(:), allocatable sed_routines::delta_e_arr_bin |
delta_E_arr_bin | Bin sizes for array E_arr() |
real(kind=real64), dimension(:,:), allocatable sed_routines::dust_em_arr_fa |
dust_em_arr_fa | Dust emission spectra for each grain size of the grain size distribution. First index is the grain size index; second index is the wavelength. |
real(kind=real64), dimension(:), allocatable sed_routines::e_arr |
E_arr | Grain enthalpy array |
real(kind=real64), dimension(:), allocatable sed_routines::edot_arr |
Edot_arr | Cooling rates at each temperature defined in the interval where to calculate the temperature probability distribution |
real(kind=real64) sed_routines::emax |
Emax | Maximum grain enthalpy |
real(kind=real64) sed_routines::emin |
Emin | Minimum grain enthalpy |
real(kind=real64), dimension(:), allocatable sed_routines::int_rf_opt |
int_rf_opt | Wavelength integrated radiation field intensity in the optical from 4430 A to longer wavelnegths for each cell. Note that the radiation field produced by the dust emission is not included. |
real(kind=real64), dimension(:), allocatable sed_routines::int_rf_uv |
int_rf_uv | Wavelength integrated radiation field intensity in the UV up to 4430 A for each cell. |
logical sed_routines::large_grain_energy |
large_grain_energy | TRUE when large grain energy limit has to be used to derive the temperature distribution in the stochastically heated dust emission calculation. See Voit 1991. |
integer, parameter sed_routines::n_temp_pt = 300 |
n_temp_pt | Number of sampling point for the temperature probability distribution Pt(). This has to be > 100 to avoid problems with the calculation of Re0(), Re1(), Re2(). Value 250 should give good accuracy in most cases. |
real(kind=real64), dimension(:), allocatable sed_routines::phot_energy |
phot_energy | Photon energy for each wavelength stored in lambda_arr_SI(). |
real(kind=real64), dimension(:), allocatable sed_routines::pt |
Pt | Grain temperature probability distribution. Note that each point is already multiplied by the temperature bin size. So, this is P(T)d(T) = f(E)dE. |
real(kind=real64), dimension(:), allocatable sed_routines::qp_arr |
Qp_arr | Planck-averaged Qabs array at the temperatures T_arr(). |
real(kind=real64), dimension(0:2) sed_routines::rd_arr |
Rd_arr | Moments of dosage function. The zero moment is the total number of photons per unit time heating a dust grain. The first moment is the total heating rate in [W] and the second is the sum of f_lambda*E_lambda^2 where f_lambda is the total number of photons absorbed by a grain at wavelength lambda and E_lambda is the energy of a photon with wavelength lambda. |
real(kind=real64), dimension(:), allocatable sed_routines::rd_integrated |
Rd_integrated | Array of integrals of the photon absorption rate over wavelengths. Corresponding to integrals of "dosage function" in Voit 1991, but the order is inverted because the integration is over wavelength not energy. |
real(kind=real64), dimension(:), allocatable sed_routines::re0 |
Re0 | Zero moment of the dosage funtion integrated up to epsilon (see Voit 1991) |
real(kind=real64), dimension(:), allocatable sed_routines::re1 |
Re1 | First moment of the dosage funtion integrated up to epsilon (see Voit 1991) |
real(kind=real64), dimension(:), allocatable sed_routines::re2 |
Re2 | Second moment of the dosage funtion integrated up to epsilon (see Voit 1991) |
real(kind=real64), dimension(:), allocatable sed_routines::rf_opt_arr |
rf_opt_arr | list of wavelength integrated optical radiation field intensities defining the bins used in the adaptive SED approach |
real(kind=real64), dimension(:), allocatable sed_routines::rf_uv_arr |
rf_uv_arr | list of wavelength integrated UV radiation field intensities defining the bins used in the adaptive SED approach |
real(kind=real64), parameter sed_routines::t0 =0 |
t0 | Minimum dust temperature allowed. |
real(kind=real64), parameter sed_routines::t1 =1E4 |
t1 | Maximum dust temperature allowed |
real(kind=real64), dimension(:), allocatable sed_routines::t_arr |
T_arr | Grain temperature array |
real(kind=real64) sed_routines::tmax |
Tmax | Maximum grain temperature |
real(kind=real64) sed_routines::tmax_prev |
Tmax_prev | Maximum grain temperature in previous temperature iteration. |
real(kind=real64) sed_routines::tmin |
Tmin | Minimum grain temperature |
real(kind=real64) sed_routines::tmin_prev |
Tmin_prev | Minimum grain temperature in previous temperature iteration. |
real(kind=real64), parameter sed_routines::tol =1E-8 |
tol | Tolerance parameter used in zbrent function. |
real(kind=real64), dimension(:), allocatable sed_routines::tot_dust_em |
tot_dust_em | Dust emission spectra after integration over the grain size distributions. |
real(kind=real64), dimension(:,:,:), allocatable sed_routines::u_av_dust |
u_av_dust | Average radiation field spectra of dust emission in each bin. First index is wavelength. Second index is UV radiation field index corresponding to bin in rf_uv_arr(). Third index is optical radiation field index corresponding to bin in rf_opt_arr(). Note that, although the radiation field due to dust emission is included in the average radiation field, its integrated intensity is not considered when binning the radiation field. |
real(kind=real64), dimension(:,:,:), allocatable sed_routines::u_av_uv_opt |
u_av_uv_opt | Average radiation field spectra of stellar emission in each bin. First index is wavelength. Second index is UV radiation field index corresponding to bin in rf_uv_arr(). Third index is optical radiation field index corresponding to bin in rf_opt_arr(). |