TORAY ECH/ECCD Code v1.6 Prepared by Jon Kinsey -- kinsey@fusion.gat.com Myunghee Choi -- choi@fusion.gat.com ABSTRACT -------- The TORAY ray tracing code computes contributions to electron cyclotron heating (ECH) and RF current-drive (ECCD) sources. Plasma heating and non-inductive current generation by injection of electromagnetic waves in the electron cyclotron frequency range (ECH and ECCD) has been considered an important tool in fusion research. Electron cyclotron current drive (ECCD) is a leading candidate for current profile control in Advanced Tokamak (AT) operation. ECCD has successfully demonstrated that it can help sustain high beta negative central shear (NCS) discharges and suppress neoclassical tearing modes (NTM). This version of TORAY includes the recently developed ECCD module by Lin Liu which includes an adjoint formulation with collisionality correction factors that reduce the trapped electron fraction and increase the current drive efficiency. UNPACKING INSTRUCTIONS > gunzip toray.tar.gz > tar xvf toray.tar DOCUMENTATION Documentation for the TORAY code is given in Latex form. To print the Latex documentation, you need to typeset the Latex file twice to obtain correct cross-references: > latex toray.tex > latex toray.tex > dvips -f toray.dvi > toray.ps CONTENTS: Inside the main TORAY directory, the following files and subdirectories are created upon installation: NOTES - correspondence README - this file REVISIONS - a historical list of code revisions toray.tex - TORAY Latex documentation source toray.ps - Postscript version of Latex documentation d3dphys_0201.pdf - DIII-D physics memo IMB_Memo_#3.pdf - DIII-D memo on Lin Liu ECCD module G_EQDSK.pdf - DIII-D memo on GEQDSK file format src - contains source *.f90 and common block files config - Makefile configuration files root - auxiliary makefiles test - input and output files for test cases COMPILATION INSTRUCTIONS: TORAY has been successfully built and tested on the following platforms using F90 compilers : HP (HP700 UNIX) Dec Alpha (Tru64 UNIX) Linux - Intel (PGF77,PGF90), Athlon (PGF90), LaheyFujitsu (lf95) Sun/Solaris This new F90 version no longer requires any preprocessing to handle precision. Note: because TORAY stills relies on a binary file for the input equilibrium, special flags must be set to read binary files with the opposite byte ordering on Linux systems. For the Portland Group compiler, the byteswapio option is used. The Lahey-Fujitsu compiler does not have an equivalent compiler flag. However, one can read binary files using runtime flags: ./toray -Wl,-T TORAY is free of any commercial libraries. The only requirement is that NetCDF be installed on the system. The current version of TORAY has been built and tested using NetCDF v3.4. To build TORAY, you will need a Fortran compiler. The build procedure makes use of the platform dependent files found in toray-ga/config. Make sure the CPU environment variable is set appropriately where CPU is one of the recognized values: HP700 LINUX LINUX_ATHLON ALPHA SOL Here, LINUX and LINUX_ATHLON includes optimizations for Intel and Athlon systems, respectively. You may need to edit the file corresponding to your platform to conform to your local installations of the compilers and netcdf. To compile on Linux systems, the user must specify the command line argument FORT to use either the PGI or LF95 compiler: gmake all FORT=pgf90 gmake all FORT=lf95 The other recognized optional arguments are: clean | DEBUG=yes | DEBUG=no | FORT=f90 The clean option will do a clean build of TORAY. The DEBUG=yes option sets the -g compiler flag to build a debuggable version of Toray. Conversely, the DEBUG=no option sets the compiler flags to build an optimized version of TORAY. EXECUTION INTRUCTIONS: When TORAY is built, an executable is created in the toray-ga/src directory. To run TORAY, the input files must be in the same directory as the executable. The inputs for various test cases reside in the toray-ga/test directory along with their corresponding echout output files. A description of the test cases can be found in a later section of this file. input files: echin - ascii file containing profile information mhddat, psiin, or eqdskin - MHD equilibrium information toray.in - TORAY namelist input file gafit.in - GAFIT namelist input file needed when igafit=1 in toray.in output files: echout - ascii output file toray.nc - NetCDF output file. To prevent this from being written, set netcdfdat = .false. in the toray.in file. rayec001 - auxiliary output file needed by the CQL3D code. Set cqldat = .true. in toray.in to produce this file. It is not written by default. a) MHD equilibrium Currently, equilibrium information is obtained from some origination of a G-EQDSK file (see the web page lithos.gat.com/efit/g_eqdsk.html). That information can be passed to TORAY in several ways : 1) Providing an 'mhddat' file which is a binary file created by the GAFIT code and is automatically produced in a ONETWO transport simulation. This is the default mode of operation. Here, igafit=0. 2) Providing an ascii file called 'psiin'. This is another processed file created in a ONETWO simulation where the MHD information originates from a G-EQDSK file. To run TORAY using a 'psiin' file instead of a 'mhddat' file, set igafit=1 in the toray.in namelist file. Also, ipsi is set to zero in the gafit.in namelist file. The default is ipsi=0. 3) Provide a G-EQDSK file. Here, the processed mhddat or psiin files are not needed. The user may simply copy the desired G-EQDSK file to a file called 'eqdskin' and set igafit=1 in toray.in and set ipsi=1 in gafit.in. Here, psi(rho) is simply obtained from q(psi) and will not give the exact same results for the ECH/ECCD profiles obtained from running TORAY with the mhddat input files. Note: the current version of TORAY is currently limited to 65x65 EFIT resolution. In principle, the variables nxmx, nzmx, and npsimax in the common block file, paradm.i, can be increased but running TORAY with higher resolution EFITs has not been tested. b) Profile data The electron density (cm^-3), electron temperature (keV), and Zeff profiles are supplied to TORAY through the echin input file. The echin input file also specifies a number of other parameters including the choice of damping model (see the Latex documentation). c) Ray launcher A new ray pattern generator has been added to TORAY. The variable 'raypatt' is used to choose between the two different formulations and is set in the toray.in file. The choices are raypatt model '.km.' Matsuda (limited to 30 rays) '.gauss.' Gaussian (limited to 100 rays) The default is now raypatt='.gauss.' for the starting ray angles which selects a Gaussian distribution centered around a central ray with polar angle theta0 and azimuthal angle phi0. Rays are arrayed into 'gauszone' annular zones, each having mray(gauszone) rays. The single central ray has angles theta0, phi0. All rays have the same power, so annular zones must be adjusted in width depending on number of rays in that zone and total number of rays. The rays in each annulus are arrayed at the power-weighted center of that annulus. The defaults for gauszone and mray are: gauszone = 4 mray(1) = 1 mray(2) = 5 mray(3) = 12 mray(4) = 12 mray(5) = 20 mray(6) = 24 mray(7) = 26 So, for gauszone=4 the total number of rays is 1+5+12+12=30 rays. For gauszone=5, the total number of rays is 50. See the TORAY Latex documentation for further information. d) Damping models TORAY includes options for using cold plasma propagation or various absorption models including Matsuda's mild relativistic module for 1st and 2nd harmonic damping and Mazzucato's relativistic module good near the 1st harmonic. The choice of damping model is set in the echin input file and is read into TORAY using the idamp variable. e) Current Drive The electron cyclotron current drive (ECCD) is computed either using the Cohen or Lin Liu modules and includes relativistic, electron-ion collisions, and trapped particle effects. See the Latex documentation for further discussion. The switch setting the choice of ECCD module is modelc where modelc = 3 Cohen module modelc = 4 Lin Liu module (default) f) Test cases There are 10 test cases provided in the toray-ga/test directory. Each case was generated using the Gaussian ray pattern and using a mhddat binary file for the equilibrium input. The results for each case are stored in echout.. The test cases include: 1) rf99 = DIII-D #96148 w/ 30 rays 2) metro = DIII-D #98549 w/ 30 rays 3) ll = DIII-D #96163 off-axis ECCD w/ 30 rays 4) jt60su = JT60SU test w/ 18 rays (gauszone=3) 5) prater1 - DIII-D 103969 w/ 2 sources, 1 ray 6) prater2 - DIII-D 103969 w/ 2 sources, 1 ray, inside launch 7) at = DIII-D 107181 w/ 3 sources, 30 rays, 129x129 EQDSK, 201 grid pts 8) choi1 = DIII-D 106275 w/ 3 sources at high beta, Lin Liu ECCD 9) choi2 = DIII-D 104328 at t=2.88, Lin Liu ECDD 10) choi3 = DIII-D 104328 at t=3.50, Lin Liu ECDD Here, the first 7 test cases use the Cohen ECCD module while cases 8-10 use the Lin Liu ECCD module. For each test case there is an input profile data file (e.g. echin.rf99) and equilibrium data files in the 3 formats (e.g. eqdsk.rf99, psiin.rf99, mhddat.rf99). The sample output files (echout) are also provided for comparison. The accompanying ONETWO input files (inone) are also given for completeness. To execute any given test case, copy the profile input file, which must be called 'echin', and equilibrium file ('mhddat', 'psiin', or 'eqdskin') to the toray-ga/src directory. The echout files for cases 1-3 and 7 used the toray.in file supplied in the test directory. Note that for the prater1,2 and jt60su test cases, the specific toray.in files (e.g. toray.in-jt60su) must also be copied to toray-ga/src directory and renamed toray.in. Cases 8-10 use the toray.in-choi input file. Most test cases where generated using 65x65 EFIT EQDSK files. Case 7 is different in that it runs with a 129x129 EFIT EQDSK and 201 grid pts. To run this test case several parameter statements need to be modified in the paradm.i common block file. A modified file called paradm.i-201 was created for convenience. Here, the following lines needed were uncommented : parameter ( nxmx = 129, nzmx = 129, nzmx2 = 2*nzmx) parameter ( kj = 202, kjp = 3*kj + 1) parameter (npsimax = 129) parameter (njmax = 201, njmaxp = njmax + 1) The same lines referring to 65x65 and 51 grid pts were commented out. The file, paradm.i-65 is the default version for 65x65 EFITs. ----------------------------------------------------------------------- IF YOU HAVE ANY QUESTIONS OR PROBLEMS, PLEASE CONTACT: JON KINSEY, General Atomics kinsey@fusion.gat.com or MYUNGHEE CHOI, General Atomics choi@fusion.gat.com The development and implementation of the TORAY module is based on work performed by a wide variety of eccentric fusion researchers including: Jon Kinsey, Lehigh University and currently at General Atomics Myunghee Choi, General Atomics Lin Liu, formerly at General Atomics Ron Prater, General Atomics Bob Harvey, CompX Ray Jong, Lawrence Livermore National Laboratory Ron Cohen, Lawrence Livermore National Laboratory Gary Smith, Lawrence Livermore National Laboratory Arnold Kritz, Lehigh University Don Batchelor, Oak Ridge National Laboratory Alex Pletzer, PPPL This is not an inclusive list, so please don't take offense if I have left someone out -- JEK.