Package: neutpy
NeutPy - A code for the calculation of neutral particle transport in plasmas based on the transmission and escape probability methodNeutPy is the Python 2.x port of GTNEUT, which was written by John Mandrekas.GTNEUT is a two-dimensional code for the calculation of the transport of neutral particles in fusion plasmas.
It is based on the Transmission and Escape Probabilities (TEP) method and can be considered a computationally efficient
alternative to traditional Monte Carlo methods. The code has been benchmarked extensively against Monte Carlo and
has been used to model the distribution of neutrals in fusion experiments.The original physics background can be found atMandrekas, John. (2004). GTNEUT: A code for the calculation of neutral particle transport in plasmas based on the
Transmission and Escape Probability method. Computer Physics Communications.
161. 36-64. 10.1016/j.cpc.2004.04.009.The original FORTRAN 95 GTNEUT code can be found at The Fusion Research Center GitHub athttps://github.com/gt-frc/GTNEUTInstallationTriangle InstallationThe Triangle 2D mesh generator is required for NeutPy mesh generation. This guide can be used to install Triangle
locally. If you imagine using triangle otherwise, consider
following the steps below but with consideration for global installation (e.g., cloning to /opt/ instead
of your home directory). Ensure that you have a C compiler installed.
Download the Triangle zip file fromhttps://www.cs.cmu.edu/~quake/triangle.htmlor$ cd ~$ git clone https://github.com/libigl/triangle.git$ cd triangleMake your bin directory$ mkdir binRead the README file for instructions on how to compile. It's pretty basic. We recommend simply
compiling triangle alone with (using GCC) since we do not use showme.$ gcc -O -o bin/triangle triangle.c -lmIf you want to fully compile triangle and showme, edit the makefile,
noting any special options from the README.KeepSRC = ./and setBIN = ./bin/Make triangle$ makeAfter triangle is compiled, set executable$ cd bin$ sudo chmod +x triangleSet link (this allows triangle to be called on command line as triangle) to /usr/local/bin or some
other directory on your PATH.$ sudo ln -s /full/path/to/triangle /usr/local/bin/triangleInstall NeutPyUsing pip$ pip install neutpyFrom GitHubIf you'd like to work on the actual neutpy code, you canclonefrom GitHub:$ cd /your/future/neutpy/home/Master branchClone  master branch from github$ git clone https://github.com/gt-frc/neutpy.gitOther branchesYou can clone another branch from github as follows:$ git clone -b <branch> https://github.com/gt-frc/neutpy.gitEnter NeutPy$ cd neutpySetup your virtual environment (install virtualenv using apt, yum, etc.)$ virtualenv --python=/usr/bin/python2.7 venvActivate it$ source venv/bin/activateInstall packages$ pip install -r requirements.txtUsageNeutPy requires 6 input files and 2 configuration files.Configuration files:toneutpy.confis the main input file for a shot. This file will change with each shot.neutpy.confis the main NeutPy configuration file and includes parameters that probably wouldn't change between
shots and other variables. This file needs to be in the current working directory and cannot be renamed. Grab an
example copy from the FRC GitHub (https://github.com/gt-frc/neutpy/)Data files:The names of the data files included follow the GT3 gt3_shotid_timeid_profile.dat convention but can be defined
differently in yourtoneutpy.conffile.Ion/Electron density and temperature data are X/Y (normalized rho/value) two-column data. Temperatures are
in keV. Densities should be given in #/m^3. Psi data are non-normalized 3-column R/Z/value data, with R/Z in
meters.Example File Structuregt3_shotid_timeid_ne.dat(Electron density profile)gt3_shotid_timeid_ni.dat(Ion density profile)gt3_shotid_timeid_Te.dat(Electron temperature profile)gt3_shotid_timeid_Ti.dat(Ion temperature profile)gt3_shotid_timeid_psirz.dat(Non-normalized psi grid)gt3_diid_wall.dat(Machine wall coordinates (R/Z))Example UsageImport the neutrals class.>>> from neutpy import neutralsThere are three main entry points into NeutPy:from_file,from_mesh, andfrom_gt3.from_file()>>>neuts=neutrals()INITIALIZINGNEUTPY>>>neuts.from_file('/relative/path/to/your/toneutpy.conf')where the filename is relative to the CWD.from_gt3()>>>neuts=neutrals()INITIALIZINGNEUTPY>>>neuts.from_gt3(<GT3object>)Thefrom_meshmethod is in development.