Introduction
The description of the IMAS interface to the plasma initiation code DYON (reference here) is given on this page. The page has the following parts:
- User guide on using interface on the Gateway
- Detailed description of the mapping scripts for
- Output
- Input
User Guide
The instructions on using the interface on the EUROfusion Gateway platform are provided below.
Prerequisites
The following steps are required before interface can be used:
- DYON code should be executed
- Input/output data (mat file+(optional) xml file with parameters) should be transferred to the Gateway
Preparation steps:
The following steps need to be executed on the Gateway before the interface execution
- Prepare Input file
- Create database to save the data
- Load DYON module
The steps are described in detail below
Prepare input file
The text file with the following contents (example values are given below) should be created somewhere in the user space on the Gateway:
shot = 27512;
run_in=2;
run_out=22;
database = mast;
original_dyon_file=/afs/eufus.eu/g2itmdev/user/g2hkim/public/DYON/output/MAST_27512__2023_8_1_11_56_4_test.mat;
backend= hdf5;
xmlfile=;
Here:
- shot - shot number to be used to generate the IMAS shofiles
- run_in - run number for the shotfile to contain input data
- run_out - run number to contain output data
- database - name of the database to be used
- original_dyon_file - absolute path to the file with DYON input/output data (i.e. .mat file)
- backend - backend to be used to save data (can be mdsplus or hdf5)
- xmlfile - (optional) file with the code parameters
Create database to save IMAS data
Open new terminal, execute the following command:
imasdb database_name
here database_name is the name of the database (usually tokamak name) to be used to save the input/output data. In the example above (input text file) this is 'mast'.
Note: 'imasdb' command should be executed once.
Load DYON module
Open new terminal, execute the following command
module load dyon
This command will load all modules required by the interface
Note: the same terminal should be used to run the interface
Note: latest stable version of the dyon module is loaded using the command above; the full list of the available versions can be displayed using the command module avail dyon.
Run the interface
Go to the folder where input text file is created. Execute the following command
dyon text_file_name
here text_file_name is the name of the input text file
Results of the run
The execution will result in the following steps:
- folder dyon_runs will be created in the $ITMWORK if not previously created; this folder will be used to contain results for all runs of the DYON interface
- 'execution' folder to contain the particular run results will be created in the $ITMWORK/dyon_runs folder with following general structure of the folder name username_databasename_shot_timestamp
- username - your username on the Gateway
- databasename - name of the database given in the input text file
- shot - shot number given in the input text file
- timestamp - timepoint when database is created in form yyyy-mm-dd-hhmmss
example of the folder name (full path including $ITMWORK part): /pfs/work/g2diy/dyon_runs/g2diy_mast_27512_2024_2_1_113657
- input data will be copied to the 'execution' folder: mat file will be copied to dyon_data.mat file, xmlfile (if given) will be copied to namelist_input.xml file
- interface will be executed (matlab session will be started)
- input and output structures will be saved to the separate files in the 'execution' folder:
- input - imas_dyon_input.mat
- output - imas_dyon_output.mat
- input and output data will be save in IDS format using shot run_in and run_out provided in the input text file
List of INPUT/OUTPUT signals for mapping
The list is saved in google docs file: google docs file
DYON presentations
Presentation at the project meeting, march 2024: DYON_presentation_march_24
Detailed INPUT/OUTPUT description
DYON output
The storage of the DYON output in IMAS is supported by two MATLAB functions, put_to_IMAS and get_from_IMAS. Depending on the situation, they can be integrated to the code or used separately as wrappers providing the connection between DYON and IMAS. The scripts test_put_to_IMAS and test_get_from_IMAS are provided, which illustrate how the functions can be called as wrappers.
The available IMAS Data Dictionary (DD) does not satisfy all requirements of DYON. Therefore, the functions put_to_IMAS and get_from_IMAS are to be extended after the planned extension of the DD.
Now the output data are placed into 7 IMAS IDS's (Interface Data Structures - sections of the IMAS DD describing tokamak subsystems or tokamak physics chapters): 'core_profiles', 'core_sources', 'equilibrium', 'gas_injection', 'magnetics', 'radiation', and 'wall' (this list is to be extended). The allocation of the data in the IDS's and the functions supporting it are described below.
Files provided
File name | Content |
---|---|
put_to_IMAS.m | Function saving IMAS output data to IMAS |
get_from_IMAS.m | Function reading IMAS output data from IMAS |
test_put_to_IMAS.m | Sample script invoking the function put_to_IMAS |
test_get_from_IMAS.m | Sample script that invokes the function get_from_IMAS and compares the recovered data with the initial ones |
put_core_profiles.m | Function saving data to the 'core_profiles' IDS |
put_core_sources.m | Function saving data to the 'core_sources' IDS |
put_equilibrium.m | Function saving data to the 'equilibrium' IDS |
put_gas_injection.m | Function saving data to the 'gas_injection' IDS |
put_magnetics.m | Function saving data to the 'magnetics' IDS |
put_radiation.m | Function saving data to the 'radiation' IDS |
put_wall.m | Function saving data to the 'wall' IDS |
get_core_profiles.m | Function recovering the saved data from the 'core_profiles' IDS |
get_core_sources.m | Function recovering the saved data from the 'core_sources' IDS |
get_equilibrium.m | Function recovering the saved data from the 'equilibrium' IDS |
get_gas_injection.m | Function recovering the saved data from the 'gas_injection' IDS |
get_magnetics.m | Function recovering the saved data from the 'magnetics' IDS |
get_radiation.m | Function recovering the saved data from the 'radiation' IDS |
get_wall.m | Function recovering the saved data from the 'wall' IDS |
arrange_ion_densities.m | Function putting the densities of all charge states and the properties of an ion to 'core_profiles' |
arrange_neutral_density.m | Function putting the density and the properties of a neutral atom to 'core_profiles' |
arrange_radiation.m | Function arranging the radiation power density (together with all atom attributes) for given radiation type and neutral/ion kind |
extract_ion_densities.m | Function extracting the densities of all charge states from the 'core_profiles' IDS |
find_source.m | Function finding the location of the source with a given data dictionary index in an AoS |
find_species.m | Function finding the location of the species with a given label in AoS |
compare_core_profiles.m | Function comparing the data restored from the 'core_profiles' IDS with the initial content |
compare_core_sources.m | Function comparing the data restored from the 'core_sources' IDS with the initial content |
compare_equilibrium.m | Function comparing the data restored from the 'equilibrium' IDS with the initial content |
compare_magnetics.m | Function comparing the data restored from the 'magnetics' IDS with the initial content |
compare_radiation.m | Function comparing the data restored from the 'radiation' IDS with the initial content |
compare_wall.m | Function comparing the data restored from the 'wall' IDS with the initial content |
STEP_10003_N_O_impurities_Cwall_2022_11_12_17_53_27.mat | Example of MAT-file with DYON results (received from Kim Hyun-Tae) |
STEP_10003_v4_600kW_EBWCD_2022_6_20_21_24_29.mat | Example of MAT-file with DYON results (received from Kim Hyun-Tae) |
README.txt | Brief user guide |
DYON-IMAS_wrappers_user_guide.pdf | This documentation in PDF-format |
Running the scripts
To launch the test scripts, do the following:
1. Enter:
module load imasenv/<IMASversion>
Here <IMASversion> is 3.37.0 or higher.
2. The scripts in its present form use the IMAS database 'step'. If you are planning to use it and this database is non-existent, enter the following command to create the database:
imasdb step
You can replace 'step' with another IMAS database name, but do not forget to create it and change the variable 'machine' in test_put_to_IMAS.m and test_get_from_IMAS.m.
3. Enter either
matlab
or
matlab -nodesktop -nosplash
In the nodesktop mode, MATLAB should work faster (I did not notice a significant difference - YY). When using the nodesktop mode, do not forget to run the command 'quit()' to end the session (otherwise, a dangling MATLAB session may remain).
4. Run test_put_to_IMAS.m in order to save in IMAS the data from an available DYON output MAT-file (you can change shot, run, IDS comments etc. by changing the parameters in this script).
5. Type 'viz' (on a console with imasenv loaded) to see the content of the IMAS database.
6. To get back the DYON output data, run test_get_from_IMAS.m.
The main files (functions 'put_to_IMAS', 'get_from_IMAS' and test scripts)
The script test_put_to_IMAS.m loads a MAT-file containing the DYON results (the name of the file is defined in the script). It is assumed that there is a structure with the name 'output' among the variables loaded from the MAT-file and that this structure holds all the data that must be saved.
The script then defines the rest of arguments of the function 'put_to_IMAS' and invokes it. The dummy arguments of this function are as follows:
Name | Type | Description |
---|---|---|
output | struct | structure containing the DYON output to be saved |
H_mass | float | mass of the H isotope (in units of the proton mass) |
machine | symbol array | name of the IMAS database (usually a tokamak name) |
shot | int | shot number |
run | int | run number |
comment | symbol array | comment characterizing the data to be saved (put into each IDS) |
data_source | symbol array | text describing the origin of the data (put into each IDS) |
The function creates an IMAS data entry for the given 'shot' and 'run' parameters (note that the database with the required name must exist; otherwise, an error is raised). Then it invokes several functions that put data to separate IDS's ('put_core_profiles', 'put_core_sources', 'put_equilibrium', 'put_gas_injection', 'put_magnetics', 'put_wall', and 'put_radiation') and closes the database. After that, the content of the 'output' structure is put to IMAS. The DD fields to which the data are placed can be found in the table IMAS interface with DYON - Google Documents. Some more comments will be given in next sections of this document for each IDS separately.
The script test_get_from_IMAS.m defines the input parameters of the function get_from_IMAS and invokes it. The dummy arguments of this function are as follows:
Name | Type | Description |
---|---|---|
machine | symbol array | name of the IMAS database (usually a tokamak name) |
shot | int | shot number |
run | int | run number |
The function calls several functions that extract data from separate IDS's ('get_core_profiles', 'get_core_sources', 'get_equilibrium', 'get_gas_injection', 'get_magnetics', 'get_wall', and 'get_radiation') and closes the database. The function returns the 'output' structure, which is to be equivalent (after the script is complete) to the 'output' structure that was initially put to IMAS. In addition, the function prints to the screen the comments extracted from all IDS's.
The script in its current form contains some parts that are used for verification and debugging. It imports the original DYON output and compares it with the one recovered from IMAS. These part should be removed in the future when such comparison is not required.
IDS core_profiles
The quantities stored in this IDS include electron and ion temperatures, densities of electrons, several ion species and several neutral species, loop voltage, and plasma current. Although all these quantities are represented by single values, most of them are stored as 1D-profiles on the formal grid consisting of a single point. When the ion and neutral densities are recovered from the IDS, the ion species are selected in the array of structures by their charge numbers (not by their places in the array). This is done to permit more flexibility if the set of the ions simulated by the code changes. At present, the storage of ion quantities in the IDS is organized as follows:
Element | Ion label | Ion index | Neutral label | Neutral index |
---|---|---|---|---|
H | H | 1 | - | - |
Be | Be | 2 | Be0 | 1 |
C | C | 3 | C0 | 2 |
N | N | 4 | N0 | 3 |
O | O | 5 | O0 | 4 |
He | He | 6 | He0 | 5 |
Ne | Ne | 7 | Ne0 | 6 |
Here 'ion label' and 'ion index' are the label and the index of the species in the core_profiles.profiles1d.ion AoS (array of structures), respectively; 'neutral label' and 'neutral index' are the label and the index of the species in the core_profiles.profiles1d.neutral AoS (array of structures), respectively.
For all ions except for H, several ion states (charge states) are defined, the index of the 'state' array element being equal to the ion charge number.
The following functions support I/O with the 'core_profiles' IDS:
function put_core_profiles (output, H_mass, idx, comment, data_source, imas_version, access_layer)
Write a suitable part of the 'output' structure to the 'core_profiles' IDS.
This function invokes the functions 'arrange_ion_densities' and 'arrange_neutral_density'.
Name | Type | Description |
---|---|---|
output | struct | structure containing the DYON output to be saved |
H_mass | float | mass of the H isotope (in units of the proton mass) |
idx | int | the data entry identifies |
comment | symbol array | comment characterizing the data to be saved |
data_source | symbol array | text describing the origin of the data |
imas_version | symbol array | IMAS major version (prepared in the 'put_to_IMAS' function) |
access_layer | symbol array | IMAS access layer version used when writing the IDS (prepared in the 'put_to_IMAS' function) |
function [output, comment, data_source, imas_version, access_layer] = get_core_profiles (output, idx, get_time)
Add the data from the 'core_profiles' IDS to the 'output' structure.
This function invokes the functi on ' extract_ion_densities '.
Name | Type | Description |
---|---|---|
output | struct | structure containing the DYON output recovered from IMAS |
idx | int | the data entry identifies |
get_time | boolean | switch on transferring the IDS time to the output time |
comment | symbol array | comment characterizing the recovered data |
data_source | symbol array | text describing the origin of the data |
imas_version | symbol array | IMAS major version |
access_layer | symbol array | IMAS access layer version used when writing the IDS |
IDS core_sources
The source densities are stored as 1D-profiles on the formal grid consisting of a single point although they are represented by single values.
When the data are recovered from the IDS, the sources are sought in the array of structures by their DD indices (not by their places in the array). This is done to permit more flexibility if the set of the sources calculated by the code changes. At present, the storage of sources in the IDS is organized as follows:
Source | DD index | IDS name | IDS index |
---|---|---|---|
Ohmic heating to electrons | 7 | Ohmic | 1 |
Electron energy loss for ionization | 601 | ionization | 2 |
Energy loss due to radiation including excitation, recombination, and bremsstrahlung | 200 | radiation | 3 |
Electron energy loss due to equilibration with ions | 402 | equipartition | 4 |
Electron energy loss due to particle transport | 400 | transport | 5 |
Ion energy loss due to particle transport | 400 | transport | 5 |
ECH power absorbed to electrons | 3 | ECH | 6 |
ECH + EBW power absorbed to electrons | 901 | ECH&EBW | 7 |
Ion energy loss due to charge exchange | 305 | CX | 8 |
Net electron heating power in a unit volume | 1 | net_power | 9 |
Net ion heating power in a unit volume | 1 | net_power | 9 |
Here 'IDS index' is the location of the source in the core_sources.source AoS (which can be changed if required). The 'IDS name' is the label of the source (a part of the source identifier), which is not used when the data are extracted from the IDS. The source 901 (ECH + EBW power absorbed to electrons) is a custom source missing in the DD.
The data are put to the 'core_sources' IDS by the function 'put_core_sources'. Its interface is as follows:
function put_core_sources (output, idx, comment, data_source, imas_version, access_layer)
Name | Type | Description |
---|---|---|
output | struct | structure containing the DYON output to be saved |
idx | int | the data entry identifies |
comment | symbol array | comment characterizing the data to be saved |
data_source | symbol array | text describing the origin of the data |
imas_version | symbol array | IMAS major version (prepared in the 'put_to_IMAS' function) |
access_layer | symbol array | IMAS access layer version used when writing the IDS (prepared in the 'put_to_IMAS' function) |
The data are extracted from the 'core_sources' IDS by the function 'get_core_sources'. Its interface is identical to that of 'get_core_profiles' (Section 2.4).
IDS equilibrium
Data exchange with the 'equilibrium' IDS is carried out by the functions 'put_equilibrium' and 'get_equilibrium'. The interface of 'get_equilibrium' is identical to that of 'get_core_profiles' (Section 2.4). The interface of 'put_equilibrium' is identical to that of 'put_core_sources' (Section 2.5).
IDS gas_injection
Data exchange with the 'gas_injection' IDS is carried out by the functions 'put_gas_injection' and 'get_gas_injection'. The interface of 'get_gas_injection' is identical to that of 'get_core_profiles' (Section 2.4). The interface of 'put_gas_injection' is identical to that of 'put_core_sources' (Section 2.5).
The gas puffing units are electron/s in DYON and Pa*m^3/s in IMAS. The unit conversion is made on the assumption that the gas is H2 (D2) molecules with the temperature of 300 K:
PIMAS = PDYON k T / 2,
with P the gas puffing, T = 300 K, k = 1.3807*10-23 J/K.
IDS magnetics
Data exchange with the 'magnetics' IDS is carried out by the functions 'put_magnetics' and 'get_magnetics'. The interface of 'get_magnetics' is identical to that of 'get_core_profiles' (Section 2.4). The interface of 'put_magnetics' is identical to that of 'put_core_sources' (Section 2.5).
IDS radiation
The emission densities are stored as 1D-profiles on the formal grid consisting of a single point although they are represented by single values.
When the data are recovered from the IDS, the emission processes are sought in the array of structures by their DD indices. At present, the storage of process in the IDS is organized as follows:
Process | DD index | IDS name | IDS index |
---|---|---|---|
Total emission from line radiation | 10 | Line_radiation | 1 |
Recombination and bremsstrahlung emission from ions | 901 | Recombination_and_bremsstrahlung | 2 |
Radiation from charge exchange reactions between H isotope atoms and various ions | 902 | Charge_exchange | 3 |
Here 'IDS index' is the location of the source in the 'radiation.process' AoS (which can be changed if required). The 'IDS name' is the label of the process (a part of the process identifier), which is not used when the data are extracted from the IDS. The processes with DD indices 901 and 902 are custom processes missing in the DD.
The radiating species are sought in the AoS's 'radiation.process(:).profiles1d(1).ion' and 'radiation.process(:).profiles1d(1).neutral' by their labels, which are the standard chemical element notations.
Data exchange with the 'radiation' IDS is carried out by the functions 'put_radiation' and 'get_radiation'. The interface of 'get_radiation' is identical to that of 'get_core_profiles' (Section 2.4). The interface of 'put_radiation' is identical to that of 'put_core_sources' (Section 2.5).
IDS wall
The 'wall' IDS is used to store sputtering coefficients. When the data are extracted from the IDS, each coefficient is found in the AoS by the labels of the sputtered and incident species, which are the standard chemical element notations.
Data exchange with the 'wall' IDS is carried out by the functions 'put_wall' and 'get_wall'. The interface of 'get_wall' is identical to that of 'get_core_profiles' (Section 2.4). The interface of 'put_wall' is identical to that of 'put_core_sources' (Section 2.5).
Service functions
function [ion] = arrange_ion_densities (mass, Z_n, label, neutral_index, densities)
Prepare a structure containing the densities of all ion charge states of an element for the core_profiles IDS and other element characteristics.
Name | Type | Description |
---|---|---|
ion | struct | structure containing the properties of the ion species |
mass | float | ion mass number |
Z_n | float | charge number of the nucleus |
label | symbol array | label of the ion chemical element |
neutral_index | int | index of the respective neutral in the AoS |
densities | 1d float array | array of densities, densities(Z) being the density of the charge state Z |
function [neutral] = arrange_neutral_density (mass, Z_n, label, ion_index, density)
Prepare a structure containing the density of neutral atoms of an element for the core_profiles IDS.
Name | Type | Description |
---|---|---|
neutral | struct | structure containing the properties of the neutral species |
mass | float | ion mass number |
Z_n | float | charge number of the nucleus |
label | symbol array | label of the chemical element |
ion_index | int | index of the respective ion in the AoS |
density | float | neutral density |
function [neutral_sort] = arrange_radiation (label, mass, Z, power_density)
Arrange the structure holding the data about emissivity and other characteristics of a neutral species.
Name | Type | Description |
---|---|---|
neutral_sort | struct | structure containing the emissivity and properties of the neutral species |
label | symbol array | label of the chemical element |
mass | float | ion mass number |
Z | float | charge number of the nucleus |
power_density | float | neutral density |
function [density, ion_found] = extract_ion_densities (profiles, Z)
Extract densities of all charge states of an ion species from the core_profiles IDS.
Name | Type | Description |
---|---|---|
density | 1D float array | the array elements with the numbers 1, ..., Z hold the densities of the corresponding charge states; the element Z+1 hold the neutral density |
ion_found | boolean | equals to false if the ion with the given Z is missing |
profiles | struct | time slice of the AoS core_profiles.profiles_1d |
Z | float | charge number of the nucleus |
function [AOS_index] = find_source (sources, dictionary_index)
Find location of the element with a given data dictionary index in an AOS (in particular, the source in core_sources.source and the process in radiation.process).
Name | Type | Description |
---|---|---|
AOS_index | int | index of the required element in the array |
sources | struct | AoS where the search is performed |
dictionary_index | int | DD index of the required element |
function index = find_species (species_list, label)
Find location of the element with a given label in AoS. The function is used to find the required spruttering coefficient in the 'wall' IDS. The label is the chemical element label; it is hold in the 'label' leaf of each AoS element.
Name | Type | Description |
---|---|---|
index | int | index of the required element in the array |
species_list | struct | AoS where the search is performed |
label | symbol array | label of the required element |
DYON input
The importing of the DYON input from IMAS is supported by MATLAB function, main_input_get_data_from_IMAS.m. The input data for testing script can be loaded to IMAS via main_input_put_data_to_IMAS.m. Depending on the situation, they can be integrated to the code or used separately as wrappers providing the connection between DYON and IMAS.
Similarly as in script for output DYON data, the input data are placed into IMAS IDS's (Interface Data Structures). The allocation of the data in the IDS's and the functions supporting it are described below.
List of the script files
File name | Content |
main_input_get_data_from_IMAS.m | Main script DYON input saving data from IMAS to MAT file: IMAS data |
main_input_put_data_to_IMAS.m | Additional script saving DYON input data in the IMAS |
get_from_IMAS.m | Auxiliary script for main_input_get_data_from_IMAS.m |
Input_put_to_IMAS.m | Auxiliary script for main_input_put_data_to_IMAS.m |
Input_put_core_profiles.m | Function saving data to the 'core_profiles' IDS |
Input_put_ec_launchers.m | Function saving data to the 'ec_lauchers' IDS |
Input_put_equilibrium.m | Function saving data to the 'equilibrium' IDS |
Input_put_gas_injection.m | Function saving data to the 'gas_injection' IDS |
Input_put_magnetics.m | Function saving data to the 'magnetics' IDS |
Input_put_em_coupling.m | Function saving data to the ' em_coupling' IDS |
Input_put_wall.m | Function saving data to the 'wall' IDS |
Input_put_pf_active.m | Function saving data to the 'pf_active ' IDS |
Input_put_pf_passive.m | Function saving data to the 'pf_passive' IDS |
Input_put_pulse_shedule.m | Function saving data to the ' pulse_shedule ' IDS |
Input_put_plasma_initiation.m | Function saving data to the ' plasma_initiation ' IDS |
Input_put_tf.m | Function saving data to the ' tf ' IDS |
Input_get_core_profiles.m | Function recovering the saved data from the 'core_profiles' IDS |
Input_get_ec_launchers.m | Function recovering the saved data from the 'ec_lauchers' IDS |
Input_get_equilibrium.m | Function recovering the saved data from the 'equilibrium' IDS |
Input_get_gas_injection.m | Function recovering the saved data from the 'gas_injection' IDS |
Input_get_magnetics.m | Function recovering the saved data from the 'magnetics' IDS |
Input_get_em_coupling.m | Function recovering the saved data from the ' em_coupling' IDS |
Input_get_wall.m | Function recovering the saved data from the 'wall' IDS |
Input_get_pf_active.m | Function recovering the saved data from the 'pf_active ' IDS |
Input_get_pf_passive.m | Function recovering the saved data from the 'pf_passive' IDS |
Input_get_pulse_shedule.m | Function recovering the saved data from the ' pulse_shedule ' IDS |
Input_get_plasma_initiation.m | Function recovering the saved data from the ' plasma_initiation ' IDS |
MAT data files | |
MAST_27512__2023_3_17_22_1_45_p0=1.1563mPa.mat | Example of MAT-file with DYON results (received from Kim Hyun-Tae) |
ids_data.mat | Control MAT-file generated from data readed from IDS'es |
Running the scripts
To launch the test scripts, do the following:
1. Enter:
module load imasenv/<IMASversion>
Here <IMASversion> is 3.38.1/rc or higher.
2. The scripts in its present form use the IMAS database 'step'. If you are planning to use it and this database is non-existent, enter the following command to create the database:
imasdb <Maschine_name>
You can replace <Maschine_name> with another IMAS database name ('step', 'mast', etc.), but do not forget to create it and change the variable 'machine' in main_input_get_data_from_IMAS.m and main_input_put_data_to_IMAS.m.
3. Enter either
matlab
4. Run main_input_put_data_to_IMAS.m in order to save in IMAS the data from an available DYON input MAT-file (you can change shot, run, IDS comments etc. by changing the parameters in this script).
5. To get back the DYON input data, run test_get_from_IMAS.m.
The main files (main_input_put_data_to_IMAS.m, input_put_to_IMAS and main_input_get_data_from_IMAS.m, input_get_from_IMAS)
- The script main_input_put_data_to_IMAS.m loads a MAT-file containing the DYON data (the name of the file is defined in the script). It is assumed that there is a structure with the name 'input' among the variables loaded from the MAT-file and that this structure holds all the data that must be saved. Currently the reference MAT-file is MAST_27512__2023_3_17_22_1_45_p0=1.1563mPa.mat that can be found on Gateway at:
afs/eufus.eu/user/g/g2hkim/public/DYONtoIMAS/stable/MAST_27512__2023_3_17_22_1_45_p0=1.1563mPa.mat
or
afs/eufus.eu/user/g/g2chmiel/public/imas_DYON/MAST_27512__2023_3_17_22_1_45_p0=1.1563mPa.mat
In the script there have to be defined machine name, shot number, run number and H_mass. The script the script engages the function input_put_to_IMAS.
- Function input_put_to_IMAS creates an IMAS data entry for the given 'shot' and 'run' parameters (note that the database with the required name must exist; otherwise, an error is raised). Then it invokes several functions that put data to separate IDS's ('input_put_core_profiles', 'input_put_equilibrium', 'input_put_gas_injection', ‘input_put_tf’, 'input_put_wall', ‘input_put_pf_active’, ‘input_put_pf_pasive’, ‘input_put_ec_launchers’, ‘input_put_pulse_shedule’, ‘input_put_plasma_initiation’, 'input_put_magnetics' and ‘input_put_em_coupling’) and closes the database. After that, the content of the 'input' structure is put to IMAS. The DYON data fields and IMAS IDS’s to which the data are placed can be found in the table IMAS interface with DYON - Google Documents:
https://docs.google.com/document/d/1CBK1mU8uYXuPSLk3-xa3osyHTGSHcr_1bHjSFS996gE/edit
- In the similar way the data are loaded from IMAS IDS’s to the MAT-file called IMAS_data.mat. In the script main_input_get_data_from_IMAS there are also defined: machine name, shot number and run number. Note that values of machine, shot and run number have to be the same as given in main_input_put_data_to_IMAS script. Otherwise the database cannot be found. After all, opened and filled structure is saved to the MAT-file.
- The script engage the function input_get_from_IMAS, which load data to MAT-file from different IDS’s defined in the body of the function via separate functions: 'input_get_core_profiles', 'input_get_equilibrium', 'input_get_gas_injection', ‘input_get_tf’, 'input_get_wall', ‘input_get_pf_active’, ‘input_get_pf_pasive’, ‘input_get_ec_launchers’, ‘input_get_pulse_shedule’, ‘input_get_plasma_initiation’, 'input_get_magnetics' and ‘input_get_em_coupling’. The function returns the 'input' structure, which is to be equivalent (after the script is complete) to the 'input' structure that was initially put to IMAS.
IDS core_profiles
input_put_core_profiles
The function load DYON data to core_profiles IDS. The quantities stored in this IDS include prefill gas pressure with individual time (input.pefill.time and input.prefill.data). All data are stored as a single value for given time step.
input_get_core_profiles
This function load prefill gas pressure with individual time to input.prefill.time and input.prefill.data MAT-file structure. Data are strored in profiles_1d.time and profiles_1d.neutral.presure IDS path.
IDS equilibrium
input_put_equilibrium
The function load to the equilibrium IDS the DYON data: major radius of the plasma current (input.R.time, input.R.data), vertical position of the plasma current (input.Z.time, input.Z.data), minor radius of the plasma current in time_slice{it}.boundary.minor_radius, plasma elongation data (input.Kappa.time, input.Kappa.data), plasma cross sectional area data (input.area.time, input.area.data), plasma volume data (input.Vp.time, input.Vp.data), internal inductance data (input.li.time, input.li.data), as well as radial and vertical position of the mesh grid cells (input.vacuum_inductance.raxis, input.vacuum_inductance.z). All quantities are time dependent with a genetic time.
Input_get_equilibrium
This function load above mentioned variables from equilibrium IDS to MAT-file structure.input. The major radius of the plasma current is stored in time_slice{time}.global_quantities.current_centre.r, vertical position of the plasma current in time_slice{time}.global_quantities.current_centre.z, minor radius of the plasma current in time_slice{time}.boundary.minor_radius, plasma elongation data in time_slice{time}.boundary.elongation, plasma cross sectional area data in time_slice{time}.boundary.area, plasma volume data in time_slice{time}.boundary.volume, internal inductance data in time_slice{time}.boundary.li_3, as well as radial and vertical position of the mesh grid cells in time_slice.profiles_2d.grid.dim1 and time_slice.profiles_2d.grid.dim2.
IDS gas injection
Input_put_gas_injection
The function load to the gas injection IDS the DYON data: gas influx data for individual time (input.gasflux.time, input.gasflux.data). The interface of 'input_put_gas_injection' is identical to that of 'input_put_core_profiles'. The gas puffing units are electron/s in DYON and Pa*m^3/s in IMAS. The unit conversion is made on the assumption that the gas is H2 (D2) molecules with the temperature of 300 K: PIMAS = PDYON k T / 2, where P the gas puffing, T = 300 K, k = 1.3807*10-23 J/K.
Input_get_gas_injection
This function load above mentioned variables with appropriate conversion from gas injection IDS to MAT-file structure. The time and data are stored in .pipe.flow_rate.time and .pipe.flow_rate.data IDS path.
IDS tf
Input_put_tf
The function load to the toroidal field coils IDS called tf the quantity being the product of Bt (toroidal magnetic field) and R (major radius) in Tesla*meters for individual time (input.BtR.time, input.BtR.data).
Input_get_tf
The function load above mentioned variables from tf IDS to MAT-file structure. The toroidal coils data are stred in tt.b_field_tor_vacuum_r.time and tt.b_field_tor_vacuum_r.data IDS path.
IDS wall
Input_put_wall
The function load to the wall IDS the volume of vacuum space and data of the simulation boundary representing the first wall. The chamber boundary is described by R (input.ChamberBoundary(:,1)) and Z (input.ChamberBoundary(:,2)) coordinates.
Input_get_wall
This function load above mentioned variables from wall IDS to MAT-file structure. Here chamber boundary in stred in description_2d.vessel.unit.annular.outline_inner.r and description_2d.vessel.unit.annular.outline_inner.z IDS paths.
IDS pf active
Input_put_pf_active
The function load to the pf active IDS the voltage applied in each coil for individual time (input.coil_voltage_input.data(:,:), input.coil_voltage_input.data_time), currents induced in each coil for individual time (input.coil_current_input.data(:,:), input.coil_current_input.data_time), the number of current and voltage circuits as well as coil resistance of the coil vessel resistance (input.coil_vessel_resistance) DYON quantity.
Input_get_pf_active
This function load above mentioned variables from pf active IDS to MAT-file structure. The voltage and current of each coil are stored in pa.coil.current.time, pa.coil.current.data and in pa.coil.voltage.time, pa.coil.voltage.data IDS paths while the coil resistance is storred in coil.resistance IDS path.
IDS pf passive
Input_put_pf_passive
The function load to the pf passive IDS the number of coil voltage and current vessel elements and vessel elements resistance of the coil vessel resistance (input.coil_vessel_resistance) DYON quantity.
Input_get_pf_passive
This function load above mentioned variables from pf passive IDS to MAT-file structure. The vessel resistance is stored in 1D loop.resistance IDS path.
IDS ec_launchers
Input_put_ ec_launchers
The function load to the ec launchers IDS the Injected ECH power (names.ECH.data, names.ECH.time), Toroidal angle of ECH injection (names.ECH.thTor), poloidal angle of ECH injection (names.ECH.thPol), ECH frequency (names.ECH.freq) and CH mode. Note that the ECH O-mode in DYON(IMAS) is defined by 0 (1), while X-mode by 1 (-1). Therefore appropriate conversion have been applied.
Input_get_ ec_launchers
This function load above mentioned variables from ec launchers IDS to MAT-file structure with appropriate conversion. The frequency is stored in beam.frequency.data, the power in .beam.power_launched.data, the toroidal and poloidal angle in beam.steering_angle_tor and beam.steering_angle_pol, while time is stored in beam.time IDS path.
IDS pulse_shedule
Input_put_pulse_shedule
The function load to the pulse shedule IDS the value of the loop voltage induced to the plasma current for individual time (input.Vloop.time, input.Vloop.data).
Input_get_pulse_shedule
This function load above mentioned variables from pulse_shedule IDS to MAT-file structure. Here loop voltage values are stored in flux_control.loop_voltage.reference.time and flux_control.loop_voltage.reference.data IDS path.
IDS plasma initiation
Input_put_ plasma initiation
The function load to the plasma initiation IDS the value of the stray magnetic field at the plasma position i.e. sqrt(Br^2 + Bz^2) for individual time (input.Bstray.time, input.Bstray.data).
Input_get_ plasma initiation
This function load above mentioned variables from plasma initiation IDS to MAT-file structure. The stray magnetic field data are stored in global_quantities.b_field_stray.time and global_quantities.b_field_stray.data IDS paths.
IDS magnetics
Input_put_magnetics
The function load to the magnetics IDS the value of the major radius (input.flux_loop_sensor(:).r) and vertical position (input.flux_loop_sensor(:).z) of each flux loop as well magnetic flux loop voltage.
Input_get_magnetics
This function load above mentioned variables from magnetics IDS to MAT-file structure. The flux loop R and Z coordinates are stored in flux_loop.position.r and flux_loop.position.z IDS paths.
IDS em coupling
Input_put_em coupling
The function load to the em coupling IDS the value of the mutual inductance matrix between the circuits and vessel elements (input.coil_vessel_inductance(a,b)), mutual inductance between each flux loop and a grid in the vacuum space (input.flux_loop_sensor(k).plasma_inductance(m,n)) and mutual inductance between each flux loop and each coil/vessel element (input.coil_vessel_inductance(a,b)).
Input_get_em coupling
This function load above mentioned variables from em coupling IDS to MAT-file structure. Here the input.flux_loop_sensor.plasma_inductance variable is stored in mutual_loops_grid matrix, while input.coil_vessel_inductance in mutual_active_active, mutual_passive_passive and mutual_passive_active IDS path as shown on Fig.1.
The scientific work is published for the realization of the international project co-financed by Polish Ministry of Science and Higher Education in 2019 from financial resources of the program entitled "PMW"; Agreement No. 5040/H2020/Euratom/2019/2
This work has been carried out within the framework of the EUROfusion Consortium and has received funding from the Euratom research and training programme 2014–2020 under grant agreement No 633053. The views and opinions expressed herein do not necessarily reflect those of the European Commission or ITER