Table of Contents

Introduction to Plasma R&D Codes

This session is intended as an introduction to the codes that we use on a day-to-day basis to service existing or new contracts. The aim is to show similarities and differences of the codes. We define the differences between commercial (or industry hardened) codes and those codes that are being developed by research programs to address new challenges in the science (e.g. tough physics) or to take advantages of new available resources (e.g. new faster computers).

The modeling tools fall into four main areas:

  1. Single Particle
  2. Kinetic
  3. Fluid (or magneto-hydrodynamics_
  4. Hybrids
  5. Non-plasma tools (neutronics)

Intro to different methods

Single Particle Modeling

In the presence of a magnetic field, charge particles will prescribe Larmor orbits and the guiding center of their orbit will drift in response to externally applied electric and magnetic fields.

Glasser's intro talk to the RMF code for tracking guiding center drift of charged particles in response to a rotating magnetic field

RMF code

Orbital mechanics code exploiting LSODE

xdraw

Kinetic Modeling

Magneto-hydrodynamic (MHD) Modeling

Derived from moments of the Vlasov equation, the fluid description of plasmas is with macroscopic parameters (density, temperature, velocity, magnetic field).

Magnetohydrodynamics

If we consider the time-independent form of the force balance, we can find a solution, called the Grad-shafranov equation:

Grad-Shafranov equation

Codes we use

NIMROD

Non-Ideal Magnetohydrodynamics with Rotation, Open Discussion

NIMROD solves the extended magnetohydrodynamic equations using:

Introduction to NIMROD - Carl Sovinec

NIMROD Tutorial

HiFi

HiFi Multi-Fluid Modeling Framework

HiFi is a user-friendly massively parallel adaptive high order finite element (a.k.a. spectral element) modeling framework designed for multi-fluid numerical simulations in two- and three-dimensional geometries.

BOUT++

BOUndary-plasma Turbulence (written in C++)

Corsica

Corsica

The Corsica magnetic fusion simulation code is a prototype for an integrated simulation that would solve models for all aspects of tokamak operations.

nimeq

http://example.com|External Link

To run, put the following input deck into the run directory:

&nimeq_input
nimeq_solver="bl_diaga"
f_model="quad_closed"
f_open=0.0
f1_closed=-9.9099
f1_closed=-1.
f2_closed=0.0
dfdpsi=-9.9099
pres_model="quad_closed"
p1_closed=1
p2_closed=0.25 
p_open=0.0e-6
p_axis=0.002e-3
gsh_tol=1.e-8
gsh_tol=1.e-8
eq_iters=300
eq_iters=60
linmaxit=150
gscenter=0.75
nimeq_tx=F
/
frac_flux=1.
cf_min=-.3891
cf_min=-9999.
spectral_energy=T

Then run nimset, then run nimeq.

Programming languages

Fortran

(Originally FORTRAN, FORmula TRANslating system) Wikipedia / Fortran

Fortran 90 Handbook, by Adams et al.

C

The C Programming Language, by Kernighan and Ritchie

C++

The C++ Programming Language, by Stroustrup

Transfering files around

To transfer files to your local terminal do:

$scp -P 26 username@10.1.10.11:directory/file.avi .

To uncompress tarballs:

$tar -xvf filename.tar

Starting a run

cd to your SCRATCH directory with

cd $SCRATCH

Make a directory for your run:

mkdir myrun1

Transfer the input deck and batch script in your example directory into your run directory. Then make a symbolic link to the preprocessor (nimset) and physics kernal (nimrod) in your run directory with:

ln -sf ~trainxx/codedirectory/nimrod/nimrod nimrod
ln -sf ~trainxx/codedirectory/nimrod/nimset nimset

Then you are ready to run nimset and launch the batch script:

./nimset
qsub mybatch


  

Broken code

Waganer

Adams

Launch jobs

cp -R rundir $SCRATCH/.
cd $SCRATCH
nano go_script

edit out the line with -A (del should do it)

./nimset
sbatch go_script

squeue -u <username>

tail nimrod.out