module params_brag_boundaries_perp_m !! Parameters for the BRAGINSKII model related with boundaries_perp 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 use descriptors_braginskii_m, only : & convert_descriptor_char_int, & BND_TYPE_DIRICHLET_ZERO, BND_TYPE_NEUMANN implicit none ! For density ------------------------------------- integer, protected :: bnddescr_ne_core = BND_TYPE_NEUMANN !! Type of boundary condition for density at core boundary real(GP), protected :: bndval_ne_core = 0.0_GP !! Value for boundary condition for density at core boundary integer, protected :: bnddescr_ne_wall = BND_TYPE_NEUMANN !! Type of boundary condition for density at wall boundary real(GP), protected :: bndval_ne_wall = 0.0_GP !! Value of boundary condition for density at wall boundary integer, protected :: bnddescr_ne_dome = BND_TYPE_NEUMANN !! Type of boundary condition for density at dome boundary real(GP), protected :: bndval_ne_dome = 0.0_GP !! Value of boundary condition for density at dome boundary integer, protected :: bnddescr_ne_out = BND_TYPE_NEUMANN !! Type of boundary condition for density at outer(mask) boundary real(GP), protected :: bndval_ne_out = 0.0_GP !! Value of boundary condition for density at outer(mask) boundary ! For electrostatic potential --------------------- integer, protected :: bnddescr_pot_core = BND_TYPE_NEUMANN !! Type of boundary condition for electrostatic potential at core boundary real(GP), protected :: bndval_pot_core = 0.0_GP !! Value for boundary condition for electrostatic potential at core boundary integer, protected :: bnddescr_pot_wall = BND_TYPE_DIRICHLET_ZERO !! Type of boundary condition for electrostatic potential at wall boundary real(GP), protected :: bndval_pot_wall = 0.0_GP !! Value of boundary condition for electrostatic potential at wall boundary integer, protected :: bnddescr_pot_dome = BND_TYPE_DIRICHLET_ZERO !! Type of boundary condition for electrostatic potential at dome boundary real(GP), protected :: bndval_pot_dome = 0.0_GP !! Value of boundary condition for electrostatic potential at dome boundary integer, protected :: bnddescr_pot_out = BND_TYPE_DIRICHLET_ZERO !! Type of boundary condition for electrostatic potential at outer(mask) boundary real(GP), protected :: bndval_pot_out = 0.0_GP !! Value of boundary condition for electrostatic potential at outer(mask) boundary ! For generalised vorticity ----------------------- integer, protected :: bnddescr_vort_core = BND_TYPE_NEUMANN !! Type of boundary condition for vorticity at core boundary real(GP), protected :: bndval_vort_core = 0.0_GP !! Value for boundary condition for vorticity at core boundary integer, protected :: bnddescr_vort_wall = BND_TYPE_NEUMANN !! Type of boundary condition for vorticity at wall boundary real(GP), protected :: bndval_vort_wall = 0.0_GP !! Value of boundary condition for vorticity at wall boundary integer, protected :: bnddescr_vort_dome = BND_TYPE_NEUMANN !! Type of boundary condition for vorticity at dome boundary real(GP), protected :: bndval_vort_dome = 0.0_GP !! Value of boundary condition for vorticity at dome boundary integer, protected :: bnddescr_vort_out = BND_TYPE_NEUMANN !! Type of boundary condition for vorticity at outer(mask) boundary real(GP), protected :: bndval_vort_out = 0.0_GP !! Value of boundary condition for vorticity at outer(mask) boundary ! For parallel electromagnetic potential ---------- integer, protected :: bnddescr_apar_core = BND_TYPE_DIRICHLET_ZERO !! Type of boundary condition for apar at core boundary real(GP), protected :: bndval_apar_core = 0.0_GP !! Value for boundary condition for apar at core boundary integer, protected :: bnddescr_apar_wall = BND_TYPE_DIRICHLET_ZERO !! Type of boundary condition for apar at wall boundary real(GP), protected :: bndval_apar_wall = 0.0_GP !! Value of boundary condition for apar at wall boundary integer, protected :: bnddescr_apar_dome = BND_TYPE_DIRICHLET_ZERO !! Type of boundary condition for apar at dome boundary real(GP), protected :: bndval_apar_dome = 0.0_GP !! Value of boundary condition for apar at dome boundary integer, protected :: bnddescr_apar_out = BND_TYPE_DIRICHLET_ZERO !! Type of boundary condition for apar at outer(mask) boundary real(GP), protected :: bndval_apar_out = 0.0_GP !! Value of boundary condition for apar at outer(mask) boundary ! For parallel current ---------------------------- integer, protected :: bnddescr_jpar_core = BND_TYPE_NEUMANN !! Type of boundary condition for parallel current at core boundary real(GP), protected :: bndval_jpar_core = 0.0_GP !! Value for boundary condition for parallel current at core boundary integer, protected :: bnddescr_jpar_wall = BND_TYPE_NEUMANN !! Type of boundary condition for parallel current at wall boundary real(GP), protected :: bndval_jpar_wall = 0.0_GP !! Value of boundary condition for parallel current at wall boundary integer, protected :: bnddescr_jpar_dome = BND_TYPE_NEUMANN !! Type of boundary condition for parallel current at dome boundary real(GP), protected :: bndval_jpar_dome = 0.0_GP !! Value of boundary condition for parallel current at dome boundary integer, protected :: bnddescr_jpar_out = BND_TYPE_NEUMANN !! Type of boundary condition for parallel current at outer(mask) boundary real(GP), protected :: bndval_jpar_out = 0.0_GP !! Value of boundary condition for parallel current at outer(mask) boundary ! For electron temperature ------------------------ integer, protected :: bnddescr_te_core = BND_TYPE_NEUMANN !! Type of boundary condition for electron temperature at core boundary real(GP), protected :: bndval_te_core = 0.0_GP !! Value for boundary condition for electron temperature at core boundary integer, protected :: bnddescr_te_wall = BND_TYPE_NEUMANN !! Type of boundary condition for electron temperature at wall boundary real(GP), protected :: bndval_te_wall = 0.0_GP !! Value of boundary condition for electron temperature at wall boundary integer, protected :: bnddescr_te_dome = BND_TYPE_NEUMANN !! Type of boundary condition for electron temperature at dome boundary real(GP), protected :: bndval_te_dome = 0.0_GP !! Value of boundary condition for electron temperature at dome boundary integer, protected :: bnddescr_te_out = BND_TYPE_NEUMANN !! Type of boundary condition for electron temperature at outer(mask) boundary real(GP), protected :: bndval_te_out = 0.0_GP !! Value of boundary condition for electron temperature at outer(mask) boundary ! For ion temperature ------------------------ integer, protected :: bnddescr_ti_core = BND_TYPE_NEUMANN !! Type of boundary condition for ion temperature at core boundary real(GP), protected :: bndval_ti_core = 0.0_GP !! Value for boundary condition for ion temperature at core boundary integer, protected :: bnddescr_ti_wall = BND_TYPE_NEUMANN !! Type of boundary condition for ion temperature at wall boundary real(GP), protected :: bndval_ti_wall = 0.0_GP !! Value of boundary condition for ion temperature at wall boundary integer, protected :: bnddescr_ti_dome = BND_TYPE_NEUMANN !! Type of boundary condition for ion temperature at dome boundary real(GP), protected :: bndval_ti_dome = 0.0_GP !! Value of boundary condition for ion temperature at dome boundary integer, protected :: bnddescr_ti_out = BND_TYPE_NEUMANN !! Type of boundary condition for ion temperature at outer(mask) boundary real(GP), protected :: bndval_ti_out = 0.0_GP !! Value of boundary condition for ion temperature at outer(mask) boundary ! For parallel ion velocity ------------------------ integer, protected :: bnddescr_upar_core = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion velocity at core boundary real(GP), protected :: bndval_upar_core = 0.0_GP !! Value for boundary condition for parallel ion velocity at core boundary integer, protected :: bnddescr_upar_wall = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion velocity at wall boundary real(GP), protected :: bndval_upar_wall = 0.0_GP !! Value of boundary condition for parallel ion velocity at wall boundary integer, protected :: bnddescr_upar_dome = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion velocity at dome boundary real(GP), protected :: bndval_upar_dome = 0.0_GP !! Value of boundary condition for parallel ion velocity at dome boundary integer, protected :: bnddescr_upar_out = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion velocity at outer(mask) boundary real(GP), protected :: bndval_upar_out = 0.0_GP !! Value of boundary condition for parallel ion velocity at outer(mask) boundary ! For parallel electron heat flux -------------------- integer, protected :: bnddescr_qe_core = BND_TYPE_NEUMANN !! Type of boundary condition for parallel electron heat flux at core boundary real(GP), protected :: bndval_qe_core = 0.0_GP !! Value for boundary condition for parallel electron heat flux at core boundary integer, protected :: bnddescr_qe_wall = BND_TYPE_NEUMANN !! Type of boundary condition for parallel electron heat flux at wall boundary real(GP), protected :: bndval_qe_wall = 0.0_GP !! Value for boundary condition for parallel electron heat flux at wall boundary integer, protected :: bnddescr_qe_dome = BND_TYPE_NEUMANN !! Type of boundary condition for parallel electron heat flux at dome boundary real(GP), protected :: bndval_qe_dome = 0.0_GP !! Value for boundary condition for parallel electron heat flux at dome boundary integer, protected :: bnddescr_qe_out = BND_TYPE_NEUMANN !! Type of boundary condition for parallel electron heat flux at outer(mask) boundary real(GP), protected :: bndval_qe_out = 0.0_GP !! Value for boundary condition for parallel electron heat flux at outer(mask) boundary ! For parallel ion heat flux ------------------------- integer, protected :: bnddescr_qi_core = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion heat flux at core boundary real(GP), protected :: bndval_qi_core = 0.0_GP !! Value for boundary condition for parallel ion heat flux at core boundary integer, protected :: bnddescr_qi_wall = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion heat flux at wall boundary real(GP), protected :: bndval_qi_wall = 0.0_GP !! Value for boundary condition for parallel ion heat flux at wall boundary integer, protected :: bnddescr_qi_dome = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion heat flux at dome boundary real(GP), protected :: bndval_qi_dome = 0.0_GP !! Value for boundary condition for parallel ion heat flux at dome boundary integer, protected :: bnddescr_qi_out = BND_TYPE_NEUMANN !! Type of boundary condition for parallel ion heat flux at outer(mask) boundary real(GP), protected :: bndval_qi_out = 0.0_GP !! Value for boundary condition for parallel ion heat flux at outer(mask) boundary public :: read_params_brag_boundaries_perp public :: write_params_brag_boundaries_perp ! The bndtype variables are introduced for human ! readable format in parameter files character(len=64), private :: & bndtype_ne_core = 'BND_TYPE_NEUMANN', & bndtype_ne_wall = 'BND_TYPE_NEUMANN', & bndtype_ne_dome = 'BND_TYPE_NEUMANN', & bndtype_ne_out = 'BND_TYPE_NEUMANN', & bndtype_pot_core = 'BND_TYPE_DIRICHLET_ZERO', & bndtype_pot_wall = 'BND_TYPE_NEUMANN', & bndtype_pot_dome = 'BND_TYPE_NEUMANN', & bndtype_pot_out = 'BND_TYPE_NEUMANN', & bndtype_vort_core = 'BND_TYPE_NEUMANN', & bndtype_vort_wall = 'BND_TYPE_NEUMANN', & bndtype_vort_dome = 'BND_TYPE_NEUMANN', & bndtype_vort_out = 'BND_TYPE_NEUMANN', & bndtype_apar_core = 'BND_TYPE_DIRICHLET_ZERO', & bndtype_apar_wall = 'BND_TYPE_DIRICHLET_ZERO', & bndtype_apar_dome = 'BND_TYPE_DIRICHLET_ZERO', & bndtype_apar_out = 'BND_TYPE_DIRICHLET_ZERO', & bndtype_jpar_core = 'BND_TYPE_NEUMANN', & bndtype_jpar_wall = 'BND_TYPE_NEUMANN', & bndtype_jpar_dome = 'BND_TYPE_NEUMANN', & bndtype_jpar_out = 'BND_TYPE_NEUMANN', & bndtype_te_core = 'BND_TYPE_NEUMANN', & bndtype_te_wall = 'BND_TYPE_NEUMANN', & bndtype_te_dome = 'BND_TYPE_NEUMANN', & bndtype_te_out = 'BND_TYPE_NEUMANN', & bndtype_ti_core = 'BND_TYPE_NEUMANN', & bndtype_ti_wall = 'BND_TYPE_NEUMANN', & bndtype_ti_dome = 'BND_TYPE_NEUMANN', & bndtype_ti_out = 'BND_TYPE_NEUMANN', & bndtype_upar_core = 'BND_TYPE_NEUMANN', & bndtype_upar_wall = 'BND_TYPE_NEUMANN', & bndtype_upar_dome = 'BND_TYPE_NEUMANN', & bndtype_upar_out = 'BND_TYPE_NEUMANN', & bndtype_qe_core = 'BND_TYPE_NEUMANN', & bndtype_qe_wall = 'BND_TYPE_NEUMANN', & bndtype_qe_dome = 'BND_TYPE_NEUMANN', & bndtype_qe_out = 'BND_TYPE_NEUMANN', & bndtype_qi_core = 'BND_TYPE_NEUMANN', & bndtype_qi_wall = 'BND_TYPE_NEUMANN', & bndtype_qi_dome = 'BND_TYPE_NEUMANN', & bndtype_qi_out = 'BND_TYPE_NEUMANN' namelist / brag_boundaries_perp / & bndtype_ne_core, & bndtype_ne_wall, & bndtype_ne_dome, & bndtype_ne_out, & bndtype_pot_core, & bndtype_pot_wall, & bndtype_pot_dome, & bndtype_pot_out, & bndtype_vort_core, & bndtype_vort_wall, & bndtype_vort_dome, & bndtype_vort_out, & bndtype_apar_core, & bndtype_apar_wall, & bndtype_apar_dome, & bndtype_apar_out, & bndtype_jpar_core, & bndtype_jpar_wall, & bndtype_jpar_dome, & bndtype_jpar_out, & bndtype_te_core, & bndtype_te_wall, & bndtype_te_dome, & bndtype_te_out, & bndtype_ti_core, & bndtype_ti_wall, & bndtype_ti_dome, & bndtype_ti_out, & bndtype_upar_core, & bndtype_upar_wall, & bndtype_upar_dome, & bndtype_upar_out, & bndtype_qe_core, & bndtype_qe_wall, & bndtype_qe_dome, & bndtype_qe_out, & bndtype_qi_core, & bndtype_qi_wall, & bndtype_qi_dome, & bndtype_qi_out, & bndval_ne_core, & bndval_ne_wall, & bndval_ne_dome, & bndval_ne_out, & bndval_pot_core, & bndval_pot_wall, & bndval_pot_dome, & bndval_pot_out, & bndval_vort_core, & bndval_vort_wall, & bndval_vort_dome, & bndval_vort_out, & bndval_apar_core, & bndval_apar_wall, & bndval_apar_dome, & bndval_apar_out, & bndval_jpar_core, & bndval_jpar_wall, & bndval_jpar_dome, & bndval_jpar_out, & bndval_te_core, & bndval_te_wall, & bndval_te_dome, & bndval_te_out, & bndval_ti_core, & bndval_ti_wall, & bndval_ti_dome, & bndval_ti_out, & bndval_upar_core, & bndval_upar_wall, & bndval_upar_dome, & bndval_upar_out, & bndval_qe_core, & bndval_qe_wall, & bndval_qe_dome, & bndval_qe_out, & bndval_qi_core, & bndval_qi_wall, & bndval_qi_dome, & bndval_qi_out private brag_boundaries_perp contains subroutine read_params_brag_boundaries_perp(filename) !! Reads parameters related with brag_boundaries_perp 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=brag_boundaries_perp, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif ! Convert to descriptors call convert_descriptor_char_int(bndtype_ne_core, bnddescr_ne_core) call convert_descriptor_char_int(bndtype_ne_wall, bnddescr_ne_wall) call convert_descriptor_char_int(bndtype_ne_dome, bnddescr_ne_dome) call convert_descriptor_char_int(bndtype_ne_out, bnddescr_ne_out) call convert_descriptor_char_int(bndtype_pot_core, bnddescr_pot_core) call convert_descriptor_char_int(bndtype_pot_wall, bnddescr_pot_wall) call convert_descriptor_char_int(bndtype_pot_dome, bnddescr_pot_dome) call convert_descriptor_char_int(bndtype_pot_out, bnddescr_pot_out) call convert_descriptor_char_int(bndtype_vort_core, bnddescr_vort_core) call convert_descriptor_char_int(bndtype_vort_wall, bnddescr_vort_wall) call convert_descriptor_char_int(bndtype_vort_dome, bnddescr_vort_dome) call convert_descriptor_char_int(bndtype_vort_out, bnddescr_vort_out) call convert_descriptor_char_int(bndtype_apar_core, bnddescr_apar_core) call convert_descriptor_char_int(bndtype_apar_wall, bnddescr_apar_wall) call convert_descriptor_char_int(bndtype_apar_dome, bnddescr_apar_dome) call convert_descriptor_char_int(bndtype_apar_out, bnddescr_apar_out) call convert_descriptor_char_int(bndtype_jpar_core, bnddescr_jpar_core) call convert_descriptor_char_int(bndtype_jpar_wall, bnddescr_jpar_wall) call convert_descriptor_char_int(bndtype_jpar_dome, bnddescr_jpar_dome) call convert_descriptor_char_int(bndtype_jpar_out, bnddescr_jpar_out) call convert_descriptor_char_int(bndtype_te_core, bnddescr_te_core) call convert_descriptor_char_int(bndtype_te_wall, bnddescr_te_wall) call convert_descriptor_char_int(bndtype_te_dome, bnddescr_te_dome) call convert_descriptor_char_int(bndtype_te_out, bnddescr_te_out) call convert_descriptor_char_int(bndtype_ti_core, bnddescr_ti_core) call convert_descriptor_char_int(bndtype_ti_wall, bnddescr_ti_wall) call convert_descriptor_char_int(bndtype_ti_dome, bnddescr_ti_dome) call convert_descriptor_char_int(bndtype_ti_out, bnddescr_ti_out) call convert_descriptor_char_int(bndtype_upar_core, bnddescr_upar_core) call convert_descriptor_char_int(bndtype_upar_wall, bnddescr_upar_wall) call convert_descriptor_char_int(bndtype_upar_dome, bnddescr_upar_dome) call convert_descriptor_char_int(bndtype_upar_out, bnddescr_upar_out) call convert_descriptor_char_int(bndtype_qe_core, bnddescr_qe_core) call convert_descriptor_char_int(bndtype_qe_wall, bnddescr_qe_wall) call convert_descriptor_char_int(bndtype_qe_dome, bnddescr_qe_dome) call convert_descriptor_char_int(bndtype_qe_out, bnddescr_qe_out) call convert_descriptor_char_int(bndtype_qi_core, bnddescr_qi_core) call convert_descriptor_char_int(bndtype_qi_wall, bnddescr_qi_wall) call convert_descriptor_char_int(bndtype_qi_dome, bnddescr_qi_dome) call convert_descriptor_char_int(bndtype_qi_out, bnddescr_qi_out) close(io_unit) end subroutine subroutine write_params_brag_boundaries_perp(filename) !! Reads parameters related with brag_boundaries_perp 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=brag_boundaries_perp, 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