DOI: 10.5061/dryad.cvdncjt9h
title: Python scripts for input and post-processing of fuzz sputtering TRI3DYN simulations

description: The influence of a fuzzy surface on the physical sputtering of Mo in He
 plasmas has been studied with hyperspectral imaging (HSI) measurements and
 simulations that couple the TRI3DYN code with an impurity transport code.
 The 2D profiles of the Mo I line emission intensity from HSI images reveal
 that the sputtering yield, Y, is reduced to ~40% of the smooth-surface
 value due to the presence of a fuzz layer, while the angular distribution
 of the sputtered Mo atoms might not change significantly. The simulations
 reproduce the Y reduction successfully, but indicate that fuzz causes an
 increase in the small-angle distribution of sputtered atoms. However, the
 increase is too small to produce an observable change in the Mo I emission
 profiles. A simple analytical model that assumes a single collision mean
 free path for a fuzz layer and considers only the primary sputtering
 events qualitatively reproduces the Y reduction and the small-angle
 distribution enhancement, explaining the geometrical effect of fuzz on
 physical sputtering.
description: These are not the raw data of our results, but the Python scripts
 that can be used to reproduce the simulation results in our work. Please
 see the "file structure" section in the readme file for more
 detailed illustration.
description: # Python scripts for input and post-processing of fuzz sputtering TRI3DYN
 simulations ## Introduction This dataset contains the Python scripts
 required to reproduce the simulation results shown in "Hyperspectral
 Imaging and TRI3DYN Simulation Study of Physical Sputtering from a Fuzzy
 Surface", which was submitted to Nuclear Materials and Energy in late
 2023. The core simulation code used in this work was
 [TRI3DYN](https://www.hzdr.de/db/Cms?pOid=64858&pNid=2689&pLang=en), which unfortunately cannot be given here. Users interested in reproducing our simulation results should try to contact Prof. Dr. Wolfhard Möller () to get access to TRI3DYN by themselves. In this work, TRI3DYN was used to simulate the physical sputtering of Mo atoms on a fuzzy surface. Afterwards, a simple Monte-Carlo impurity transport code given in this dataset was used to simulate the 2D spatial profiles of Mo I line emission intensity, which were then compared with the experimental results. Note that this dataset does NOT directly contain the output data from the original simulations. Thus, the users must follow the procedures illustrated in the "file structure" section below to reproduce the results by themselves. ## Prerequisites * Python 3: These Python scripts were run with Python 3.11 on a Windows 11 system. Installation and debugging of the Python codes are the responsibility of the users. * Python packages: Numpy, Scipy, Matplotlib, and netCDF4. * TRI3DYN: This work used TRI3DYN_2022 version Jan-2023. ## File Structure The uploaded file, "PythonScripts.zip", contains four files or folders. The purpose of them and the way to perform the entire simulation processes with them are introduced below. ### (1) Fuzz geometry construction (folder) This folder contains the Python scripts that are used to generate the two input files of TRI3DYN simulations, the ".in" input parameter file, and the ".vrc" fuzz geometry file. The scripts are categorized by the geometrical parameters used. There are 3 subfolders under this folder. "t = t_ave" indicates that the fuzz layer thickness (*t*) is equivalent to the average of *t* measured in the SEM images, and "t = t_ave +(-) t_std" indicates that *t* is equivalent to the average of *t* plus (minus) one standard deviation of *t* in the SEM images. The secondary subfolders under these three subfolders are named by the incident ion fluence, which determines the geometrical parameters of the fuzz tendrils. Lastly, the individual Python scripts inside these secondary subfolders are named by the value of "n", which is defined as (1 - porosity) of the fuzz layer and controlled by the parameter "target_density" in the scripts. The fuzz geometry is generated by a random-walk algorithm, which means that even using the same Python script, the exact geometry might be different every time. However, since the important geometrical parameters are the same, the random seeds shouldn't influence the results of the simulation too much. Simply run these Python scripts and they should generate and save the output files. ### (2) He\_Mo\_0020.in This is an example of the ".in" input parameter file to TRI3DYN, which specifies the details of the simulations, e.g., the species of the projectiles and recoils, the number of the injected pseudo-particles, etc. The details about the parameters and this file can be found in the user manual of TRI3DYN. Since the ".in" files are automatically generated by the Python scripts mentioned in (1), the users don't really need to change this file by themselves. ### (3) ReadTRI3DYN.py This is a Python script that is used to extract the statistics (sputtering yields and distributions) of the sputtered particles from the output files of TRI3DYN simulations. The users should copy this script to the folder storing the TRI3DYN output files, and then run it to get the statistics. The output files from this script will be saved in folders that are automatically created and named after the input files. ### (4) Impurity transport simulation (folder) This folder contains the Python scripts that perform a simple Monte-Carlo simulation for the impurity transport of sputtered Mo atoms inside the He plasma in the macroscopic vacuum vessel (PISCES-A). This simulation requires the particle distributions from the output of "ReadTRI3DYN.py", and its final results are the 2D spatial profiles of the Mo I line emission intensity. The structure of this folder is more complicated. Please follow the following order to complete the simulation. #### (4a) \Impurity transport simulation\Input\\ This is where the files common to all scripts are stored. In particular, there should be two files in this folder, "pec93#mo_llu#mo0.dat", which is the photon emissivity coefficient of the Mo I lines, and "scd89_mo.dat", which is the ionization rate coefficient of Mo atoms, from the ADAS database. Due to copyright issues, they are removed from this dataset, but the users can easily download them from the links below * "pec93#mo_llu#mo0.dat": * "scd89_mo.dat": #### (4b) Subfolders under \Impurity transport simulation\\ Except "Input" and "Flat", these subfolders are named after the values of the incident He ion fluences used in the corresponding experiments. On the other hand, "Flat" can be seen as the zero ion fluence case, which means that there is no fuzz but only a flat Mo surface. #### (4c) \Impurity transport simulation\\\\PlasmaProfiles\\ These folders store the 2D spatial profiles of electron density (ne) and electron temperature (Te) that were obtained from the hyperspectral images in the corresponding experiments. These plasma profiles are necessary for the simulation. To make them accessible by the simulation code, the users should first run the "WriteProfilesNC_from2dProfile.py" script, which will generate netCDF files of them. #### (4d) \Impurity transport simulation\\\\\\\\ Examples of the paths are "\Impurity transport simulation\Flat\Flat", "\Impurity transport simulation\Fluence0.47e25m-2\He_Mo_0020_splst", etc. We have introduced the meaning of the subfolders' names in (4b). The name of the secondary subfolders don't really matter, but the users should understand that each secondary subfolder uses results from one TRI3DYN simulation, i.e., one geometry. Before proceeding to the impurity transport simulation, the results from "ReadTRI3DYN.py", including "EnergyCount.csv", "Stat.csv" and "ThetaCount.csv", should be manually copied to the "Rough surface output" folder by the users. Then, the users should run the Python script "ParticleSource_ForMacro.py" to randomly generate the initial location and velocity vectors of the test particles (incident He ions). The number of test particles can be set in this script. The output will be saved as a ".nc" file in a newly created folder "MacroParticleSourceOutput". Note that the users do not need to restrict themselves to the existing secondary subfolders. New folders can be created, as long as the particle distributions (the three ".csv" files) are properly given. #### (4e) \Impurity transport simulation\\\\\\\06CalDensity\_S\_X.XX This is where the impurity transport simulation code is located. The value "X.XX" specifies the number of S/S0, which is the reduction factor of the Mo ionization rate coefficient, *S*, as mentioned in our paper. The users must note that the simulation code reads this value directly from the folder name. Then, the users should follow the order of the file names to complete the simulation: * "01CalDensity_NoGITR.py": This script carries out the Monte-Carlo impurity transport simulation in parallel computation. The users don't need to change any parameter except "cpu_num", which determines the number of processor threads to be used in the simulation. The output files are mainly the spatial density profiles of the sputtered Mo atoms. However, results from different processor threads are stored separately. * "02SumDensity.py": This script adds up the results of file "01" from different processor threads. * "03PlotDensity.py": This script plots the 2D spatial profiles of the Mo atom density. * "04CalEmission.py": This script calculates the 2D spatial profiles of the Mo I line emission intensity using the results from file "02". If the users want to use the photon emissivity coefficient (PEC) from the ADAS database, they must set "use_S_XB = False". Otherwise, the PEC will be set as S / (S/XB), using the reduced *S* value specified by the folder name, and the *S*/*XB* values extrapolated from [{D. Nishijima, et al. *J. Phys. B: At. Mol. Opt. Phys.* 43.22 (2010): 225701}](https://iopscience.iop.org/article/10.1088/0953-4075/43/22/225701/meta). The calculated Mo I line intensity profiles will be saved as ".csv" files and plotted as 2D contour plots. This is the last step of the entire simulation process.