User Tools

Site Tools


scbc3

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:

  • Spectral finite element discretization in two dimensions,
  • Finite Fourier series in the third dimension,
  • Semi-implicit and implicit temporal discretization for the range of temporal scales found in fusion experiments,
  • Simulation particles for kinetic effects from a minority species of energetic ions, and
  • Integro-differential methods for kinetic effects from free-streaming.

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++)

  • Framework for writing fluid / plasma simulations in curvilinear geometry.
  • Finite-difference code, variety of numerical methods and time-integration solvers.
  • Written from scratch in C++, borrowing some ideas from the original BOUT code.
  • Intended to be quite modular, enabling fast testing of numerical methods.
  • Can evolve any number of equations, with equations appearing in a readable form.
  • Primarily designed and tested with reduced plasma fluid models in mind.

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.

  • Corsica I flexibly coupled one-dimensional calculations of particle, energy, and magnetic-flux transport in the core, or confined region, of the plasma to a calculation of a two-dimensional magnetic configuration.
  • Corsica II coupled the one-dimensional core transport calculation to a simulation of the two-dimensional “edge” where magnetic-field lines intersect material surfaces.
  • Corsica III is being developed as funding permits and will couple the evolution of the fusion process to plasma turbulence models for a more comprehensive simulation.

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

C++

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

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
scbc3.txt · Last modified: 2022/07/21 06:59 by 127.0.0.1