module descriptors_braginskii_m !! Definition of additional descriptors not available from PARALLAX use error_handling_grillix_m, only: handle_error, error_info_t use status_codes_grillix_m, only : GRILLIX_ERR_OTHER use screen_io_m, only : get_stdout use descriptors_m, only : BND_TYPE_DIRICHLET_ZERO, BND_TYPE_DIRICHLET, BND_TYPE_NEUMANN, BND_TYPE_NONE implicit none save public ! Everything in this module will be externally accessible unless declared private ! Define boundary types in the range 300-400, with a decade (10) per variable ! General boundary conditions integer, parameter :: BND_BRAGTYPE_UPWIND = 300 !! Takes the upwind value (i.e. first order local neumann) !! If pen_bndval_into or pen_bndval_out are supplied, they should be in the range 0 <= val <= 1, which !! will give a local gradient by setting the boundary value as val * upwind_value !! Note that val=1 has no effect, while val->0 applies an increasingly strong gradient. val > 1 is allowed !! if you want to experiment with positive gradients ! Log-density boundary conditions 320-329 ! BND_BRAGTYPE_UPWIND recommended ! Log-temperature boundary conditions 330-339 integer, parameter :: BND_BRAGTYPE_PARALLEL_HEAT_TRANSMISSION = 330 ! Parallel velocity boundary conditions 340-349 integer, parameter :: BND_BRAGTYPE_SONIC_LOCAL = 340 !! Applies upar = \pm c_s, where the sound speed is evaluated locally integer, parameter :: BND_BRAGTYPE_BOHM_LOCAL = 341 !! Applies upar >= \pm c_s, where the sound speed is evaluated locally ! integer, parameter :: BND_BRAGTYPE_SONIC_TARGET = 342 !! Applies upar = pm c_s, where the sound speed is interpolated to the target value ! integer, parameter :: BND_BRAGTYPE_BOHM_TARGET = 344 !! Applies upar = pm c_s, where the sound speed is interpolated to the target value integer, parameter :: BND_BRAGTYPE_SONIC_DRIFT_LOCAL = 345 !! Applies Bohm-Chodura sonic boundary conditions with drift corrections, i.e.: upar = pm c_s -v_E*n / (n \cdot b) integer, parameter :: BND_BRAGTYPE_BOHM_DRIFT_LOCAL = 346 !! Applies Bohm-Chodura boundary conditions with drift corrections, i.e.: upar >= pm c_s -v_E*n / (n \cdot b) ! Vorticity boundary conditions 350-359 ! BND_BRAGTYPE_UPWIND recommended ! Psi-m (for current and apar) boundary condition 360-369 ! BND_TYPE_DIRICHLET_ZERO is enforced (no other option in parameter file). Note that it is not possible ! to set 'pen_bndval_into' or 'pen_bndval_out' for this field since there is no constant current boundary condition ! Potential boundary conditions 370-379 integer, parameter :: BND_BRAGTYPE_ZONAL_NEUMANN = 375 !! Zonal Neumann boundary condition usable for potential at core integer, parameter :: BND_BRAGTYPE_FLOATING_POTENTIAL_LOCAL = 370 !! Applies potential = Lambda * T_e, for the local electron temperature and Lambda \approx 2.69 !! as the sheath potential difference ! integer, parameter :: BND_BRAGTYPE_FLOATING_POTENTIAL_TARGET = 371 !! Applies potential = Lambda * T_e, for the target-interpolated electron temperature and !! Lambda \approx 3.1 as the sheath potential difference ! Boundary condition for current/electromagnetic potential integer, parameter :: BND_BRAGTYPE_JPAR_SMOOTHPENZERO = 380 !! Applies jpar = 0 boundary conditions at targets !! Smoothly penalised to zero contains subroutine convert_descriptor_char_int(char_descr, int_descr) !! Extends PARALLAX subroutine of the same name !! converts character, e.g. as specified in parameter files, into actual (integer) descriptor use descriptors_m, only : convert_descriptor_char_int_parallax => convert_descriptor_char_int implicit none character(len=*), intent(in) :: char_descr !! character descriptor integer, intent(out) :: int_descr !! actual descriptor for code !! Check that the descriptors inherited from PARALLAX have not changed. Otherwise, they might conflict (i.e. have !! the same value) as some of the other descriptors we have added if (.not.((BND_TYPE_DIRICHLET_ZERO == -3) .and. & !! Dirichlet boundary condition zeroth order (BND_TYPE_DIRICHLET == 0) .and. & !! Dirichlet boundary condition first order (BND_TYPE_NEUMANN == 1) .and. & !! Neumann boundary condition first order (BND_TYPE_NONE == 312))) then !! nothing applied for boundary conditions call handle_error('Error: PARALLAX BND_TYPE descriptors have changed. & Update descriptors_neutrals_m to ensure & that boundary type descriptors do not conflict', & GRILLIX_ERR_OTHER, __LINE__, __FILE__) endif select case(char_descr) case ('BND_TYPE_DIRICHLET_ZERO', 'BND_TYPE_DIRICHLET', 'BND_TYPE_NEUMANN', 'BND_TYPE_NONE') call convert_descriptor_char_int_parallax(char_descr, int_descr) case ('BND_BRAGTYPE_UPWIND') int_descr = BND_BRAGTYPE_UPWIND case ('BND_BRAGTYPE_PARALLEL_HEAT_TRANSMISSION') int_descr = BND_BRAGTYPE_PARALLEL_HEAT_TRANSMISSION case ('BND_BRAGTYPE_SONIC_LOCAL') int_descr = BND_BRAGTYPE_SONIC_LOCAL case ('BND_BRAGTYPE_BOHM_LOCAL') int_descr = BND_BRAGTYPE_BOHM_LOCAL case ('BND_BRAGTYPE_SONIC_DRIFT_LOCAL') int_descr = BND_BRAGTYPE_SONIC_DRIFT_LOCAL case ('BND_BRAGTYPE_BOHM_DRIFT_LOCAL') int_descr = BND_BRAGTYPE_BOHM_DRIFT_LOCAL case ('BND_BRAGTYPE_ZONAL_NEUMANN') int_descr = BND_BRAGTYPE_ZONAL_NEUMANN case ('BND_BRAGTYPE_FLOATING_POTENTIAL_LOCAL') int_descr = BND_BRAGTYPE_FLOATING_POTENTIAL_LOCAL case ('BND_BRAGTYPE_JPAR_SMOOTHPENZERO') int_descr = BND_BRAGTYPE_JPAR_SMOOTHPENZERO case default call handle_error('Char_descr not valid', & GRILLIX_ERR_OTHER, __LINE__, __FILE__, & error_info_t(char_descr)) end select end subroutine subroutine convert_descriptor_int_char(int_descr, char_descr) !! Converts integer descriptor into character descriptor integer, intent(in) :: int_descr !! Integer descriptor character(len=:), allocatable, intent(out) :: char_descr !! Character descriptor select case(int_descr) case (BND_TYPE_DIRICHLET_ZERO) char_descr = 'BND_TYPE_DIRICHLET_ZERO' case (BND_TYPE_DIRICHLET) char_descr = 'BND_TYPE_DIRICHLET' case (BND_TYPE_NEUMANN) char_descr = 'BND_TYPE_NEUMANN' case (BND_TYPE_NONE) char_descr = 'BND_TYPE_NONE' case (BND_BRAGTYPE_UPWIND) char_descr = 'BND_BRAGTYPE_UPWIND' case (BND_BRAGTYPE_PARALLEL_HEAT_TRANSMISSION) char_descr = 'BND_BRAGTYPE_PARALLEL_HEAT_TRANSMISSION' case (BND_BRAGTYPE_SONIC_LOCAL) char_descr = 'BND_BRAGTYPE_SONIC_LOCAL' case (BND_BRAGTYPE_BOHM_LOCAL) char_descr = 'BND_BRAGTYPE_BOHM_LOCAL' case (BND_BRAGTYPE_SONIC_DRIFT_LOCAL) char_descr = 'BND_BRAGTYPE_SONIC_DRIFT_LOCAL' case (BND_BRAGTYPE_BOHM_DRIFT_LOCAL) char_descr = 'BND_BRAGTYPE_BOHM_DRIFT_LOCAL' case (BND_BRAGTYPE_ZONAL_NEUMANN) char_descr = 'BND_BRAGTYPE_ZONAL_NEUMANN' case (BND_BRAGTYPE_FLOATING_POTENTIAL_LOCAL) char_descr = 'BND_BRAGTYPE_FLOATING_POTENTIAL_LOCAL' case (BND_BRAGTYPE_JPAR_SMOOTHPENZERO) char_descr = 'BND_BRAGTYPE_JPAR_SMOOTHPENZERO' case default call handle_error('Char_descr not valid', & GRILLIX_ERR_OTHER, __LINE__, __FILE__, & error_info_t('Int_descr: ',[int_descr])) end select end subroutine end module