load_profiles_data_from_hdf5 Subroutine

private subroutine load_profiles_data_from_hdf5(params, P)

Arguments

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

Core KORC simulation parameters.

type(PROFILES), intent(inout) :: P

An instance of KORC's derived type PROFILES containing all the information about the plasma profiles used in the simulation. See korc_types and korc_profiles.


Calls

proc~~load_profiles_data_from_hdf5~~CallsGraph proc~load_profiles_data_from_hdf5 load_profiles_data_from_hdf5 h5fclose_f h5fclose_f proc~load_profiles_data_from_hdf5->h5fclose_f proc~allocate_2d_profiles_arrays ALLOCATE_2D_PROFILES_ARRAYS proc~load_profiles_data_from_hdf5->proc~allocate_2d_profiles_arrays interface~load_array_from_hdf5 load_array_from_hdf5 proc~load_profiles_data_from_hdf5->interface~load_array_from_hdf5 proc~allocate_3d_profiles_arrays ALLOCATE_3D_PROFILES_ARRAYS proc~load_profiles_data_from_hdf5->proc~allocate_3d_profiles_arrays h5fopen_f h5fopen_f proc~load_profiles_data_from_hdf5->h5fopen_f interface~load_from_hdf5 load_from_hdf5 proc~load_profiles_data_from_hdf5->interface~load_from_hdf5 proc~rload_1d_array_from_hdf5 rload_1d_array_from_hdf5 interface~load_array_from_hdf5->proc~rload_1d_array_from_hdf5 proc~rload_2d_array_from_hdf5 rload_2d_array_from_hdf5 interface~load_array_from_hdf5->proc~rload_2d_array_from_hdf5 proc~rload_3d_array_from_hdf5 rload_3d_array_from_hdf5 interface~load_array_from_hdf5->proc~rload_3d_array_from_hdf5 proc~iload_from_hdf5 iload_from_hdf5 interface~load_from_hdf5->proc~iload_from_hdf5 proc~rload_from_hdf5 rload_from_hdf5 interface~load_from_hdf5->proc~rload_from_hdf5 proc~korc_abort korc_abort proc~iload_from_hdf5->proc~korc_abort h5dclose_f h5dclose_f proc~iload_from_hdf5->h5dclose_f h5dread_f h5dread_f proc~iload_from_hdf5->h5dread_f proc~rload_from_hdf5->proc~korc_abort proc~rload_from_hdf5->h5dclose_f proc~rload_from_hdf5->h5dread_f proc~rload_1d_array_from_hdf5->proc~korc_abort proc~rload_1d_array_from_hdf5->h5dclose_f proc~rload_1d_array_from_hdf5->h5dread_f proc~rload_2d_array_from_hdf5->proc~korc_abort proc~rload_2d_array_from_hdf5->h5dclose_f proc~rload_2d_array_from_hdf5->h5dread_f proc~rload_3d_array_from_hdf5->proc~korc_abort proc~rload_3d_array_from_hdf5->h5dclose_f proc~rload_3d_array_from_hdf5->h5dread_f mpi_abort mpi_abort proc~korc_abort->mpi_abort

Called by

proc~~load_profiles_data_from_hdf5~~CalledByGraph proc~load_profiles_data_from_hdf5 load_profiles_data_from_hdf5 proc~initialize_profiles initialize_profiles proc~initialize_profiles->proc~load_profiles_data_from_hdf5 program~main main program~main->proc~initialize_profiles

Contents


Source Code

  subroutine load_profiles_data_from_hdf5(params,P)
    !! @note Subroutine that loads pre-computed plasma profiles' data
    !! from an input HDF5 file. @endnote
    TYPE(KORC_PARAMS), INTENT(IN)  :: params
    !! Core KORC simulation parameters.
    TYPE(PROFILES), INTENT(INOUT)  :: P
    !! An instance of KORC's derived type PROFILES containing all the
    !! information about the plasma profiles used in the
    !! simulation. See [[korc_types]] and [[korc_profiles]].
    CHARACTER(MAX_STRING_LENGTH)   :: filename
    !!String containing the name of the input HDF5 file.
    CHARACTER(MAX_STRING_LENGTH)   :: gname
    !! String containing the group name of a parameter in the HDF5 file.
    CHARACTER(MAX_STRING_LENGTH)   :: subgname
    !! String containing the subgroup name of a parameter in the HDF5 file.
    CHARACTER(MAX_STRING_LENGTH)   :: dset
    !!Name of data set to read from file.
    INTEGER(HID_T)                 :: h5file_id
    !! HDF5 file identifier.
    INTEGER(HID_T)                 :: group_id
    !! HDF5 group identifier.
    INTEGER(HID_T)                 :: subgroup_id
    !!HDF5 subgroup identifier.
    REAL(rp)                       :: rdatum
    !!
    INTEGER                        :: h5error
    !! HDF5 error status.

    filename = TRIM(P%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_profiles_data_from_hdf5 --> h5fopen_f")')
    end if


    dset = "/NR"
    call load_from_hdf5(h5file_id,dset,rdatum)
    P%dims(1) = INT(rdatum)

    if (P%axisymmetric) then
       P%dims(2) = 0
    else
       dset = "/NPHI"
       call load_from_hdf5(h5file_id,dset,rdatum)
       P%dims(2) = INT(rdatum)
    end if

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

    if (P%axisymmetric) then
       call ALLOCATE_2D_PROFILES_ARRAYS(params,P)
    else
       call ALLOCATE_3D_PROFILES_ARRAYS(P)
    end if

    dset = "/R"
    call load_array_from_hdf5(h5file_id,dset,P%X%R)

    if (.NOT.P%axisymmetric) then
       dset = "/PHI"
       call load_array_from_hdf5(h5file_id,dset,P%X%PHI)
    end if

    dset = "/Z"
    call load_array_from_hdf5(h5file_id,dset,P%X%Z)

    dset = "/FLAG"
    if (P%axisymmetric) then
       call load_array_from_hdf5(h5file_id,dset,P%FLAG2D)
    else
       call load_array_from_hdf5(h5file_id,dset,P%FLAG3D)
    end if

    dset = "/ne"
    if (P%axisymmetric) then
       call load_array_from_hdf5(h5file_id,dset,P%ne_2D)
    else
       call load_array_from_hdf5(h5file_id,dset,P%ne_3D)
    end if

    dset = "/Te"
    if (P%axisymmetric) then
       call load_array_from_hdf5(h5file_id,dset,P%Te_2D)
       P%Te_2D = P%Te_2D*C_E
    else
       call load_array_from_hdf5(h5file_id,dset,P%Te_3D)
       P%Te_3D = P%Te_3D*C_E
    end if

    !write(output_unit_write,'("Te: ",E17.10)') P%Te_2D(1,1)

    dset = "/Zeff"
    if (P%axisymmetric) then
       call load_array_from_hdf5(h5file_id,dset,P%Zeff_2D)
    else
       call load_array_from_hdf5(h5file_id,dset,P%Zeff_3D)
    end if

    if (params%profile_model(10:10).eq.'H') then

       dset = "/RHON"
       call load_array_from_hdf5(h5file_id,dset,P%RHON)
       dset = "/nRE"
       call load_array_from_hdf5(h5file_id,dset,P%nRE_2D)
       dset = "/nAr0"
       call load_array_from_hdf5(h5file_id,dset,P%nAr0_2D)
       dset = "/nAr1"
       call load_array_from_hdf5(h5file_id,dset,P%nAr1_2D)
       dset = "/nAr2"
       call load_array_from_hdf5(h5file_id,dset,P%nAr2_2D)
       dset = "/nAr3"
       call load_array_from_hdf5(h5file_id,dset,P%nAr3_2D)
       dset = "/nD"
       call load_array_from_hdf5(h5file_id,dset,P%nD_2D)
       dset = "/nD1"
       call load_array_from_hdf5(h5file_id,dset,P%nD1_2D)
       
    end if
   
    call h5fclose_f(h5file_id, h5error)
    if (h5error .EQ. -1) then
       write(output_unit_write,'("KORC ERROR: Something went wrong in: load_profiles_data_from_hdf5 --> h5fclose_f")')
    end if
  end subroutine load_profiles_data_from_hdf5