module params_neut_switches_m !! Parameters for the neutrals model related with switches use precision_grillix_m, only : GP use error_handling_grillix_m, only: handle_error use status_codes_grillix_m, only : GRILLIX_ERR_NAMELIST use screen_io_m, only : get_stdout implicit none real(GP), protected :: swn_iz = 1.0_GP !! Switch for ionization rate coefficient real(GP), protected :: swn_rec = 1.0_GP !! Switch for recombination rate coefficient real(GP), protected :: swn_dens_diff_pol = 1.0_GP !! Switch for poloidal diffusion of neutrals density real(GP), protected :: swn_dens_diff_tor = 0.0_GP !! Switch for toroidal diffusion of neutrals density, only used in 1-moment model real(GP), protected :: swn_dens_par_flux = 1.0_GP !! Switch for parallel advection and compression (flux) in neutrals density real(GP), protected :: swn_parmom_diff_pol = 1.0_GP !! Switch for poloidal diffusion of neutrals parallel momentum real(GP), protected :: swn_parmom_par_flux = 1.0_GP !! Switch for parallel advection and compression (flux) in neutrals parallel momentum real(GP), protected :: swn_parmom_par_pressure = 1.0_GP !! Switch for parallel pressure gradient in neutrals parallel momentum real(GP), protected :: swn_pressure_diff_pol = 1.0_GP !! Switch for poloidal diffusion of N TN^2 in neutrals pressure equation real(GP), protected :: swn_pressure_par_flux = 1.0_GP !! Switch for parallel flux in neutrals pressure equation real(GP), protected :: swn_pressure_div_vpar = 1.0_GP !! Switch for parallel compression in neutrals pressure equation real(GP), protected :: swn_pressure_vischeat = 1.0_GP !! Switch for viscous heating in neutrals pressure equation real(GP), protected :: swn_src_vort = 1.0_GP !! Switch for vorticity source (or rather sink) due to neutrals real(GP), protected :: swn_src_te = 1.0_GP !! Switch for electron temperature source real(GP), protected :: swn_src_parmom = 1.0_GP !! Switch for parallel momentum source real(GP), protected :: swn_src_upar = 1.0_GP !! Switch for parallel velocity source for momentum conservation real(GP), protected :: swn_src_pressure = 1.0_GP !! Switch for neutrals pressure source real(GP), protected :: swn_src_ti = 1.0_GP !! Switch for ion temperature source for thermal energy conservation real(GP), protected :: swn_cx_equi_ti = 1.0_GP !! Switch for CX equilibration term in ion temperature source real(GP), protected :: swn_cx_equi_pn = 1.0_GP !! Switch for CX equilibration term in neutrals pressure source real(GP), protected :: swn_src_rcy = 0.0_GP !! Switch for local recycling neutrals density source real(GP), protected :: swn_src_rcy_partarget = 0.0_GP !! Switch for local recycling source contribution of parallel fluxes on target real(GP), protected :: swn_src_rcy_perpouter = 0.0_GP !! Switch for local recycling source contribution from perpendicular plasma fluxes !! through outer boundary real(GP), protected :: swn_src_rcy_perpcore = 0.0_GP !! Switch for local recycling source contribution from perpendicular plasma fluxes !! through core boundary logical, protected :: lswn_src_rcy_perp_local = .true. !! Logical switch whether or not to apply recycling source from perpendicular fluxes !! locally or spread it evenly over the source region in front of the targets public :: read_params_neut_switches public :: write_params_neut_switches namelist / neut_switches / & swn_iz, & swn_rec, & swn_dens_diff_pol, & swn_dens_diff_tor, & swn_dens_par_flux, & swn_parmom_diff_pol, & swn_parmom_par_flux, & swn_parmom_par_pressure, & swn_pressure_diff_pol, & swn_pressure_par_flux, & swn_pressure_div_vpar, & swn_pressure_vischeat, & swn_src_parmom, & swn_src_pressure, & swn_src_vort, & swn_src_upar, & swn_src_parmom, & swn_src_te, & swn_src_ti, & swn_cx_equi_ti, & swn_cx_equi_pn, & swn_src_rcy, & swn_src_rcy_partarget, & swn_src_rcy_perpouter, & swn_src_rcy_perpcore, & lswn_src_rcy_perp_local private neut_switches contains subroutine read_params_neut_switches(filename) !! Reads parameters related with neut_switches character(len=*), intent(in) :: filename !! Filename, to read from integer :: io_unit, io_error character(len=256) :: io_errmsg open(newunit=io_unit, file=filename, status='old', action='read', & iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif read(io_unit, nml=neut_switches, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif close(io_unit) end subroutine subroutine write_params_neut_switches(filename) !! Reads parameters related with neut_switches character(len=*), intent(in), optional :: filename !! If present, filename where params are written to, !! if not present, writes to screen integer :: io_unit, io_error character(len=256) :: io_errmsg if (present(filename)) then open(newunit=io_unit, file=filename, status='unknown', & access='append', action='write', & iostat=io_error, iomsg=io_errmsg ) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif else io_unit = get_stdout() endif write(io_unit, nml=neut_switches, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif if (present(filename)) then close(io_unit) endif end subroutine end module