descriptors_neutrals_m.f90 Source File


Contents


Source Code

module descriptors_neutrals_m
    !! Definition of additional descriptors not available from PARALLAX
    use screen_io_m, only :  get_stdout
    use error_handling_grillix_m, only : handle_error, error_info_t
    use status_codes_grillix_m, only : GRILLIX_ERR_OTHER
    use descriptors_m, only : BND_TYPE_DIRICHLET_ZERO, BND_TYPE_NEUMANN, BND_TYPE_NONE
    implicit none
    save
    public ! Everything in this module will be externally accessible unless declared private

    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_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_NEUMANN', 'BND_TYPE_NONE')
            call convert_descriptor_char_int_parallax(char_descr, int_descr)

        case default
            call handle_error('Char_descr not valid', &
                              GRILLIX_ERR_OTHER, __LINE__, __FILE__, &
                              error_info_t(char_descr))
        end select

    end subroutine convert_descriptor_char_int

end module