Reads the optional &chemistry_input namelist block.
Chemistry is operator-split from advection/diffusion and is solved by the
Cantera C++ bridge as a cell-local constant-pressure reactor. The block
is optional; defaults are conservative and do not enable chemistry by
themselves. enable_reactions remains in &species_input for backward
compatibility with existing cases.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename | |||
| type(case_params_t), | intent(inout) | :: | params |
subroutine read_chemistry_input(filename, params) character(len=*), intent(in) :: filename type(case_params_t), intent(inout) :: params integer :: chemistry_update_interval real(rk) :: chemistry_rtol, chemistry_atol integer :: chemistry_max_steps logical :: chemistry_energy_enabled real(rk) :: chemistry_temperature_cutoff real(rk) :: chemistry_min_reactive_mass_fraction integer :: chemistry_n_active_species character(len=name_len) :: chemistry_active_species_name(max_species) real(rk) :: chemistry_active_species_threshold real(rk) :: chemistry_max_dT_per_step, chemistry_max_rel_rho_change_per_step real(rk) :: chemistry_max_dY_per_step, chemistry_dt_safety, chemistry_dt_min_factor logical :: chemistry_limit_source_update real(rk) :: chemistry_source_relaxation logical :: enable_chemistry_subcycling integer :: max_chemistry_subcycles real(rk) :: subcycling_dT_threshold logical :: reject_on_nan real(rk) :: min_density_ratio_limit real(rk) :: max_temperature_limit real(rk) :: min_temperature_limit real(rk) :: max_pressure_residual_limit logical :: enable_chemistry_load_balancing integer :: unit_id, ios, k namelist /chemistry_input/ chemistry_update_interval, chemistry_rtol, chemistry_atol, & chemistry_max_steps, chemistry_energy_enabled, & chemistry_temperature_cutoff, chemistry_min_reactive_mass_fraction, & chemistry_n_active_species, chemistry_active_species_name, & chemistry_active_species_threshold, & chemistry_max_dT_per_step, chemistry_max_rel_rho_change_per_step, & chemistry_max_dY_per_step, chemistry_dt_safety, chemistry_dt_min_factor, & chemistry_limit_source_update, chemistry_source_relaxation, & enable_chemistry_subcycling, max_chemistry_subcycles, subcycling_dT_threshold, & reject_on_nan, min_density_ratio_limit, max_temperature_limit, & min_temperature_limit, max_pressure_residual_limit, & enable_chemistry_load_balancing chemistry_update_interval = params%chemistry_update_interval chemistry_rtol = params%chemistry_rtol chemistry_atol = params%chemistry_atol chemistry_max_steps = params%chemistry_max_steps chemistry_energy_enabled = params%chemistry_energy_enabled chemistry_temperature_cutoff = params%chemistry_temperature_cutoff chemistry_min_reactive_mass_fraction = params%chemistry_min_reactive_mass_fraction chemistry_n_active_species = params%chemistry_n_active_species chemistry_active_species_name = params%chemistry_active_species_name chemistry_active_species_threshold = params%chemistry_active_species_threshold chemistry_max_dT_per_step = params%chemistry_max_dT_per_step chemistry_max_rel_rho_change_per_step = params%chemistry_max_rel_rho_change_per_step chemistry_max_dY_per_step = params%chemistry_max_dY_per_step chemistry_dt_safety = params%chemistry_dt_safety chemistry_dt_min_factor = params%chemistry_dt_min_factor chemistry_limit_source_update = params%chemistry_limit_source_update chemistry_source_relaxation = params%chemistry_source_relaxation enable_chemistry_subcycling = params%enable_chemistry_subcycling max_chemistry_subcycles = params%max_chemistry_subcycles subcycling_dT_threshold = params%subcycling_dT_threshold reject_on_nan = params%reject_on_nan min_density_ratio_limit = params%min_density_ratio_limit max_temperature_limit = params%max_temperature_limit min_temperature_limit = params%min_temperature_limit max_pressure_residual_limit = params%max_pressure_residual_limit enable_chemistry_load_balancing = params%enable_chemistry_load_balancing call open_namelist_file(filename, unit_id, ios) if (ios == 0) then read(unit_id, nml=chemistry_input, iostat=ios) close(unit_id) end if if (ios /= 0 .and. ios /= -1) then call fatal_error('input', 'failed reading &chemistry_input. Check for unknown variables or typos.') end if if (ios == 0) then params%chemistry_update_interval = chemistry_update_interval params%chemistry_rtol = chemistry_rtol params%chemistry_atol = chemistry_atol params%chemistry_max_steps = chemistry_max_steps params%chemistry_energy_enabled = chemistry_energy_enabled params%chemistry_temperature_cutoff = chemistry_temperature_cutoff params%chemistry_min_reactive_mass_fraction = chemistry_min_reactive_mass_fraction params%chemistry_n_active_species = chemistry_n_active_species params%chemistry_active_species_name = chemistry_active_species_name params%chemistry_active_species_threshold = chemistry_active_species_threshold params%chemistry_max_dT_per_step = chemistry_max_dT_per_step params%chemistry_max_rel_rho_change_per_step = chemistry_max_rel_rho_change_per_step params%chemistry_max_dY_per_step = chemistry_max_dY_per_step params%chemistry_dt_safety = chemistry_dt_safety params%chemistry_dt_min_factor = chemistry_dt_min_factor params%chemistry_limit_source_update = chemistry_limit_source_update params%chemistry_source_relaxation = chemistry_source_relaxation params%enable_chemistry_subcycling = enable_chemistry_subcycling params%max_chemistry_subcycles = max_chemistry_subcycles params%subcycling_dT_threshold = subcycling_dT_threshold params%reject_on_nan = reject_on_nan params%min_density_ratio_limit = min_density_ratio_limit params%max_temperature_limit = max_temperature_limit params%min_temperature_limit = min_temperature_limit params%max_pressure_residual_limit = max_pressure_residual_limit params%enable_chemistry_load_balancing = enable_chemistry_load_balancing if (params%chemistry_n_active_species <= 0) then do k = 1, max_species if (len_trim(params%chemistry_active_species_name(k)) > 0) then params%chemistry_n_active_species = k end if end do end if end if end subroutine read_chemistry_input