Identifiers

The “identifier” structure is used to provide an enumerated list of options.

For a complete reference of all available identifiers, see the IMAS Data Dictionary Identifiers documentation.

Identifier examples (from part of the core_sources/source identifier)

Index

Name

Description

2

NBI

Source from Neutral Beam Injection

3

EC

Sources from heating at the electron cyclotron heating and current drive

4

LH

Sources from lower hybrid heating and current drive

5

IC

Sources from heating at the ion cyclotron range of frequencies

6

fusion

Sources from fusion reactions, e.g. alpha particle heating

Using the identifiers library

Use pkg-config to get the required compile and link flags: pkg-config --libs --cflags al-identifiers-fortran.

Below examples illustrates how to use the identifiers in your Fortran programs.

Fortran example 1: obtain identifier information of coordinate identifier phi
program testindentifiers
    use al_coordinate_identifier
    implicit none
    integer :: i_phi

    ! Note: accessing as a variable like coordinate_identifier%phi is deprecated
    i_phi = get_index('phi') 

    print *,i_phi
    print *,get_index('phi')
    print *,get_name(i_phi)
    print *,get_description(i_phi)
end program
Fortran example 2: Use the identifier library to fill the NBI label in the core_sources IDS
program testindentifiers
    use ids_schemas, only: ids_distribution_sources, ids_equilibrium
    use al_distribution_source_identifier, only: set_ds_identifier => set_identifier
    use al_poloidal_plane_coordinates_identifier, &
        only: set_ppc_identifier => set_identifier
    implicit none

    type(ids_distribution_sources) :: distribution_sources
    type(ids_equilibrium) :: equilibrium

    allocate(distribution_sources%source(1))
    allocate(distribution_sources%source(1)%process(1))
    allocate( equilibrium%time_slice(1) )
    allocate( equilibrium%time_slice(1)%profiles_2d(1) )

    call set_ds_identifier( distribution_sources%source(1)%process(1)%type, 'NBI')
    call set_ppc_identifier( equilibrium%time_slice(1)%profiles_2d(1)%grid_type, 'rectangular')

    print *,distribution_sources%source(1)%process(1)%type%name
    print *,distribution_sources%source(1)%process(1)%type%index
    print *,distribution_sources%source(1)%process(1)%type%description
    print *,equilibrium%time_slice(1)%profiles_2d(1)%grid_type%name
    print *,equilibrium%time_slice(1)%profiles_2d(1)%grid_type%index
    print *,equilibrium%time_slice(1)%profiles_2d(1)%grid_type%description
end program
Fortran example 3: Use the identifier library to fill the type of coordinate system used in the equilibrium IDS
program testindentifiers
    use ids_schemas, only: ids_wall
    use al_materials_identifier, &
        only: set_identifier
    implicit none
    
    integer :: i
    type(ids_wall) :: wall
    character(2), dimension(5) :: names
    
    names = ['W ', 'C ', 'Be', 'Cu', 'SS']

    allocate( wall%description_ggd(1) )
    allocate( wall%description_ggd(1)%material(1) )
    allocate( wall%description_ggd(1)%material(1)%grid_subset(1) )

    call set_identifier( wall%description_ggd(1)%material(1)%grid_subset(1)%identifiers ,names)

    print *, 'Number of materials:', size(wall%description_ggd(1)%material(1)%grid_subset(1)%identifiers%indices)
    do i = 1, size(wall%description_ggd(1)%material(1)%grid_subset(1)%identifiers%indices)
        print *, 'Material', i, ':'
        print *, '  Index:', wall%description_ggd(1)%material(1)%grid_subset(1)%identifiers%indices(i)
        print *, '  Name: "', trim(wall%description_ggd(1)%material(1)%grid_subset(1)%identifiers%names(i)), '"'
        print *, '  Description: "', trim(wall%description_ggd(1)%material(1)%grid_subset(1)%identifiers%descriptions(i)), '"'
    end do
end program