=====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: - Single Particle - Kinetic - Fluid (or magneto-hydrodynamics_ - Hybrids - Non-plasma tools (neutronics) [[http://www.woodruffscientific.com/temp/bootcamp/Bootcamp.pdf|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. [[http://www.woodruffscientific.com/temp/bootcamp/glasserTalk.pdf|Glasser's intro talk to the RMF code for tracking guiding center drift of charged particles in response to a rotating magnetic field]] [[http://www.woodruffscientific.com/temp/bootcamp/RMF.tar|RMF code]] [[http://www.woodruffscientific.com/temp/bootcamp/orb.tar|Orbital mechanics code exploiting LSODE]] [[http://www.woodruffscientific.com/temp/bootcamp/xdraw.tar|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). [[ http://en.wikipedia.org/wiki/Magnetohydrodynamics | Magnetohydrodynamics]] If we consider the time-independent form of the force balance, we can find a solution, called the Grad-shafranov equation: [[ https://en.wikipedia.org/wiki/Grad%E2%80%93Shafranov_equation | Grad-Shafranov equation ]] ====Codes we use==== ===NIMROD=== [[ https://nimrodteam.org/ | 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. [[https://nimrodteam.org/presentations/plsem_10_29_07_2.pdf | Introduction to NIMROD - Carl Sovinec]] {{:nimrod_tutorial.pdf| NIMROD Tutorial}} ===HiFi=== [[ http://faculty.washington.edu/vlukin/HiFi_Framework.html | 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++=== [[ https://bout.llnl.gov/ | 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=== [[ https://www.llnl.gov/str/Cohen.html | 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=== {{:nimeq.png?100|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) [[ http://en.wikipedia.org/wiki/Fortran | Wikipedia / Fortran]] [[ http://micro.ustc.edu.cn/Fortran/Fortran%252090%2520Handbook.pdf | Fortran 90 Handbook, by Adams et al.]] ===C=== [[ http://cm.bell-labs.com/cm/cs/cbook/ | The C Programming Language, by Kernighan and Ritchie]] ===C++=== [[ http://www.stroustrup.com/4th.html | 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 ==== [[http://www.woodruffscientific.com/temp/bootcamp/WaganerF90.pdf|Waganer]] [[http://www.woodruffscientific.com/temp/bootcamp/AdamsF90.pdf|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 tail nimrod.out