@brief Surboutine that saves the Gamma distribution parameters to the HDF5 file gamma_distribution_parameters.h5.
@param[in] params Core KORC simulation parameters. @param filename String containing the name of the HDF5 file. @param gname String containing the group name of a set of KORC parameters. @param attr_array An 1-D array with attributes of 1-D real or integer arrays that are passed to KORC interfaces of HDF5 I/O subroutines. @param dset Name of data set to be saved to file. @param attr A single attributes of real or integer data that is passed to KORC interfaces of HDF5 I/O subroutines. @param h5file_id HDF5 file identifier. @param group_id HDF5 group identifier. @param h5error HDF5 error status. @param units Temporary variable used to add physical units to KORC parameters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params |
SUBROUTINE save_gamma_params(params)
TYPE(KORC_PARAMS), INTENT(IN) :: params
CHARACTER(MAX_STRING_LENGTH) :: filename
CHARACTER(MAX_STRING_LENGTH) :: gname
CHARACTER(MAX_STRING_LENGTH), DIMENSION(:), ALLOCATABLE :: attr_array
CHARACTER(MAX_STRING_LENGTH) :: dset
CHARACTER(MAX_STRING_LENGTH) :: attr
INTEGER(HID_T) :: h5file_id
INTEGER(HID_T) :: group_id
INTEGER :: h5error
REAL(rp) :: units
if (params%mpi_params%rank .EQ. 0) then
filename = TRIM(params%path_to_outputs) // "gamma_distribution_parameters.h5"
call h5fcreate_f(TRIM(filename), H5F_ACC_TRUNC_F, h5file_id, h5error)
gname = "params"
call h5gcreate_f(h5file_id, TRIM(gname), group_id, h5error)
dset = TRIM(gname) // "/min_energy"
attr = "Minimum energy in avalanche PDF (eV)"
units = 1.0_rp/C_E
call save_to_hdf5(h5file_id,dset,units*gamma_pdf_params%min_energy,attr)
dset = TRIM(gname) // "/max_energy"
attr = "Maximum energy in avalanche PDF (eV)"
units = 1.0_rp/C_E
call save_to_hdf5(h5file_id,dset,units*gamma_pdf_params%max_energy,attr)
dset = TRIM(gname) // "/max_p"
attr = "Maximum momentum in avalanche PDF (me*c^2)"
call save_to_hdf5(h5file_id,dset,gamma_pdf_params%max_p,attr)
dset = TRIM(gname) // "/min_p"
attr = "Maximum momentum in avalanche PDF (me*c^2)"
call save_to_hdf5(h5file_id,dset,gamma_pdf_params%min_p,attr)
dset = TRIM(gname) // "/k"
attr = "Shape factor"
call save_to_hdf5(h5file_id,dset,gamma_pdf_params%k,attr)
dset = TRIM(gname) // "/t"
attr = "Scale factor"
call save_to_hdf5(h5file_id,dset,gamma_pdf_params%t,attr)
call h5gclose_f(group_id, h5error)
call h5fclose_f(h5file_id, h5error)
end if
END SUBROUTINE save_gamma_params