which_fields_in_file Subroutine

public subroutine which_fields_in_file(params, Bfield, Efield, Bflux, dBfield, B1field, E1field)

@brief Subroutine that queries the HDF5 file what data are present in the HDF5 input file (sanity check).

@param[in] params Core KORC simulation parameters. @param Bfield Logical variable that specifies if the magnetic field is present in the HDF5 file. @param Efield Logical variable that specifies if the electric field is present in the HDF5 file. @param Bflux Logical variable that specifies if the poloidal magnetic flux is present in the HDF5 file. @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. @param h5error HDF5 error status.

Arguments

Type IntentOptional AttributesName
type(KORC_PARAMS), intent(in) :: params
logical, intent(out) :: Bfield
logical, intent(out) :: Efield
logical, intent(out) :: Bflux
logical, intent(out) :: dBfield
logical, intent(out) :: B1field
logical, intent(out) :: E1field

Calls

proc~~which_fields_in_file~~CallsGraph proc~which_fields_in_file which_fields_in_file h5fclose_f h5fclose_f proc~which_fields_in_file->h5fclose_f h5fopen_f h5fopen_f proc~which_fields_in_file->h5fopen_f

Called by

proc~~which_fields_in_file~~CalledByGraph proc~which_fields_in_file which_fields_in_file proc~initialize_fields initialize_fields proc~initialize_fields->proc~which_fields_in_file program~main main program~main->proc~initialize_fields

Contents

Source Code


Source Code

  subroutine which_fields_in_file(params,Bfield,Efield,Bflux,dBfield,B1field, &
       E1field)
    TYPE(KORC_PARAMS), INTENT(IN)      :: params
    LOGICAL, INTENT(OUT)               :: Bfield
    LOGICAL, INTENT(OUT)               :: B1field
    LOGICAL, INTENT(OUT)               :: E1field
    LOGICAL, INTENT(OUT)               :: dBfield
    LOGICAL, INTENT(OUT)               :: Efield
    LOGICAL, INTENT(OUT)               :: Bflux
    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                            :: h5error

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

    gname = "BR"
    call h5lexists_f(h5file_id,TRIM(gname),Bfield,h5error)

    gname = "dBRdR"
    call h5lexists_f(h5file_id,TRIM(gname),dBfield,h5error)
    
    gname = "ER"
    call h5lexists_f(h5file_id,TRIM(gname),Efield,h5error)

    gname = "PSIp"
    call h5lexists_f(h5file_id,TRIM(gname),Bflux,h5error)

    gname = "ReBZ"
    call h5lexists_f(h5file_id,TRIM(gname),B1field,h5error)

    gname = "ReEZ"
    call h5lexists_f(h5file_id,TRIM(gname),E1field,h5error)


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