load_dim_data_from_hdf5 Subroutine

public subroutine load_dim_data_from_hdf5(params, F)

@brief Subroutine that loads the size of the arrays having the electric and magnetic field data. @details All the information of externally calculated fields must be given in a rectangular, equally spaced mesh in the space of cylindrical coordinates. If the fields are axisymmetric, then the fields must be in a rectangular mesh on the -plane.

@param[in] params Core KORC simulation parameters. @param[in,out] F An instance of the KORC derived type FIELDS. @param filename String containing the name of the HDF5 file. @param gname String containing the group name of a parameter in the HDF5 file. @param subgname String containing the subgroup name of a parameter in the HDF5 file. @param dset Name of data set to read from file. @param h5file_id HDF5 file identifier. @param group_id HDF5 group identifier. @param subgroup_id HDF5 subgroup identifier. @dims Array containing the size of the mesh with the data of the electric and magnetic fields. dims(1) = dimension along the coordinate, dims(2) = dimension along the coordinate, and dims(3) = dimension along the coordinate. @param h5error HDF5 error status. @param rdamum Temporary variable keeping the read data.

Arguments

Type IntentOptional AttributesName
type(KORC_PARAMS), intent(in) :: params
type(FIELDS), intent(inout) :: F

Contents


Source Code

  subroutine load_dim_data_from_hdf5(params,F)
    TYPE(KORC_PARAMS), INTENT(IN)                  :: params
    TYPE(FIELDS), INTENT(INOUT)                    :: F
    CHARACTER(MAX_STRING_LENGTH)                   :: filename
    CHARACTER(MAX_STRING_LENGTH)                   :: gname
    CHARACTER(MAX_STRING_LENGTH)                   :: subgname
    CHARACTER(MAX_STRING_LENGTH)                   :: dset
    INTEGER(HID_T)                                 :: h5file_id
    INTEGER(HID_T)                                 :: group_id
    INTEGER(HID_T)                                 :: subgroup_id
    INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE    :: dims
    INTEGER                                        :: h5error
    REAL(rp)                                       :: rdatum

    filename = TRIM(params%magnetic_field_filename)
    call h5fopen_f(filename, H5F_ACC_RDONLY_F, h5file_id, h5error)
    if (h5error .EQ. -1) then
       write(6,'("KORC ERROR: Something went wrong in: load_dim_data_from_hdf5 --> h5fopen_f")')
    end if

    if (F%Bflux.OR.F%axisymmetric_fields) then
       dset = "/NR"
       call load_from_hdf5(h5file_id,dset,rdatum)
       F%dims(1) = INT(rdatum)

       F%dims(2) = 0

       dset = "/NZ"
       call load_from_hdf5(h5file_id,dset,rdatum)
       F%dims(3) = INT(rdatum)

       if(params%SC_E) then

          dset = "/OSNR"
          call load_from_hdf5(h5file_id,dset,rdatum)
          F%dims(1) = INT(rdatum)

          dset = "/OSNZ"
          call load_from_hdf5(h5file_id,dset,rdatum)
          F%dims(3) = INT(rdatum)

       end if

       if(F%Dim2x1t) then

          dset = "/NPHI"
          call load_from_hdf5(h5file_id,dset,rdatum)
          F%dims(2) = INT(rdatum)

       end if
       
    else
       dset = "/NR"
       call load_from_hdf5(h5file_id,dset,rdatum)
       F%dims(1) = INT(rdatum)

       dset = "/NPHI"
       call load_from_hdf5(h5file_id,dset,rdatum)
       F%dims(2) = INT(rdatum)

       dset = "/NZ"
       call load_from_hdf5(h5file_id,dset,rdatum)
       F%dims(3) = INT(rdatum)
    end if


    call h5fclose_f(h5file_id, h5error)
    if (h5error .EQ. -1) then
       write(6,'("KORC ERROR: Something went wrong in: load_dim_data_from_hdf5 --> h5fclose_f")')
    end if
  end subroutine load_dim_data_from_hdf5