3#include "../afivo/src/cpp_macros.h"
22 character(len=20) :: photoi_method =
'helmholtz'
25 character(len=20) :: photoi_source_type =
'Zheleznyak'
28 character(len=20) :: photoi_species =
'O2_plus'
34 character(len=string_len) :: photoi_excited_species =
'UNDEFINED'
37 integer :: i_excited_species = -1
41 real(dp) :: photoi_eta = 0.05_dp
44 real(dp) :: photoi_quenching_pressure = 40e-3
47 real(dp) :: photoi_quenching_pressure_h2o_aints = 0.3 *
uc_torr_to_bar
50 real(dp) :: photoi_photoemission_time = 0.0_dp
59 integer,
public,
protected ::
i_photo = -1
70 type(af_t),
intent(inout) :: tree
71 type(cfg_t),
intent(inout) :: cfg
75 "Whether photoionization is enabled")
77 "Update photoionization every N time steps")
78 call cfg_add_get(cfg,
"photoi%method", photoi_method, &
79 "Which photoionization method to use (helmholtz, montecarlo)")
80 call cfg_add_get(cfg,
"photoi%eta", photoi_eta, &
81 "Photoionization efficiency factor, typically around 0.05-0.1")
82 call cfg_add_get(cfg,
"photoi%quenching_pressure", photoi_quenching_pressure, &
83 "Photoionization quenching pressure for dry air (bar)")
84 call cfg_add_get(cfg,
"photoi%quenching_pressure_H2O_Aints", &
85 photoi_quenching_pressure_h2o_aints, &
86 "Photoionization quenching pressure for H2O in Aints model (bar)")
87 call cfg_add_get(cfg,
"photoi%source_type", photoi_source_type, &
88 "Model (Zheleznyak, Naidis_humid, Aints_humid, from_species)")
89 call cfg_add_get(cfg,
"photoi%excited_species", photoi_excited_species, &
90 "Which excited species to use when photoi%source_type = from_species")
91 call cfg_add_get(cfg,
"photoi%species", photoi_species, &
92 "Which species is ionized by photoionization")
95 call cfg_add_get(cfg,
"photoi%photoemission_time", photoi_photoemission_time, &
96 "Photoemission time delay in case photoi_source_type is 'from_species'")
98 "Whether photoemission is enabled")
100 "Update photoemission every N time step")
103 if (photoi_eta <= 0.0_dp) error stop
"photoi%eta <= 0.0"
104 if (photoi_eta > 1.0_dp) error stop
"photoi%eta > 1.0"
105 if (photoi_quenching_pressure <= 0.0_dp) &
106 error stop
"photoi%quenching_pressure <= 0.0"
110 print *,
"photoi%species not found (", trim(photoi_species),
")"
111 error stop
"photoi%species not present"
114 call af_add_cc_variable(tree,
"photo", ix=
i_photo)
117 select case (photoi_source_type)
120 error stop
"Cannot use photoi%excited_species with Zheleznyak"
121 case (
"Naidis_humid")
122 if (photoi_method /=
"montecarlo") &
123 error stop
"Naidis_humid is not implemented for helmholtz"
125 if (photoi_method /=
"montecarlo") &
126 error stop
"Aints_humid is not implemented for helmholtz"
127 case (
'from_species')
129 error stop
"Please define photoi%excited_species"
131 i_excited_species = &
132 af_find_cc_variable(tree, trim(photoi_excited_species))
134 error stop
"Unknown value for photoi%source_type"
138 select case (photoi_method)
146 print *,
"Unknown photoi_method: ", trim(photoi_method)
155 type(af_t),
intent(inout) :: tree
157 real(dp),
intent(in),
optional :: dt
158 real(dp) :: quench_fac, decay_fraction
159 real(dp) :: eff_decay_time, decay_rate
162 if (photoi_source_type ==
'Aints_humid')
then
171 quench_fac = 1/(1 + (
gas_pressure - p_h2o)/photoi_quenching_pressure + &
172 p_h2o / photoi_quenching_pressure_h2o_aints)
175 quench_fac = photoi_quenching_pressure / &
181 select case (photoi_source_type)
182 case (
'Zheleznyak',
'Naidis_humid',
'Aints_humid')
183 call af_loop_box_arg(tree, photoionization_rate_from_alpha, &
184 [photoi_eta * quench_fac], .true.)
185 case (
'from_species')
187 eff_decay_time = photoi_photoemission_time
188 decay_fraction = 1 - exp(-dt / eff_decay_time)
189 if (dt > 1e-6_dp * eff_decay_time)
then
190 decay_rate = decay_fraction / dt
192 decay_rate = 1.0 / eff_decay_time
195 call af_loop_box_arg(tree, photoionization_rate_from_species, &
196 [quench_fac * decay_rate, 1-decay_fraction], .true.)
199 select case (photoi_method)
259 subroutine photoionization_rate_from_alpha(box, coeff)
264 type(box_t),
intent(inout) :: box
265 real(dp),
intent(in) :: coeff(:)
267 real(dp) :: fld, td, alpha, mobility, tmp, gas_dens
268 type(lt_loc_t) :: loc
282 loc = lt_get_loc(
td_tbl, td)
287 tmp = fld * mobility * alpha * box%cc(ijk,
i_electron) * coeff(1)
289 box%cc(ijk,
i_rhs) = tmp
291 end subroutine photoionization_rate_from_alpha
294 subroutine photoionization_rate_from_species(box, coeff)
299 type(box_t),
intent(inout) :: box
300 real(dp),
intent(in) :: coeff(:)
302 real(dp) :: source_factor, decay_factor
305 source_factor = coeff(1)
306 decay_factor = coeff(2)
308 box%cc(dtimes(1:nc),
i_rhs) = source_factor * &
309 box%cc(dtimes(1:nc), i_excited_species)
310 box%cc(dtimes(1:nc), i_excited_species) = decay_factor * &
311 box%cc(dtimes(1:nc), i_excited_species)
312 end subroutine photoionization_rate_from_species
Module for handling chemical reactions.
elemental integer function, public species_index(name)
Find index of a species, return -1 if not found.
Module that stores parameters related to the gas.
elemental integer function, public gas_index(name)
Find index of a gas component, return -1 if not found.
real(dp), dimension(:), allocatable, public, protected gas_fractions
integer, public, protected i_gas_dens
real(dp), parameter, public si_to_townsend
real(dp), public, protected gas_pressure
logical, public, protected gas_constant_density
Whether the gas has a constant density.
real(dp), public, protected gas_number_density
Module for photoionization with the Helmholtz approximation.
subroutine, public photoi_helmh_compute(tree, i_photo)
subroutine, public photoi_helmh_bc(box, nb, iv, coords, bc_val, bc_type)
subroutine, public photoi_helmh_initialize(tree, cfg, is_used, eta)
Initialize options for Helmholtz photoionization.
Module that provides routines for Monte Carlo photoionization.
subroutine, public phmc_set_src(tree, rng, i_src, i_photo, use_cyl, dt)
Set the source term due to photoionization. At most phmc_num_photons discrete photons are produced.
subroutine, public phmc_initialize(cfg, is_used, source_type)
Initialize photoionization parameters.
logical, public, protected phmc_physical_photons
Whether physical photons are used.
Top-module for photoionization, which can make use of different methods.
integer, public, protected photoi_species_index
Index of species ionized by photoionization (in list of chemical species)
subroutine, public photoi_set_src(tree, dt)
Sets the photoionization.
integer, public, protected photoe_per_steps
Update photoemission every N time step.
logical, public, protected photoe_enabled
Whether photoemission is enabled.
logical, public, protected photoi_enabled
Whether photoionization is enabled.
integer, public, protected i_photo
Optional variable (when using photoionization)
subroutine, public photoi_initialize(tree, cfg)
Initialize photoionization parameters.
integer, public, protected photoi_per_steps
Update photoionization every N time step.
This module contains several pre-defined variables like:
logical, public, protected st_cylindrical
Whether cylindrical coordinates are used.
integer, public, protected i_electron
Index of electron density.
integer, public, protected i_rhs
Index of source term Poisson.
integer, public, protected i_electric_fld
Index of electric field norm.
type(rng_t), public st_rng
Random number generator.
Module that provides routines for reading in arbritrary transport data.
type(lt_t), public, protected td_tbl
integer, parameter, public td_alpha
Ionization coefficient.
integer, parameter, public td_mobility
Electron mobility.
character(len= *), parameter undefined_str
Undefined string.
Module that contains physical and numerical constants.
real(dp), parameter uc_torr_to_bar