read_tables Subroutine

public subroutine read_tables()

Reads in atomic tables from file and stores them in tables

Arguments

None

Calls

proc~~read_tables~~CallsGraph proc~read_tables read_tables h5close_f h5close_f proc~read_tables->h5close_f proc~read_nuclear_rates read_nuclear_rates proc~read_tables->proc~read_nuclear_rates proc~read_atomic_rate read_atomic_rate proc~read_tables->proc~read_atomic_rate proc~read_atomic_transitions read_atomic_transitions proc~read_tables->proc~read_atomic_transitions h5open_f h5open_f proc~read_tables->h5open_f h5ltread_dataset_double_f h5ltread_dataset_double_f proc~read_tables->h5ltread_dataset_double_f proc~read_atomic_cross read_atomic_cross proc~read_tables->proc~read_atomic_cross proc~h5ltread_dataset_int_scalar_f h5ltread_dataset_int_scalar_f proc~read_tables->proc~h5ltread_dataset_int_scalar_f h5fclose_f h5fclose_f proc~read_tables->h5fclose_f h5fopen_f h5fopen_f proc~read_tables->h5fopen_f proc~read_nuclear_rates->h5ltread_dataset_double_f proc~read_nuclear_rates->proc~h5ltread_dataset_int_scalar_f h5ltpath_valid_f h5ltpath_valid_f proc~read_nuclear_rates->h5ltpath_valid_f proc~h5ltread_dataset_double_scalar_f h5ltread_dataset_double_scalar_f proc~read_nuclear_rates->proc~h5ltread_dataset_double_scalar_f proc~read_atomic_rate->h5ltread_dataset_double_f proc~read_atomic_rate->proc~h5ltread_dataset_int_scalar_f h5ltget_dataset_ndims_f h5ltget_dataset_ndims_f proc~read_atomic_rate->h5ltget_dataset_ndims_f proc~read_atomic_rate->h5ltpath_valid_f proc~read_atomic_rate->proc~h5ltread_dataset_double_scalar_f proc~read_atomic_transitions->h5ltread_dataset_double_f proc~read_atomic_transitions->proc~h5ltread_dataset_int_scalar_f proc~read_atomic_transitions->h5ltget_dataset_ndims_f proc~read_atomic_transitions->h5ltpath_valid_f proc~read_atomic_transitions->proc~h5ltread_dataset_double_scalar_f proc~read_atomic_cross->h5ltread_dataset_double_f proc~read_atomic_cross->proc~h5ltread_dataset_int_scalar_f proc~read_atomic_cross->h5ltpath_valid_f proc~read_atomic_cross->proc~h5ltread_dataset_double_scalar_f h5ltread_dataset_int_f h5ltread_dataset_int_f proc~h5ltread_dataset_int_scalar_f->h5ltread_dataset_int_f proc~h5ltread_dataset_double_scalar_f->h5ltread_dataset_double_f

Called by

proc~~read_tables~~CalledByGraph proc~read_tables read_tables program~fidasim fidasim program~fidasim->proc~read_tables

Contents

Source Code


Source Code

subroutine read_tables
    !+ Reads in atomic tables from file and stores them in [[libfida:tables]]
    integer(HID_T) :: fid
    integer(HSIZE_T), dimension(2) :: dim2
    integer :: error

    integer :: n_max, m_max
    character(len=4) :: impname
    real(Float64) :: imp_amu
    real(Float64), dimension(2) :: b_amu
    real(Float64), dimension(:,:), allocatable :: dummy2

    if(inputs%verbose.ge.1) then
        write(*,'(a)') "---- Atomic tables settings ----"
    endif

    !!Initialize HDF5 interface
    call h5open_f(error)

    !!Open HDF5 file
    call h5fopen_f(inputs%tables_file, H5F_ACC_RDONLY_F, fid, error)

    !!Read Hydrogen-Hydrogen CX Cross Sections
    call read_atomic_cross(fid,"/cross/H_H",tables%H_H_cx_cross)

    !!Read Hydrogen-Hydrogen CX Rates
    b_amu = [inputs%ab, inputs%ai]
    call read_atomic_rate(fid,"/rates/H_H",b_amu, inputs%ai, tables%H_H_cx_rate)

    !!Read Hydrogen-Hydrogen Transitions
    call read_atomic_transitions(fid,"/rates/H_H",b_amu, inputs%ai, tables%H_H)
    inputs%ab = tables%H_H%ab(1)
    inputs%ai = tables%H_H%ab(2)

    !!Read Hydrogen-Electron Transitions
    call read_atomic_transitions(fid,"/rates/H_e",b_amu, e_amu, tables%H_e)

    !!Read Hydrogen-Impurity Transitions
    impname = ''
    select case (inputs%impurity_charge)
        case (5)
            impname = "B5"
            imp_amu = B5_amu
        case (6)
            impname = "C6"
            imp_amu = C6_amu
        case DEFAULT
            impname = "Aq"
            imp_amu = 2.d0*inputs%impurity_charge
    end select

    call read_atomic_transitions(fid,"/rates/H_"//trim(adjustl(impname)), b_amu, imp_amu, tables%H_Aq)

    !!Read Einstein coefficients
    call h5ltread_dataset_int_scalar_f(fid,"/rates/spontaneous/n_max", n_max, error)
    call h5ltread_dataset_int_scalar_f(fid,"/rates/spontaneous/m_max", m_max, error)
    allocate(dummy2(n_max,m_max))
    dim2 = [n_max, m_max]
    call h5ltread_dataset_double_f(fid,"/rates/spontaneous/einstein",dummy2, dim2, error)
    tables%einstein(:,:) = transpose(dummy2(1:nlevs,1:nlevs))
    deallocate(dummy2)

    !!Read nuclear Deuterium-Deuterium rates
    if(inputs%calc_neutron.ge.1) then
        call read_nuclear_rates(fid, "/rates/D_D", tables%D_D)
    endif

    !!Close file
    call h5fclose_f(fid, error)

    !!Close HDF5 interface
    call h5close_f(error)

    if(inputs%verbose.ge.1) then
        write(*,'(T2,"Maximum n/m: ",i2)') nlevs
        write(*,'(T2,"Beam/Fast-ion mass: ",f6.3," [amu]")') inputs%ab
        write(*,'(T2,"Thermal/Bulk-ion mass: ",f6.3," [amu]")') inputs%ai
        write(*,'(T2,"Impurity mass: ",f6.3," [amu]")') imp_amu
        write(*,*) ''
    endif

end subroutine read_tables