NUBEAM

NUBEAM NTCC Module Documentation

 *** NUBEAM was developed at the Princeton Plasma Physics Laboratory    ***
 *** utilizing funding from the U.S. Department of Energy, 1979--today. ***

This note describes the use of NUBEAM-- either through the subroutine
library provided applications interface, or, by advancing steps through
separate executions of the standalone driver "nubeam_comp_exec" or
"mpi_nubeam_comp_exec".

Written by D. McCune -- Original, March 2002.  Revised, November 2008
Email comments & questions to author:  dmccune@pppl.gov

Update note:  NUBEAM was parallelized (using MPI) and has been converted
to use the Plasma State interface developed in conjunction with SciDAC
("Scientific Discovery through Advanced Computing") DoE projects,
(specifically, SWIM and FACETs), over the period 2006-2008.  The old 
driver program "nubeam_driver" has been replaced with "nubeam_comp_exec". 

Contents
========

  0.  Introduction; Update Notices
  1.  Build Dependencies & Prerequisites.
  2.  I/O: Use of Plasma State and Xplasma modules.
  3.  I/O: Code-generator & FORTRAN-90 Modules.
  4.  Executing the NUBEAM calculation.
  5.  Outputs (beyond the Plasma State).
  6.  2d Outputs.
  7.  Odds & Ends:  Sawteeth; State file save & restore; PPPL help.
  8.  Known limitations / problems.
  9.  Note on operation of test programs.

  A.  Appendices.

Home Top


Doc_Issues

DMC note to self: Nov. 2008 **********************************

clarify description for sawtooth handling?  Reference to deleted
"nubeam_driver" still present in sawtooth section of "Odds & Ends".

Home Top


Introduction

The NUBEAM module is a Monte Carlo package for time dependent modeling
of fast ion species in an axisymmetric tokamak using classical physics.
Multiple fast ion species can be present, due either to beam injection
of energetic neutral particles deposited as ions in the target plasma, 
or as a product of nuclear fusion reactions.

The model self consistently handles classical guiding center drift
orbiting, collisional and atomic physics effects during the slowing 
down of the fast specie population (represented by an ensemble of Monte 
Carlo model particles), with options for sawtooth-induced or anomalous
radial diffusion, in a time evolving plasma with nested magnetic
flux surfaces represented by a numerical MHD equilibrium.

Timestepping is explicit, with the Monte Carlo deposition of new particles
and slowing down of the Monte Carlo ion ensemble against a fixed plasma 
for a prescribed time interval, after which the Monte Carlo model state
is recorded, and control is returned to the plasma model, allowing the
plasma model to then evolve for the same time interval, before resuming 
Monte Carlo deposition and slowing down in the next time interval, and so 
on until the simulation is complete.

A numerical "goosing" technique is used to exploit the disparity in
timescale between fast guiding center drift orbit bounces and the next
next fastest physical timescale, be this collisions, atomic physics, or
anomalous diffusion.  This is the key to the computational efficiency 
of the model.  The method is basically as described in the original
balance, plasma rotation, time-evolving numerical MHD equilibrium, and 
fusion product ions) were added since the original paper was written.
These new features are described in a more recently published CPC 
article [B].

The NUBEAM software package originally came about as an integral part of
TRANSP[C,D], but has now been extracted as an independent module for the 
National Transport Code Collaboration (NTCC--  https://w3.pppl.gov/ntcc). 

This document describes how to use NUBEAM, from the point of view of
a FORTRAN programmer with a driver code capable of utilizing NUBEAM's
capabilities.  Physics details are described elsewhere.  It is presumed
that the user has access to a Unix workstation, FORTRAN-90, C and C++ 
compilers, and is familiar with the NTCC Modules Library website
(  https://w3.pppl.gov/ntcc  ), where this and related software can be 
found.

references
----------
[A] R.J. Goldston et al., "New Techniques for Calculating Heat and 
Particle Source Rates due to Neutral Beam Injection in Axisymmetric
Tokamaks", J. Comp. Phys. 43 (1981) 61.

[B] A. Pankin, D. McCune, R. Andre et al., "The Tokamak Monte Carlo Fast
Ion Module NUBEAM in the National Transport Code Collaboration Library",
Computer Physics Communications Vol. 159, No. 3 (2004) 157-184.

[C] R.J. Hawryluk, "An Empirical Approach to Tokamak Transport", in Physics
of Plasmas Close to Thermonuclear Conditions, ed. by B. Coppi, et al.,
(CEC, Brussels, 1980), Vol. 1, p. 19.

[D] J. Ongena, M. Evrard, D. McCune, "Numerical Transport Codes", in the
Proceedings of the Third Carolus Magnus Summer School on Plasma Physics,
(Spa, Belgium, Sept 1997), as published in Transactions of Fusion Technology,
March, 1998, Vol. 33, No. 2T, pp. 181-191.

[E] HIRSHMAN, "Neoclassical current in a toroidally-confined multispecies plasma", in
PHYS. FLUIDS VOL 21 NO. 8 AUG 1978, p.1295.
[F] HIRSHMAN,"Moment equation approach to neoclassical transport theory", in
PHYS. FLUIDS VOL 21 NO. 2 Feb. 1978, p.224.
[G] S.P.Hirshman, D.J.Sigmar, "Neoclassical transport of impurities in tokamak plasmas", in
Nuclear Fusion, Vol.21, No.9(1981), p.1079
[H] N.C Lin-Liu, Hinton,"Trapped electron correction to beam driven current in 
general tokamak equilibria", in Phys.Plasmas 4(11),p.4179, 1997 
[I] N.C Lin_Liu,Miller, "Upper and Lower bounds of effective trapped particle fraction 
in general tokamak equilibria"'in Phys. Plasmas 2(5), p.1666, 1995


Home Top


A_Note_on_Units

NUBEAM uses NTCC data management and interpolation tools (Plasma State
and Xplasma) for input/output communication of profile data, plasma
MHD equilibrium, and geometrical description of neutral beams.

All such data is in MKS units -- except "temperature" and "average energy"
profiles which in accordance with widely used plasma physics tradition are
given in KeV.

However, scalar quantities, communicated directly as members of
compound data types for output (not going through Plasma State 
or xplasma) are often but not always in MKS; the user is referred
to the documentation in the appendices of this document for units of 
specific output data elements.

Home Top


Update_Notices

There is an active program for development of NUBEAM capabilities.
Some of the long term physics goals of development are (a) Handling of
interaction with RF wavefields, (b) interaction with TF ripple fields,
(c) interaction with plasma instabilities, (d) generalization of geometrical 
framework to support stellarator applications.  In addition, minor 
updates and bug fixes are ongoing.

NUBEAM is developed within the TRANSP production and development system
with source code shared amongst authors via an svn repository.  Improvements
are mapped into the NTCC version of NUBEAM on a weekly basis.

Occasionally, specific upgrades will be summarized here.

Home Top


Client_Server_Architecture

(DMC Sept 2005)
November 2008 note: server code is now "nubeam_comp_exec"-- however
the general outline of method of use is unchanged.

Timesteps on the NUBEAM calculation can now be run in a separate process
on a client-server basis.  This allows drivers to access NUBEAM 
functionality without having to build in the NUBEAM library and all its
dependencies.  The separate process runs "nubeam_comp_exec" and 
communicates with the driver by means of files, as follows:

  (a) client sets environment variables NUBEAM_ACTION specifying
      "INIT", "STEP", "BACKUP", or "RETRIEVE", and NUBEAM_WORKPATH
      specifying a working subdirectory to contain NUBEAM files.
  (b) client writes NUBEAM inputs into files in $NUBEAM_WORKPATH.
  (c) client writes a namelist in $NUBEAM_WORKPATH:
        -- for INIT step: nubeam_init_files.dat
        -- for all others: nubeam_step_files.dat
      which specifies the input/output filenames.
  (d) client runs a script to invoke "nubeam_comp_exec" as a "server"
      sub-process, which will read input files, perform the requested
      action (e.g. calculate a NUBEAM time step), and write output files.
      This includes state files internally maintained by NUBEAM-- these
      are numerous in the case of the MPI version, which is why the
      separate subdirectory $NUBEAM_WORKPATH is recommended.  The 
      state files contain particle sublists for each MPI thread, and
      are required for accurate restart ability of time dependent 
      simulations.
  (e) client reads NUBEAM outputs from files.
  (f) at this point client can proceed as if it had used NUBEAM via
      its subroutine library API.

(DMC Nov 2008)

Details of the file I/O are described in the comments of code:

  nubeam_comp_exec.f90

The NUBEAM NTCC module provides a data set and README to allow a simple
demonstration of "nubeam_comp_exec" and "mpi_nubeam_comp_exec" execution.

Home Top


November 2008: NUBEAM has been converted to use the Plasma State

interface developed in conjunction with SciDAC ("Scientific Discovery 
through Advanced Computing") DoE projects, (specifically, SWIM and FACETs), 
over the period 2006-2008.  The old driver program "nubeam_driver" has
been replaced with "nubeam_comp_exec" which uses a simplified interface
based on the Plasma State software module, to compute a NUBEAM time step
(i.e. deposition following orbiting for a prescribed period of time 
against a fixed target plasma).  The new NUBEAM has been parallelized 
using MPI; the parallelized single step driver is "mpi_nubeam_comp_exec".
Similarly there is a library "mpi_nubeam" which allows MPI-enabled NUBEAM
to be driven in memory from a time dependent code using subroutine calls.
The serial and MPI versions of the codes are built from a single sources, 
using cpp compiler directives #ifdef __MPI // #endif to identify 
conditionally compiled MPI-specific code.

Many-- but not all--  NUBEAM inputs and outputs are now exchanged via 
the Plasma State.  The Plasma State contains a snap shot of evolving
plasma conditions within the (tokamak) vacuum vessel, in addition to
time invariant physical quantities (machine description).  The information
in the Plasma State is shared between several physics model components and
is not specific to any one component.

Non-physical NUBEAM-specific input information, such as numerical 
controls and model options, are passed via separate control structures 
provided by NUBEAM for that purpose.  The most commonly used such controls
are NPTCLS-- the number of Monte Carlo model particles used to represent
each beam fast ion species, and NPTCLF-- the number of Monte Carlo 
particles used to represent each fusion product fast ion species.

Common NUBEAM outputs-- such as profiles of total beam species heating 
of thermal electrons and ions-- are returned via the Plasma State.
However, more detailed information, such as partial heating profiles
due to each individual neutral beam in a multi-beam simulation, are 
provided through the xplasma interface (this is unchanged from the 2005 
version of the code).  Also, NUBEAM provides diagnostic information, such 
as scalar power and momentum balances for each fast species, through its
own output mechanisms (unchanged from the 2005 version) which are
described in greater detail later in this document and in Appendix D.

Home Top


RF_kick_off_operator (July 2016): RF kick off operator implemented in TRANSP/NUBEAM

and can be used in the standalone '(mpi_)nubeam_comp_exec' run .
User should  have time slice TRANSP data stored in <runid>_FI_TAR.GZ<nn> file.
Please note that TRANSP run must be done with a switch to enable 
RF kick off operator in NUBEAM.
There are two options to start standalone '(mpi_)nubeam_comp_exec' job:
First option: only newly deposited fast ion MC particles will be used 
in the slowing down calculation with a kick due to RF activity. 
In your home directory run 
'fi_gzn_unpack <path_to_GZ_file>/<runid>_FI_TAR.GZ<nn>' to unpack input data.
then run 'nbx_driver' script with '-repeat <nsteps>x<delta_time>' argument.
Bellow is an examples how to make MPI run on 8 CPU:
'nbx_driver <job_type> -repeat 2x0.02 -input_state <runid>_ps_ts1_state.cdf -step <runid>_nubeam_step.dat -wkpath wrk -ncpu 8',
where <job_type> could be set as
'no-qsub' run from an interactive parallel machine with PBS job scheduler
'no-sbatch' run from an interactive parallel machine with SLURM job scheduler
'qsub' run as a parallel PBS job
'sbatch' run as a parallel SLURM job
For a serial job run a script:
'nbx_driver -repeat 2x0.02 -input_state <runid>_ps_ts1_state.cdf -step <runid>_nubeam_step.dat -wkpath wrk '

Second option: the slowing down fast ion population of MC particles (
read particle list from the previous time step) with a newly deposited 
fast ion MC particles will be used in the slowing down calculation 
with a kick due to RF activity. 
To prepare input data user have to run script
'nbx_restart <path_to_GZ_file>/<runid>_FI_TAR.GZ<nn>' 
then run 'nbx_driver'  script with 'restart' flag.
Here is an example how to make MPI run on 8 CPU  interactively:
'nbx_driver <job_type> restart -input_state <runid>_ps_ts1_state.cdf -step <runid>_nubeam_step.dat -wkpath wrk -ncpu 8'
where <job_type> same as above.
For a serial job user may run the following command:
'nbx_driver restart -input_state <runid>_ps_ts1_state.cdf -step <runid>_nubeam_step.dat -wkpath wrk'
 NOTE: be sure that namelist used for '-step' has setting 'xplasma_in_memory=0'
       directory used for '-wkpath' already exist and has files with a particle list.

Home Top


Links_to_Related_Documents

NUBEAM is distributed for use via the "NTCC Modules Library" website:

   https://w3.pppl.gov/NTCC 

This site also contains links to the source code and documentation of 
NTCC modules such as Plasma State and Xplasma that are used by NUBEAM.

The Plasma State was developed as part of the SWIM SciDAC Fusion 
Simulation Project prototype.  The web page for this project can be
found at:

   http://www.cswim.org 

There are descriptions of the Plasma State software under the "Component
Definition Documents" link.  Note that several versions of the software
may be documented; the document that references the most recent version
should be preferred.

Copies of Plasma State documents can also (usually) be found in the
directory at:

   https://w3.pppl.gov/~dmccune/SWIM 

In particular, the current state specification "plasma_state_spec.dat"
can be found-- this will give the current definition of Plasma State
data elements.

If these hints are unhelpful, you can try to email me at this address:

  dmccune@pppl.gov

[This section last updated DMC November 2008].

Home Top


Glossary_of_States

The reader may be confused by various uses of the word "state" in 
discussions of NUBEAM.

Here are the two contexts that arise:

  (a) Plasma State -- refers to an NTCC module that defines a
      Plasma State object-- a model plasma time slice-- in a 
      standardized form that is meant as a resource for data sharing 
      between tokamak simulation model components.  A simulation 
      application can maintain any number of Plasma State objects.  
      In the context of NUBEAM, the Plasma State software is a 
      resource for transmitting input data to, and receiving output 
      data from, the computational model.

  (b) NUBEAM internal state -- NUBEAM models physical effects with
      long time scales, such that the results of the calculation of
      time step N depend on the results of steps 1 through (N-1).
      Restart ability requires that state information -- the cumulative
      results of past calls -- be representable in a set of data
      files.  These files contain such things as particle lists, or
      distributed sublists in the case of MPI runs, which collectively
      constitute the "particle state".  Also, accumulated reaction rate
      data, such as fusion product rates and neutral beam stopping 
      rates due to the slowing down fast ion population computed 
      during step N-1, are used to estimate beam and fusion product
      ion deposition during step N.  The latter data is referred to 
      collectively as the "field state".

Home Top


Dependencies_&_Prerequisites

Whether NUBEAM is built directly into an executable driver as a
subroutine library, or, computed in separate process steps via
"nubeam_comp_exec", the necessary software libraries must be built.

NUBEAM is built over software modules of the "National Transport
Code Collaboration" (NTCC) modules library:

   https://w3.pppl.gov/NTCC 

NUBEAM is itself distributed as an NTCC module.  The NTCC module
contains detailed build documentation.  The information here is
a summary.

NUBEAM depends on the following supporting NTCC modules which
must also be built and installed:

  PREACT -- atomic/nuclear cross sections and reaction rate data.
            (now includes ADAS)

  PLASMA_STATE -- library for numerical representation of plasma
            time slice, including equilibrium, profiles, and 
            machine description, with standardized data element names 
            as defined in a shared specification.

  XPLASMA --module for numerical representation of axisymmetric plasma 
            equilibrium geometry and plasma parameter profiles-- 
            expandable dictionary of code-specific names.  Used by
            the PLASMA_STATE software, and also, directly by NUBEAM.

  NSCRUNCH--tool for regularization of Fourier moments representation
            of MHD equilibrium (used by XPLASMA).

  PSPLINE --interpolation library (used by XPLASMA and PREACT).

  KDSAW  -- a Kadomtsev-style MHD sawtooth "mixing model".

  R8SLATEC--a library of mathematical subroutines.

  RANDOM -- a portable, parallelizable, high quality random number 
            generator.

  EZCDF --  easy interface to NetCDF -- portable binary files used for
            save and restore of the state of the NUBEAM calculation.

  PORTLIB --library of subroutines for portable low level utilities
            (e.g. for naming files or for fetching current machine
            precision).

(Each of the above modules has its own documentation, which can be
reached via the software catalog under  https://w3.pppl.gov/NTCC). 

NUBEAM comes with two test programs, the latter of which use additional 
NTCC modules not needed by NUBEAM itself:

"nubeam_comp_exec" -- non-interactive, self-contained namelist-driven 
test program and example NUBEAM driver code (which can also be used
as a standalone NUBEAM time step server).

"nubeam_test" -- NUBEAM debugging program, with command-line control
and interactive graphics.  NUBEAM crashes can be diagnosed with this
program, using state data written during execution of NUBEAM time steps.

The nubeam_test program uses the additional NTCC modules:

  TRGRAF -- command line interactive control of SGLIB plots (used by
            nubeam_test).

  UREAD  -- command line user interface / scripting package (used by
            nubeam_test).

  SGLIB  -- AG4010-compatible scientific graphics package (used by
            nubeam_test).


Note: the NUBEAM download package may already include some of these 
modules; others may have to be downloaded separately.  Details are 
given in the installation instructions (README file) provided with 
the module code.  Recommended installation procedures are documented
at the NTCC web site and may evolve over time due to changing
requirements.

In addition to the NTCC module dependencies, the following freeware math
libraries should also be installed on systems where NUBEAM is to be run:

  math libraries:
     http://www.netlib.org  -- blas & lapack  (linear algebra)
     http://www.fftw.org  -- fftw  (fast Fourier transforms)
           **version 2.1.5**
           **cautions -- versions 3.x.x not backward compatible!**

  portable binary file i/o library:
     http://www.unidata.ucar.edu/packages/netcdf  -- NetCDF

(Be sure to check the module README file; dependencies are subject to
change as technical requirements evolve).

NUBEAM is written in FORTRAN-90, but, a C/C++ call interface is being
developed (as of Nov. 2008) in the SciDAC FACETs project.

Home Top


more_on_prerequisites

Note that the atomic physics database software -- PREACT -- must be
properly configured.  It uses a directory of files to store pre-
computed tables e.g. of beam-target Maxwellian averaged reaction rate
coefficients.  These include atomic physics processes as needed to 
compute beam deposition profiles, beam charge exchange loss and 
recapture processes, and, nuclear physics processes as needed to 
compute fusion reaction rates, production of neutrons and fusion 
product fast ions.

If the PREACT NTCC module's test programs run correctly, then, PREACT 
has been properly configured.

PREACT includes C++ components, and the system and compilers must be 
chosen and properly configured to support mixed language FORTRAN/C++ 
applications.  If the PREACT FORTRAN driver test program, "fpreact_test", 
runs correctly, then this software prerequisite has been met.

If the NUBEAM test program can be built and test case run correctly, then,
all the software prerequisites have been met.

Home Top


neutral_gas_model

In addition to the above listed components, upon which NUBEAM is
directly dependent, there is also an implicit dependency on an 
external thermal neutral gas model (such as: the FRANTIC NTCC
module).  A thermal neutral gas model is needed to compute transport
of neutral atoms in a plasma-- with concomitant ion and electron 
source terms and transport of momentum and energy.  The thermal
neutral gas model also computes profiles of average energy and
density of neutral atoms, which determine charge exchange loss of 
fast ions; conversely, fast neutral deposition and charge exchange 
recapture drive thermal neutral sources which should be tracked by 
the thermal neutral gas model, and at the same time, the presence of 
circulating fast ion species strongly depletes thermal neutrals.  Thus 
the NUBEAM and thermal neutral gas calculations are inter-dependent.

Author's note:  this is an area where more work is needed.  The FRANTIC
NTCC module, which, like NUBEAM uses PREACT for atomic physics data, is
fast and efficient; it supports simultaneous presence of multiple 
isotopes of H and He, can handle NUBEAM's neutral sink rate profiles,
and computes all necessary transport terms-- but, all in an over-
simplified 1d geometry (flux surfaces remapped to concentric 
cylinders); this is what TRANSP uses at present.

Author's note #2:  there is a plan to add a 3d halo thermal neutral
transport computation to NUBEAM, but, even after this is done, there
would still be a need for a separate code to compute the transport of
neutrals from the plasma periphery.  The penetration of recycling
neutrals into the core plasma affects the magnitude of charge 
exchange loss of the slowing down fast ions.

Home Top


Use_of_XPLASMA_and_Plasma_State

XPLASMA is a general tool for representing and sharing plasma geometry
and profiles, and for interpolation of such profiles between disparate
grids.  Although coded to allow eventual generalization to 3d, XPLASMA
at present is restricted to axisymmetric configurations (i.e. tokamaks).

An XPLASMA object contains an application-defined dictionary of data
items.  XPLASMA look-up functions convert recognized names to addresses;
Addresses can be used to access or interpolate XPLASMA data.  XPLASMA
itself provides no standard names.

The Plasma_State NTCC module is built over XPLASMA, and defines a
standardized set of names of physical quantities commonly needed in
tokamak numerical transport models, from a public specification.  The 
Plasma State specification is designed to provide all the physical 
inputs needed to drive NUBEAM and similar models, and then to provide a
place at which to store the most common outputs, such as: heating
and current drive source profiles needed by a tokamak plasma model's 
transport equations, fast ion densities, and fast ion pressures needed 
for models to compute the plasma MHD equilibrium and internal geometry.

A code makes use of NUBEAM by setting up a Plasma State object containing
the necessary input data: MHD equilibrium, lists of plasma species, 
target plasma temperature and density and toroidal angular velocity 
profiles, densities and average velocities and energy spreads of 
populations of neutral atoms, as well as machine description information
that defines neutral beam geometries, location of vacuum vessel wall
and limiters and divertors, etc.  The Plasma State also contains slots
for information not used by NUBEAM, such as RF antenna geometry
descriptions.

The following Plasma State data elements are used as input to NUBEAM:

 -- Neutral Beam "machine description" data (invariant in time):
    -- species injected by each neutral beam
    -- toroidal aiming expressed as signed tangency radius;
    -- position of beam source grid 
    -- dimensions of beam source
    -- dimensions of beam aperture into vacuum vessel
    -- horizontal and vertical focal lengths of each beam
    -- horizontal and vertical divergences of each beam
    -- etc. -- (See the Plasma State documentation in the NTCC module).

 -- Time dependent neutral beam data
    -- power
    -- voltage
    -- full/half/third energy fractions for H/D/T conventional 
       neutral beams.

 -- List of Fusion Product species to be modeled by NUBEAM

 -- Target plasma description:
    -- MHD equilibrium: flux surface geometry, R*B_phi profile; 
       q profile
    -- thermal plasma species list (including impurities); this 
       must include slot(s) for thermalization of beam injected
       fast ions.
    -- plasma specie temperatures, densities, and toroidal angular
       velocities
    -- List of neutral sources
    -- Densities, average energies, and average toroidal velocities
       of neutral atom species penetrating the core plasma due to
       each neutral source.

 -- Physics model inputs:
    -- anomalous radial velocity and diffusivity profiles can be
       input, as a simple means to model fast ion transport due
       to physical effects (such as MHD instabilities) not covered
       by the NUBEAM classical model.

The following Plasma State data elements are output from NUBEAM:

 -- Neutral beam:
    -- density, <E_perp>, <E_pll> of unthermalized slowing down beam ions
    -- beam electron heating Pbe
    -- beam ion heating Pbi
    -- residual power in thermalization of beam ions at (3/2)Ti: Pbth
    -- beam collisional torque to electrons Tqbe
    -- beam collisional torque to ions Tqbi
    -- beam JxB torque to thermal plasma Tqbjxb
    -- residual momentum source at thermalization Tqbth
    -- net source of thermal species (includes cold electron source);
       this is the thermalization source less adjustments due to 
       beam halo charge exchange losses: sbsce
    -- halo neutral source sb0halo
    -- thermal neutral sink rate due to fast ion charge exchange:
       rate_sinb0x
    -- thermal neutral sink rate due to fast ion impact ionization:
       rate_sinb0i
    -- beam current drive source curbeam.

 -- Fusion Products
    -- density, <E_perp>, <E_pll> of unthermalized fusion product ions
    -- electron heating Pfuse
    -- ion heating Pfusi
    -- thermalization Pfusth
    -- net particle sources due to thermalization with generally minor
       corrections for charge exchange loss/recapture: sfsce
    -- fusion product ion driven current (usually negligible): curfusn.

It should be noted that definition of the contents of the Plasma State 
is a work in progress; the above summary was accurate as of Nov. 2008.

Additional NUBEAM profile outputs (detailed profile breakdowns not 
provided for in the Plasma State) are provided via an output XPLASMA 
object.  XPLASMA addresses and other additional NUBEAM scalar outputs 
are provided through an interface to scalar output data objects which 
are described in Appendix D of this document.

Home Top


Irregular_2d_grid

XPLASMA supports an irregular 2d grid over flux coordinates (rho,theta)
specially tailored to NUBEAM, and especially suitable for NUBEAM's 
Monte Carlo algorithm.  This grid bins the core plasma into 2d zones 
of roughly equivalent cross-sectional area, organized as a nested 
sequence of radial "zone rows", each with a different number of poloidal
zones-- proportional to the zone row's distance from the magnetic axis.
These grids are known by the acronym MCgrid -- Monte Carlo grid-- and 
are described in detail in the XPLASMA documentation:

   https://w3.pppl.gov/~pshare/help/xplasma.htm 
  (look for "MCgrid_Routines").

The set of spatially 2d data defined on the XPLASMA MCgrid includes:
   2d neutral source profiles (of each neutral species from each
      fast species)
   2d neutral sink rate profiles (of each neutral species from each
      fast species)
   2d beam density, <Eperp>, <Epll> <toroidal_velocity> of each fast
      species.
   2d fast neutral density, average energy and toroidal velocity--
      from charge exchange of partially slowed down fast ion species.

and for each fast specie:

   4d fast ion distribution functions f(E,vpll/v,rho,theta)

A separate section, below, describes all 2d outputs in detail.

  --------------------------
A note on units:  all profile quantities passed through XPLASMA and
Plasma State are in MKS, except: specie temperatures and average energies 
are in KeV.

Home Top


Code_Generators_and_Fortran_90_Modules

Both the Plasma State and NUBEAM I/O f90 modules are written by code
generators, which enable a reliable process for adding data elements
to the modules, insuring that all associated declarations and I/O
methods and documentation are updated accurately.  Each code generator
works off a single specification file, generally a list of data elements;
the capability for reliable updates allows the interfaces to evolve 
with improvements in code capabilities.

Inputs to NUBEAM are provided and outputs received by means of publicly
defined f90 compound data types.  The definitions are written by the
code generators.

The subtopics discuss the use of these data types from a FORTRAN driver.

Due to collaborative work in the FACETs SciDAC, it is now possible to
instantiate Plasma State objects from a C/C++ driver and access their
member data elements.  A subtopic discusses the details.

Home Top


C_code_access

Two classes of f90 objects are to be considered: 

  "Deep" f90 objects:  Plasma State

  "Shallow" f90 objects:  NUBEAM input control structures
                          NUBEAM output data structures

"Deep" types contain FORTRAN-90 allocatable array elements.  The 
precise memory layout is non-standard and dependent on FORTRAN compiler
implementation.  Therefore, portable solutions for C/C++ access require
a FORTRAN-90 code layer must be involved.  The C/C++ code still controls
instantiation-- it provides an "opaque handle", an array of integers, to
FORTRAN routines to handle the Plasma State internal memory management.
The method was worked out in a technical collaboration between PPPL and
Tech-X Corporation, as reported elsewhere [1].  The Plasma State code 
generator is used to maintain the necessary interfaces as the Plasma 
State specification evolves[2].

"Shallow" types contain static elements only; in this case C structs or
C++ classes can be created which replicate the FORTRAN objects in memory,
and instances can be passed directly across the language barrier as 
subroutine arguments.  The NUBEAM interface code generator creates the
C/C++ header files with the necessary C/C++ language definitions.

[1] A. Pletzer, D. McCune et al., "Exposing FORTRAN Derived Types to
C and Other Languages", CISE Vol. 10, No. 4, pp 86-92, July/August 2008.

[2] The necessary generator modifications were carried out by 
    Alex Pletzer at Tech-X Corp., as part of the FACETs SciDAC 
    collaboration.

For more information contact authors via email to dmccune@pppl.gov.

Home Top


FORTRAN_declarations

The NUBEAM NTCC module test program "nubeam_comp_exec" shows an example
of the use of the modules which declare NUBEAM and Plasma State public data 
types and methods:

  use plasma_state_mod  ! Plasma State (PS) module definitions & methods
  use nbi_pstypes       ! NUBEAM control data structures & methods
  use nbi_types         ! definition of NUBEAM output data types

  !------------------------------  
  ! Plasma state(s):

  type (plasma_state) :: ps_in   ! input state
  type (plasma_state) :: ps_out  ! output state

Or:

  type (plasma_state) :: ps_inout  ! single state to contain both 
                                   ! inputs & outputs
  !------------------------------  
  ! Input control(s):

  type (nbi_ctrl_init) :: nb_init      ! initialization control object
                                       ! (used once at start of simulation)

  type (nbi_ctrl_update) :: nb_update  ! update control object
                                       ! (controls adjustable at each step)

  !------------------------------  
  ! Output objects:
  !   (only needed to get output details beyond what is included in
  !   the plasma state)

  type (nbotype_cptimes) :: zcptimes   ! CPU time usage
  type (nbotype_powers) :: zpower_ids  ! Xplasma IDs for detailed power
                                       ! profiles (Plasma State contains
                                       ! total heating Pbe, Pbi, etc.).

    ...etc... (there are about 25 nbotype objects defined).


Home Top


Plasma_State_objects

  use plasma_state_mod  ! Plasma State (PS) module definitions & methods

This f90 module invocation allows declaration of plasma state objects:

  type (plasma_state) :: ps_in   ! input state
  type (plasma_state) :: ps_out  ! output state

Or:

  type (plasma_state) :: ps_inout  ! single state to contain both 
                                   ! inputs & outputs

In applications, plasma state objects (or portions thereof) can be read 
from or written to files.  Alternatively, a driver code can set/get plasma
state object data elements directly.

At write time, there is the option to write a file containing plasma state 
changes only, or, the entire state object may be written.

Some examples of plasma state elements:

  ps_in%t0 -- start of time step (seconds)
  ps_in%t1 -- end of time step (seconds)

  ps_in%nbeam = <the number of neutral beams>

  ps_in%srtcen(1:ps_in%nbeam) = <signed toroidal aiming of beams>

The element "srtcen" is the signed tangency radius of each neutral
beam centerline, i.e the distance of nearest approach of the beam
centerline to the axis of symmetry of the tokamak.  A sign of +1
(a positive value) indicates a neutral beam that injects atoms in
a direction to flow counter-clockwise around the tokamak when viewed
from above; a sign of -1 indicates the opposite orientation.  Whether
each beam is injecting "co" (with the direction of the plasma current)
or "counter", depends on the direction of the plasma current, which
is specified separately in the plasma state:  ps_in%kccw_Jphi = +1
if the plasma current flows counter-clockwise when viewed from above.

The plasma state inputs also include the target plasma equilibrium
geometry and fields {ps_in%R_geo, ps_in%Z_geo, ps_in%q_eq, ps_in%g_eq,...}
and the target plasma parameters {ps_in%ns, ps_in%ts, ...} and the
neutral densities (normalized), temperatures, and angular velocities
{ps_in%n0norm, ps_in%T0sc0, ps_in%omeg0sc0} given for each neutral
source.  Physical units and grids are defined in the plasma state 
specification (plasma_state_spec.dat), the Plasma State code generator
input file, a copy of which can be found in:

   https://w3.pppl.gov/~dmccune/SWIM. 

The Plasma State data elements used by NUBEAM are loaded into an
XPLASMA object for internal use by the NUBEAM subroutine in
source file nubeam_ctrl_psupdate.f90-- this can be examined to get
a complete list of Plasma State elements which NUBEAM needs.  Where
profile interpolation is performed, profile element Xplasma address
handles, e.g. ps_in%id_ns(<specie>) for ps_in%ns(<rho-zone>,<specie>))
are utilized.

The Plasma State contains data elements describing physical quantities
only-- tokamak machine geometry, plasma MHD equilibrium, temperature
and density profiles, etc.  In general, Plasma State data elements are
of general interest, in principle not specific to NUBEAM, although an
effort has been made sure that all physical data needed by NUBEAM are
in fact included in Plasma State data elements.

Home Top


NUBEAM_control_data_structures

Separate control objects are used to specify model logical switches
and numerical controls-- such as the the numbers of Monte Carlo test 
particles used to approximately represent each fast ion population.
These are specific to NUBEAM and so not included in the Plasma State
module.
  
There are two control objects-- a complete set, "nbi_ctrl_init", 
containing many elements that can only be set once at the start of a 
time dependent simulation (i.e an "INIT" operation), and the subset 
"nbi_ctrl_update" which only contains elements that are able to change 
from time step to time step of the NUBEAM simulation.

Important examples of NUBEAM control inputs (definitions from the 
nbi_pstypes f90 module):

  use nbi_pstypes       ! NUBEAM control data structures & methods

  ... ...

  type (nbi_ctrl_init) :: nb_init
  type (nbi_ctrl_update) :: nb_update

  ... ...

  call nbi_ctrl_init_dflt(nb_init)  ! clear all elements to default values

  call nbi_ctrl_update_dflt(nb_update)  ! clear all to default values

  ... ...

  nb_init%nseed = <initialization random number seed>

  nb_init%nzones = <number of radial zones for 1d MC sums>

The element "nzones" defines the number of radial zones for NUBEAM
output profiles-- it must be defined at initialization time.  This
will size the Plasma State grids ps_out%rho_nbi(...) and 
ps_out%rho_fus(...); if these are already allocated in the Plasma State
then the grid size must match "nzones" and the grid itself must be
evenly spaced in rho = SQRT(normalized-toroidal-flux) space.

  nb_init%nzone_fb = <number of radial zones rows, spatial 2d outputs>

There is a 2d irregular "Monte Carlo" grid vs. flux coordinates 
(rho,theta) with fewer poloidal zones near the plasma magnetic axis,
and more near the edge, such that all zones have roughly equal cross-
sectional area.  This is used for NUBEAM output fast ion distribution
functions and other outputs which are 2d in space.  The element
"nzones_fb" must match "nzones" or be an integer divisor of "nzones".

  nb_init%nptcls = <initial number of MC particles for beam species>
  nb_init%nptclf = <initial number of MC particles for fusion products>

  nb_update%nptcls = <number of MC particles for beam species>
  nb_update%nptclf = <number of MC particles for fusion products>

The elements "nptcls" and "nptclf" can be initialized at the start of 
a simulation, and may (optionally) be updated time dependently.  Thus,
the elements "nptcls" and "nptclf" are members of both "nb_init" and
"nb_update", whereas "nzone_fb", which can only be set once at the start
of the simulation, is a member of "nbi_ctrl_init" object only.

The complete catalog of elements in the nbi_ctrl_init and nbi_ctrl_update
types are described in Appendices B and C of this document.

Home Top


NUBEAM_output_data_structures

After completion of a NUBEAM time step, the most commonly used NUBEAM 
outputs are stored in Plasma State elements.  For example: 

   ps_out%pbe(1:ps%nrho_nbi-1) -- total electron heating by all
                                  beam ions.

For those quantities not available through the Plasma State, additional
calls are provided to load publicly defined output data types which can
be instantiated in the NUBEAM caller.  For example:

  use nbitypes
  type (nbotype_cptimes) :: zcptimes   ! CPU time usage

    ... ...

  call nbo_get_cptimes(zcptimes)

  write(6,*) ' nubeam_ctrl_step timer results:'
  write(6,'(a,1pe11.4,a)') ' root thread cpu',zcptimes%cpbroot,' seconds.'
  write(6,'(a,1pe11.4,a)') ' min thread cpu ',zcptimes%cpbmin,' seconds.'
  write(6,'(a,1pe11.4,a)') ' max thread cpu ',zcptimes%cpbmax,' seconds.'

This example shows some data that may be of interest in the context of
MPI NUBEAM runs.

Appendix D of this document describes all the available "nbotype" output
data structures and each of their member data elements.

Home Top


Legacy_input_structures

An earlier version of the NUBEAM NTCC module pre-dated the Plasma State.
In this version, physical inputs and numerical controls were mixed 
together.  This created a large number of inputs that were broken up
in an attempt to provide separate pieces of manageable complexity.

Appendix E contains code-generated descriptions of these legacy elements.

Home Top


NUBEAM_code_generator_files

(This is background information).

The NUBEAM code generator (python code) reads this file:

  nbspec.dat -- NUBEAM i/o and module data specification file
                basic data types are:  R -- REAL, I -- INTEGER,
                L -- LOGICAL, D -- REAL*8, C*n -- CHARACTER*n.
                An instance of each specified item is generated
                in NUBEAM's internal FORTRAN-90 module; in addition,
                input/output items are made members of publicly
                declared compound data types used for transfer of
                information in and out of the NUBEAM internal module.

and the code generator writes the following NUBEAM components:

  nbi_types.f90 -- public FORTRAN-90 module defining input/output
                   data structures.

  nbo_get.f90   -- retrieve NUBEAM output (into output data structures).

(the remainder are private to NUBEAM...)

  nbi_dimensions_mod.f90 --
  nbi_com_mod.f90 -- NUBEAM's internal FORTRAN-90 modules.  These can
                   not be referenced directly by user code, but they
                   contain copies of comments from nbspec.dat, and may be
                   useful as documentation.

  nbi_alloc.f90 -- allocate most NUBEAM data structures based on user
                   specified grid sizes-- called by user after a
                   successful "nbi_set_dims" call...

  nbi_alloc2.f90 --allocate remainder of NUBEAM data structures based
                   on additional user input (but not data for
                   Monte Carlo particles in simulation, see nbi_alloc_minb.f90).  
                   The user does not call this directly.

  nbi_alloc_minb.f90 --allocate  NUBEAM data related to the MC particle's 
		   sublist. The user does not call this directly.

  nbi_dalloc.f90 --deallocate NUBEAM data structures.  Since the NUBEAM
                   simulation has state, this should not be done unless 
                   all NUBEAM fast ions have thermalized, and NUBEAM is
                   never again to be called.

  nbi_init.f90  -- set defaults for input data structures
  nbi_set.f90   -- pass inputs to NUBEAM.  Since NUBEAM assumes state,
                   this is generally done ONLY ONCE per run per input
                   data structure.

  nbi_get.f90   -- fetch current settings of input data structures.
  nbi_update.f90 --update input.  Most input data elements are not
                   updatable.  For example, array dimensions can only
                   be set once at the beginning of a run.  Attempts to
                   update non-updatable members are ignored.  See the
                   Inputs section for more details.

  nbi_state_io.f90 -- subroutines for NUBEAM state save/restore operations.
                   User callable routine:  see nbi_states.f90.

  nbi_inputs_io.f90 -- subroutines for reading/writing NUBEAM inputs files
                   (inputs not communicated via XPLASMA); used to enable
                   NUBEAM client-server implementation.

  nbi_outputs_io.f90 -- subroutines for reading/writing NUBEAM outputs files
                   (outputs not communicated via XPLASMA); used to enable
                   NUBEAM client-server implementation.

  nbi_ascii.f90 -- ascii dump of NUBEAM input and output quantities, for
                   debugging.

Home Top


Executing_the_NUBEAM_calculation

The NUBEAM NTCC module test program "nubeam_comp_exec" shows an example
of the use of the modules which declare NUBEAM and Plasma State public data 
types and methods.

A synopsis is presented here:

Declarations
------------

  use plasma_state_mod  ! Plasma State (PS) module definitions & methods
  use nbi_pstypes       ! NUBEAM control data structures & methods
  use nbi_types         ! definition of NUBEAM output data types

  !------------------------------  
  ! Plasma state(s):

  type (plasma_state) :: ps_in   ! input state
  type (plasma_state) :: ps_out  ! output state

Or:

  type (plasma_state) :: ps_inout  ! single state to contain both 
                                   ! inputs & outputs
  !------------------------------  
  ! Input control(s):

  type (nbi_ctrl_init) :: nb_init      ! initialization control object
  type (nbi_ctrl_update) :: nb_update  ! update control object

  !------------------------------  
  ! Output objects:

  type (nbotype_cptimes) :: zcptimes   ! CPU time usage
  type (nbotype_powers) :: zpower_ids  ! Xplasma IDs for detailed power
                                       ! profiles (Plasma State contains
                                       ! total heating Pbe, Pbi, etc.).

    ...etc... (there are about 25 nbotype objects defined).


  !------------------------------  
  integer :: status   ! return code: 0=OK


Calls
-----

  call nubeam_set_workpath(<workpath>, ierr)
                                         ! set workpath (subdirectory)
                                         ! for NUBEAM files

  call nubeam_ctrl_init(ps_in, nb_init, status)  ! NUBEAM initialization

  [ optional:
  call nubeam_ctrl_nostep(ps_in, status) ! establish NUBEAM internal state
                                         ! w/o taking an immediate step ]
    ... ...

  call nubeam_ctrl_step(ps_in,ps_out, nb_update, status)  ! NUBEAM step
                                         ! separate states for input & output
     --OR--
  call nubeam_ctrl_step(ps_inout,ps_inout, nb_update, status)  ! NUBEAM step
                                         ! single state object storing both
                                         ! inputs and outputs
    ... ...

  ! NUBEAM internal state (restartability) management

  call nbi_states(...) ! save, restore, backup, or retrieve NUBEAM internal
                       ! state (not to be confused with Plasma State).

    ... ...

  ! NUBEAM outputs: access Plasma State data elements directly.  For 
  ! additional outputs not available through the Plasma State:

  call nbo_get_<output-type>(<output-type-instance>)

  ! for example:

  call nbo_get_cptimes(zcptimes)

  write(6,*) ' nubeam_ctrl_step timer results:'
  write(6,'(a,1pe11.4,a)') ' root thread cpu',zcptimes%cpbroot,' seconds.'
  write(6,'(a,1pe11.4,a)') ' min thread cpu ',zcptimes%cpbmin,' seconds.'
  write(6,'(a,1pe11.4,a)') ' max thread cpu ',zcptimes%cpbmax,' seconds.'
  
Home Top


MPI_communicator

By default, MPI NUBEAM uses MPI_COMM_WORLD as its communicator.  But,
this can be reset by the following call:

  call nbi_set_comm(<communicator, integer>)

Home Top


Client_Server_Execution

A serial driver (i.e. a transport code) can run NUBEAM (with or without
MPI) as a sub-process, by running the executable program nubeam_comp_exec
(serial) or mpi_nubeam_comp_exec.

Two environment variables control (mpi_)nubeam_comp_exec execution:

   NUBEAM_WORKPATH -- subdirectory for files: relative path.
     (if omitted, current working directory is assumed, i.e.
     $NUBEAM_WORKPATH = $cwd, current working directory.

   NUBEAM_ACTION   -- requested action -- required:
     INIT -- initialize a time dependent simulation
             (this optionally includes the first time step); save state.
             read $NUBEAM_WORKPATH/nubeam_init_files.dat for data file
             names: plasma state & control namelist(s).
     STEP -- time step advance the simulation; save state.
             read $NUBEAM_WORKPATH/nubeam_step_files.dat for data file
             names: plasma state & control namelist(s).
     BACKUP -- copy state to a backup state.
     RETRIEVE -- make backup state the current state ("BACKUP" in reverse),
             e.g. to revert to the prior "BACKUP" state.

The client must provide the indicated file, which is a namelist which in
turn names the remaining I/O files in $NUBEAM_WORKPATH.  Here are the 
files that are used in the working example provided with the NTCC module:

unix> cat nubeam_init_files.dat 
 &NUBEAM_FILES
  input_plasma_state = "118419W95_ps_ts1_state.cdf"
  output_plasma_state = "118419W95_ps_ts2_state.cdf"
  init_namelist = "118419W95_nubeam_init.dat"
  step_namelist = "118419W95_nubeam_step.dat"
 /

unix> cat nubeam_step_files.dat 
 &NUBEAM_FILES
  input_plasma_state = "118419W95_ps_ts1_state.cdf"
  output_plasma_state = "118419W95_ps_ts2_state.cdf"
  step_namelist = "118419W95_nubeam_step.dat"
 /

The contents of these files are:

  input_plasma_state -- Plasma State containing the input data: MHD 
     equilibrium, temperatures, densities, neutrals profiles, beam
     geometry description, power and voltage, etc.

  output_plasma_state -- Name of file to receive a Plasma State
     object to contain the NUBEAM outputs.

  init_namelist -- namelist containing nbi_ctrl_init control data
     (can only be used if NUBEAM_ACTION = INIT, in nubeam_init_files.dat).

  step_namelist -- namelist containing nbi_ctrl_update control data
     (if present in nubeam_init_files.dat, this means, perform the
     initial time step after initialization).

NOTE: filename namelist values "private_fld_state" and "private_ptcl_state"
have been removed.  NUBEAM generates these filenames from its <runid> 
variable.

The namelist files are commented with "!" initiated comment lines (the
code removes these prior to reading).  The namelist files provided with the
running NTCC example show some of the more commonly used namelist elements.
Most elements have sensible defaults and can be safely omitted.  Some 
elements need to be set: nptcl_max, nptcls, nptclf.

Home Top


Additional_Server_Option

The environment variable NUBEAM_POSTPROC can optionally be set to 
request additional work by the nubeam_comp_exec (or mpi_nubeam_comp_exec)
program:

  NUBEAM_POSTPROC = "summary_test": perform tests on NUBEAM XPLASMA 
    output; demonstrate use of detailed NUBEAM outputs.

  NUBEAM_POSTPROC = "fbm_write": write distribution function data in
    a NetCDF file (the contents match the output of a TRANSP/NUBEAM
    program "get_fbm" that has long been used to produce this data
    from TRANSP/NUBEAM generated output).  This is the filename:

       $NUBEAM_WORKPATH/<runid>_fbm_data.cdf

    where <runid> is the RUNID string specified in the Plasma State.

  NUBEAM_POSTPROC = "fbm_write:<filename>" -- as above, but, control
    the name of the output file.  For example "fbm_write:xyz.cdf" to
    write the distribution function data in a file named "xyz.cdf".
    The file is still written to $NUBEAM_WORKPATH, or, the current
    work directory where nubeam_comp_exec runs, if NUBEAM_WORKPATH
    is undefined.

It is possible to use nubeam_comp_exec with the "fbm_write" option to 
capture beam slowing down distribution functions developed against a
fixed target plasma.  Repeated executions will advance the pseudo-time
of the slowing down fast ion population, which will reach equilibrium
in a slowing down time (depending on the target plasma conditions).

The input Plasma State elements t0 and t1 define the nominal time step
for each execution of the program.

NUBEAM_POSTPROC = "NONE" -- no post-processing action, but normal output files

NUBEAM_POSTPROC = "NO_OUTPUT" -- suppress output after a time step.


Home Top


Outputs

NOTE: for basic uses of NUBEAM, the Plasma State outputs are sufficient
and this section, which describes the full output detailed dataset 
available through XPLASMA, can be skipped.

NUBEAM output can be divided into three categories:  scalars (and
arrays of scalars), 1d profiles f(rho), and 2d profiles f(theta,rho)
on the 2d irregular grid.  The 2d profiles are considered in the
next section "2d_Outputs".

Scalars contains 0d information, such as terms in the global energy,
momentum, or particle balance for individual fast ion species-- 
typically an array of numbers dimensioned by the fast ion species
index array dimension (mibs).  Examples will be given below.

1d profiles are of the form f(rho), are defined on the NUBEAM internal
grid but stored as XPLASMA objects, allowing interpolation to the caller's
own rho grid.  For each 1d output profile, a unique integer XPLASMA id 
code is returned.  Selected summary 1d outputs are in the output Plasma
State object.

All scalar and 1d profile outputs are defined in nbspec.dat; Outputs
are organized into several blocks, each of which corresponds to a 
compound data type definable in the caller's code by the statement

  use nbi_types

The caller's code creates an instance of each output data type, such as

  type (nbotype_power_balance) :: zpbal
  type (nbotype_powers) :: zpowers

and then, after the beam code timestep has been completed, issues a call

  call nbo_get_power_balance(zpbal)

after which individual elements can be extracted into the caller's data
structures, as in:

  do isi=1,nsfast
     call my_imap(isi,isb)  ! mapping from NUBEAM to user fast ion index
                            ! (user defined-- see information on species
                            ! indexing, below).
     pinjs(isb) = zpbal%pinjs(isi)
     pshine(isb) = zpbal%bpshins(isi) 
       ...
  enddo

NUBEAM outputs are defined by nbspec.dat, the input file to the NUBEAM
interface code generator.

Each element of each compound data type is defined in nbspec.dat in
lines of the form:

  <data-type>[A][S][code]       <name>[(dims,...)]
                                [! comments...]

Where <data-type> usually specifies D for REAL*8, [A] is present and
dimensions given if the output type is an array, and [S] indicates an
item that is reused by NUBEAM in its next timestep and must therefore 
be saved in the NUBEAM code's state file (the python generator handles
this).  There is also a symbolic [code] specification which indicates
a profile subtype {blank, "^", "|", "~", or "@"} which will be described
below.

As an example of a scalar data definitions, the block "power_balance"
contains the specifications:

  RA  pinjs(mibs)    ! watts
        ! injected power (or fusion product source power), by species.

  RA  bpshins(mibs)  ! watts
        ! BEAM SHINE THRU POWER, BY BEAM SPECIES

which are used in the preceding "zpbal" pseudo-code example.

1d f(rho) profile outputs are similarly declared, but are identifiable
by the presence of the array dimension "mj", which is the rho-grid
dimension in NUBEAM.  Thus for example, the block "powers" contains
(as seen in nbspec.dat):
 
  RA  pbe(mj)  ! watts
        ! POWER TO ELECTRONS FROM BEAM HEATING -- for electron power balance
 
  RA  pbes(mj, mibs)  ! watts
        ! POWER TO ELECTRONS FROM fast ion HEATING, BY FAST SPECIES
 
  RA  pbi(mj)  ! watts
        ! POWER TO IONS FROM BEAM SLOWING DOWN -- for ion power balance
 
  RA  pbis(mj, mibs)  ! watts
        ! POWER TO IONS FROM fast ion HEATING, BY SPECIES
 
  RA  pfe(mj)  ! watts
        ! POWER TO ELECTRONS FROM FUSION ION HEATING -- for electron power bal.
 
  RA  pfi(mj)  ! watts
        ! POWER TO IONS FROM FUSION ION SLOWING DOWN -- for ion power bal.

which define a set of XPLASMA output profiles.  The corresponding compound
data type contains for each of these items an integer scalar or array which
is formed by deleting the "mj" dimension from the above specifications, i.e.
in this case:

  integer :: id_pbe, id_pbes(mibs), id_pbi, id_pbis(mibs), id_pfe, id_pfi

which are members of a compound FORTRAN-90 structure of type "nbotype_powers".

Thus, to retrieve the heating profiles, the user code employs:

  use nbi_types
  type (nbotype_powers) :: zpowers

  ...

  call nbo_get_powers(zpowers)  ! get profile ids

  id = zpowers%io_pbi           ! interpolate PBI to user grid
  call my_xplasma_extractor(id, my_pbi_array, ...)

  id = zpowers%io_pbe           ! interpolate PBE to user grid
  call my_xplasma_extractor(id, my_pbe_array, ...)

  ...etc...

Where the last calls are to a user written routine that uses XPLASMA to 
interpolate the NUBEAM profile data to the caller's own rho-grid, with
possible normalizations or units transformations applied.

The majority of output profiles are integrated particle, power, torque,
source or energy density profiles in MKS units of (# of particles), watts,
Nt-m, #/sec, or Joules, respectively.  To reconstruct local density on the
user's rho-grid, the typical method would be to use XPLASMA to interpolate
the integrated profile to the boundaries of the user's rho-grid, and then
employ a finite-difference formula such as

   n(j) = (N(rho(j+1/2))-N(rho(j-1/2)))/dVol(j)

where n(j) = the density in the user's zone j, N(rho) is the integrated
profile interpolated to the boundaries of zone j, and dVol(j) is the volume
of zone j.  XPLASMA interpolation defines N(rho).

Some output profiles are different, and these are indicated in nbspec.dat
by profile-type symbol codes in nbspec.dat.  Examples of such profiles are
the fast ion driven currents:

  RA@ curjbeam(mj)  ! beam ion driven current (shielded), amps

  RA@ curjfusi(mj)  ! fusion ion driven current (shielded), amps

The "@" code indicates that these profiles, which specify enclosed
toroidal current as a function of flux surface label, are integrated 
using the cross-sectional area rather than the volume of plasma flux
zones.

The complete set of profile type codes are as described in nbspec.dat
comments:

#  for profiles there are some output category codes:
#
#   <default> -- item is an integrated density, source density, torque
#         density, or power density (n, n/sec, Nt-m, watts), starting
#         with zero at the magnetic axis.  The corresponding number in
#         a user's zone [rho(j),rho(j+1)] is the difference in profile
#         value between these two end points.  Internally these are
#         Monte Carlo sums done on a zone by zone basis; quantity will
#         be smoothed (cf dbxsmoo input parameter).
#
#   "@" -- item is an integrated profile of enclosed current density (A)
#         starting with zero at the magnetic axis; quantity is still 
#         smoothed.
#
#   "~" -- item is a characteristic parameter such as "average energy"
#         not integrated from the axis; quantity is still smoothed.
#
#   "^" -- item is a characteristic parameter such as "slowing down time"
#         but does not need to be smoothed; piecewise linear output
#         profile is provided.
#
#   "|" -- item is a boundary oriented "flow" quantity; evaluated at
#         rho(j) is the nominal flow across the specified surface; units
#         vary.  Internally these are Monte Carlo sums of flows across
#         boundaries, generally using orbit averaging to reduce variance.
#         quantity is fit using piecewise linear interpolation, NO
#         smoothing.

The scalar and profile outputs are organized into several blocks, each
of which has a corresponding FORTRAN-90 compound data type containing
scalars and XPLASMA integer id's for profiles:

  nbotype_fusion    -- computed fusion reaction rates.
  nbotype_density   -- fast ion particle and energy density data.
  nbotype_deposition-- details on fast ion deposition.
  nbotype_nclass    -- fast ion statistics wanted by NCLASS
                       (W. Houlberg's neoclassical NTCC module).
  nbotype_n0_fast   -- fast neutral densities (flux surface averaged).
  nbotype_trap_fraction  -- trapping fraction information.
  nbotype_erngfi_output  -- densities and trapping fractions split
                            over a coarse user defined energy grid.

  nbotype_average_energies -- average perpendicular and parallel 
                       energies of fast ion species.

  nbotype_excited_states -- excited states effect on deposition
                       and charge exchange recapture.

  nbotype_rotation  -- flux surface averaged angular velocities of
                       fast ion populations.

  nbotype_compression -- effects of change in MHD equilibrium on fast species.

  nbotype_powers    -- plasma heating profiles.
  nbotype_currents  -- driven currents.
  nbotype_sources   -- fast ion driven thermal ion and electron sources.
  nbotype_torques   -- torques (for the thermal ion angular momentum
                       balance equation).

  nbotype_neutral_sources  -- thermal neutral atom sources.
  nbotype_neutral_sinks    -- thermal neutral atom sinks.
  nbotype_recapture -- details of fast ion charge exchange loss and recapture.

  nbotype_fokker_planck  -- classical slowing-down and pitch-angle-scattering
                       times of newly deposited fast ions.

  nbotype_mc_statistics  -- some numerical data on the Monte Carlo
                       algorithm.

  nbotype_radial_current -- radial currents (flows) (amps).

  nbotype_power_balance  -- scalar power balance data on fast species.
  nbotype_momentum_balance -- scalar angular momentum balance data on
                       fast species.
  nbotype_torque_work    -- work done on rotating plasma by fast ion torques.
  nbotype_particle_balance -- scalar particle balance data on fast species.

  --------------------------
A note on units:  all profile quantities passed through XPLASMA are
in MKS, except specie temperatures and average energies are in KeV.

Scalar quantities have units as documented in "nbspec.dat" and in the
appendix.

Home Top


species_indexing

It should be noted that the indexing of fast ion species between NUBEAM
and the user's code might not be identical.  NUBEAM provides an integer
mapping function

  inubeam = index_nbfi(iZ,iA,iType)

which returns the NUBEAM index of the fast specie of indicated integer
Z (e.g. 1 for Hydrogen), A (e.g. 2 for Deuterium), and:

  iType = 1  ... if seeking a Monte Carlo beam specie
  iType = 2  ... if seeking a Fokker-Planck beam specie (expected
                 for the future: NUBEAM deposition combined with
                 Fokker-Planck with ICRF heating in a separate module
                 calculation... not yet available).
  itype = 3  ... if seeking a Monte Carlo fusion product specie

NOTE: if the input arguments do not correspond to a fast specie known
to NUBEAM, index_nbfi returns a value of 0 (zero); no warning message
is output.

Home Top


example_code

The nubeam_comp_exec program (or mpi_nubeam_comp_exec, built from the
same source code) contains a subroutine library nubeam_comp_sub which
is included in the NTCC driver code.  This subroutine library contains
routines which demonstrate the use of NUBEAM outputs beyond what is
captured in the Plasma State.  See in particular:

  nbdrive_summary.f90 -- extensive demo of use of NUBEAM outputs

Home Top


_2d_Outputs

NUBEAM creates several outputs on the "irregular" 2d (rho,theta) MCgrid
structure described in the XPLASMA documentation.  These are stored in 
XPLASMA, associated with a MCgrid "id" and identified by character 
strings:

  SRBN02_<neutral-gas>_<fast-specie> -- thermal neutral source profiles
            #/sec in each zone.
  example:  SRBN02_H0_D_MCBEAM  
            -- 2d H0 neutral source due to D Neutral Beam specie.

  SNBN02_<neutral-gas>_<fast-specie> -- neutral sink <nb*sigma*v>, 1/sec
            due to charge exchange
  example:  SNBN02_D0_HE4_MCBEAM
            -- 2d D0 neutral sink due to charge exchange with 
               HE4 Neutral Beam specie.

  SNB0I2_<neutral-gas>_<fast-specie> -- neutral sink <nb*sigma*v>, 1/sec
            due to impact ionization
  example:  SNBN02_D0_HE4_MCFUSN
            -- 2d D0 neutral sink due to impact ionization by
               HE4 Fusion Product specie (fusion alphas).

  BDENS2_<fast_specie> -- 2d fast ion density profile, #/zone

  EBA2PP_<fast_specie> -- 2d profile of <Eperp>, KeV

  EBA2PL_<fast_specie> -- 2d profile of <Epll>, KeV

  FBM_<fast_specie>    -- ** fast ion distribution function **
                       -- a function of pitch and energy at each 2d zone 
                       -- pitch and energy grids as per user input.

XPLASMA also defines for any MCgrid structure:

  BMVOL                -- volume of each MCgrid zone (m**3).

which is frequently needed, e.g. for normalization to density.

A note on the definition of "pitch".  Although often denoted as vpll/v,
NUBEAM assumes a convention where vpll/v > 0 means moving "with the
plasma current" and vpll/v < 0 means moving "against the plasma current".
This means:

  pitch = (v.B)/(|v|*|B|)*sigma, where

  sigma = 1 if Btoroidal and Itoroidal are parallel, and
  sigma = -1 if Btoroidal and Itoroidal are anti-parallel.

In the following discussion, inubeam refers to NUBEAM's fast ion 
specie index...

A set of routines are provided for indexing into the distribution
function's pitch and energy grids.  The following code sample gives
the flavor.  Working examples exist in TRANSP and can be had by
request (email dmccune@pppl.gov).

  integer iZ,iA,iType   ! fast specie information (set by user)
  integer inubeam       ! NUBEAM fast specie index (see subtopic)
  integer inumE         ! number of energy zones
  integer inumA         ! number of vpll/v zones
  real zE,zEmax         ! energy (user supplied) & max energy
  real zvpllv           ! vpll/v (user supplied)
  integer iEzone        ! energy zone index
  integer iAzone        ! vpll/v zone index

  inubeam = index_nbfi(iZ,iA,iType)  ! get NUBEAM specie index (see [9])
  call get_fbm_index_info(inubeam,zEmax,inumE,inumA)
   ...
  iEzone = 1 + (zE/zEmax)*inumE     ! init guess
  iEzone = ndxfbe(zE,inubeam,iEzone)  ! actual energy zone index

  iAzone = ndxfba(zvpllv,inubeam)   ! vpll/v zone index

  ! ... can now refer to individual elements of the fast ion distribution
  ! ... data array FBM(iEzone,iAzone,<spatial-zone-index>,<specie-index>)

subroutine get_fbm_index_info and integer functions index_nbfi, ndxfbe, and
ndxfbe are defined by the NUBEAM library.

-------------
To fetch 2d outputs, the appropriate character name strings have to
be generated.  The names consist of a root concatenated with specie
identification label substrings and separated by underscore ("_")
characters.

The <fast_specie> label substrings can be generated by NUBEAM subroutine
calls:

  integer inubeam  !  the NUBEAM index of the fast specie wanted...

  integer inum_fast,igot
  character*20, dimension(:), allocatable :: zlbls
  character*40 zlbl_2dobj

  call nbfi_numfast(inum_fast)
  allocate(zlbls(inum_fast))
  call nbfi_lbl(zlbls,inum_fast,igot)

  zlbl_2dobj = 'BDENS2_'//zlbls(inubeam)
  call mcgrid_getobj(..., zlbl_2dobj, ...)

The above code uses the NUBEAM auxilliary routines "nbfi_numfast" and
"nbfi_lbl":

subroutine nbfi_numfast(inum_fast)
  !  return number of NUBEAM fast species...
  integer, intent(out) :: inumfast

subroutine nbfi_lbl(lbls,idim,igot)

  !  return a label for each known fast specie, labels have this form...

  !  <id> will be H or D or T or He3 or He4 or (rarely) something from
  !  higher on the periodic table of elements

  !  <id>_MCBEAM  -- Monte Carlo beam specie
  !  <id>_MCFUSN  -- Monte Carlo fusion product specie
  !  <id>_FPBEAM  -- Fokker Planck beam specie (not computed by MC code)
  !  <id>_FPRFI   -- Fokker Planck RF minority ion specie (not by MC code)

  !  igot gives the number of labels set; igot=-1 if idim is too small

  use nbi_com
  implicit NONE

  integer, intent(in) :: idim    ! dimension of lbls character string array
  character*(*), dimension(idim), intent(out) :: lbls   ! label strings
  integer, intent(out) :: igot   ! number of label strings returned

  ........

---------------

The <neutral-gas> label can be generated from the table

  Z  A  label
 ------------
  1  1  "H0"
  1  2  "D0"
  1  3  "T0"
  2  3  "He30"
  2  4  "He40"

For which an NTCC library routine "namels" can also be used (see
subtopic).

Home Top


species_indexing

It should be noted that the indexing of fast ion species between NUBEAM
and the user's code might not be identical.  NUBEAM provides an integer
mapping function

  inubeam = index_nbfi(iZ,iA,iType)

which returns the NUBEAM index of the fast specie of indicated integer
Z (e.g. 1 for Hydrogen), A (e.g. 2 for Deuterium), and:

  iType = 1  ... if seeking a Monte Carlo beam specie
  iType = 2  ... if seeking a Fokker-Planck beam specie (expected
                 for the future: NUBEAM deposition combined with
                 Fokker-Planck with ICRF heating in a separate module
                 calculation... not yet available).
  itype = 3  ... if seeking a Monte Carlo fusion product specie

Home Top


id_mcgrid

The mcgrid subroutines require as their first argument an integer
"grid ID".  To retrieve this:

  integer :: id_mcgrid

  call mcgrid_find(id_mcgrid)

Home Top


fetch_routines

subroutine mcgrid_getobj(id_mcgrid,zname,ist_th,ist_ph,zconv,zdata,idim,ierr)
 
  !  get (fetch) mcgrid scalar field -- one number per grid zone
 
  !  the data can cover the plasma out to the boundary, or, beyond the
  !  boundary into an extrapolated space.  If the stored data goes beyond
  !  the boundary AND the user data has space for it, the beyond-the-boundary
  !  data will be copied, otherwise zeroes will be written.
 
  !  the output data is on the user's (theta,phi) grids; stored data is on
  !  the standardized xplasma mcgrid:
  !    ist_th(ph) = -1 -- user grid starts at -pi (theta, phi)
  !    ist_th(ph) =  0 -- user grid starts at 0   (theta, phi)
 
  !  if the mcgrid is updown symmetric, only data covering the range
  !  [0,pi] or [-pi,0] are copied, depending on the setting of ist_th.
 
  !  the mcgrid# id_gridi refers to a grid set up by a prior mcgrid_define
  !  call.
 
  !  if id_gridi is negative:  if the named object does not exist,
  !  set the output array to zero without setting an error flag.
 
  !  if id_gridi is positive:  non-existence of named object is an error.

  implicit NONE
 
  integer, intent(in) :: id_mcgrid   ! grid ID

  character*(*), intent(in) :: zname ! name of object to fetch

  integer, intent(in) :: ist_th,ist_ph  ! angle grid start flags

  integer, intent(in) :: idim        ! dimension of zdata array

  real*8, intent(in) :: zconv        ! units conversion factor
  !  set zconv.lt.0.0 to specify clockwise orientation of poloidal zones
  !  data scaled by a factor of abs(zconv)

  real*8 :: zdata(idim)              ! data to fetch
 
  integer, intent(out) :: ierr       ! completion code (0=OK)

 
----------------------
The following is used to fetch distribution functions 

   f(|E|,v_pll/v,<spatial_zone>)

subroutine mcgrid_getarr2(id_mcgrid,zname,ist_th,ist_ph, &
     zconv,zdata,idim1,idim2,idim3,in1,in2,ierr)
 
  !  get (fetch) mcgrid 2d array field -- array(in1,in2) per grid zone
 
  !  the data can cover the plasma out to the boundary, or, beyond the
  !  boundary into an extrapolated space.  If the stored data goes beyond
  !  the boundary AND the user data has space for it, the beyond-the-boundary
  !  data will be copied, otherwise zeroes will be written.
 
  !  the output data is on the user's (theta,phi) grids; stored data is on
  !  the standardized xplasma mcgrid:
  !    ist_th(ph) = -1 -- user grid starts at -pi (theta, phi)
  !    ist_th(ph) =  0 -- user grid starts at 0   (theta, phi)
 
  !  if the mcgrid is updown symmetric, only data covering the range
  !  [0,pi] or [-pi,0] are copied, depending on the setting of ist_th.
 
  !  the mcgrid# id_grid refers to a grid set up by a prior mcgrid_define
  !  call.
 
  !  if id_gridi is negative:  if the named object does not exist,
  !  set the output array to zero without setting an error flag.
 
  !  if id_gridi is positive:  non-existence of named object is an error.
 
  implicit NONE
 
  integer, intent(in) :: id_mcgrid   ! GRID id 

  character*(*), intent(in) :: zname ! name of object to fetch

  integer, intent(in) :: ist_th,ist_ph  ! angle grid start flags

  integer, intent(in) :: idim1,idim2,idim3        ! dimension of zdata array

  real*8, intent(in) :: zconv        ! units conversion factor
  !  set zconv.lt.0.0 to specify clockwise orientation of poloidal zones
  !  data scaled by a factor of abs(zconv)

  real*8 :: zdata(idim1,idim2,idim3) ! data to fetch

  integer, intent(inout) :: in1,in2  ! activ dimensions zdata(1:in1,1:in2,j)
  ! IF in1<=0 and/or in2<=0, these are set to match the actual data size
  ! of the stored object.  If these are >0, then the caller asserts it knows
  ! the sizes already, and, these must match the dimensions of the stored
  ! object.
 
  integer, intent(out) :: ierr       ! completion code (0=OK)

Home Top


distribution_function_grid_utilities

C-----------------------------------------------------------------------
C  NDXFBE -- FIND INDEX TO FAST ION DIST. FCN ENERGY ZONE
C
      INTEGER FUNCTION NDXFBE(ZENERGY,ISBEAM,ISTART)
C
C  INPUT
C    ZENERGY = ENERGY, EV
C    ISBEAM  = NUBEAM FAST ION SPECIES INDEX
C    ISTART  = WHERE TO START SEARCH
C
C  OUTPUT
C    NDXFBE  = INDEX TO FAST ION DIST FCN ZONE CONTAINING THE ENERGY
C              ZENERGY, OR 0 IF ZENERGY IS NEGATIVE OR .GT. MAXIMUM
C
      real, intent(in) :: zEnergy       ! Energy, eV
      integer, intent(in) :: isbeam     ! NUBEAM specie index
      integer, intent(in) :: istart     ! search index (initial guess)


---> integer function NDXFBE_R8(ZENERGY_R8,ISBEAM,ISTART) also available.
      real*8, intent(in) :: zenergy_r8

C--------------------------------------
      integer function NDXFBA(ZCOSPA,ISBEAM)
C
C  INPUT
C    ZCOSPA = cos(pitch angle) = vpll/v relative to direction of Ip.
C    ISBEAM = NUBEAM FAST ION SPECIES INDEX (not currently used because
C             at present the vpll/v grid is the same for all species).
C
C  OUTPUT
C    NDXFBA  = INDEX TO FAST ION DIST FCN ZONE CONTAINING THE ENERGY
C              ZENERGY, OR 0 IF abs(ZCOSPA).gt.1
C
      use nbi_com
      implicit NONE
C
      real, intent(in) :: zcospa    ! vpll/v
      integer, intent(in) :: isbeam ! specie index (currently not used).


---> integer function NDXFBA_R8(ZCOSPA_R8,ISBEAM,ISTART) also available.
      real*8, intent(in) :: zcospa_r8

C-----------------------------------------------------------------------
      subroutine GET_FBM_INDEX_INFO(ISBEAM,zEmax,inumE,inumA)
C
C  return summary information on energy and pitch grids for
C  fast specie distribution function.
C
      use nbi_com
      implicit NONE
C
      integer, intent(in) :: isbeam     ! NUBEAM specie index
C
      real, intent(out) :: zEmax        ! max energy in grid
      integer, intent(out) :: inumE     ! energy grid size (#zones)
      integer, intent(out) :: inumA     ! vpll/v grid size (#zones)
C


---> subroutine GET_FBM_INDEX_INFO_R8(ISBEAM,zEmax_r8,inumE,inumA)
     also available...

C-----------------------------------------------------------------------
      subroutine GET_FBM_EGRID(ISBEAM,zEgrid,imax,igotE)
C
C  return energy grid associated with fast ion specie (ISBEAM)
C  note-- these are the energy zone BOUNDARIES, and the number of
C         boundaries is the number of zones + 1.
C
      use nbi_com
      implicit NONE
C
      integer, intent(in) :: isbeam     ! NUBEAM specie index
      integer, intent(in) :: imax       ! dimension of zEgrid array
      real, intent(out) :: zEgrid(imax) ! energy grid
      integer, intent(out) :: igotE     ! energy grid size (#bdys)
C
C-------------------------------
C

---> subroutine GET_FBM_EGRID_R8(ISBEAM,zEgrid_R8,imax,igotE)
     also available...

C-----------------------------------------------------------------------
      subroutine GET_FBM_AGRID(ISBEAM,zAgrid,imax,igotA)
C
C  return vpll/v grid associated with fast ion specie (ISBEAM)
C  note-- these are the vpll/v zone BOUNDARIES, and the number of
C         boundaries is the number of zones + 1.
C
      use nbi_com
      implicit NONE
C
      integer, intent(in) :: isbeam     ! NUBEAM specie index
      integer, intent(in) :: imax       ! dimension of zAgrid array
      real, intent(out) :: zAgrid(imax) ! pitch angle grid
      integer, intent(out) :: igotA     ! pitch angle grid size (#bdys)


---> subroutine GET_FBM_AGRID_R8(ISBEAM,zAgrid_R8,imax,igotA)
     also available...

Home Top


Alternate_grid_utilities

An alternate set of utility routines were developed in Nov. 2008;
examples of use are in nubeam_comp_sub/nbdrive_load.f90:

subroutine nbi_fbm_nzons_vpv(iarg,numa)

  !  number of pitch zones.  At present all species have the same number,
  !  and, "iarg" is a dummy, placeholder argument.

  use nbi_com
  implicit NONE

  integer, intent(in) :: iarg   ! (dummy) specie index
  integer, intent(out) :: numa  ! number of vpll/v zones

  !  inside NUBEAM, this number is called nznbma:

  numa = nznbma

..............

subroutine nbi_fbm_vpvzons(iarg,isize,vpv_out,ierr)

  !  return array of vpll/v values at pitch zone centers.
  !  (nznbma) values are returned; array size (isize) must be sufficient
  !  to accomodate this

  !  At present all species have the same number,
  !  "iarg" is a dummy, placeholder argument.

  use nbi_com
  implicit NONE

  integer, intent(in) :: iarg   ! (dummy) specie index
  integer, intent(in) :: isize  ! size of output array

  real*8, intent(out) :: vpv_out(isize)  ! vpll/v grid values at zone centers
  integer, intent(out) :: ierr  ! return code: 0=OK; 1 means: isize too small


subroutine nbi_fbm_vpvbdys(iarg,isize,vpv_out,ierr)

  !  return array of vpll/v values at pitch zone boundaries
  !  (nznbma+1) values are returned; array size (isize) must be sufficient
  !  to accomodate this

  !  At present all species have the same number,
  !  "iarg" is a dummy, placeholder argument.

  use nbi_com
  implicit NONE

  integer, intent(in) :: iarg   ! (dummy) specie index
  integer, intent(in) :: isize  ! size of output array

  real*8, intent(out) :: vpv_out(isize)  ! vpll/v grid values at zone bdys
  integer, intent(out) :: ierr  ! return code: 0=OK; 1 means: isize too small

..............

subroutine nbi_fbm_nzons_e(iindx,nume)

  !  number of energy zones, by species

  use nbi_com
  implicit NONE

  integer, intent(in) :: iindx  ! specie index
  integer, intent(out) :: nume  ! number of energy zones

  !  Important to note: number of active energy zones can vary with
  !  fast ion species index.  In particular, neutral beam and fusion
  !  product distribution functions are generally represented on 
  !  different energy grids, due to the different energy ranges seen
  !  in these populations...

  !  Inside NUBEAM this set of numbers are stored as nznbmea(iinndx).

..............

subroutine nbi_fbm_ezons(iindx,isize,e_out,ierr)

  !  return array of energy values at energy grid zone centers.
  !  (nznbmea(iindx)) values are returned; array size (isize) must be 
  !  sufficient to accomodate this

  !  => energies in eV 

  use nbi_com
  implicit NONE

  integer, intent(in) :: iindx  ! specie index
  integer, intent(in) :: isize  ! size of output array

  real*8, intent(out) :: e_out(isize)  ! energy grid values at zone centers: eV
  integer, intent(out) :: ierr  ! return code: 0=OK

..............

subroutine nbi_fbm_ebdys(iindx,isize,e_out,ierr)

  !  return array of energy values at energy grid zone boundaries.
  !  (nznbmea(iindx)+1) values are returned; array size (isize) must be 
  !  sufficient to accomodate this

  !  => energies in eV 

  use nbi_com
  implicit NONE

  integer, intent(in) :: iindx  ! specie index
  integer, intent(in) :: isize  ! size of output array

  real*8, intent(out) :: e_out(isize)  ! energy grid values at zone bdys: eV
  integer, intent(out) :: ierr  ! return code: 0=OK

..............


Home Top


namels

  subroutine namels(iZ,iA,cname)
  integer, intent(in) :: iZ,iA
  character*(*), intent(out) :: cname

return short string to identify an isotope:

   in         out
 iZ  iA

  1   1       "H"
  1   2       "D"
  1   3       "T"
  2   3       "He3"
  2   4       "He4"

higher values of iZ and iA are also allowed, but typically not needed
in the NUBEAM context.

Home Top


example_code

The nubeam_comp_exec program (or mpi_nubeam_comp_exec, built from the
same source code) contains a subroutine library nubeam_comp_sub which
is included in the NTCC driver code.  This subroutine library contains
routines which demonstrate the use of NUBEAM outputs beyond what is
captured in the Plasma State.  See in particular:

  nbdrive_summary.f90 -- extensive demo of use of NUBEAM outputs
  nbdrive_summary_2d.f90 -- code for fetching spatially 2d outputs

  nbdrive_load.f90 -- set up for nbdrive_fbm_write...
  nbdrive_fbm_write.f90 -- fetch the fast ion distribution functions

Home Top


Odds_&_Ends


Home Top


Sawteeth

NUBEAM supports a method, based on Kadomtsev or Porcelli mixing, to 
model the effects of sawteeth.  The mixing model is based on the 
NTCC module KDSAW.  The user requests that sawtooth effects be 
computed using the standard model control objects.

(At initialization time):

  use nbi_pstypes
  type (nbi_ctrl_init) :: nb_init  ! initialization control object

  ...set Kadomtsev/Porcelli model options...

(before NUBEAM timestep is execute):

  use nbi_pstypes
  type (nbi_ctrl_update) :: nb_update  ! update control object


  nb_update%sawflag = < TRUE or FALSE >
                             ! apply PREVIOUSLY CALCULATED sawtooth
                             ! operator-- reset MC particle lists.

  ! additional

  ! to do mixing calculation for possible later use:

  nb_update%nlsawb = < TRUE or FALSE >  ! compute mixing for beam ions
  nb_update%nlsawf = < TRUE or FALSE >  ! compute mixing for fusion ions

If (sawflag) is set and sawtooth mixing was precomputed on the prior
step, the mixing is applied prior to orbiting.

If (nlsawb.or.nlsawf) are set, precompute the mixing for the indicated
class of fast ion species; can be used (or not) on the subsequent step.

The decision on whether to carry out mixing may depend on a sawtooth
trigger model, but, mixing must be precomputed in order for the option
for application of mixing to exist for the following step.

The modeling of a sawtooth event typically involves a discontinuous
breaking off and re-initialization of PDEs representing the evolution of the
plasma-- handling the timestepping issues and maintaining constraints such
as quasi-neutrality in the presence of discontinuously changed fast ion
density profiles-- is basically the responsibility of the user's code.
However, if the nlsawb and nlsawf options are set, NUBEAM does output 
(via XPLASMA) post-sawtooth fast ion particle density, perpendicular and
parallel energy density, and angular velocity profiles, which can be used
by the caller IF a sawtooth DOES occur.

It is preferable if the beginning and end of NUBEAM timesteps can be
synchronized with sawtooth events, so that the timestep control flow
of the user model would look like this:

  (a) use NUBEAM with sawtooth options set, compute fast ion evolution
      from TB1 to TB2.  **Save** post-sawtooth profiles, mapped to the
      user's grid.

  (b) evolve plasma from time TB1 to TB2

  (c) at time TB2: does sawtooth occur?  If not, do nothing; If yes:

      1. CALL SAWNBI to update state of NUBEAM model (or set a flag
         to cause SAWFLAG=.TRUE. to be set in the namelist of the
         next nubeam_driver "proxy_exec" server mode call).
      2. change fast ion densities, etc. using data saved from previous
         call (a) to NUBEAM.
      3. re-initialize PDE's of transport model, in conformance with
         data constraints (e.g. Zeff, quasi-neutrality) taking changed
         fast ion densities into account.

  (d) TB1 <-- TB2, TB2 <-- TB2 + dtBEAM; go back to step (a).

Home Top


State_file_save_&_restore

If the user's code has a check-point/restart capability, i.e. if it
has the ability to restart itself from saved files the middle of a 
run, e.g. in case of a system crash or for debugging purposes, then,
the NUBEAM state save / state restore feature must also be used.  The
NUBEAM procedure for saving state must be synchronized with general
state-save operations of the user's code-- so, the user must choose
when a NUBEAM state save operation is to be done; saving state for
later restart cannot be part of the normal NUBEAM calculation cycle.

The NUBEAM library provides a single simple routine to do state save
and state restore operations:

  call nbi_states(<filename1>,<filename2>,'S',imode,ierr)   
                  ! save state to file

and possibly, only as part of the procedure for restarting an 
interrupted user calculation:

  call nbi_states(<filename>,<filename2>,'R',imode,ierr)
                  ! restore state from file

In either case, an integer error code "ierr" is returned; ierr=0 
means there was no error.

The NUBEAM state file (paths) are named by the character string arguments
<filename1> & <filename2>:

    <filename1> -- "field" state -- saved items other than particle lists;
    <filename2> -- "ptcl" state -- particle list (or sublist in the case
                   of MPI simulations).

The input integer argument "imode" is a place holder: not currently used;
it is recommended to set it to zero for now.

The format of the files is portable binary (NetCDF).  Their
contents can be examined with `ncdump'.

Home Top


More_state_file_calls

  call nbi_states(<filename1>,<filename2>,'B',imode,ierr)   
                  ! create "backup" copy of state files

  call nbi_states(<filename1>,<filename2>,'C',imode,ierr)   
                  ! retrieve "backup" copy of state files
                  ! (makes previously saved backup copy the current state)
                  ! this roles back the state of NUBEAM to an earlier time.

Home Top


PPPL_help.

The NUBEAM module is distributed with a standalone test driver,
`nubeam_test'.  This driver requires two (2) NetCDF files for
input:

   XPLASMA state (just before execution of NUBEAM timestep).
     -- MHD equilibrium and input profiles.
     -- standard name: <workpath>/<runid>_xplasma_nubeam.cdf
   NUBEAM state (just before execution of NUBEAM timestep).
     -- NUBEAM state: e.g. accumulated fast ions from prior
        timesteps.
     -- standard name: <workpath>/<runid>_nbi_start.cdf

These files are generated automatically when NBSTART(...) is called
to initiate a NUBEAM timestep execution.  This happens at the beginning
a nubeam_ctrl_step call.

  <workpath> is $NUBEAM_WORKPATH if nubeam_comp_exec process is used;
             it is the value passed to nubeam_set_workpath if the 
             subroutine library API is used

  <runid>    is the RUNID which is a label in the Plasma State.


If NUBEAM crashes unexpectedly, the above state files contain all the 
information necessary to reproduce the crash in the `nubeam_test' 
standalone codem -- in a serial run.

In an MPI parallel run -- contact PPPL for advice (we are not sure 
yet of the best way to send back the necessary state information).

--caution-- some crashes may depend on random number sequence.  In this
case, reproducibility in `nubeam_test' is guaranteed only if the exact
same version of code, compilers, etc., are used to build `nubeam_test'
as are used to build the driver program from which the crash occurred.

Even so, the NetCDF files are portable, and it may well be possible with
this data to reproduce a crash elsewhere, e.g. on the workstation of
a PPPL NUBEAM expert.

**IF PPPL debugging assistance is desired**

  (a) put the 2 files <runid>_nbi_start.cdf and <runid>_xplasma_nubeam.cdf
      on an anonymous ftp server (or email a compressed tar file) so that
      a PPPL expert can access the data.

  (b) send email to dmccune@pppl.gov, and include the following information:

      -- name of tar file and anonymous ftp server.
      -- nature of problem requiring debugging (try to be specific).
      -- "tail of log file" or other output showing symptoms of problem,
         including specific messages from NUBEAM; traceback information
         in case of arithmetic error; whatever is available.

Home Top


Known_limitations_&_problems

NUBEAM runs only in REAL*8 (64 bit) precision.  No other precision
choices are available.

The definition of a modular interface to a Fokker Planck (instead of
Monte Carlo) fast ion slowing down calculation (using NUBEAM for
deposition calculations) has not been completed.  In this context,
a physics limitation of NUBEAM should be noted.  NUBEAM has no 
Monte Carlo RF operator-- therefore, effects of RF resonance on beam
injected ions cannot be calculated except by using a Fokker Planck
package.  This has disadvantages, because the Fokker Planck package 
makes other approximations (zero orbit width, zero FLR).  Development
of an appropriate RF Monte Carlo operator is a difficult computational
research problem.

Statistical Variance of Results -- 

NUBEAM is a Monte Carlo code.  This means (a) its results are statistical
in nature -- Monte Carlos sums, (b) the accuracy of these sums is subject
to statistical variance of magnitude dependent on the number of particles
used in the simulation (variance ~ nptcls**0.5), and (c) small changes to
code inputs produce generally small changes in code outputs, but only 
within the accuracy of the inherent statistical variance.  These accuracy
limitations have serious implications.  For example, when the code is
ported to another machine, the reproducibility of results will generally
be good only within the statistical variance, i.e. not nearly as good as
the arithmetic accuracy of the machines.  This is because even small 
differences will cause at some point a change of sequence of Monte Carlo
events, after which the association of the random number sequence with
subsequent decision points in the code is shifted-- putting the entire
simulation on a different track.  Such variance can be mitigated by 
precomputing random number sequences separately for each particle track,
but, this would require major changes to the code and is not planned in
the short term.

Home Top


Operation_of_Test_Programs

The NUBEAM NTCC module comes with two test programs:

  nubeam_comp_exec -- NUBEAM demonstration program.  This namelist driven
                   program can run NUBEAM through a time step against a 
                   fixed target plasma.  The NTCC module provides test
                   data.

  nubeam_test   -- NUBEAM standalone debugging program.  This program
                   uses "state file" information, and so is "parasitic"
                   on some other successful NUBEAM installation within
                   a transport code (or a code like nubeam_comp_exec).
                   Its purposes is to give a small, standalone tool that
                   can accurately reproduce problems that might arise
                   in the use of NUBEAM, for debugging purposes.  This
                   program has a command line interactive interface and
                   produces NTCC "sglib" graphical output.

These programs can and should be used to test installation of NUBEAM NTCC
distributions.  See the README instructions that come with the NTCC
module.

Home Top


Appendices


Home Top


Appendix_A_nubeam_driver_details

The "nubeam_comp_exec" program -- distributed with the NTCC module -- 
contains a short, well-commented driver program

  nubeam_comp_exec/nubeam_comp_exec.f90

that demonstrates execution of a NUBEAM time step with Plasma State
input and control inputs and Plasma State output.

It is supplemented by a well-commented library of routines 

  nubeam_comp_sub/*.f90

which demonstrate access to NUBEAM outputs beyond what is provided
through the Plasma State software.

The subtopics here give summary explanation of the subroutines called
from member routines of the nubeam_comp_sub library.  All calls are 
resolved by the NUBEAM module or its dependencies.

Home Top


NUBEAM_calls


Home Top


fetching_output_data

The calls for fetching the results of a NUBEAM calculation, including
scalar outputs and arrays of scalars, and XPLASMA ids for radial profiles,
are all described in Appendix D.  All such routines take an instance
of a FORTRAN-90 compound data type "nbotype_<tname>" as an argument,
and have names of the form:

  nbo_get_<tname> -- retrieve <tname> output data.

Home Top


Auxilliary_routines_(labeling)

The routines 

  integer function index_nbfi(iZ,iA,iType)

  subroutine nbfi_numfast(inum_fast)

  subroutine nbfi_lbl(zlbls,idim,igot)

can be used to find indices and labels for fast species computed by NUBEAM;
these are explained fully in the main text under the sections on output.

Home Top


Auxilliary_routines_(energy_grid)

There are also sets of auxilliary routines for getting information about
the pitch and energy grids of the Monte Carlo fast ion distribution 
function outputs -- ndxfbe, etc. -- also described in the section on 2d
outputs.

A note of caution is in order.  The pitch and energy grids for the
fast ion distribution functions will not be defined until the first
NUBEAM time step has successfully completed.  The pitch grid is
evenly spaced in (vpll/v) over a known range [-1,1], but the energy 
grid is generally not evenly spaced, and its maximum energy will vary
for different fast species.  For beam species, this is the maximum
value of the Plasma State data element (Einj_max) over all neutral
beams in the Plasma State machine description.

Although the maximum energy for distribution functions for beam ions
is controlled by Plasma State input, the maximum energy for fusion product
ions is determined by a NUBEAM subroutine call (based on knowledge of 
the fusion product birth energies):

subroutine nbfusn_emax(iZ,iA,emax)

  implicit NONE

  integer, intent(in) :: iZ  ! Z of fusion product
  integer, intent(in) :: iA  ! A of fusion product

  real, intent(out) :: emax  ! a number safely above the birth energy

--or--

subroutine r8_nbfusn_emax(iZ,iA,emax)

  implicit NONE

  integer, intent(in) :: iZ  ! Z of fusion product
  integer, intent(in) :: iA  ! A of fusion product

  real*8, intent(out) :: emax  ! a number safely above the birth energy

(These calls can be made any time, e.g. before the main NUBEAM 
calculation has been initialized).

Home Top


XPLASMA_calls

These are "old_xplasma" calls as described in detail in the XPLASMA NTCC 
module documentation,

   https://w3.pppl.gov/~pshare/help/xplasma.htm 

and so their usage is merely summarized here.

  call eqm_msgs(...)           ! redirect XPLASMA messages

  call eq_save(filename,ierr)  ! save XPLASMA state to a NetCDF file.
  call eq_restore(filename, ierr)  ! restore XPLASMA state from a
                               ! NetCDF file written by a prior eq_save
                               ! call; any existing state is over-written.

  call eqm_fromgeqdsk(...)     ! build complete XPLASMA equilibrium,
                               ! fields, and vacuum region description
                               ! using G-eqdsk file or MDSplus path;
                               ! any existing state is over-written.

(if eqm_fromgeqdsk is not used, the following calls will be used
to feed in data from a TRANSP run; this also serves as an example
usable by any code with an axisymmetric MHD equilibrium with
geometry of the form R(rho,theta),Z(rho,theta)).

  call eqm_select(...)         ! re-initialize XPLASMA, in preparation
                               ! for new MHD equilibrium data

  call eqm_rho(...)            ! define basic rho grid
  call eqm_chi(...)            ! define poloidal angle grid
                               !   with apologies: 
                               !        sometimes "chi" and sometimes
                               !        "theta" is used to name this
                               !        coordinate.
  call eqm_uaxis(...)          ! define a user grid -- typically with
                               ! an association to the basic rho grid.

  call eqm_rhofun(...)         ! define a named XPLASMA profile function
                               ! f(rho).  A unique XPLASMA id is returned.

  call r4_eqm_rhofun(...)      ! as eqm_rhofun, with REAL instead of
                               ! REAL*8 precision arguments.

  call r4_eqm_rzmag(...)       ! specify MHD equilibrium geometry

  call eqm_bset(...)           ! specify orientation (sign) of toroidal
                               ! and poloidal magnetic fields; the fields
                               ! are calculated if sufficient data has
                               ! been provided.

  call eqm_dbdy_grid(...)      ! specify vacuum vessel wall at fixed
                               ! distance from plasma boundary, and 
                               ! create vacuum region [R,Z] grid

  external eqm_brz_adhoc
  call eqm_brz(eqm_brz_adhoc,...) ! create adhoc extrapolation for 
                               ! B fields and pseudo-flux-coordinates
                               ! for the vacuum region.


  call eq_rholim(...)          ! return limits of XPLASMA rho grid --
                               ! in practice, rho_min=0, rho_max=1 always.

  call eq_glimrz(...)          ! find Rmin,Rmax,Zmin,Zmax of a flux surface.

  call eq_rzget(...)           ! [mag. coords] -> [cyl. coords] map
  call eq_inv(...)             ! [cyl. coords] -> [mag. coords] inverse map

  call eq_volume(...)          ! volume (m**3) enclosed by flux surfaces.
  call eq_area(...)            ! cross-sectional area (m**2) enclosed by
                               ! flux surfaces.

  call eq_rgetf(...)           ! return interpolated values of XPLASMA
                               ! profile f(rho); XPLASMA id is input.

  call eq_ganum(axis_name,id)  ! get XPLASMA axis id from name

     Note:  call eq_ganum('__RHO',id_rho) fetches the id for the
            XPLASMA rho or sqrt-normalized-toroidal-flux grid.  This
            is useful for allowing the user to define his/her own
            rho grid (with an eqm_uaxis call) and to have it associated 
            with the XPLASMA rho grid.  User rho grids need not be 
            evenly spaced.

  call eq_gfnum(fcn_name,id)   ! get XPLASMA profile id from name

     Note:  usually for f(rho) profiles in NUBEAM context.


  call mcgrid_define(...)      ! create a MCgrid; return a MCgrid id.

  call mcgrid_getsym(...)      ! return updown symmetry of MCgrid.

  call mcgrid_getnumr(...)     ! return no. of zone rows of a MCgrid.
  call mcgrid_getnumz(...)     ! return total no. of zones in a MCgrid.
  call mcgrid_getnumzns(...)   ! return array of no. of poloidal zones
                               ! per radial zone row

  call mcgrid_getobj(...)      ! get data defined over a MCgrid.
                               ! (it was put there by NUBEAM calls to
                               ! mcgrid_putobj(...)

  call mcgrid_getarr2(...)     ! get array data over a MCgrid: the
                               ! fast ion distribution function.


Home Top


Miscellaneous_support_routines


Home Top


irns

  (from library "comput" in the NTCC distribution)

  set random number seed from system clock

  integer function irns(idummy)

C******************** START FILE IRNS.FOR ; GROUP RNG ******************
      FUNCTION IRNS(IDUMMY)
C  11/29/78
C  THIS FUNCTION WAS WRITTEN BY HARRY H. TOWNER OF THE PRINCETON PLASMA
C  PHYSICS LAB.  IRNS WILL RETURN A UNIQUE INTEGER SUITABLE FOR SETTING
C  THE RANDOM NUMBER SEED.
c  5/01 RGA -- replace with f90 standard call
      integer iv(8)
      call date_and_time(values=iv)
      secnds = 60*(60*iv(5)+iv(6))+iv(7)+iv(8)/1000.
 
      IRNS=1.E4*SECNDS
      IRNS = 2*IRNS + 1  !MAKE SURE IT'S ODD, RTM 26 FEB 86
      RETURN
      END
C******************** END FILE IRNS.FOR ; GROUP RNG ******************

Home Top


fusion_reaction_labeling

A small set of routines are used to categorize and label fusion reactions
that can be computed by the NUBEAM model.  The fusion rate data going into
these estimates comes from the PREACT NTCC module.

Experimentally, it is of considerable interest to estimate not just
the total neutrons, or, the total number of fusion reactions on a 
reaction-by-reaction basis, but also, the break-down of rates based
on the reagent types (fast ions vs. thermal ions).  That was the 
motivation for the "catfus" categorization scheme-- a TRANSP legacy.

The catfus* routines are useful for indexing into the fusion related
output data of NUBEAM (or in the case of 2d outputs, generating the
necessary character label for the desired MCgrid data object), as
shown in the example code, below.

The catfus routines use a category index to distinguish among reactions
and partially among reagent types.  Then, within each category index
there are two "reagent type" codes specifying:

code  meaning

 0    thermal ion
 1    beam ion
 2    fusion product ion
 3    RF tail ion

For each category, reagent#1 can be either thermal or one of {1,2,3};
reagent#2 can be either thermal or {1: beam ion}.

This allows a separate category index / reagent code combinations for
the following fusion reactions

  DD:P  DD:N  D-T  D-He3 TT
  (T-He3 category also exists but cross-section data is suspect at
  this time).

with the following reagent combinations ("target" means thermal ion
target):

  thermonuclear               (indices 1-6)
  beam-target                 (indices 1-8)
  beam-beam                   (indices 1-6)
  (fusion_product)-target     (indices 9-10: T & He3 fusion products)
  (fusion_product)-beam       (indices 9-10: with D beams)
  (minority_tail_ion)-target  (indices 11-14)
  (minority_tail_ion)-beam    (indices 11-14)

  (erratum: indices 13 & 14 list "D" as an RF minority which is
  unlikely to occur, experimentally).

Certain fast ion -- fast ion combinations are not supported.  For
example, the fusion_product - fusion_product T-He3 fusion in a D beam
D thermal target T/He3 fusion product burnup simulation -- known to 
be small -- cannot be calculated by NUBEAM at present.

To avoid the situation where a physical reaction would be associated
with more than one index / reagent-type combination, some categories 
require that the first reagent be non-thermal, and/or that the 
second reagent be thermal.  For example, the fusion rates associated
with D beams interacting with T thermal plasma, i.e. beam-target D->T 
(index 1) is calculated separately from the rates associated with
T beams interacting with D thermal plasma, i.e. beam-target T->D 
(index 7).  But the thermonuclear and beam-beam DT fusion reactions
are symmetric with respect to reagent type, and so are reserved to
category index 1.

The code

  use nbi_types
  type(nbotype_fusion) :: zfusion

  integer i,inum_react,i1,i2
  character*20 label

  call nbo_get_fusion(zfusion)  ! get NUBEAM fusion rate results

  call catfus_num(inum_react)   ! get number of known reactions

  do i=1,inum_react
     call catfus_mtype(i,i1) ! fetch available fast ion type, this index
     do i2=0,1
        ! 0: reagent 2 is thermal; 1: reagent 2 is beam ion
        call catfus_name(i,i1,i2,label)
        if(label.ne.'error') then
           !  read fusion data vs (rho,theta) for this reaction/reagent
           !  type combination  ...  use -id_mcgrid, so that if the item
           !  is not present e.g. because not all reagents are present,
           !  the result is silently set to zero.
	
	   label = trim(label)//'_2d'   ! append this suffix

           call mcgrid_getobj(-id_mcgrid,label,...)
           if (i2.eq.0) then
               write(6,*) label,' fusion reaction with thermal ions', &
                          zfusion%btnta(i),' per second.'
           else 
               write(6,*) label,' fusion reaction with beam ions', &
                          zfusion%bbnta(i),' per second.'
           endif
        else
           !  the answer is "zero"
        endif
     enddo
  enddo

The index "i" is also to be used to specify the "reaction index" in
array data members of the nbotype_fusion data type (described in the
appendix D showing NUBEAM output data structures).  Data members with
the substring "bt" refer to "beam-target", or more generally, "fast
ion -- thermal target" reactions; data members with the substring "bb"
refer to "beam-beam", or, more generally, "fast ion -- fast ion" fusion
reactions.  The above example code illustrates the point.

Home Top


catfus_num

  subroutine catfus_num(inum_react)
  integer, intent(out) :: inum_react   ! no. of fusion reaction categories

Get total number of fusion reaction categories known by NUBEAM.

Home Top


subroutine catfus_btindx

subroutine returns a fusion reaction category index, based on the
input description.

subroutine catfus_btindx(c3beam,c3target,itypbeam,indx)
  character*(*), intent(in) :: c3beam   ! "D" "T" or "HE3"
  character*(*), intent(in) :: c3target ! "D:P" "D:N" "T" or "HE3"
  integer, intent(in) :: itypbeam     ! 1 for beam, 2 for fusion prod, 3 for
                                      ! RF tail; 0 for thermal
 
  integer, intent(out) :: indx        ! reaction index (or 0 if none found)

(note the target type has not been specified -- there are two
possibilities: beam fast ions, or thermal ions).

Home Top


catfus_name

given the reaction index and reagent types, generate a label string
for the fusion reaction.

In the NUBEAM context, this call generates the label needed to name
and fetch a profile of 2d (rho,theta) resolved fusion rate data--
example in nbdrive/nbdrive_summary_2d.f90 ...

subroutine catfus_name(ireact,irtyp1,irtyp2,name)
  integer,intent(in) :: ireact    ! reaction index
  integer, intent(in) :: irtyp1   ! type of 1st reagent
  integer, intent(in) :: irtyp2   ! type of 2nd reagent
 
  !  rule:  irtyp1.ge.irtyp2 .and. irtyp2.le.1 .and. irtyp2.ge.0
  !  additional rules:  see the module data
  !     generally, reaction indices .gt.8 are for FP and RFI ions only.
  !
  !  irtyp1|2 = 0 -- thermal   irtyp1=0, irtyp2=0: thermonuclear reaction
  !
  !     in what follows, "target" means thermal target population.
  !
  !  irtyp1|2 = 1 -- beam ion  irtyp1=1, irtyp2=0: beam-target reaction
  !                            irtyp1=1, irtyp2=1: beam-beam reaction
  !
  !  irtyp1|2 = 2 -- fusion product (FP):  T or He3
  !                            irtyp1=2, irtyp2=0: FP-target reaction
  !                            irtyp1=2, irtyp2=1: FP-beam reaction
  !
  !    (D is not a fusion product; P and He4 are non-reacting fusion products)
  !
  !  irtyp1|2 = 3 -- RF tail ion (RFI)
  !                            irtyp1=3, irtyp2=0: RFI-target reaction
  !                            irtyp1=3, irtyp2=1: RFI-beam reaction
  !    (generally, T or He3 tail ions are of interest).
 
  character*(*), intent(out) :: name   ! name (label string) for reaction

The name string "error" is returned if any of the input arguments
are out of the expected range, or if the reagent types specified
are not supported for the given reaction index.

Home Top


catfus_mtype

given a reaction index, return the type of fast species available
for the 1st reagent; the 2nd reagent can be a beam ion or thermal
target plasma species.

subroutine catfus_mtype(ireact,itypfast)

  integer,intent(in) :: ireact    ! reaction index
  integer,intent(out) :: itypfast ! fast-ion type
                                  ! 1=beam, 2=fusion product, 3=RF tail

  !  generally, the categorization allows fast-ion -- fast-ion reactions
  !  to be considered, but the "second" fast-ion specie must be a beam
  !  ion specie; the "first" specie can be beam-ion (B),
  !  fusion-product-ion (FP), or RF-tail-ion (RFI).
  !
  !  categories for FP-FP, RFI-RFI, and FP-RFI are not supported;
  !  categories B-B, FP-B, and RFI-B *are* supported.
  !

Home Top


catfus_reagent

return in character format reagent isotope information

subroutine catfus_reagent(ireact,reagent1,reagent2)

  integer,intent(in) :: ireact    ! reaction index
 
  character*(*),intent(out) :: reagent1,reagent2    ! reagents

Typical values returned: "D", "T", "HE3".  For the DD reaction, the
second reagent can be "D:P" or "D:N" indicating the proton or neutron
branch of that fusion reaction.

Home Top


catfus_mod

This is the f90 module data (set of constants) used by the subroutines
catfus*...

module catfus_mod
 
  ! Fusion reaction indexing data
  ! the categorization comes originally from TRANSP at PPPL
  ! ( https://w3.pppl.gov/transp) 
 
  integer, parameter :: nreact=14    ! no. of indexed reactions
 
  ! reagents isotope species:
 
  character*3, parameter, dimension(nreact) :: r1 = &
       (/ 'D  ','D  ','D  ','D  ','T  ','T  ','T  ','HE3', &
       'T  ','HE3','T  ','HE3','D  ','D  '   /)
 
  character*3, parameter, dimension(nreact) :: r2 = &
       (/ 'T  ','HE3','D:P','D:N','T  ','HE3','D  ','D  ', &
       'D  ','D  ','D  ','D  ','T  ','HE3'   /)
 
  ! reagent categories:
  ! 0->thermal, 1->beam, 2->fusion product, 3->RF tail
 
  ! valid reagent1 categories, by reaction index  (lower indicies 
  ! allow beam or thermal;
  ! higher indices are special purpose, generally speaking).
 
  integer, parameter, dimension(nreact) :: typmin = &
       (/  0,  0,    0,    0,    0,  0,    1,  1,   &
       2,  2,    3,  3,    3,  3    /)
 
  integer, parameter, dimension(nreact) :: typmax = &
       (/  1,  1,    1,    1,    1,  1,    1,  1,   &
       2,  2,    3,  3,    3,  3    /)
 
  ! maximum valid reagent2 categories (1 means beam or thermal; 
  ! 0 means thermal only).
 
  integer, parameter, dimension(nreact) :: typ2max = &
       (/  1,  1,    1,    1,    1,  1,    0,  0,   &
       1,  1,    1,  1,    1,  1    /)
 
end module catfus_mod

Home Top


ignore_this

  human readers need not be concerned...
  maintainers: do not change this line unless you know what your are doing:
  !-->PYTHON_START
  ! (nbigen.py: python generated .hlp code, do not edit)
Home Top


Appendix_B_Initialization_Control_Structure

 
Declaration:
 
  use nbi_pstypes
  type (nbi_ctrl_init) :: iblk
  character*80 filename   ! filename input to I/O routines
  integer ierr            ! status return code 0=normal
 
Calls:
 
  call nbi_ctrl_init_dflt(iblk) ! set default values
  call nbi_ctrl_init_write(filename,iblk,ierr) ! write iblk namelist
  call nbi_ctrl_init_cdfwrite(filename,iblk,ierr) ! write iblk NetCDF file
  call nbi_ctrl_init_read(filename,iblk,ierr)  ! read iblk namelist
  call nbi_ctrl_init_cdfread(filename,iblk,ierr)  ! read iblk NetCDF file
 
Data element members of nbi_ctrl_init:
 
  CHARACTER*120 :: mission
    default value:  "standard"
      !! NUBEAM "mission" in presence of Plasma State data
      !!   (each supported mission requires special code; at present
      !!   only "standard" is supported).
      !! "standard" means:  assume responsibility for deposition
      !!   and slowing down of neutral beam and fusion product
      !!   fast ion species found in the Plasma State
 
  CHARACTER*120 :: workpath
    default value:  " "
      !! work directory path -- for debug statefile...
      !! blank means current working directory
 
  REAL*8 :: orbrzv_toric_Prftot0(15)  ! (1:mibs)
    default value: 0.0
      !! total power calculated by toric in the previous step
 
  REAL*8 :: orbrzv_toric_frnm
    default value: 1.0d0
      !! toric RF-field strength renormalizer
 
  REAL*8 :: xdatsf3
    default value: 0.0
      !! source magnitude (n/sec) used to renormalize He3 fusion
      !! product source profile from previous timestep
      !! only applies if nlusf3.and.nlfhe3 both .TRUE.
 
  REAL*8 :: xdatsfa
    default value: 0.0
      !! source magnitude (n/sec) used to renormalize alpha fusion
      !! product source profile from previous timestep
      !! only applies if nlusfa.and.nlfhe4 both .TRUE.
 
  REAL*8 :: xdatsft
    default value: 0.0
      !! source magnitude (n/sec) used to renormalize triton fusion
      !! product source profile from previous timestep
      !! only applies if nlusft.and.nlfst both .TRUE.
 
  REAL*8 :: xdatsfp
    default value: 0.0
      !! source magnitude (n/sec) used to renormalize proton fusion
      !! product source profile from previous timestep
      !! only applies if nlusfp.and.nlfsp both .TRUE.
 
  REAL*8 :: plfhe3
    default value: 100.0d0
      !! (watts) threshhold power above which full Monte Carlo
      !! statistics (NPTCLF particles) are assigned to model the
      !! slowing down of the He3 fusion product ion population
 
  REAL*8 :: plfhe4
    default value: 10000.0d0
      !! (watts) threshhold power above which full Monte Carlo
      !! statistics (NPTCLF particles) are assigned to model the
      !! slowing down of the He4 (alpha) fusion product ion population
 
  REAL*8 :: plfst
    default value: 100.0d0
      !! (watts) threshhold power above which full Monte Carlo
      !! statistics (NPTCLF particles) are assigned to model the
      !! slowing down of the triton fusion product ion population
 
  REAL*8 :: plfsp
    default value: 100.0d0
      !! (watts) threshhold power above which full Monte Carlo
      !! statistics (NPTCLF particles) are assigned to model the
      !! slowing down of the proton fusion product ion population
 
  REAL*8 :: cxsplt
    default value: 2.0d0
      !! charge exchange model: splitting factor, tracks per event.
 
  REAL*8 :: dxbsmoo
    default value: 0.05d0
      !! smoothing parameter: half-width of triangular hat
      !! function convolution smoothing, in x=sqrt(phi/philim)
      !! applied to all output profiles
      !! NOTE: if dxbsmoo.gt.0 a spline method will be applied
      !!   to integrated profiles; if dxbsmoo.le.0 a piecewise
      !!   linear method will be applied.  Thus:
      !!      dxbsmoo .le. 0 ==> PBI is a step function
      !!      dxbsmoo .gt. 0 ==> PBI is piecewise quadratic, C1.
      !!   which follows because the integrated profile is
      !!   differenced to get the local value.
 
  REAL*8 :: dxbsm_nc
    default value: 0.0d0
      !! (Not currently active -- left in namelist for backwards
      !! compatibility and possible later use).
      !! original intent:
      !! dxbsm_nc smoothing parameter (like dxbsmoo) for nclass
      !! profile outputs only.  Actual smoothing for these
      !! profiles will be based on max(abs(dxbsmoo),abs(dxbsm_nc));
      !! spline or linear treatment still controlled by sign of
      !! dxbsmoo; effect is optional extra smoothing for nclass
      !! outputs. NO more active MG dec.09,2008
 
  REAL*8 :: xpand_nptcl
    default value: 3.0d0
      !! If xpand_nptcl.gt.0.5 it will be a limit
      !! of the total growth of the particle list
      !! after this limit (> (1.0+xpand_nptcl)*NPTCLS )
      !! revert to Russian Roulette.
      !! For xpand_nptcl.le.0.5	 it will be a fraction by which
      !! nptcl{*} can expand during
      !! deposition (see below) to avoid Russian Roulette (min val 0.05d0)
      !! (max val 0.5d0).
      !! (max(nptcls,nptclf,nptclh,nptcl_max)+1000)*1.1d0
      !! *(1+xpand_nptcl+frac_orbrr)
 
  REAL*8 :: frac_depmax
    default value: 0.25d0
      !! max fraction of nptcl{*} # of MC ptcls that can be
      !! deposited in a single step (min accepted val 0.1d0)
 
  REAL*8 :: frac_dep_lim
    default value: 1.5d0
      !! nptcl{*} # of MC ptcls that can be
      !! deposited in a single step
      !! is max(1,nptcls*min(1,delt/<tau_sl>*frac_dep_lim))
 
  REAL*8 :: frac_depmin
    default value: 0.01d0
      !! min fraction of nptcl{*}, min # of MC ptcls to
      !! deposit in a single step (btw 0.0 and 0.1d0)
 
  REAL*8 :: frac_orbrr
    default value: 0.10d0
      !! fraction of population needing to be "underweight"
      !! before application of Russian Roulette in orball routine
      !! accepted values betwe 0.05d0 and 0.5d0.
 
  REAL*8 :: AIMP
    default value:    16.D0
      !! ATOMIC WEIGHT OF IMPURITY, for tokamakium model only
 
  REAL*8 :: XZIMP
    default value:    8.D0
      !! IMPURITY ATOMIC NUMBER, for tokamakium model only
 
  REAL*8 :: BI_MAX_PL
    default value:  1.D0
      !! factor for an E_PLL component in bi-Maxwellian FI distribusion
 
  REAL*8 :: BI_MAX_PR
    default value:  1.D0
      !! factor for an E_Perp component in bi-Maxwellian FI distribusion
 
  REAL*8 :: wghta
    default value: 1.0d0
      !! weight profile adjustment.  Larger values of WGHTA result
      !! in more particles with less weight per particle in the core
      !! and fewer particles with more weight per particle at the
      !! edge.  (dimensionless).
      !!   wghta.ge.1.0 enforced; wghta.le.nzones enforced.
      !!!! Larger WGHTA -> better statistics at core, worse at edge
      !!!! Smaller WGHTA -> better statistics at edge, worse at core
 
  REAL*8 :: goocon
    default value: 10.0d0
      !! "goose" control -- strong affect on runtime!
      !! #bounces computed per min(tau(slow),tau(P.A.scatter),tau(cx)).
      !! magnitude of constraint is quadratic for diffusive processes.
      !! see also NGOOCON controls; if any of the NGOOCON controls have
      !! greater than their default values, an upper limit of 1.0d-4 is
      !! imposed on DT_ACC; otherwise upper limit of 1.0d-3 is allowed.
 
  REAL*8 :: cxpcon
    default value: 20.0d0
      !! adjustment on frequency of calls to charge exchange
      !! operator during slowing down.  Higher number --> more calls
      !! default value generally OK.
 
  REAL*8 :: fppcon
    default value: 8.0d0
      !! adjustment on frequency of calls to collision operator
      !! per orbit half-bounce during slowing down.  Higher number
      !! --> more calls; default value generally OK.
      !! if nclass is set, the number is increased to at least
      !! 20.0d0
 
  REAL*8 :: fdtnxy
    default value: 0.5d0
      !! reduction factor for orbit timesteps near the axis
      !! where a pseudo x-y space instead of a polar space is used
      !! to avoid effects of the axial singularity.  Default OK.
 
  REAL*8 :: dtn
    default value: 0.0
      !! ***orbit timestep adjustment parameter*** if left to zero
      !! an automatic timestep will be selected and adjusted based
      !! on orbit integration error analysis.  If set, constraints
      !! will be applied, and the time step will still be adjusted
      !! based on the error analysis.  General advice: leave at
      !! zero.  (dtn, seconds).
 
  REAL*8 :: dt_acc
    default value: 1.0d-4
      !! orbit accuracy criterion -- orbit timesteps adjusted so
      !! that error delta(E)/Einj (and a similar measure for momentum)
      !! is less than dt_acc per half bounce; another criterion
      !! is that there be at least 10 steps per half bounce so
      !! that goosing & timestep adjustment algorithms have
      !! enough data to work.
      !!    dt_acc<=0.0 => no adjustment (old constant dtn used).
      !! if dt_acc > 0, 1.0e-6 <= dt_acc <= 1.0e-3 is enforced.
      !! an upper limit of 1.0e-3 is enforced unless GOOCON controls
      !! are increased from their default values in which case the
      !! upper limit is 1.0e-4
 
  REAL*8 :: orbrzv_zzerr_con
    default value: 1.0e-4
      !! relative error control criterion
      !! 1.0D-4 does very expeditious job
 
  REAL*8 :: xdepmod
    default value: 1.0d0
      !! anomalous opacity adjustment
      !! this applies a multiplicative factor to all stopping
      !! cross sections.
 
  REAL*8 :: xcfanbi
    default value: 1.0d0
      !! anomalous multiplier: electron drag and energy
      !! diffusion on beam ions
 
  REAL*8 :: xdfanbi
    default value: 1.0d0
      !! anomalous multiplier: ion drag and energy
      !! diffusion on beam ions
 
  REAL*8 :: xefanbi
    default value: 1.0d0
      !! anomalous multiplier: pitch angle scattering on
      !! beam ions
 
  REAL*8 :: xcfafus
    default value: 1.0d0
      !! anomalous multiplier: electron drag and energy
      !! diffusion on fusion product ions
 
  REAL*8 :: xdfafus
    default value: 1.0d0
      !! anomalous multiplier: ion drag and energy
      !! diffusion on fusion product ions
 
  REAL*8 :: xefafus
    default value: 1.0d0
      !! anomalous multiplier: pitch angle scattering on
      !! fusion product ions
 
  REAL*8 :: gflr_min
    default value: 0.0
      !! for nlbgflr=.TRUE., if the guiding-center estimate
      !! of larmor radius, in cm, is less than this, revert
      !! to the standard guiding-center based treatment (to
      !! save computational effort).
 
  REAL*8 :: gflr_rl
    default value: 1.0d6
      !! nlbgflr=.TRUE. expert control (do not touch)
 
  REAL*8 :: gflr_ll
    default value: 30.0d0
      !! nlbgflr=.TRUE. expert control (do not touch)
 
  REAL*8 :: gflr_xv(2)  ! (1:2)
    default value:  (/1.5d0, 0.4d0/)
      !! nlbgflr=.TRUE. expert controls (do not touch)
 
  REAL*8 :: gflr_op(15)  ! (1:15)
    default value:  (/0.d0,1.d-4,1.d-5,0.d0,3.d0,10.d0,1.d0,0.2d0,0.05d0,1.d0,2.d0,0.d0,0.d0,0.d0,0.d0/)
      !! nlbgflr=.TRUE. expert controls (do not touch)
 
  REAL*8 :: xswfrac_allfast
    default value: 1.0d0
      !! fraction multiplier -- fast ions participating
      !! in sawtooth mixing
 
  REAL*8 :: xswfrac_beam
    default value: 1.0d0
      !! fraction multiplier -- beam ions participating
      !! in sawtooth mixing: net xswfrac_allfast*xswfrac_beam
 
  REAL*8 :: xswfrac_fusn
    default value: 1.0d0
      !! fraction multiplier -- fusn prod ions participating
      !! in sawtooth mixing: net xswfrac_allfast*xswfrac_fusn
 
  REAL*8 :: fporcelli
    default value: 1.0d0
      !! (if nmix_kdsaw = 3 or 4) interior fractional
      !! width of q=1 island towards the magnetic axis;
      !! fporcelli=1 means island reaches all the way to
      !! axis => Kadomtsev-like mixing.
      !!   0.0 <= fporcelli <= 1.0
      !! smaller Porcelli fractions => smaller mixing
      !! region, but the region from the axis to the q=1
      !! surface is always mixed.
      !! -------> see KDSAW NTCC MODULE documentation
 
  REAL*8 :: AEP_ASCALE(10)  ! (1:mnkaep)
    default value:  0.0d0
      !! scaling factor for mode amplitudes in  MHD transport operator (Mario Podesta)
 
  REAL*8 :: AEP_USCALE
    default value:  1.0d0
      !! scaling factor for electrical potential for MHD transport operator (Mario Podesta)
 
  REAL*8 :: TAEP_FAC
    default value:  0.0d0
      !! scaling factor to redefine time step for MHD transport operator (Mario Podesta)
 
  REAL*8 :: taurip
    default value: 0.0
      !! must be set if nrip=1: lint* readMyid0,oss time (sec) for trapped ions
 
  REAL*8 :: asrd
    default value: 0.0
      !! nrip=2 adjustment factor for fusion product ions
 
  REAL*8 :: bsrd
    default value: 0.0
      !! nrip=2 adjustment factor for beam ions.
 
  REAL*8 :: erngfi(10,15)  ! (1:nerngfi,1:mibs)
    default value: 0.0
      !! eV
      !! coarse energy bins for trapping fraction output profiles
      !! if nerngfi=1, there is one bin: [erngfi(1),infinity]
      !! if nergnfi>1, the bins are: [erngfi(1),erngfi(2)]
      !!                             [erngfi(2),erngfi(3)]
      !!                               ...
      !!                             [erngfi(nerngfi),infinity]
 
  REAL*8 :: fbemin
    default value: 0.0
      !! minimum energy (eV) of affected ions
 
  REAL*8 :: fbemax
    default value: 0.0
      !! maximum energy (eV) of affected ions
 
  REAL*8 :: fvpvmn
    default value:  0.0d0
      !! minimum midplane |vpll/v| of affected ions
 
  REAL*8 :: fvpvmx
    default value:  0.0d0
      !! maximum midplane |vpll/v| of affected ions
 
  REAL*8 :: fbltim
    default value:  1.0d-7
      !! average loss time (seconds) of affected ions
 
  REAL*8 :: fshper
    default value:  5.0d-3
      !! fishbone period (cycle time, seconds)
 
  REAL*8 :: fshwid
    default value:  1.0d-3
      !! fishbone duration (seconds)
 
  REAL*8 :: tfshon
    default value:  -1000.0
      !! fishbone onset time (seconds) default always on
 
  REAL*8 :: tfshof
    default value:  +1.0d34
      !! fishbone stop time (seconds) default always on
 
  REAL*8 :: xfishmin
    default value:  0.0d0
      !! min (x) where fishbones have an effect
 
  REAL*8 :: xfishmax
    default value:  1.0d0
      !! max (x) where fishbones have an effect
      !! (x) the usual sqrt(tor.flux) normalized coordinate; average position
      !! data from last half orbit is used.
 
  REAL*8 :: fbtrap_depth
    default value: 0.0
      !! trapping depth threshold (nfbon_vpvopt = 1 only)
      !! an orbit is considered trapped if either:
      !!    (a) max(|B|) over orbit half-bounce > max(|B1|,|B2|)
      !!        where B1 and B2 are taken at the midplane crossings (all
      !!        |B|s are guiding center values), or,
      !!    (b) the orbit never reaches the midplane after a multiple of
      !!        tau_bounce has been exceeded (i.e. ST equilibria off-midplane
      !!        trapped orbit class).
      !! IF an orbit is deemed trapped, then, its trapping depth is defined as
      !!        d = (Bmax(psi_avg)-max(|B|)_orb)/(Bmax(psi_avg)-Bmin(psi_avg))
      !! and it is considered eligible for fishbones if d >= fbtrap_depth.
      !! Here, psi_avg is the "average" flux surface seen by the orbit, defined
      !! as 1/2(psi_min+psi_max), where the min and max values are taken over
      !! the last half bounce;
      !!
      !! note that 0 < d < 1 is expected, and is enforced with min & max
      !! functions, as the limits could be exceeded slightly due to the
      !! psi_avg calculation procedure.
 
  REAL*8 :: xninja_box(100)  ! (1:nbbox)
    default value: 0
      !! NO. OF PTCLS COMING IN Ith BOX  N/SEC
 
  REAL*8 :: xninjs_box(100)  ! (1:nbbox)
    default value: 0
      !! n/sec NO. of beam ptcls.injected, by species for BOXes subset only
 
  REAL*8 :: xninj_box
    default value: 0
      !! NO. OF PTCLS INJECTED N/SEC for BOXes subset only
 
  REAL*8 :: xboxhw
    default value: 5.0d0
      !! (cm) half-width of entire Cartesian box in x direction
      !! individual bins' x width = 2*xboxhw/nxbox
 
  REAL*8 :: yboxhw
    default value: 5.0d0
      !! (cm) half-height of entire Cartesian box in y direction
      !! individual bins' y width = 2*yboxhw/nybox
 
  REAL*8 :: xlbox1
    default value: 100.0d0
      !! (cm) distance from beam source at which box starts
 
  REAL*8 :: xlbox2
    default value: 500.0d0
      !! (cm) distance from beam source at which box ends
      !! individual bins' l length = (xlbox2-xlbox1)/nlbox
 
  REAL*8 :: Rtube(200)  ! (1:nbtube)
    default value: 0.
      !! radial coordinate of start of tube (cm)
 
  REAL*8 :: Ytube(200)  ! (1:nbtube)
    default value: 0.
      !! vertical (z-axis) coordinate of start of tube (cm)
 
  REAL*8 :: XZETAtube(200)  ! (1:nbtube)
    default value: 0.
      !! angular coordinate of start of tube (degrees)
 
  REAL*8 :: PHItube(200)  ! (1:nbtube)
    default value: 0.
      !! tube's sightline azimuthal angle from start of tube measured from
      !! the centerline with the positive direction in direction of the
      !! plasma current (degrees)
 
  REAL*8 :: THETAtube(200)  ! (1:nbtube)
    default value: 0.
      !! tube's sightline elevation angle from start of tube measured from
      !! the midplane (degrees)
 
  REAL*8 :: XL1tube(200)  ! (1:nbtube)
    default value: 0.
      !! tube data will be collected between XL1tube and XL2tube along sightline.
      !! this is the distance at which data will begin to be collected (cm)
 
  REAL*8 :: XL2tube(200)  ! (1:nbtube)
    default value: 0.
      !! tube data will be collected between XL1tube and XL2tube along sightline.
      !! this is the distance at which data will stop being collected (cm)
 
  REAL*8 :: RHOtube
    default value:  1.d0
      !! radius of the tubes (cm) -- note that the number of trajectories used to
      !! compute the neutral particle density (tuben0) is inversely proportional
      !! to the tube radius.
 
  REAL*8 :: edbfac
    default value: 10.0d0
      !! debug tripwire -- if an ion reaches edbfac x its initial
      !! deposition energy, kill the run. (dimensionless).
 
  INTEGER :: nonlin
    default value: 6
      !! unit number for messages.
 
  INTEGER :: nseed
    default value: 1
      !! random number seed; default not recommended!
 
  INTEGER :: nlbout
    default value: .TRUE.
      !! .TRUE. (1) to turn on "lost particle" output data accumulation
 
  INTEGER :: lunnbx
    default value: 0
      !! unit number for "lost particles" ascii output file
      !! (will be used if ref_namelist=T is set, see below).
      !! if lunnbx<=0 or lunnbx>99, an available I/O unit is
      !! selected automatically.
 
  INTEGER :: lunres
    default value: 0
      !! auxilliary unit number for ascii file i/o -- supports
      !! debug restarts and restarts of "lunnbx" file.
      !! **** this LUN will be used **** even if .NOT.NLBOUT.
      !! if lunres<=0 or lunres>99, an available I/O unit is
      !! selected automatically.
 
  INTEGER :: mrstrt
    default value: 1
      !! set to zero if there are *no* check-point / restart files
      !! (a property of the driver code).
      !! this changes the way the NB.OUT file is handled, and may
      !! have other effects in the future.
 
  INTEGER :: nclass
    default value: 0
      !! set =1 to activate beam-by-beam full:half:third
      !! energy species resolved profiles of n, Pbe, Pbi,
      !! <v.B>, <(vcrit**3/v**3)v.B> (lab frame v.B) for NCLASS
      !! fast ion interface -- see nclass output block.
      !! *** warning *** dmc Dec 2003 -- definition and
      !! construction of nclass=1 outputs is not yet complete ***
 
  INTEGER :: only_io
    default value: .FALSE.
      !! set .TRUE. (1) when calling NUBEAM from a serial driver that
      !! will use a separate MPI-parallel process to compute the
      !! fast ion evolution.  In this mode, only the input and
      !! output structures are allocated-- NOT the large internal
      !! computational structures.  The following routines are
      !! NOT available in this mode:  NBI_INTERP_PROFILES,
      !! NBSTART, DEPALL, ORBALL, FI_FINISH; instead the timestep
      !! advance sequence is:
      !!    CALL NUBEAM_WRITE_INPUT(...)
      !!     (invoke local procedure for calling parallel NUBEAM
      !!     as separate process)
      !!    CALL NUBEAM_READ_OUTPUT(...)
      !! these calls are more fully explained elsewhere.
 
  INTEGER :: ref_namelist
    default value: .FALSE.
      !! NOTE: this is a legacy feature -- mothballed!
      !! set .TRUE. (1) to write a reference namelist
 
  INTEGER :: quasi_check
    default value: .TRUE.
      !! .TRUE. to check quasineutrality of density input profiles
      !! (can set .FALSE. to disable test, but this can be dangerous!)
 
  INTEGER :: nltest_output
    default value: .TRUE.
      !! Set .FALSE. (0) to suppress NBSTART output of interim state
      !! data for nubeam_test time step debug rerun capability
      !! (suppress e.g. to optimize NUBEAM mpi scaling).Default - .TRUE.
      !! debug_mpi= nltest_output for
      !! MPI job debugging
      !! debug_mpi   =.FALSE. for serial mode
      !! see below
      !! in TRANSP  analog of this switch is nlnbi_test_out
 
  INTEGER :: BLK_MPI_BCAST_INT
    default value:  2000000
      !! default value for size of a block of integer variables to be used
      !! for MPI communications (bytes)
 
  INTEGER :: BLK_MPI_BCAST_R8
    default value:   30000000
      !! default value for size of a block of real variables to be used
      !! for MPI communications (bytes)
 
  INTEGER :: nzones
    default value: 0
      !! number of radial zones (equally spaced in sqrt(tor.flux))
      !! this determines the grid for calculation of 1d outputs
      !! such as Pbe and Pbi; must be set to a number .le. mj-3
      !! where "mj" is a user supplied array dimension.
      !! NOTE: not included in Plasma_State_Input, because this
      !! value is used to **set** the plasma state rho_nbi grid.
 
  INTEGER :: nzone_fb
    default value: 0
      !! number of radial zones in 4d fast ion distributions
      !! (r,theta,E,vpll/v).  nzones should be an integer multiple
      !! of nzone_fb; if not, nzone_fb is increased until this
      !! condition is satisfied, or if this is not possible,
      !! nzone_fb=nzones is imposed.  Note: if id_mcgrid is set,
      !! nzone_fb is reset to match the 2d GRID in xplasma.
 
  INTEGER :: nlsym2b
    default value:  .FALSE.
      !! .TRUE. (1) to treat fast ion dist. fcn. as up-down symmetric.
      !! Note: if id_mcgrid is set, this is overridden by the 2d
      !! "irregular" grid in xplasma.
 
  INTEGER :: nth0
    default value:  2
      !! number of poloidal zones subtending [0:pi] in the first
      !! radial zone row adjacent to the magnetic axis.
      !! Note: if id_mcgrid is set, this is overridden by the 2d
      !! "irregular" grid in xplasma.
 
  INTEGER :: xplasma_in_memory
    default value: 0
      !! if >0, assume "old_xplasma" shared xplasma
      !! object has been prepositioned by caller to receive NUBEAM
      !! output; if =0, just use "old_xplasma" object; if <0, save
      !! old xplasma object for later restoration.
      !!   ** most users should never touch this **
 
  INTEGER :: nznbma
    default value: 50
      !! number of pitch angle zones for distribution functions
      !! this is the same for all NUBEAM fast ion species
 
  INTEGER :: nznbme
    default value: 100
      !! number of energy zones for beam ion distribution functions
      !! note for fusion product species the number of energy zones
      !! is always equal to the maximum, mimxbe, regardless of the
      !! nznbme specification for beam species.
 
  INTEGER :: nznbma0
    default value: 10
      !! number of pitch angle zones for neutrals
 
  INTEGER :: nznbme0
    default value: 50
      !! number of energy zones for neutrals
 
  INTEGER :: ngyro
    default value: 4
      !! NUMBER OF poloidal AIMING ANGLE ZONES, BEAM F-DIST. CALC.
      !! atan2(V_Z,V_R)-atan2(B_Z,B_R)
      !! must be > 0
      !! for ngyro=4
      !! zone 1 -- [-pi/4,pi/4] 	always means perpendicular to the flux surface and outward
      !! zone 2 -- [pi/4,3/4pi]  is tangential to the flux surface with an inward FLR displacement to GC
      !! zone 4 -- [-pi/4,-3/4pi] is tangential to the flux surface with an outward FLR displacement to GC
      !! zone 3 -- [3pi/4,-3/4pi] is perpendicular and inward
 
  INTEGER :: nlusf3
    default value: .FALSE.
      !! .TRUE. (1) to set He3 fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nlusfa
    default value: .FALSE.
      !! .TRUE. (1) to set alpha fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nlusft
    default value: .FALSE.
      !! .TRUE. (1) to set triton fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nlusfp
    default value: .FALSE.
      !! .TRUE. (1) to set proton fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nlfatom
    default value: .TRUE.
      !! .FALSE. (0) to suppress atomic physics calculations on
      !! slowing down fusion product ions (recommendation:
      !! leave this switch alone).
 
  INTEGER :: nlbfpp
    default value: .FALSE.
      !! set .TRUE. (1) if beam slowing down is to be modeled using
      !! a fokker planck code, in which case the Monte Carlo code
      !! will be used to calculate deposition only
      !! NOTE: this feature NOT implemented DMC May 2007
 
  INTEGER :: nptcls
    default value: 1000
      !! number of Monte Carlo particles per (normal) beam ion specie
      !! affects statistics of slowing down calculation
 
  INTEGER :: nptclf
    default value: 1000
      !! number of Monte Carlo particles per fusion product specie
      !! affects statistics of slowing down calculation
 
  INTEGER :: nptclh
    default value: 500
      !! number of Monte Carlo particles per heavy beam ion specie
      !! affects statistics of slowing down / stripping calculation
 
  INTEGER :: NFAST_MAP
    default value: 1
      !! in NUBEAM only: NFAST_MAP=1 - use bilinear maps to evaluate
      !! R,Z coordinates and 2x2 Jacobian,
      !! if NFAST=0 - use xplasma spline maps with tol=1.e-6 (~1.5 slower)
 
  INTEGER :: nptcl_max
    default value: 0
      !! max number of Monte Carlo particles of any type that will
      !! ever be requested; max(nptclh,nptclf,nptcls,nptcl_max) is
      !! used.
 
  INTEGER :: nltrk_dep0
    default value: .FALSE.
      !! .TRUE. (1) to save details of ndep0 beam neutral tracks
 
  INTEGER :: NLDEP0_GATHER
    default value:  .FALSE.
      !! IF .TRUE. fast ion birth source data (in NUBEAM_COMP_EXEC)
      !! will be collected for all time steps or only for the last one
      !! if NLDEP0_GATHER = .false.
      !! The output files <RINID>_nubeam_birth.cdf<nn> will be kept in
      !! main directory from where program was started (in NUBEAM_COMP_EXEC).
 
  INTEGER :: ndep0
    default value: 500
      !! minimum number of deposition tracks per beam ion specie--
      !! also, the number of tracks gathered, if deposition
      !! distribution data is saved for output, i.e. if
      !! nltrk_dep0 is .TRUE.
      !! Regardless of nltrk_dep0, This control
      !! affects statistics of deposition calculations (e.g.
      !! cold electron source, CX neutral sources, etc.).
      !! In an MPI run this value may be adjusted to be an exact
      !! multiple of the number of processors used.
      !! When deposition track data is gathered, there is an
      !! option to restrict the gathering to a single specific
      !! beam injector, or even a specific energy fraction for
      !! single injector.  (See ndep_set_beam and ndep_set_ien
      !! controls).  But, if this is done, the beam current
      !! fraction (call it f) of the selected beam injector can
      !! come into plan in determining the track data gathering.
      !! If f < 10%, the tracks gathered will be
      !!    ndep0_use = min(ndep0,f*ndep0_max)
      !! if f < 1%, the restriction to the selected beam subset
      !! is aborted, and data, ndep0 tracks, are gathered on
      !! all beam lines.  f is output as frac_cur_dep0.
 
  INTEGER :: NDEP0_MAX
    default value:    100000
      !! approximate max # of tracks to compute, when
      !! track data is gathered for only a single beam or
      !! single beam energy fraction-- used if the selected
      !! beam current fraction f is < 10%.
 
  INTEGER :: ndep_set_beam
    default value: 0
      !! beam source # to which deposition data will be gathered
      !! (must be in range 0 to mib).  Default is 0:
      !! 0 - means gather data for all available beame source
      !! if ndep_set_beam set 0, then ndep_set_ien must be set 0.
      !! If beam source# was incorrectly set, then a warning is
      !! printed, and ndep_set_beam=0 is enforced.
      !! If there is no particle current for requested beam or
      !! this current is less than 1% of total ptcl. current then
      !! collect track data for all beam sources and energy fractions
      !! (i.e. revert to ndep_set_beam=0 mode).
      !! If particle current for requested beam is less than 10%
      !! of total ptcl. current - the number of tracks collected
      !! is adjusted to min(NDEP0,f*NDEP0_MAX), where f is the beam
      !! current fraction for the selected beam, relative to the
      !! total summed over all beams.
 
  INTEGER :: ndep_set_ien
    default value: 0
      !! energy fractions to be used when gathering deposition data
      !! for a given beam source (ndep_set_beam .gt. 0).
      !! 1 - full energy fraction
      !! 2 - half energy fraction
      !! 3 - one third energy
      !! 0 - for all energy fraction
      !! if energy fraction# was incorrect set data is collected
      !! for all energy fractions.
      !! For beams without energy fractions (i.e. Helium neutral
      !! beams or high energy negative ion based H/D/T beams),
      !! this control is ignored.
 
  INTEGER :: nbbcal
    default value: 1000000
      !! number of interactions for [fast ion] - [fast ion]
      !! fusion rate Monte Carlo integrals-- affects statistics
      !! of this component of fusion product and neutron source
      !! calculation
 
  INTEGER :: ncx0
    default value: 100
      !! the total number of CX tracks, independent control of CX statistics
      !! if ncx0 = 0, then it will be no fbm_cx gathered and CX statistics will not be
      !! improved
 
  INTEGER :: nper_cx
    default value: 4
      !! the  number of gyro phase angles between [0,2*pi] will be used for CX statistics improvement
      !! if ncx0 > 0 , nper_cx=max(1,nper_cx)
 
  INTEGER :: LEV_NBIDEP
    default value:  1
      !! beam "deposision" model level:
      !! 1 -- legacy of PREACT atomic physics
      !! 2 -- ADAS atomic physics for H and He beams.
      !!      He beam -- only ground state model available
      !! 3 -- PREACT ground state atomic physics
      !!      ADAS interaction with impurities
      !! 4 -- ADAS ground state atomic physics
      !!      PREACT interaction with impurities
 
  INTEGER :: LEVMOD_HALO
    default value:  0
      !! 0 -- driver program calls FRANTIC (default)
      !! 1 -- FRANTIC will be called in NUBEAM
      !! 2 -- 3d halo model will be called in NUBEAM
      !!      for 3d halo model NSPLT_GEO and NSPLT_KIN have to be set
      !!      or default values will be used
      !!      as 3d halo model is a 'beam in box' then
      !!      NBSBOX, NBEBOX, NXBOX, NYBOX, NLBOX, NDEPBOX etc. have to be set
 
  INTEGER :: NSPLT
    default value:  100
      !! activated in case LEVMOD_HALO=2
      !! max allowed spliting along each neutral track (3D halo model),
      !! NSPLT must be >= NSPLT_GEO* NSPLT_KIN
      !! if NSPLT < 0 then it  maybe use to gather 3d density 0 generation of neutrals, only
 
  INTEGER :: NSPLT_GEO
    default value:  1
      !! activated in case LEVMOD_HALO=2, and NSPLT > 0
      !! max allowed spliting along each neutral track (3D halo model),
      !! max allowed geometrical spliting along each neutral track (3D halo model)
      !!
 
  INTEGER :: NSPLT_KIN
    default value:  1
      !! activated in case LEVMOD_HALO=2, and NSPLT > 0
      !! max allowed spliting along each neutral track (3D halo model),
      !! max allowed kinetic spliting at each CX launch point; # of velocities
      !! that are sampled from eligible ion populations (3D halo model)
 
  INTEGER :: NSPLT_GEN
    default value:  1
      !! # of halo generation to be splitted at the
      !! rate NSPLT_KIN * NSPLT_GEO, and for higher generation will be no additional
      !! splitting made.  If NSPLT_GEN = 0, all halo generation will be splitted at the
      !! rate NSPLT_KIN * NSPLT_GEO. Activated in case LEVMOD_HALO=2, and NSPLT > 0
 
  INTEGER :: nmimp
    default value:  1
      !! 1 -> using multiple impurities
      !! 0 -> using single tokamakium impurity
 
  INTEGER :: NTEST_MAX
    default value:  0
      !! set 1 to simulate bi-Maxwellian FI distribusion;
      !!  -1 to skip re-normalization of electric field from TORIC
      !! in RF kick off operator in NUBEAM for bi-Maxwellian FI distribusion;
      !! -10 to skip re-normalization of electric field from TORIC
      !! in RF kick off operator in NUBEAM for realistic FI distribusion
      !! this switch may be used for standalone nubeam_comp_exec program
      !! and can be modified through nubeam_comp_exec namelist
      !! 10 same as default but extra output files will be saved to be used in TORIC:
      !! some variables on sqrt(norm poloidal flux)
 
  INTEGER :: NGOOCON_VPVBIN
    default value:  0
      !! min #bounces per FBM pitch zone width P.A. scatter
      !! setting NGOOCON_VPVBIN constrains tau(bounce)/tau(P.A.scatter) by
      !! a factor of 4/(NGOOCON_VPVBIN**2*NZNBMA**2)
      !! a limit that scales as 1/(nznbma**2) on goosing is imposed if .gt.0
      !! Caution: setting this may slow the code considerably.
 
  INTEGER :: NGOOCON_EBIN
    default value:  1
      !! min #bounces per FBM energy zone width slowing down
      !! additional linear constraint on tau(bounce)/tau(slowing-down)
      !! a limit that scales as 1/nznbme on goosing is imposed
 
  INTEGER :: NGOOCON_RBIN
    default value:  1
      !! min #bounces per zone width radial transport
      !! linear constraint on tau(bounce)/tau(radial-flow)
      !! quadratic constraint on tau(bounce)/tau(radial-diffusion)
      !! limits that scale as 1/(nzone_fb) and 1/(nzone_fb**2) are imposed.
 
  INTEGER :: ndtorb
    default value: 4
      !! orbit timestep control algorithm selection switch;
      !! default value should be used.
 
  INTEGER :: nchdvp
    default value: 3
      !! orbit integrator options:
      !!  =1: enforce exact conservation of angular momentum
      !!  =2: enforce exact conservation of energy
      !!  =3: (recommended) obtain good but not exact conservation
      !!      of both quantities.
 
  INTEGER :: orbrzv_option
    default value: 0
      !! option to switch on & off ORBRZ(RZ-integrator) and ORBG
 
  INTEGER :: orbrzv_rf_option
    default value: 0
      !! option to switch on & off Monte-Carlo RF calculation
 
  INTEGER :: nlmcrf_on
    default value: .false.
 
  INTEGER :: orbrzv_nr
    default value: 160
 
  INTEGER :: orbrzv_nz
    default value: 160
      !! grid resolution for RZ-interpolation in ORBRZ
 
  INTEGER :: nlminsv
    default value: .TRUE.
      !! .TRUE. (1) to loop over all impurities when calculating
      !! impurity stopping cross section; .FALSE. to use an
      !! "average Z" single impurity simplifying approximation.
 
  INTEGER :: nlebei
    default value: .TRUE.
      !! .TRUE. (1) to include beam energy in approximate
      !! expression for <sigma*v> for electron impact ionization
 
  INTEGER :: nsigexc
    default value: 0
      !! NSIGEXC=0 means ground state model.
      !! NSIGEXC=1 means "appropriate applicable" excited states model:
      !! ADAS for LEV_NBIDEP=2 and
      !! Janev-Boley-Post for other values of LEV_NBIDEP=1
      !! NSIGEXC=2 means Janev-Boley-Post applied to any model including ADAS.
      !! Janev/Boley/Post article, Nucl. Fusion Vol.29, No. 12 (1989)
      !! NSIGEXC=3 means ADAS excited states model (adas310 library):
      !! ADAS for LEV_NBIDEP=2 and
 
  INTEGER :: nlbbcx
    default value: .TRUE.
      !! .FALSE. (0) to disable beam-beam charge-exchange and
      !! beam-beam impact-ionization contribution to deposition.
      !! This concerns beam neutrals being stopped by collisions
      !! with slowing down beam ions.
 
  INTEGER :: nbbcx_avg
    default value: 0
      !! use non average over the flux surface relative energy (ebb_rel_avg)
      !! and target temperature (rms_ebb_rel) for beam-beam reaction to calculate
      !! enhancement factor
      !! =1 then use average over the flux surface relative energy (ebb_rel_avgx)
      !! and target temperature (rms_ebb_relx)
      !! this switch is activated if nlbbcx = .TRUE.
 
  INTEGER :: nbbcx_bb
    default value: 0
      !! integer switch. If nbbcx_bb=0 then contribution from beam-beam reactions to the enhancement
      !! factor will be included in case if NLBBCX=.TRUE.
      !! If nbbcx_bb.ne.0  then contribution from beam-beam reactions to the enhancement
      !! factor will be NOT included even if NLBBCX=.TRUE.
 
  INTEGER :: nbfallgr
    default value: 0
      !! if set 1, then program will be stopped, if enhancement
      !! factor computed from ADAS data set became less than 1.0.
      !! This setting will be used for a debugging purposes.
      !! If set 0,then enhancement factor computed from ADAS data set
      !! will be forced to be 1.0 if it became less than 1.0. It means that
      !! ground state data will be used for this region.
      !! This switch will be used if nlbbcx=.true.
 
  INTEGER :: nlbeamcx
    default value: .TRUE.
      !! set .FALSE. (0) to disable beam charge exchange losses
      !! (if .FALSE. beamcx subroutine is never called).  For
      !! technical reasons nlbeamcx=.FALSE. implies nlbbcx=.FALSE.
      !! but cx stopping of neutral beams on thermal species still
      !! occurs, and a beam halo neutral source is still computed.
      !! Caution: nb*sigma*v ionization rate profile for background
      !! neutrals will be ZERO if nlbeamcx=.FALSE. -- this is for
      !! debugging only!
 
  INTEGER :: nlhvion
    default value: .TRUE.
      !! this switch only used for heavy neutral beam deposition
      !! (i.e. experiments using neutral beams to inject Argon or
      !! Neon-- very rare).  If set .TRUE. (1), ion collisions are used
      !! in calculating the stripping of the deposited heavy ion; if
      !! .FALSE. (0) only electron collisions are used.  For ordinary
      !! (Hydrogen or Helium) beams this switch has no effect.
 
  INTEGER :: nlbcde
    default value: .true.
      !! .FALSE. (0) to turn off energy diffusion
 
  INTEGER :: nlbcoh
    default value: .true.
      !! .FALSE. (0) to suppress acceleration of beam ions by
      !! toroidal electric field
 
  INTEGER :: nlbcpa
    default value: .true.
      !! .FALSE. (0) to turn off pitch angle scattering
 
  INTEGER :: nlorbo
    default value: .false.
      !! .TRUE. (1) for "orbit only" mode: suppress all collisions
      !! used only in specialized debugging situations.
 
  INTEGER :: nlbflr
    default value: .TRUE.
      !! .TRUE. (1) for standard FLR treatment, based on a mod(B)
      !! at guiding center and notion of a FLR circle about
      !! the guiding center, upon which a random gyro-phase
      !! angle is taken to define the current particle position.
 
  INTEGER :: nlfbmflr
    default value: .TRUE.
      !! .TRUE. (1) to use the FLR localized fast ion
      !! distribution for beam-beam neutron calculations.
      !! Note that recent code changes (by Marina Gorelenkova)
      !! ensure that both an FLR and a GC localized fast ion
      !! distribution are computed and output on every run.
 
  INTEGER :: nlbgflr
    default value: .FALSE.
      !! .TRUE. (1) for enhanced FLR treatment
      !! this deforms the FLR trajectory by looking at the
      !! variation of mod(B) in the guiding center vicinity,
      !! and is appropriate when the larmor radius is >~ L(B)
      !! e.g. in low field systems such as STs.  **but** this
      !! option is extremely expensive computationally!
 
  INTEGER :: sawflag
    default value: .FALSE.
      !! set .TRUE. (1) if sawtooth occurred since prior step
      !! (this means: apply previously calculated sawtooth
      !! mixed new start coordinates when restarting partially
      !! slowed down orbiting ions).
 
  INTEGER :: nlsawb
    default value: .TRUE.
      !! if .TRUE. (1) calculate sawtooth mixing of beam ions.
 
  INTEGER :: nlsawf
    default value: .TRUE.
      !! if .TRUE. (1) calculate sawtooth mixing of fusion products.
 
  INTEGER :: nmix_kdsaw
    default value: 1
      !! KDSAW (Kadomtsev/Porcelli) mixing model option
      !! =1: standard Kadomtsev
      !! =2: Kadomtsev, ions fully mixed => flat density
      !! =3: Porcelli, two mixing regions (island annulus +
      !!     interior axial region separately mixed).
      !! =4: Porcelli, ions fully mixed => flat density;
      !! -------> see KDSAW NTCC MODULE documentation
 
  INTEGER :: nkaep
    default value:  0
      !! number of terms (NK) in expansion of MHD transport operator (Mario Podesta)
 
  INTEGER :: ngradd_opt
    default value:  0
      !! grad(Db) pinch cancellation option
      !! 0, default, means automatic: active for 1d diffusivity
      !! profile inputs, inactive for 2d inputs.  Set =1 to force
      !! grad(Db) correction; set to -1 to force its absence.
 
  INTEGER :: nrip
    default value: 0
      !! =0: no ripple loss;  =1: simple "loss time" model
      !! =2: adjustable model based on Goldston-White-Boozer and
      !!     ripple field strength. CAUTION-- calibration against
      !!     a more exact model is needed.  PPPL expert help should
      !!     be sought before using this model
 
  INTEGER :: nerngfi
    default value: 1
      !! number of energy bins for trapping fraction output profiles
      !! generally only coarse binning is useful, e.g. nerngfi=5.
      !! the maximum allowed value is the (user settable) array
      !! dimension "miefi".
 
  INTEGER :: nsdbgb
    default value: 1
      !! index to fast ion specie selected for debug output
      !! (artifact-- not currently used).
 
  INTEGER :: nlfbon
    default value: .FALSE.
      !! .TRUE. to turn on fishbone loss model
      !! "fishbones" are an MHD phenomenon though to be capable
      !! of ejecting fast ions.
 
  INTEGER :: nfbon_vpvopt
    default value: 0
      !! =0: control vpll/v of affected ions with {fvpvmn,fvpvmx}
      !! =1: only operate on trapped ions with a trapping depth
      !!     exceeding the threshold fbtrap_depth (see descr.).
      !!     Note (fbemin,fbemax) constraints still apply.
 
  INTEGER :: nfbon_species
    default value: 3
      !! species control
      !!   =1 beam ions only
      !!   =2 fusion product ions only
      !!   =3 (default) all fast ions
 
  INTEGER :: nbbox
    default value: 0
      !! number of "beam-in-box" neutral density profile
      !! calculations
 
  INTEGER :: nbsbox(100)  ! (1:nbbox)
    default value: 0
      !! beam source numbers for neutral density calculation.
 
  INTEGER :: nsample_box(100)  ! (1:nbbox)
    default value: 0
      !! # of lanched MC particles in each box
 
  INTEGER :: nbebox(100)  ! (1:nbbox)
    default value: 1
      !! beam energy fractions, before which to compute a 3d
      !! neutral density profile on a Cartesian grid alligned
      !! on the beam centerline.
      !!   nbsbox(i)=j  nbebox(i)=k
      !! means the i'th neutral density calculation is done in
      !! front of beam source j, using energy fraction k (for H
      !! isotope beams k=1 means full energy, k=2 means half-
      !! energy, k=3 means 1/3 energy).
 
  INTEGER :: nxbox
    default value: 1
      !! number of bins in horizontal direction (x) in front of beam
 
  INTEGER :: nybox
    default value: 1
      !! number of bins in vertical direction (y) in front of beam
 
  INTEGER :: nlbox
    default value: 100
      !! number of bins in the direction (l) of beam injection
 
  INTEGER :: ndepbox
    default value: 500
      !! Monte Carlo statistics control:  minimum number of neutral
      !! tracks to use per calculation.
 
  INTEGER :: nbtube
    default value: 0
      !! number of beam-in-tube neutral density calculations
 
  INTEGER :: nbstube(200)  ! (1:nbtube)
    default value: 0
      !! tube beam source numbers
 
  INTEGER :: nbetube(200)  ! (1:nbtube)
    default value: 1
      !! beam energy fractions to be used when calculating neutral
      !! density
      !!   nbstube(i)=j  nbetube(i)=k
      !! means the i'th neutral density calculation is done in
      !! front of beam source j, using energy fraction k (for H
      !! isotope beams k=1 means full energy, k=2 means half-
      !! energy, k=3 means 1/3 energy).
 
  INTEGER :: LMIDtube(200)  ! (1:nbtube)
    default value: 0
      !! 0->tube data will be collected between XL1tube<s<XL2tube
      !! 1->tube data will be collected from XL1tube to XL2tube relative
      !!    to the point on the tube which is closest to the beam's sightline
 
  INTEGER :: NSEGtube(200)  ! (1:nbtube)
    default value: 100
      !! number of data segments between XL1tube and XL2tube in which to compute
      !! the neutral density data.  This number must be less then mituben.
 
  INTEGER :: NDEPtube
    default value: 500
      !! estimated number of beam intersections per tube assuming no beam loss and a tube
      !! perfectly centered within the beam aperture.  The number of trajectories which
      !! will be attempted will be  NDEPtube*sqrt(area_aperture)/2*RHOtube
 
  INTEGER :: nlcprb
    default value: .TRUE.
      !! set .FALSE. (0) to suppress compression operator and other
      !! effects of time varying MHD equilibrium on beam ions
      !! (recommendation: leave default, .TRUE., alone).
 
  INTEGER :: nlpsirz
    default value: .FALSE.
      !! set .TRUE. (1) if an accurate Psi(R,Z) (free boundary) MHD
      !! equilibrium, extending beyond the plasma boundary, is
      !! available.
 
  INTEGER :: nmcurb
    default value: 1
      !! set to 0 to suppress fast ion driven current.
      !! nmcurb=1 gives an aspect-ratio approximate neoclassical
      !! shielding calculation for the current; nmcurb=2 gives
      !! the simplified shielding correction (1-1/Zeff).
      !! nmcurb=3  gives neoclassical shielding calculation for the current
      !! by Lin-Liu formula Phys.Plasmas 4(11),p.4179, 1997. Other
      !! non-zero values of nmcurb give the same result as nmcurb=1
      !! (for now), but, a fully generalized geometry neoclassical
      !! shielding calculation will be implemented at some point
      !! in the future, and nmcurb=3 may be used to select this,
      !! when it exists.
      !! NMCURB  = 4, shielding calculation by Honda M., Kikuchi M., Azumi M.
      !! "Collisionality dependence on shielding factor of beam driven current"
      !! Nuclear Fusion, submitted by October 2011. Martix inversion method are used
      !! to include collisionality dependence on a shielding factor at arbitrary aspect ratio.
 
  INTEGER :: nlfdep
    default value: .FALSE.
      !! set .TRUE. (1) to compute midplane index oriented deposition
      !! distribution function in the lab frame using the "fbm"
      !! grids for pitch and energy, with particles mapped to
      !! their outer midplane crossing (a few particles which
      !! never cross the midplane at R > Raxis will be missed!).
      !! setting this switch causes a specialized, rarely used
      !! output data structure to be created
      !! nlfdep ***DISABLED*** DMC May 2 2007
      !! deposition data is now output on original chordal tracks
Home Top


Appendix_C_Step_Control_Structure

 
Declaration:
 
  use nbi_pstypes
  type (nbi_ctrl_update) :: sblk
  character*80 filename   ! filename input to I/O routines
  integer ierr            ! status return code 0=normal
 
Calls:
 
  call nbi_ctrl_update_dflt(sblk) ! set default values
  call nbi_ctrl_update_write(filename,sblk,ierr) ! write sblk namelist
  call nbi_ctrl_update_cdfwrite(filename,sblk,ierr) ! write sblk NetCDF file
  call nbi_ctrl_update_read(filename,sblk,ierr)  ! read sblk namelist
  call nbi_ctrl_update_cdfread(filename,sblk,ierr)  ! read sblk NetCDF file
 
Data element members of nbi_ctrl_update:
 
  REAL*8 :: orbrzv_toric_Prftot0(15)  ! (1:mibs)
    default: value not changed
      !! total power calculated by toric in the previous step
 
  REAL*8 :: orbrzv_toric_frnm
    default: value not changed
      !! toric RF-field strength renormalizer
 
  REAL*8 :: xdatsf3
    default: value not changed
      !! source magnitude (n/sec) used to renormalize He3 fusion
      !! product source profile from previous timestep
      !! only applies if nlusf3.and.nlfhe3 both .TRUE.
 
  REAL*8 :: xdatsfa
    default: value not changed
      !! source magnitude (n/sec) used to renormalize alpha fusion
      !! product source profile from previous timestep
      !! only applies if nlusfa.and.nlfhe4 both .TRUE.
 
  REAL*8 :: xdatsft
    default: value not changed
      !! source magnitude (n/sec) used to renormalize triton fusion
      !! product source profile from previous timestep
      !! only applies if nlusft.and.nlfst both .TRUE.
 
  REAL*8 :: xdatsfp
    default: value not changed
      !! source magnitude (n/sec) used to renormalize proton fusion
      !! product source profile from previous timestep
      !! only applies if nlusfp.and.nlfsp both .TRUE.
 
  REAL*8 :: xpand_nptcl
    default: value not changed
      !! If xpand_nptcl.gt.0.5 it will be a limit
      !! of the total growth of the particle list
      !! after this limit (> (1.0+xpand_nptcl)*NPTCLS )
      !! revert to Russian Roulette.
      !! For xpand_nptcl.le.0.5	 it will be a fraction by which
      !! nptcl{*} can expand during
      !! deposition (see below) to avoid Russian Roulette (min val 0.05d0)
      !! (max val 0.5d0).
      !! (max(nptcls,nptclf,nptclh,nptcl_max)+1000)*1.1d0
      !! *(1+xpand_nptcl+frac_orbrr)
 
  REAL*8 :: frac_dep_lim
    default: value not changed
      !! nptcl{*} # of MC ptcls that can be
      !! deposited in a single step
      !! is max(1,nptcls*min(1,delt/<tau_sl>*frac_dep_lim))
 
  REAL*8 :: AIMP
    default: value not changed
      !! ATOMIC WEIGHT OF IMPURITY, for tokamakium model only
 
  REAL*8 :: XZIMP
    default: value not changed
      !! IMPURITY ATOMIC NUMBER, for tokamakium model only
 
  REAL*8 :: BI_MAX_PL
    default: value not changed
      !! factor for an E_PLL component in bi-Maxwellian FI distribusion
 
  REAL*8 :: BI_MAX_PR
    default: value not changed
      !! factor for an E_Perp component in bi-Maxwellian FI distribusion
 
  REAL*8 :: wghta
    default: value not changed
      !! weight profile adjustment.  Larger values of WGHTA result
      !! in more particles with less weight per particle in the core
      !! and fewer particles with more weight per particle at the
      !! edge.  (dimensionless).
      !!   wghta.ge.1.0 enforced; wghta.le.nzones enforced.
      !!!! Larger WGHTA -> better statistics at core, worse at edge
      !!!! Smaller WGHTA -> better statistics at edge, worse at core
 
  REAL*8 :: AEP_ASCALE(10)  ! (1:mnkaep)
    default: value not changed
      !! scaling factor for mode amplitudes in  MHD transport operator (Mario Podesta)
 
  REAL*8 :: AEP_USCALE
    default: value not changed
      !! scaling factor for electrical potential for MHD transport operator (Mario Podesta)
 
  REAL*8 :: TAEP_FAC
    default: value not changed
      !! scaling factor to redefine time step for MHD transport operator (Mario Podesta)
 
  REAL*8 :: taurip
    default: value not changed
      !! must be set if nrip=1: lint* readMyid0,oss time (sec) for trapped ions
 
  REAL*8 :: edbfac
    default: value not changed
      !! debug tripwire -- if an ion reaches edbfac x its initial
      !! deposition energy, kill the run. (dimensionless).
 
  INTEGER :: nlbout
    default: value not changed
      !! .TRUE. (1) to turn on "lost particle" output data accumulation
 
  INTEGER :: nltest_output
    default: value not changed
      !! Set .FALSE. (0) to suppress NBSTART output of interim state
      !! data for nubeam_test time step debug rerun capability
      !! (suppress e.g. to optimize NUBEAM mpi scaling).Default - .TRUE.
      !! debug_mpi= nltest_output for
      !! MPI job debugging
      !! debug_mpi   =.FALSE. for serial mode
      !! see below
      !! in TRANSP  analog of this switch is nlnbi_test_out
 
  INTEGER :: xplasma_in_memory
    default: value not changed
      !! if >0, assume "old_xplasma" shared xplasma
      !! object has been prepositioned by caller to receive NUBEAM
      !! output; if =0, just use "old_xplasma" object; if <0, save
      !! old xplasma object for later restoration.
      !!   ** most users should never touch this **
 
  INTEGER :: ngyro
    default: value not changed
      !! NUMBER OF poloidal AIMING ANGLE ZONES, BEAM F-DIST. CALC.
      !! atan2(V_Z,V_R)-atan2(B_Z,B_R)
      !! must be > 0
      !! for ngyro=4
      !! zone 1 -- [-pi/4,pi/4] 	always means perpendicular to the flux surface and outward
      !! zone 2 -- [pi/4,3/4pi]  is tangential to the flux surface with an inward FLR displacement to GC
      !! zone 4 -- [-pi/4,-3/4pi] is tangential to the flux surface with an outward FLR displacement to GC
      !! zone 3 -- [3pi/4,-3/4pi] is perpendicular and inward
 
  INTEGER :: nlusf3
    default: value not changed
      !! .TRUE. (1) to set He3 fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nlusfa
    default: value not changed
      !! .TRUE. (1) to set alpha fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nlusft
    default: value not changed
      !! .TRUE. (1) to set triton fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nlusfp
    default: value not changed
      !! .TRUE. (1) to set proton fusion product source magnitude from
      !! data instead of from past timestep fusion rates
 
  INTEGER :: nptcls
    default: value not changed
      !! number of Monte Carlo particles per (normal) beam ion specie
      !! affects statistics of slowing down calculation
 
  INTEGER :: nptclf
    default: value not changed
      !! number of Monte Carlo particles per fusion product specie
      !! affects statistics of slowing down calculation
 
  INTEGER :: nptclh
    default: value not changed
      !! number of Monte Carlo particles per heavy beam ion specie
      !! affects statistics of slowing down / stripping calculation
 
  INTEGER :: NFAST_MAP
    default: value not changed
      !! in NUBEAM only: NFAST_MAP=1 - use bilinear maps to evaluate
      !! R,Z coordinates and 2x2 Jacobian,
      !! if NFAST=0 - use xplasma spline maps with tol=1.e-6 (~1.5 slower)
 
  INTEGER :: nltrk_dep0
    default: value not changed
      !! .TRUE. (1) to save details of ndep0 beam neutral tracks
 
  INTEGER :: NLDEP0_GATHER
    default: value not changed
      !! IF .TRUE. fast ion birth source data (in NUBEAM_COMP_EXEC)
      !! will be collected for all time steps or only for the last one
      !! if NLDEP0_GATHER = .false.
      !! The output files <RINID>_nubeam_birth.cdf<nn> will be kept in
      !! main directory from where program was started (in NUBEAM_COMP_EXEC).
 
  INTEGER :: ndep0
    default: value not changed
      !! minimum number of deposition tracks per beam ion specie--
      !! also, the number of tracks gathered, if deposition
      !! distribution data is saved for output, i.e. if
      !! nltrk_dep0 is .TRUE.
      !! Regardless of nltrk_dep0, This control
      !! affects statistics of deposition calculations (e.g.
      !! cold electron source, CX neutral sources, etc.).
      !! In an MPI run this value may be adjusted to be an exact
      !! multiple of the number of processors used.
      !! When deposition track data is gathered, there is an
      !! option to restrict the gathering to a single specific
      !! beam injector, or even a specific energy fraction for
      !! single injector.  (See ndep_set_beam and ndep_set_ien
      !! controls).  But, if this is done, the beam current
      !! fraction (call it f) of the selected beam injector can
      !! come into plan in determining the track data gathering.
      !! If f < 10%, the tracks gathered will be
      !!    ndep0_use = min(ndep0,f*ndep0_max)
      !! if f < 1%, the restriction to the selected beam subset
      !! is aborted, and data, ndep0 tracks, are gathered on
      !! all beam lines.  f is output as frac_cur_dep0.
 
  INTEGER :: NDEP0_MAX
    default: value not changed
      !! approximate max # of tracks to compute, when
      !! track data is gathered for only a single beam or
      !! single beam energy fraction-- used if the selected
      !! beam current fraction f is < 10%.
 
  INTEGER :: ndep_set_beam
    default: value not changed
      !! beam source # to which deposition data will be gathered
      !! (must be in range 0 to mib).  Default is 0:
      !! 0 - means gather data for all available beame source
      !! if ndep_set_beam set 0, then ndep_set_ien must be set 0.
      !! If beam source# was incorrectly set, then a warning is
      !! printed, and ndep_set_beam=0 is enforced.
      !! If there is no particle current for requested beam or
      !! this current is less than 1% of total ptcl. current then
      !! collect track data for all beam sources and energy fractions
      !! (i.e. revert to ndep_set_beam=0 mode).
      !! If particle current for requested beam is less than 10%
      !! of total ptcl. current - the number of tracks collected
      !! is adjusted to min(NDEP0,f*NDEP0_MAX), where f is the beam
      !! current fraction for the selected beam, relative to the
      !! total summed over all beams.
 
  INTEGER :: ndep_set_ien
    default: value not changed
      !! energy fractions to be used when gathering deposition data
      !! for a given beam source (ndep_set_beam .gt. 0).
      !! 1 - full energy fraction
      !! 2 - half energy fraction
      !! 3 - one third energy
      !! 0 - for all energy fraction
      !! if energy fraction# was incorrect set data is collected
      !! for all energy fractions.
      !! For beams without energy fractions (i.e. Helium neutral
      !! beams or high energy negative ion based H/D/T beams),
      !! this control is ignored.
 
  INTEGER :: ncx0
    default: value not changed
      !! the total number of CX tracks, independent control of CX statistics
      !! if ncx0 = 0, then it will be no fbm_cx gathered and CX statistics will not be
      !! improved
 
  INTEGER :: nper_cx
    default: value not changed
      !! the  number of gyro phase angles between [0,2*pi] will be used for CX statistics improvement
      !! if ncx0 > 0 , nper_cx=max(1,nper_cx)
 
  INTEGER :: LEV_NBIDEP
    default: value not changed
      !! beam "deposision" model level:
      !! 1 -- legacy of PREACT atomic physics
      !! 2 -- ADAS atomic physics for H and He beams.
      !!      He beam -- only ground state model available
      !! 3 -- PREACT ground state atomic physics
      !!      ADAS interaction with impurities
      !! 4 -- ADAS ground state atomic physics
      !!      PREACT interaction with impurities
 
  INTEGER :: LEVMOD_HALO
    default: value not changed
      !! 0 -- driver program calls FRANTIC (default)
      !! 1 -- FRANTIC will be called in NUBEAM
      !! 2 -- 3d halo model will be called in NUBEAM
      !!      for 3d halo model NSPLT_GEO and NSPLT_KIN have to be set
      !!      or default values will be used
      !!      as 3d halo model is a 'beam in box' then
      !!      NBSBOX, NBEBOX, NXBOX, NYBOX, NLBOX, NDEPBOX etc. have to be set
 
  INTEGER :: NSPLT
    default: value not changed
      !! activated in case LEVMOD_HALO=2
      !! max allowed spliting along each neutral track (3D halo model),
      !! NSPLT must be >= NSPLT_GEO* NSPLT_KIN
      !! if NSPLT < 0 then it  maybe use to gather 3d density 0 generation of neutrals, only
 
  INTEGER :: NSPLT_GEO
    default: value not changed
      !! activated in case LEVMOD_HALO=2, and NSPLT > 0
      !! max allowed spliting along each neutral track (3D halo model),
      !! max allowed geometrical spliting along each neutral track (3D halo model)
      !!
 
  INTEGER :: NSPLT_KIN
    default: value not changed
      !! activated in case LEVMOD_HALO=2, and NSPLT > 0
      !! max allowed spliting along each neutral track (3D halo model),
      !! max allowed kinetic spliting at each CX launch point; # of velocities
      !! that are sampled from eligible ion populations (3D halo model)
 
  INTEGER :: NSPLT_GEN
    default: value not changed
      !! # of halo generation to be splitted at the
      !! rate NSPLT_KIN * NSPLT_GEO, and for higher generation will be no additional
      !! splitting made.  If NSPLT_GEN = 0, all halo generation will be splitted at the
      !! rate NSPLT_KIN * NSPLT_GEO. Activated in case LEVMOD_HALO=2, and NSPLT > 0
 
  INTEGER :: nmimp
    default: value not changed
      !! 1 -> using multiple impurities
      !! 0 -> using single tokamakium impurity
 
  INTEGER :: NTEST_MAX
    default: value not changed
      !! set 1 to simulate bi-Maxwellian FI distribusion;
      !!  -1 to skip re-normalization of electric field from TORIC
      !! in RF kick off operator in NUBEAM for bi-Maxwellian FI distribusion;
      !! -10 to skip re-normalization of electric field from TORIC
      !! in RF kick off operator in NUBEAM for realistic FI distribusion
      !! this switch may be used for standalone nubeam_comp_exec program
      !! and can be modified through nubeam_comp_exec namelist
      !! 10 same as default but extra output files will be saved to be used in TORIC:
      !! some variables on sqrt(norm poloidal flux)
 
  INTEGER :: orbrzv_rf_option
    default: value not changed
      !! option to switch on & off Monte-Carlo RF calculation
 
  INTEGER :: nlmcrf_on
    default: value not changed
 
  INTEGER :: nsigexc
    default: value not changed
      !! NSIGEXC=0 means ground state model.
      !! NSIGEXC=1 means "appropriate applicable" excited states model:
      !! ADAS for LEV_NBIDEP=2 and
      !! Janev-Boley-Post for other values of LEV_NBIDEP=1
      !! NSIGEXC=2 means Janev-Boley-Post applied to any model including ADAS.
      !! Janev/Boley/Post article, Nucl. Fusion Vol.29, No. 12 (1989)
      !! NSIGEXC=3 means ADAS excited states model (adas310 library):
      !! ADAS for LEV_NBIDEP=2 and
 
  INTEGER :: nlbbcx
    default: value not changed
      !! .FALSE. (0) to disable beam-beam charge-exchange and
      !! beam-beam impact-ionization contribution to deposition.
      !! This concerns beam neutrals being stopped by collisions
      !! with slowing down beam ions.
 
  INTEGER :: nbbcx_avg
    default: value not changed
      !! use non average over the flux surface relative energy (ebb_rel_avg)
      !! and target temperature (rms_ebb_rel) for beam-beam reaction to calculate
      !! enhancement factor
      !! =1 then use average over the flux surface relative energy (ebb_rel_avgx)
      !! and target temperature (rms_ebb_relx)
      !! this switch is activated if nlbbcx = .TRUE.
 
  INTEGER :: nbbcx_bb
    default: value not changed
      !! integer switch. If nbbcx_bb=0 then contribution from beam-beam reactions to the enhancement
      !! factor will be included in case if NLBBCX=.TRUE.
      !! If nbbcx_bb.ne.0  then contribution from beam-beam reactions to the enhancement
      !! factor will be NOT included even if NLBBCX=.TRUE.
 
  INTEGER :: nlorbo
    default: value not changed
      !! .TRUE. (1) for "orbit only" mode: suppress all collisions
      !! used only in specialized debugging situations.
 
  INTEGER :: nlbgflr
    default: value not changed
      !! .TRUE. (1) for enhanced FLR treatment
      !! this deforms the FLR trajectory by looking at the
      !! variation of mod(B) in the guiding center vicinity,
      !! and is appropriate when the larmor radius is >~ L(B)
      !! e.g. in low field systems such as STs.  **but** this
      !! option is extremely expensive computationally!
 
  INTEGER :: sawflag
    default: value not changed
      !! set .TRUE. (1) if sawtooth occurred since prior step
      !! (this means: apply previously calculated sawtooth
      !! mixed new start coordinates when restarting partially
      !! slowed down orbiting ions).
 
  INTEGER :: nlsawb
    default: value not changed
      !! if .TRUE. (1) calculate sawtooth mixing of beam ions.
 
  INTEGER :: nlsawf
    default: value not changed
      !! if .TRUE. (1) calculate sawtooth mixing of fusion products.
 
  INTEGER :: nkaep
    default: value not changed
      !! number of terms (NK) in expansion of MHD transport operator (Mario Podesta)
 
  INTEGER :: nlfbon
    default: value not changed
      !! .TRUE. to turn on fishbone loss model
      !! "fishbones" are an MHD phenomenon though to be capable
      !! of ejecting fast ions.
Home Top


Appendix_D_Output_Structures_&_Methods

 
 Methods and structure contents are shown, with
 comments copied from nubeam/nbspec.dat ...
 
 To define the referenced fortran-90 structures,
 user code should include the statement: 
 
     use nbi_types
 
Home Top


nbotype_fusion

    use nbi_types
    type(nbotype_fusion) :: zfusion   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_fusion(zfusion)
 
members of nbotype_fusion data type:
 
    ! mireact -- reaction index dimension.
    ! xplasma ids:  io_bbntns(mireact), etc.
    !
    ! a legacy system for categorizing fusion reactions is in use.
    ! Reactions indexing is from 1 to NREACT, get NREACT via
    !      call catfus_num(NREACT)
    ! as of Jan 2002 NREACT=14.
    !
    ! Originally, these arrays held "beam-target" and "beam-beam"
    ! reactions; now these arrays also hold "FP-target","FP-beam",
    ! "RF-target", and "RF-beam" reactions, FP = fusion product,
    ! RF = RF tail ions, with separate indices allocated.
    !
    !      integer ireact,itype1
    !      character*3 reagent1,reagent2
    !      do ireact = 1,NREACT
    !         call catfus_mtype(ireact,itype1)
    !         call catfus_reagent(reagent1,reagent2)
    !         write(nonlin,*) itype1,' ',reagent1,reagent2
    !      enddo
    ! will return in sequence the first component type for each
    ! reaction index ireact: itype1=1 for beams, itype1=2 for FP,
    ! itype1=3 for RF; and the reagent codes "D  ","T  ", or "HE3".
    ! For the DD(n) reaction reagent2 = "D:N"; for the DD(p) reaction
    ! reagent2 = "D:P" are returned
    !
    ! The "catfus" calls are included with the beam module in the
    ! library "comput.a".  A working sample code and output follow.
    !
    !      program foo
    !      implicit NONE
    !
    !      integer nreact
    !      integer ireact,itype1
    !      character*3 reagent1,reagent2
    !
    !      call catfus_num(nreact)
    !      do ireact = 1,NREACT
    !         call catfus_mtype(ireact,itype1)
    !         call catfus_reagent(ireact,reagent1,reagent2)
    !         write(nonlin,*) '! ireact=',ireact,' itype1=',itype1,
    !     >      ' reagent1,2= ',reagent1,' ',reagent2
    !      enddo
    !
    !      stop
    !      end
    !
    ! ireact= 1  itype1= 1  reagent1,2= D   T
    ! ireact= 2  itype1= 1  reagent1,2= D   HE3
    ! ireact= 3  itype1= 1  reagent1,2= D   D:P
    ! ireact= 4  itype1= 1  reagent1,2= D   D:N
    ! ireact= 5  itype1= 1  reagent1,2= T   T
    ! ireact= 6  itype1= 1  reagent1,2= T   HE3
    ! ireact= 7  itype1= 1  reagent1,2= T   D
    ! ireact= 8  itype1= 1  reagent1,2= HE3 D
    ! ireact= 9  itype1= 2  reagent1,2= T   D
    ! ireact= 10  itype1= 2  reagent1,2= HE3 D
    ! ireact= 11  itype1= 3  reagent1,2= T   D
    ! ireact= 12  itype1= 3  reagent1,2= HE3 D
    ! ireact= 13  itype1= 3  reagent1,2= D   T
    ! ireact= 14  itype1= 3  reagent1,2= D   HE3
    !
    ! Here again, itype1 characterizes the "first" reagent:
    ! itype1=1 means "beam", itype1=2 means "fusion product",
    ! itype1=3 means "RF tail".  The second reagent is either
    ! a beam ion (output to "bb" arrays) or a thermal target
    ! ion (outupt to "bt" arrays).  Fast ion - Fast ion reactions
    ! where the 2nd reagent is a fusion product or RF tail ion
    ! are never computed in the current software setup.
    !
    ! caveats: As of Jan 2002, no cross sections were available for
    ! the T-HE3 reaction, so this index is a place-holder, and the
    ! reaction rates returned are always zero.  Also, regarding the
    ! RF reactions:  (a) "D RF minority" experiments (ireact=13,14)
    ! have probably never been done; (b) the Monte Carlo code does
    ! not have an RF operator and so cannot follow RF tail ions.
    ! Instead, the RF tail ion distribution function can be computed
    ! by another code (e.g. a Fokker-Planck package) and the
    ! distribution function passed into the MC package, and an MC
    ! integral computed for the RF-beam fast ion - fast ion fusion
    ! rate, output to the "bb" arrays.  The RF-(thermal) target
    ! fusion calculation is left to the Fokker-Planck package or
    ! whatever code is computing the RF tail distribution.  Thus
    ! for the "bt" arrays only the rows corresponding to ireact=1:10
    ! will ever be set.  This is the situation as of Jan 2002; the
    ! code may be updated in the future according to user requirements.
    !
    ! The cross sections for these reaction rate integrations come
    ! from the NTCC module "preact", and, originally, from:
    !
    ! H-S. Bosch, Review of Data and Formulas for Fusion Cross-sections,
    ! IPP I/252 (Sept 1990).
    !
    ! the output profiles in this block are flux surface averaged.
    ! 2d profiles showing poloidal variation are also available.
    !------------------------
    ! for "mireact" indexed quantities, the labeling is handled
    ! specially in nubeam/nbo_name1 ...
    !------------------------
 
    INTEGER :: io_bbntns(18)  ! (mireact)
               ! XPLASMA ids for BBNTNS profiles.
        ! '#/S; fast ion -- fast ion fusion'
        ! BEAM-BEAM NEUTRON EMISSION 1D PROFILE, by reaction
        ! ALSO: INFO ON FUSION REACTIONS WHICH DO NOT MAKE NEUTRONS
 
    INTEGER :: io_bbntnt
               ! XPLASMA id for BBNTNT profile.
        ! '#/S; beam-beam neutrons'
        ! BEAM-BEAM TOTAL NEUTRON EMISSION 1D PROFILE
 
    INTEGER :: io_btntns(18)  ! (mireact)
               ! XPLASMA ids for BTNTNS profiles.
        ! '#/S; fast ion -- target fusion'
        ! BEAM-TARGET NEUTRON EMISSION PROFILE, by reaction
        ! ALSO: INFO ON FUSION REACTIONS WHICH DO NOT MAKE NEUTRONS
 
    INTEGER :: io_btntrs(18)  ! (mireact)
               ! XPLASMA ids for BTNTRS profiles.
        ! 'cm^3/S; fast ion -- target fusion, sigv'
        ! BEAM-TARGET NEUTRON sigv PROFILE, by reaction
        ! ALSO: INFO ON FUSION REACTIONS WHICH DO NOT MAKE NEUTRONS
 
    INTEGER :: io_btntws(18)  ! (mireact)
               ! XPLASMA ids for BTNTWS profiles.
        ! '#/cm^3; fast ions react with thermal'
 
    INTEGER :: io_btntnt
               ! XPLASMA id for BTNTNT profile.
        ! '#/S; beam-target neutrons'
        ! BEAM-TARGET TOTAL NEUTRON EMISSION PROFILE
 
    REAL*8 :: bbntot
        ! '#/S; total beam-beam neutrons'
        ! TOTAL BEAM-BEAM NEUTRON PRODUCTION
 
    REAL*8 :: bbnta(18)  ! (mireact)
        ! '#/S; fast ion -- fast ion fusion'
        ! BEAM-BEAM NEUTRONS, BY FUSION REACTION
        ! ALSO: INFO ON FUSION REACTIONS WHICH DO NOT MAKE NEUTRONS
 
    REAL*8 :: btneut
        ! '#/S; total beam-target neutrons'
        ! BEAM TARGET NEUTRONS PER SECOND
 
    REAL*8 :: btnta(18)  ! (mireact)
        ! '#/S; fast ion -- target fusion'
        ! BEAM TARGET NEUTRONS, BY SOURCE REACTION
        ! ALSO: INFO ON FUSION REACTIONS WHICH DO NOT MAKE NEUTRONS
 
    REAL*8 :: sftot(18)  ! (mireact)
        ! '#/S; total fusion product source'
        ! TOTAL FUSION PRODUCT SOURCE, BY REACTION INDEX
        ! includes beam-beam, beam-target, and thermonuclear contributions,
        ! as appropriate to reaction index.
Home Top


nbotype_density

    use nbi_types
    type(nbotype_density) :: zdensity   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_density(zdensity)
 
members of nbotype_density data type:
 
    ! mibs -- fast ion specie index
    ! xplasma ids:  io_bdenss(mibs)
    !
    ! post-sawtooth arrays: if sawtooth calculation is requested,
    ! these are the specie densities expected after a Kadomtsev
    ! sawtooth remix of affected fast ion species.
 
    INTEGER :: io_bdenss(15)  ! (mibs)
               ! XPLASMA ids for BDENSS profiles.
        ! '#; fast ion density'
        ! total number of fast ions, by specie.  Orbit averaged.
        ! Fusion product ion densities are also here.
 
    INTEGER :: io_mc_dens(15)  ! (mibs)
               ! XPLASMA ids for MC_DENS profiles.
        ! '#/m^3; MC fast ion density (unsmoothed)'
        ! instantaneous density from particle list at end of time
        ! step; no orbit averaging; no smoothing.
 
    INTEGER :: io_bdenssw(15)  ! (mibs)
               ! XPLASMA ids for BDENSSW profiles.
        ! '#; post-sawtooth fast ion density'
        ! same as bdenss, but if a sawtooth occur this is what
        ! the density profiles change to.
 
    INTEGER :: io_udenspl(15)  ! (mibs)
               ! XPLASMA ids for UDENSPL profiles.
        ! 'J; pll energy density'
        ! pll energy density profiles (Joules, integrated)
 
    INTEGER :: io_udenspp(15)  ! (mibs)
               ! XPLASMA ids for UDENSPP profiles.
        ! 'J; perp energy density'
        ! perp energy density profiles (Joules, integrated)
 
    INTEGER :: io_udensplw(15)  ! (mibs)
               ! XPLASMA ids for UDENSPLW profiles.
        ! 'J; post-sawtooth pll energy density'
        ! pll energy density profiles (post-sawtooth)
 
    INTEGER :: io_udensppw(15)  ! (mibs)
               ! XPLASMA ids for UDENSPPW profiles.
        ! 'J; post-sawtooth perp energy density'
        ! perp energy density profiles (post-sawtooth)
Home Top


nbotype_deposition

    use nbi_types
    type(nbotype_deposition) :: zdeposition   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_deposition(zdeposition)
 
members of nbotype_deposition data type:
 
    ! mibs -- fast ion specie index
    ! 1:3 -- full/half/third energy index
    ! xplasma ids:  io_bdepe(3,mibs), io_bdeps(mibs),etc.
    ! mig -- thermal gas index
    !
    ! total deposition profiles f, f(x) = n/sec inside surface "x".
    ! components broken down by stopping reaction type, generally
    ! given as a sum over all beams and energy fractions, as a sum
    ! over energy fraction for each beam specie, and as a separate
    ! profile for each beam specie and energy fraction.  For non-
    ! Hydrogenic beams, the 2nd and 3rd energy fractions are always
    ! zero.
 
    INTEGER :: io_bdepb(3,320)  ! (3,mib)
               ! XPLASMA ids for BDEPB profiles.
        ! '#/S; deposition rate'
        ! deposition profile at each energy fraction due to each
        ! neutral beam injector.
 
    INTEGER :: io_bdepb_nb(320)  ! (mib)
               ! XPLASMA ids for BDEPB_NB profiles.
        ! 'beam deposition profile'
        ! deposition profile to each neutral beam injector.
 
    INTEGER :: io_bdepe(3,15)  ! (3,mibs)
               ! XPLASMA ids for BDEPE profiles.
        ! '#/S; deposition rate'
        ! total beam deposition, by beam energy fraction and specie.
        ! for non-Hydrogenic beams, the beams are assumed to be 100%
        ! full energy.
 
    INTEGER :: io_bdeps(15)  ! (mibs)
               ! XPLASMA ids for BDEPS profiles.
        ! '#/S; deposition rate'
        ! total beam deposition, summed over energy fractions
        ! profile is sum of results of integrations along beam neutral tracks.
 
    INTEGER :: io_sdep_oa(15)  ! (mibs)
               ! XPLASMA ids for SDEP_OA profiles.
        ! '#/S; deposition rate'
        ! the orbit averaged total deposition fast ion source
        ! NEW PARTICLES BEAM DEPOSITION PROFILES, BY SPECIE
        ! produce a quantity closely related to BDEPS
        ! but, vs. the orbit averaged position <X> (JIAV)
        ! instead of the instantaneous deposition location X (J) "BDEPS"
        ! FAST ION SCE --orbit averaged total BEAM DEPOSITION
 
    REAL*8 :: SDEP_OAUC(15)  ! (mibs)
        ! '#/S; deposition rate'
        ! the orbit averaged deposition fast ion source, unconfined
        ! same as sdep_oa(LEP1,:)
 
    INTEGER :: io_mc_newdens(15)  ! (mibs)
               ! XPLASMA ids for MC_NEWDENS profiles.
        ! '#/m^3; MC fast ions added (unsmoothed)'
        ! Monte Carlo fast ion source -- as actually deposited to MC particle
        ! list on most recent time step; no smoothing.
 
    REAL*8 :: einjav(15)  ! (mibs)
        ! 'KeV; nominal injection energy'
        ! for beams this is based on the full energy component only.
        ! if there is no power, the value for the species is retained
        ! from the last time that there was non-zero power.
 
    INTEGER :: io_sbbidpe(3,15)  ! (3,mibs)
               ! XPLASMA ids for SBBIDPE profiles.
        ! '#/S; dep. by beam-beam ionization'
        ! BEAM *DEPOSITION* BY BEAM-BEAM II, BY E.FRAC. & by species
 
    INTEGER :: io_sbbidps(15)  ! (mibs)
               ! XPLASMA ids for SBBIDPS profiles.
        ! '#/S; dep. by beam-beam ionization'
        ! BEAM *DEPOSITION* BY BEAM-BEAM II, BY SPECIES
        ! summed over energy fractions
 
    INTEGER :: io_sbbxdpe(3,15)  ! (3,mibs)
               ! XPLASMA ids for SBBXDPE profiles.
        ! '#/S; dep. by beam-beam charge exchange'
        ! BEAM *DEPO* BY BEAM-BEAM CX, BY E.FRAC. & by species
 
    INTEGER :: io_sbbxdps(15)  ! (mibs)
               ! XPLASMA ids for SBBXDPS profiles.
        ! '#/S; dep. by beam-beam charge exchange'
        ! BEAM *DEPOSITION* BY BEAM-BEAM CX, BY SPECIES
        ! summed over energy fractions
 
    INTEGER :: io_sbcxdpe(10,3,15)  ! (mig,3,mibs)
               ! XPLASMA ids for SBCXDPE profiles.
        ! '#/S; dep. by charge exchange'
        ! BEAM *DEPO* BY THERM. CX, BY E.FRAC. & by species
 
    INTEGER :: io_sbcxdps(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SBCXDPS profiles.
        ! '#/S; dep. by charge exchange'
        ! BEAM *DEPOSITION* BY THERMAL CX, BY SPECIES
        ! summed over energy fractions
 
    INTEGER :: io_sbedepe(3,15)  ! (3,mibs)
               ! XPLASMA ids for SBEDEPE profiles.
        ! '#/S; dep. by ion impact ionization'
        ! BEAM *DEPO* BY plasma ion II, by E.FRAC. & by species
 
    INTEGER :: io_sbedeps(15)  ! (mibs)
               ! XPLASMA ids for SBEDEPS profiles.
        ! '#/S; dep. by ion impact ionization'
        ! BEAM *DEPOSITION* BY plasma ion IONIZ., BY SPECIES
        ! summed over energy fractions
 
    INTEGER :: io_sbiedepe(3,15)  ! (3,mibs)
               ! XPLASMA ids for SBIEDEPE profiles.
        ! '#/S; dep. by e- impact ionization'
        ! BEAM *DEPO* BY electron II, by E.FRAC. & by species
 
    INTEGER :: io_sbiedeps(15)  ! (mibs)
               ! XPLASMA ids for SBIEDEPS profiles.
        ! '#/S; dep. by e- impact ionization'
        ! BEAM *DEPOSITION* BY ELEC. IMPACT IONIZ., BY SPECIES
        ! summed over energy fractions
 
    INTEGER :: io_sbildepe(3,15)  ! (3,mibs)
               ! XPLASMA ids for SBILDEPE profiles.
        ! '#/S; dep. by Lorentz ionization'
        ! BEAM *DEPO* BY Lorentz ioniz., by E.FRAC. & by species
 
    INTEGER :: io_sbildeps(15)  ! (mibs)
               ! XPLASMA ids for SBILDEPS profiles.
        ! '#/S; dep. by Lorentz ionization'
        ! BEAM *DEPOSITION* BY Lorentz IONIZ., BY SPECIES
        ! summed over energy fractions
 
    INTEGER :: io_sbizdepe(3,15)  ! (3,mibs)
               ! XPLASMA ids for SBIZDEPE profiles.
        ! '#/S; dep. by impurity stopping'
        ! BEAM *DEPO* BY IMPURITY II, BY E.FRAC. & by species
 
    INTEGER :: io_sbizdeps(15)  ! (mibs)
               ! XPLASMA ids for SBIZDEPS profiles.
        ! '#/S; dep. by impurity stopping'
        ! BEAM *DEPOSITION* BY IMPURITY IMPACT IONIZ., BY SPECIES
        ! summed over energy fractions
 
    REAL*8 :: frac_cur_ndep0
        ! '-; track data gathered, this fraction of beam current'
        ! current fraction of beam(s) eligible for
        ! deposition track data gathering
 
    INTEGER :: ndep0_use
        ! '-; NDEP0 used (for deposition statistics)'
        ! also for deposition track data gathering
        ! if nltrk_dep0 is .TRUE.
 
    INTEGER :: nbs_step
        ! '-; # of nbsteps used for averaged beam ion birth statistics'
        ! # of steps to gather data from ~ OUTTIM-AVGTIM to OUTTIM
        ! list of ions actually deposited for subsequent
        ! following in orball(...).  This not depend on NDEP0
        ! but rather on our census control based on NPTCLS
        ! (it would vary from step to step based on beam power
        ! history and our census control logic).
 
    INTEGER :: n_outtim
        ! '-; # for a  current outtim time'
Home Top


nbotype_nclass

    use nbi_types
    type(nbotype_nclass) :: znclass   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_nclass(znclass)
 
members of nbotype_nclass data type:
 
    ! beam line & beam energy fraction resolved outputs needed by
    ! NCLASS evaluation of neoclassical effects of beam forces
    !
    ! profiles:
    !   bnb_ien(mj,1:3,1:mib) -- density
    !   pbe_ien(mj,1:3,1:mib) -- electron heating
    !   pbi_ien(mj,1:3,1:mib) -- ion heating including impurity
    !   upb_ien(mj,1:3,1:mib) -- (lab frame) <v.B>
    !   bdens_nb(mj, mib) -- beam density
    !   bnbs_ien(mj, 3, mibs) "#; no. of ions"
    !   pbes_ien(mj, 3, mibs) "W; electron heating"
    !	!   pbis_ien(mj, 3, mibs) "W; ion heating"
    ! scalars:
    !   ein_ien(1:3,1:mib) -- average lab frame injection energy
    !   dei_ien(1:3,1:mib) -- RMS variance from ein(...)
    !     (from time variation of injection voltage on beamlines).
    !
    ! by species & fraction instead of by beamline & energy fraction:
    !   (same set of data as above)
    !   (fusion product contributions for NCLASS captured here).
    !
    ! *** warning *** dmc Dec 2003 -- definition and
    ! construction of nclass=1 outputs is not yet complete ***
 
    INTEGER :: io_bnb_ien(3,320)  ! (3,mib)
               ! XPLASMA ids for BNB_IEN profiles.
        ! '#; no. of ions'
 
    INTEGER :: io_bdens_nb(320)  ! (mib)
               ! XPLASMA ids for BDENS_NB profiles.
        ! 'beam density'
        ! to each neutral beam injector
 
    INTEGER :: io_pbe_ien(3,320)  ! (3,mib)
               ! XPLASMA ids for PBE_IEN profiles.
        ! 'W; electron heating'
 
    INTEGER :: io_pbi_ien(3,320)  ! (3,mib)
               ! XPLASMA ids for PBI_IEN profiles.
        ! 'W; ion heating'
 
    INTEGER :: io_upb_ien(3,320)  ! (3,mib)
               ! XPLASMA ids for UPB_IEN profiles.
        ! 'T*(m/sec); <v.B> lab frame'
 
    REAL*8 :: ein_ien(3,320)  ! (3, mib)
        ! 'KeV; avg injection energy'
 
    REAL*8 :: dei_ien(3,320)  ! (3, mib)
        ! 'KeV; avg inj. energy RMS variation'
        ! the following are computed for beam species only
        ! (fusion product numbers calculated already, elsewhere).
 
    INTEGER :: io_bnbs_ien(3,15)  ! (3,mibs)
               ! XPLASMA ids for BNBS_IEN profiles.
        ! '#; no. of ions'
 
    INTEGER :: io_pbes_ien(3,15)  ! (3,mibs)
               ! XPLASMA ids for PBES_IEN profiles.
        ! 'W; electron heating'
 
    INTEGER :: io_pbis_ien(3,15)  ! (3,mibs)
               ! XPLASMA ids for PBIS_IEN profiles.
        ! 'W; ion heating'
        ! the following are computed for all species, but for
        ! fusion products the energy fraction index is always 1.
 
    INTEGER :: io_upbs_ien(3,15)  ! (3,mibs)
               ! XPLASMA ids for UPBS_IEN profiles.
        ! 'T*(m/sec); <v.B> lab frame'
Home Top


nbotype_n0_fast

    use nbi_types
    type(nbotype_n0_fast) :: zn0_fast   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_n0_fast(zn0_fast)
 
members of nbotype_n0_fast data type:
 
    ! flux surface averaged fast neutral density profiles
    ! mibs -- specie index    1:3 energy fraction index
    ! mib -- beamline index
    !
    ! xplasma ids:  io_bn00ts(3,mibs), etc...
    !
    ! indexing generally similar to indexing for the deposition
    ! profiles; in addition separate profiles for each beam line
    ! are available.
 
    INTEGER :: io_bn00t(3)  ! (3)
               ! XPLASMA ids for BN00T profiles.
        ! '#; beam neutral density'
        ! TOTAL 1ST GEN BEAM NEUTRAL DENSITIES
        ! full/half/third energy, summed over all species
 
    INTEGER :: io_bn00ts(3,15)  ! (3,mibs)
               ! XPLASMA ids for BN00TS profiles.
        ! '#; beam neutral density'
        ! TOTAL 1ST GEN BEAM NEUTRAL DENSITIES by species
        ! full/half/third energy
 
    INTEGER :: io_bn00(320,3)  ! (mib,3)
               ! XPLASMA ids for BN00 profiles.
        ! '#; beam neutral density'
        ! 1D 1ST GEN BEAM NEUTRAL DENSITIES
        ! full/half/third energy, by beamline
 
    INTEGER :: io_bn0tot(15)  ! (mibs)
               ! XPLASMA ids for BN0TOT profiles.
        ! '#; beam neutral density'
        ! TOTAL 1ST GEN BEAM NEUTRAL DENSITIES BY SPECIES
 
    INTEGER :: io_bn0cx(15)  ! (mibs)
               ! XPLASMA ids for BN0CX profiles.
        ! '#; charge exchange fast neutral density'
        ! BEAM CX-EX fast NEUTRAL DENSITY
Home Top


nbotype_trap_fraction

    use nbi_types
    type(nbotype_trap_fraction) :: ztrap_fraction   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_trap_fraction(ztrap_fraction)
 
members of nbotype_trap_fraction data type:
 
    ! mibs -- fast ion specie index
    ! fraction of "banana trapped" ions
 
    INTEGER :: io_btrap(15)  ! (mibs)
               ! XPLASMA ids for BTRAP profiles.
        ! '-; trapping fraction'
        ! Trapping fraction profile of slowing down population
 
    INTEGER :: io_btrap0(15)  ! (mibs)
               ! XPLASMA ids for BTRAP0 profiles.
        ! '-; trapping fraction'
        ! Trapping fraction profile: newly deposited full energy ions.
 
    REAL*8 :: tbtrap(15)  ! (mibs)
        ! '-; total trapping fraction'
        ! Summed trapping fraction (over whole profile)
 
    REAL*8 :: tbtrap0(15)  ! (mibs)
        ! '-; total trapping fraction'
        ! Summed trapping fraction (over whole profile) (new full-E ions)
Home Top


nbotype_erngfi_output

    use nbi_types
    type(nbotype_erngfi_output) :: zerngfi_output   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_erngfi_output(zerngfi_output)
 
members of nbotype_erngfi_output data type:
 
    ! miefi -- energy range index
    ! mibs -- fast ion specie index
    ! densities and trapping fractions constrained to
    ! energy ranges erngfi(1:nerngfi) as specified by user input.
 
    INTEGER :: io_btrape(10,15)  ! (miefi,mibs)
               ! XPLASMA ids for BTRAPE profiles.
        ! '-; trapping fraction'
        ! Trapping fraction profiles by energy range
 
    INTEGER :: io_densfi(10,15)  ! (miefi,mibs)
               ! XPLASMA ids for DENSFI profiles.
        ! '#; fast ion density'
        ! ENERGY-RESTRICTED FAST ION DENSITY PROFILES
Home Top


nbotype_average_energies

    use nbi_types
    type(nbotype_average_energies) :: zaverage_energies   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_average_energies(zaverage_energies)
 
members of nbotype_average_energies data type:
 
    ! mibs -- fast ion specie index
    ! average parallel energy, average perp energy, average energy
    !
    ! post-sawtooth arrays: if sawtooth calculation is requested,
    ! these are the average energies expected after a Kadomtsev
    ! sawtooth remix of affected fast ion species.
 
    INTEGER :: io_ebapl2s(15)  ! (mibs)
               ! XPLASMA ids for EBAPL2S profiles.
        ! 'Kev; avg ion pll energy'
        ! AVG BEAM ION PLL ENERGY @CURRENT STEP BY ION SPECIES
        ! includes fusion product species.
 
    INTEGER :: io_ebapp2s(15)  ! (mibs)
               ! XPLASMA ids for EBAPP2S profiles.
        ! 'Kev; avg ion perpenergy'
        ! AVG BEAM ION PERP ENERGY @CURRENT STEP BY ION SPECIES
        ! includes fusion product species.
 
    INTEGER :: io_ebapl2sw(15)  ! (mibs)
               ! XPLASMA ids for EBAPL2SW profiles.
        ! 'Kev; avg pll ion energy after sawtooth'
        ! AVG BEAM ION PLL ENERGY @CURRENT STEP BY ION SPECIES
        ! includes fusion product species.
 
    INTEGER :: io_ebapp2sw(15)  ! (mibs)
               ! XPLASMA ids for EBAPP2SW profiles.
        ! 'Kev; avg perp ion energy after sawtooth'
        ! AVG BEAM ION PERP ENERGY @CURRENT STEP BY ION SPECIES
        ! includes fusion product species.
 
    INTEGER :: io_ebavps(15)  ! (mibs)
               ! XPLASMA ids for EBAVPS profiles.
        ! 'Kev; avg ion energy'
        ! AVG BEAM ION ENERGY AT ZONE J, BY ION SPECIES
        ! includes fusion product species.
Home Top


nbotype_excited_states

    use nbi_types
    type(nbotype_excited_states) :: zexcited_states   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_excited_states(zexcited_states)
 
members of nbotype_excited_states data type:
 
    ! mibs -- fast ion specie index
    ! 1:3 -- full/half/third energy index
    ! xplasma ids:  io_excit0(3,mibs), io_excitr(mibs).
    !
    ! excited states correction profiles (flux surface averaged).
    ! =1.0 if no excited states correction included in the
    ! calculation, as per user input.
 
    INTEGER :: io_excit0(3,15)  ! (3,mibs)
               ! XPLASMA ids for EXCIT0 profiles.
        ! '-; deposition adj. (state excitation)'
        ! net effect of excitation on stopping cross section
        ! fast neutrals due to beam injection
        ! (relative to ground state model)
 
    INTEGER :: io_excitr(15)  ! (mibs)
               ! XPLASMA ids for EXCITR profiles.
        ! '-; deposition adjustment (state excitation)'
        ! net effect of excitation on stopping cross section:
        ! fast neutrals due to fast ion charge exchange
        ! (relative to ground state model)
Home Top


nbotype_mc_statistics

    use nbi_types
    type(nbotype_mc_statistics) :: zmc_statistics   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_mc_statistics(zmc_statistics)
 
members of nbotype_mc_statistics data type:
 
    ! mibs -- fast ion specie index
    !
    !   MC statistics vs. fast ion radial location (orbit averaged).
    ! these statistics are computed after deposition, before
    ! slowing down.
 
    INTEGER :: io_nmc(15)  ! (mibs)
               ! XPLASMA ids for NMC profiles.
        ! '#; number of Monte Carlo particles'
        ! integrated number of Monte Carlo model particles after deposition
        ! but before orbiting.
 
    INTEGER :: io_wnmc(15)  ! (mibs)
               ! XPLASMA ids for WNMC profiles.
        ! '#; number of ions in MC particles'
        ! physical number of ptcls (calculated when nmc is calculated)
        ! this is different than the fast ion density in that the latter
        ! is averaged over the entire timestep; calculated after deposition
        ! but before orbiting.
 
    INTEGER :: nmctot(15)  ! (mibs)
        ! '#; number of Monte Carlo particles'
        ! total number of MC ptcls by fast species; calculated after deposition
        ! but before orbiting.
 
    REAL*8 :: wnmctot(15)  ! (mibs)
        ! '#; number of ions in MC particles'
        ! total physicsl number of ptcls; calculated after deposition
        ! but before orbiting.
 
    INTEGER :: naeptot(15)  ! (mibs)
        ! '#; number of Monte Carlo particles'
        ! total number of MC ptcls by fast species evolved by MHD transport;
 
    INTEGER :: nstep_aep(15)  ! (mibs)
        ! '#; number time step for inner MonteCarlo loop in MHD transport (M.Podesta)'
        ! total number of  time steps used by MHD transport;
 
    INTEGER :: nmcloss(15)  ! (mibs)
        ! '#; number of prompt loss Monte Carlo particles'
        ! total number of MC ptcls on prompt loss orbits
 
    INTEGER :: nnew(15)  ! (mibs)
        ! '# OF NEW M.C. PTCLS FOR DEPOSITION'
        ! # OF NEW M.C. PTCLS FOR DEPOSITION
 
    REAL*8 :: xncx0_orb(15)  ! (mibs)
        ! '# OF CX events during orbiting'
        ! the number of CX tracks that we get from orbiting
Home Top


nbotype_rotation

    use nbi_types
    type(nbotype_rotation) :: zrotation   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_rotation(zrotation)
 
members of nbotype_rotation data type:
 
    ! mibs -- fast ion specie index
    ! fast ion flux surface averaged angular velocities
    ! (flux surface averaged toroidal rotation profiles)
    ! xplasma ids:  io_omegabs, io_omegabsw
 
    INTEGER :: io_omegabs(15)  ! (mibs)
               ! XPLASMA ids for OMEGABS profiles.
        ! 'rad/S; avg fast ion toroidal angular velocity'
        ! APPROX TOROIDAL ANGULAR VELOCITY OF IONS, BY FAST ION SPECIES
 
    INTEGER :: io_omegabsw(15)  ! (mibs)
               ! XPLASMA ids for OMEGABSW profiles.
        ! 'rad/S; avg fast ion ang. veloc. after sawtooth'
        ! APPROX TOROIDAL ANGULAR VELOCITY OF IONS, BY FAST ION SPECIES
        ! post-sawtooth profile
        ! note: dmc 15 March 2002: not computed; for now omegabsw=omegabs
Home Top


nbotype_compression

    use nbi_types
    type(nbotype_compression) :: zcompression   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_compression(zcompression)
 
members of nbotype_compression data type:
 
    ! mibs -- fast ion specie index
    ! energy added (or removed) from fast population by adiabatic
    ! compression (or decompression).
    ! These are informational profiles only.
 
    INTEGER :: io_pbcprs
               ! XPLASMA id for PBCPRS profile.
        ! 'W; compression (de)acceleration of all fast ions'
        ! HEATING OF ALL FAST IONS BY COMPRESSION
 
    INTEGER :: io_pbcprss(15)  ! (mibs)
               ! XPLASMA ids for PBCPRSS profiles.
        ! 'W; compressional power to'
        ! HEATING OF BEAM IONS BY COMPRESSION BY SPECIES
Home Top


nbotype_powers

    use nbi_types
    type(nbotype_powers) :: zpowers   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_powers(zpowers)
 
members of nbotype_powers data type:
 
    ! mibs -- fast ion specie index
    ! heating profiles f(x) = total power, watts, inside flux surface x.
    !
    ! this includes some correction terms, and various terms separated
    ! by fast ion specie index.  However, the powers seen by the thermal
    ! plasma are:
    !   pbe -- beam electron heating (summed over beam species pbes(...))
    !   pfe -- fusion product electron heating
    !                      (summed over fusion product species pbes(...))
    !
    !   pbi -- beam ion heating (summed over beam species pbes(...))
    !   pfi -- fusion product ion heating
    !                      (summed over fusion product species pbes(...))
    !   pbth -- power in fast ion thermalization source
    !
    !   pbe_nb(mj, mib) "W; beam heating to thermal electrons"
    !			by neutral beam injector
    !   pbi_nb(mj, mib) "W; beam heating to thermal ions"
    ! 			by neutral beam injector
    !   pbth_nb(mj, mib) "W; beam thermalization power"
    ! 			 by neutral beam injector
    !   pbtot_nb(mj, mib) "W; total beam power"
    ! 			by neutral beam injector
    ! (the correction terms are included in the appropriate places).
    !
    ! xplasma ids: io_pbe, io_pbi, etc.
 
    INTEGER :: io_pbdfbes(15)  ! (mibs)
               ! XPLASMA ids for PBDFBES profiles.
        ! 'W; power to e-, anom. diffusion adjustment'
        ! POWER TO ELECTRONS, BEAM ANOM.DIFF BY SPECIES
        ! generally a small correction; included in pbe (or pfe).
 
    INTEGER :: io_pbdfbis(15)  ! (mibs)
               ! XPLASMA ids for PBDFBIS profiles.
        ! 'W; power to ions, anom. diffusion adjustment'
        ! POWER TO IONS- BEAM ANOM.DIFF BY SPECIES
        ! generally a small correction; included in pbi (or pfi).
 
    INTEGER :: io_pbe
               ! XPLASMA id for PBE profile.
        ! 'W; beam electron heating'
        ! POWER TO ELECTRONS FROM BEAM HEATING -- for electron power balance
 
    INTEGER :: io_pbes(15)  ! (mibs)
               ! XPLASMA ids for PBES profiles.
        ! 'W; fast ion electron heating'
        ! POWER TO ELECTRONS FROM BEAM HEATING, BY FAST SPECIES
 
    INTEGER :: io_pbi
               ! XPLASMA id for PBI profile.
        ! 'W; beam ion heating'
        ! POWER TO IONS FROM BEAM SLOWING DOWN -- for ion power balance
 
    INTEGER :: io_pbis(15)  ! (mibs)
               ! XPLASMA ids for PBIS profiles.
        ! 'W; fast ion -> thermal ion heating'
        ! POWER TO IONS FROM BEAM HEATING, BY SPECIES
 
    INTEGER :: io_pbohs(15)  ! (mibs)
               ! XPLASMA ids for PBOHS profiles.
        ! 'W; power, OH circuit -> fast ions'
        ! POWER PROFILE - OH CIRCUIT TO BEAM IONS BY SPECIES (informational).
 
    INTEGER :: io_pbephis(15)  ! (mibs)
               ! XPLASMA ids for PBEPHIS profiles.
        ! 'W; electrostatic acceleration of fast ions'
        ! POWER PROFILE -- radial electrostatic field to beam ions by species
        ! (informational).
 
    INTEGER :: io_pbephis_ntr(15)  ! (mibs)
               ! XPLASMA ids for PBEPHIS_NTR profiles.
        ! 'W; electrostatic acceleration of fast ions'
        ! POWER PROFILE -- radial electrostatic field to beam ions by species
        ! (informational) (part from NUTRAV only).
 
    INTEGER :: io_pbephis_dep(15)  ! (mibs)
               ! XPLASMA ids for PBEPHIS_DEP profiles.
        ! 'W; electrostatic accel (dep. FLR adjust)'
        ! POWER PROFILE -- radial electrostatic field to beam ions by species
        ! (informational).  (Deposition calc. only).
 
    INTEGER :: io_pbth
               ! XPLASMA id for PBTH profile.
        ! 'W; beam thermalization power'
        ! POWER TO IONS DUE TO BEAM ION THERMALIZATIONS -- for ion power bal.
        ! note this includes fusion product thermalization as well.
 
    INTEGER :: io_pbths(15)  ! (mibs)
               ! XPLASMA ids for PBTHS profiles.
        ! 'W; fast ion thermalization'
        ! POWER TO IONS DUE TO BEAM ION THERMALIZATIONS BY FAST ION SPECIES
 
    INTEGER :: io_pbe_nb(320)  ! (mib)
               ! XPLASMA ids for PBE_NB profiles.
        ! 'W; beam heating to thermal electrons'
        ! by neutral beam injector
 
    INTEGER :: io_pbi_nb(320)  ! (mib)
               ! XPLASMA ids for PBI_NB profiles.
        ! 'W; beam heating to thermal ions'
        ! by neutral beam injector
 
    INTEGER :: io_pbth_nb(320)  ! (mib)
               ! XPLASMA ids for PBTH_NB profiles.
        ! 'W; beam thermalization power'
        ! by neutral beam injector
 
    INTEGER :: io_pbtot_nb(320)  ! (mib)
               ! XPLASMA ids for PBTOT_NB profiles.
        ! 'W; total beam power'
        ! by neutral beam injector
 
    INTEGER :: io_pbthr2s(15)  ! (mibs)
               ! XPLASMA ids for PBTHR2S profiles.
        ! 'W; ion thermalization rotation adjustment'
        ! ROTATION/ASSYMETRY PERTUBATION TO PBTH BY FAST ION SPECIES
        ! a small correction term, included in pbth
 
    INTEGER :: io_pfe
               ! XPLASMA id for PFE profile.
        ! 'W; fusion product electron heating'
        ! POWER TO ELECTRONS FROM FUSION ION HEATING -- for electron power bal.
 
    INTEGER :: io_pfi
               ! XPLASMA id for PFI profile.
        ! 'W; fusion product thermal ion heating'
        ! POWER TO IONS FROM FUSION ION SLOWING DOWN -- for ion power bal.
 
    INTEGER :: io_orbrzv_Prf(15)  ! (mibs)
               ! XPLASMA ids for ORBRZV_PRF profiles.
        ! 'W; RF-heating on fast ions from mcrf'
        ! power profile calculated by mcrf
 
    INTEGER :: io_orbrzv_toric_Prf(15)  ! (mibs)
               ! XPLASMA ids for ORBRZV_TORIC_PRF profiles.
        ! 'W; RF-heating on fast ions from toric'
        ! power profile calculated by toric
Home Top


nbotype_currents

    use nbi_types
    type(nbotype_currents) :: zcurrents   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_currents(zcurrents)
 
members of nbotype_currents data type:
 
    ! mibs -- fast ion specie index
    ! driven current profiles
    !
    !   curjbeam and curjfusi (or their <J.B> form equivalents)
    !   will be needed for the parallel Ohms Law expression in the
    !   poloidal field diffusion equation; the rest are just for
    !   information.
 
    INTEGER :: io_curjbeam
               ! XPLASMA id for CURJBEAM profile.
        ! 'A; beam ion current drive (shielded)'
 
    INTEGER :: io_curjfusi
               ! XPLASMA id for CURJFUSI profile.
        ! 'A; fusion product ion current drive (shielded)'
 
    INTEGER :: io_curjs(15)  ! (mibs)
               ! XPLASMA ids for CURJS profiles.
        ! 'A; shielded fast ion driven current'
 
    INTEGER :: io_ucurjs(15)  ! (mibs)
               ! XPLASMA ids for UCURJS profiles.
        ! 'A; unshielded fast ion driven current'
 
    INTEGER :: io_ucurjco
               ! XPLASMA id for UCURJCO profile.
        ! 'A; unshielded current driven by co-injected beams'
 
    INTEGER :: io_ucurjctr
               ! XPLASMA id for UCURJCTR profile.
        ! 'A; unshielded current driven by counter-injected beams'
        ! unshielded current driven by "ctr" injected beams, amps
 
    INTEGER :: io_ucurjnb(320)  ! (mib)
               ! XPLASMA ids for UCURJNB profiles.
        ! 'A; unshielded fast ion driven current by beam'
 
    INTEGER :: io_curjnb(320)  ! (mib)
               ! XPLASMA ids for CURJNB profiles.
        ! 'A; shielded fast ion driven current by beam'
 
    INTEGER :: io_xjbfac
               ! XPLASMA id for XJBFAC profile.
        ! '-; species averaged neoclassical current shielding factor'
        ! --> average fast ion CURRENT SHIELDING FACTOR (btw 0 and 1)
        ! (1-Zb/ZEFF FOR classical, + NEOCLASSICAL TERMS as requested)
        ! (classical also known as Okhawa current)
        ! cf NMCURB -- member of "miscellaneous" input control structure
        !  (averaging is weighted by unshielded current absolute value)
 
    INTEGER :: io_xjbfacs(15)  ! (mibs)
               ! XPLASMA ids for XJBFACS profiles.
        ! '-; neoclassical current shielding factor, by species'
Home Top


nbotype_neutral_sources

    use nbi_types
    type(nbotype_neutral_sources) :: zneutral_sources   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_neutral_sources(zneutral_sources)
 
members of nbotype_neutral_sources data type:
 
    ! mibs -- fast ion specie index
    ! mig -- thermal gas index
    ! SORBN0 is a flux surface averaged volume source that might be
    ! used by a 1d thermal neutral gas model to estimate flux surface
    ! averaged halo neutral densities.  Non-flux-surface averaged 2d
    ! information is also available, to drive a 2d neutral gas model.
 
    INTEGER :: io_sbcx0s(15)  ! (mibs)
               ! XPLASMA ids for SBCX0S profiles.
        ! '#/S; CX fast neutral source'
        ! SCE FCN: FAST NEUTRALS BORN BY CX INSIDE PLASMA BY FAST ION SPECIES
        ! (information only; MC code computes recapture and loss)
 
    INTEGER :: io_sorbn0(10)  ! (mig)
               ! XPLASMA ids for SORBN0 profiles.
        ! '#/S; thermal neutral source'
        ! Thermal NEUTRAL SOURCE DUE TO deposition or cx recapture of fast
        ! neutrals, summed over species -- ** input to neutral gas model **
 
    INTEGER :: io_sorbn0s(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SORBN0S profiles.
        ! '#/S; thermal neutral source'
        ! Thermal NEUTRAL SOURCE DUE TO deposition or cx recapture of fast
        ! neutrals, broken down by fast neutral specie
 
    INTEGER :: io_sorbn0s_dep(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SORBN0S_DEP profiles.
        ! '#/S; thermal neutral source (dep only)'
        ! Thermal NEUTRAL SOURCE DUE TO beam deposition *only*,
        ! broken down by fast neutral specie
 
    INTEGER :: io_sn0s3dh(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SN0S3DH profiles.
        ! '#/S; 3dhalo thermal neutral source zone av'
        ! Thermal NEUTRAL SOURCE DUE TO beam deposition *only*,
        ! broken down by fast neutral specie
Home Top


nbotype_recapture

    use nbi_types
    type(nbotype_recapture) :: zrecapture   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_recapture(zrecapture)
 
members of nbotype_recapture data type:
 
    ! mibs -- fast ion specie index
    ! mig -- thermal gas index
    ! profiles showing processes for recapture of charge exchange
    ! fast neutrals.
 
    INTEGER :: io_sbcxrbs(15)  ! (mibs)
               ! XPLASMA ids for SBCXRBS profiles.
        ! '#/S; fast ion induced fast neutral recapture'
        ! FAST NEUTRAL RECAPTURE BY BEAM-BEAM CX OR IONIZIZATION
 
    INTEGER :: io_sbcxres(15)  ! (mibs)
               ! XPLASMA ids for SBCXRES profiles.
        ! '#/S; fast neutral recapture: e- impact'
        ! FAST NEUTRAL RECAPTURE BY IONIZATION (ELECTRONS)
 
    INTEGER :: io_sbcxris(15)  ! (mibs)
               ! XPLASMA ids for SBCXRIS profiles.
        ! '#/S; fast neutral recapture: th. ion impact'
        ! FAST NEUTRAL RECAPTURE BY IONIZATION (collision w/ non-impurity
        ! thermal ions)
 
    INTEGER :: io_sbcxrls(15)  ! (mibs)
               ! XPLASMA ids for SBCXRLS profiles.
        ! '#/S; fast neutral recapture: Lorentz ioniz.'
        ! FAST NEUTRAL RECAPTURE BY Lorentz IONIZATION
 
    INTEGER :: io_sbcxrxs(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SBCXRXS profiles.
        ! '#/S; fast neutral recapture: th ion cx'
        ! FAST NEUTRAL RECAPTURE BY CHARGE EXCHANGE W/THERMAL ION SPECIES
 
    INTEGER :: io_sbcxrzs(15)  ! (mibs)
               ! XPLASMA ids for SBCXRZS profiles.
        ! '#/S; fast neutral recapture: impurity impact'
        ! FAST NEUTRAL RECAPTURE BY IONIZATION (IMPURITIES)
Home Top


nbotype_neutral_sinks

    use nbi_types
    type(nbotype_neutral_sinks) :: zneutral_sinks   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_neutral_sinks(zneutral_sinks)
 
members of nbotype_neutral_sinks data type:
 
    ! mibs -- fast ion specie index
    ! mig -- thermal gas index
    !
    ! sink rates for thermal neutral gases-- flux surface averages.
    ! These should be used by a 1d thermal neutral gas model to
    ! calculate attenuation of neutral density due to the effects
    ! of fast ions.  For many experiments, this is a dominant effect
    ! on core neutral transport!
    !
    ! the profiles sinbn0 and sinb0i are flux surface averaged and
    ! suitable for use by a "1d" or flux surface averaged thermal
    ! neutral gas model; the code also outputs this data not flux
    ! surface averaged on a 2d grid: "SNBN02" and "SNB0I2"; the 2d
    ! outputs of the fast ion code are described in detail elsewhere.
    !
    ! also provided are profiles broken down by fast ion specie, for
    ! informational purposes.
 
    INTEGER :: io_sinb0i(10)  ! (mig)
               ! XPLASMA ids for SINB0I profiles.
        ! '/S; fast ion neutral ionization rate'
        ! SINK rate OF NEUTRALS DUE TO fast ion IMPACT IONIZATION (sum).
 
    INTEGER :: io_sinb0is(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SINB0IS profiles.
        ! '/S; fast ion neutral ionization rate'
        ! SINK rate OF NEUTRALS DUE TO fast ion IMPACT IONIZATION
        ! on backgroung plasma
 
    INTEGER :: io_sinbn0(10)  ! (mig)
               ! XPLASMA ids for SINBN0 profiles.
        ! '/S; fast ion CX rate w/thermal neutrals'
        ! NEUTRAL SINK rate DUE TO fast ion CHARGE EXCHANGE (sum).
 
    INTEGER :: io_sinbn0s(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SINBN0S profiles.
        ! '/S; fast ion CX rate with neutrals'
        ! NEUTRAL SINK rate DUE TO fast ion CHARGE EXCHANGE
        ! on backgroung plasma
Home Top


nbotype_sources

    use nbi_types
    type(nbotype_sources) :: zsources   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_sources(zsources)
 
members of nbotype_sources data type:
 
    ! mibs -- fast ion specie index
    ! mig -- thermal gas index
    !
    ! electron source profile, ion source profiles f(x) = no. of
    ! ptcls per second inside surface "x".
    !
    ! transport model particle continuity equations should
    ! use SORBE and SORBH; SORBTH and the
    ! breakdown by fast species profiles are informational.
 
    INTEGER :: io_sorbe
               ! XPLASMA id for SORBE profile.
        ! '#/S; electron source (fast neutral ionization)'
        ! ELECTRON SOURCE DUE TO BEAM DEPOSITION & CX total
        ! electrons direct from fast neutrals only; see also SORBN0
 
    INTEGER :: io_sorbes(15)  ! (mibs)
               ! XPLASMA ids for SORBES profiles.
        ! '#/S; electron source (fast neutral ionization)'
        ! ELECTRON SOURCE DUE TO BEAM DEPOSITION & CX, each fast specie
        ! electrons direct from fast neutrals only; see also SORBN0
 
    INTEGER :: io_sorbes_ntr(15)  ! (mibs)
               ! XPLASMA ids for SORBES_NTR profiles.
        ! '#/S; electron source (fast neutral ionization)'
        ! ELECTRON SOURCE DUE TO BEAM DEPOSITION & CX, each fast specie
        ! electrons direct from fast neutrals only; see also SORBN0
        ! came only from NUTRAV
 
    INTEGER :: io_sorbes_dep(15)  ! (mibs)
               ! XPLASMA ids for SORBES_DEP profiles.
        ! '#/S; electron source (beam deposition)'
        ! ELECTRON SOURCE DUE TO BEAM DEPOSITION only, each fast specie
        ! electrons direct from fast neutrals only; see also SORBN0
 
    INTEGER :: io_sorbh(10)  ! (mig)
               ! XPLASMA ids for SORBH profiles.
        ! '#/S; CX adjusted thermalization source'
        ! net ION SOURCE/SINK DUE TO BEAM thermalization, less CH-EX loss
        ! sum over all fast ion species; for recapture of thermal neutrals
        ! (SORBN0) created by charge exchange, use a thermal neutral gas model.
 
    INTEGER :: io_sorbhs(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SORBHS profiles.
        ! '#/S; CX adjusted thermalization source'
        ! net ion source/sink due to beam, indexed by fast ion specie
 
    INTEGER :: io_sorbhs_ntr(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SORBHS_NTR profiles.
        ! '#/S; CX adjusted thermalization source'
        ! net ion source/sink due to beam, indexed by fast ion specie
        ! came only from NUTRAV
 
    INTEGER :: io_sorbhs_dep(10,15)  ! (mig,mibs)
               ! XPLASMA ids for SORBHS_DEP profiles.
        ! '#/S; CX sink due to beam deposition'
        ! net ion sink due to beam ch-ex depo., indexed by fast ion specie
 
    INTEGER :: io_sorbth
               ! XPLASMA id for SORBTH profile.
        ! '#/S; thermalization source summed over species'
        ! ION SOURCE DUE TO BEAM THERMALIZATION, summed over all species
 
    INTEGER :: io_sorbths(15)  ! (mibs)
               ! XPLASMA ids for SORBTHS profiles.
        ! '#/S; thermalization source'
        ! ION SOURCE DUE TO BEAM THERMALIZATION, indexed by fast species
Home Top


nbotype_fokker_planck

    use nbi_types
    type(nbotype_fokker_planck) :: zfokker_planck   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_fokker_planck(zfokker_planck)
 
members of nbotype_fokker_planck data type:
 
    ! profiles related to the collision operator:
    !
    !   --slowing down times of newly deposited fast ions
    !   --pitch angle scattering times of newly deposited fast ions
    !
    !   different profiles are given for each category of beam
    !   ion (co-injected with Ip, ctr-injected, full/half/third
    !   energy).  For fusion product species, only taubpa0 and
    !   taubsl0 are computed.
    !
    ! also computed:
    !   fraction of ion heating going to impurities
    !      PBI*[this fraction] = power to impurity species
    !   fraction of pitch angle scattering caused by impurities
 
    INTEGER :: io_taubpa0(15)  ! (mibs)
               ! XPLASMA ids for TAUBPA0 profiles.
        ! 'S; P.A. scattering time at deposition (avg)'
        ! p.a. scattering time (secs), average over deposition
 
    INTEGER :: io_taubpaco1(15)  ! (mibs)
               ! XPLASMA ids for TAUBPACO1 profiles.
        ! 'S; P.A. scattering time at dep. (full E co)'
        ! p.a. scattering -- full energy "co" beam ions, sec
 
    INTEGER :: io_taubpaco2(15)  ! (mibs)
               ! XPLASMA ids for TAUBPACO2 profiles.
        ! 'S; P.A. scattering time at dep. (half E co)'
        ! p.a. scattering -- half energy "co" beam ions, sec
 
    INTEGER :: io_taubpaco3(15)  ! (mibs)
               ! XPLASMA ids for TAUBPACO3 profiles.
        ! 'S; P.A. scattering time at dep. (1/3 E co)'
        ! p.a. scattering -- 1/3 energy "co" beam ions, sec
 
    INTEGER :: io_taubpactr1(15)  ! (mibs)
               ! XPLASMA ids for TAUBPACTR1 profiles.
        ! 'S; P.A. scattering time at dep. (full E ctr)'
        ! p.a. scattering -- full energy "ctr" beam ions, sec
 
    INTEGER :: io_taubpactr2(15)  ! (mibs)
               ! XPLASMA ids for TAUBPACTR2 profiles.
        ! 'S; P.A. scattering time at dep. (half E ctr)'
        ! p.a. scattering -- half energy "ctr" beam ions, sec
 
    INTEGER :: io_taubpactr3(15)  ! (mibs)
               ! XPLASMA ids for TAUBPACTR3 profiles.
        ! 'S; P.A. scattering time at dep. (1/3 E ctr)'
        ! p.a. scattering -- 1/3 energy "ctr" beam ions, sec
 
    INTEGER :: io_taubsl0(15)  ! (mibs)
               ! XPLASMA ids for TAUBSL0 profiles.
        ! 'S; slowing down time at deposition (avg)'
        ! slowing down time (secs), average over deposition
 
    INTEGER :: io_taubslco1(15)  ! (mibs)
               ! XPLASMA ids for TAUBSLCO1 profiles.
        ! 'S; slowing down time at dep. (full E co)'
        ! slowing down -- full energy "co" beam ions, sec
 
    INTEGER :: io_taubslco2(15)  ! (mibs)
               ! XPLASMA ids for TAUBSLCO2 profiles.
        ! 'S; slowing down time at dep. (half E co)'
        ! slowing down -- half energy "co" beam ions, sec
 
    INTEGER :: io_taubslco3(15)  ! (mibs)
               ! XPLASMA ids for TAUBSLCO3 profiles.
        ! 'S; slowing down time at dep. (1/3 E co)'
        ! slowing down -- 1/3 energy "co" beam ions, sec
 
    INTEGER :: io_taubslctr1(15)  ! (mibs)
               ! XPLASMA ids for TAUBSLCTR1 profiles.
        ! 'S; slowing down time at dep. (full E ctr)'
        ! slowing down -- full energy "ctr" beam ions, sec
 
    INTEGER :: io_taubslctr2(15)  ! (mibs)
               ! XPLASMA ids for TAUBSLCTR2 profiles.
        ! 'S; slowing down time at dep. (half E ctr)'
        ! slowing down -- half energy "ctr" beam ions, sec
 
    INTEGER :: io_taubslctr3(15)  ! (mibs)
               ! XPLASMA ids for TAUBSLCTR3 profiles.
        ! 'S; slowing down time at dep. (1/3 E ctr)'
        ! slowing down -- 1/3 energy "ctr" beam ions, sec
 
    INTEGER :: io_paxfrc(15)  ! (mibs)
               ! XPLASMA ids for PAXFRC profiles.
        ! '-; fraction of P.A. scattering on impurities'
        ! FRACTION OF PITCH ANGLE SCATTERING DUE TO IMPURITIES, BY FAST SPECIES
        ! covers beams and fusion product species
 
    INTEGER :: io_pbxfrc(15)  ! (mibs)
               ! XPLASMA ids for PBXFRC profiles.
        ! '-; fraction of ion heating on impurities'
        ! FRACTION OF ION HEATING GOING TO IMPURITY SPECIES, BY FAST SPECIES
        ! covers beams and fusion product species
Home Top


nbotype_radial_current

    use nbi_types
    type(nbotype_radial_current) :: zradial_current   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_radial_current(zradial_current)
 
members of nbotype_radial_current data type:
 
    ! these are boundary oriented radial current profiles
    ! these are informational outputs, and apt to be noisy.
    ! DMC May 2010: anomalous transport diffusivity and pinch
    ! velocity "as observed" output profiles added.
 
    INTEGER :: io_tirabd
               ! XPLASMA id for TIRABD profile.
        ! 'A(radial); anomalous diffusion current'
        ! BEAM ION RADIAL CURRENT: anomalous diffusion
 
    INTEGER :: io_tirabds(15)  ! (mibs)
               ! XPLASMA ids for TIRABDS profiles.
        ! 'A(radial); anomalous diffusion current'
        ! BEAM ION RADIAL CURRENT: anomalous diffusion, by species
 
    INTEGER :: io_tirfsh
               ! XPLASMA id for TIRFSH profile.
        ! 'A(radial); fishbone current'
        ! BEAM ION RADIAL CURRENT: fishbones
 
    INTEGER :: io_tirfshs(15)  ! (mibs)
               ! XPLASMA ids for TIRFSHS profiles.
        ! 'A(radial); fishbone current'
        ! BEAM ION RADIAL CURRENT: fishbones, by species
 
    INTEGER :: io_tirorb
               ! XPLASMA id for TIRORB profile.
        ! 'A(radial); orbit evolution current'
        ! BEAM ION RADIAL CURRENT ACROSS SURFACES: classical orbiting,
        ! computed by differencing orbit averages
 
    INTEGER :: io_tirorbs(15)  ! (mibs)
               ! XPLASMA ids for TIRORBS profiles.
        ! 'A(radial); orbit evolution current'
        ! BEAM ION RADIAL CURRENT ACROSS SURFACES: classical orbiting,
        ! computed by differencing orbit averages, by species
 
    INTEGER :: io_tirrip
               ! XPLASMA id for TIRRIP profile.
        ! 'A(radial); TF ripple loss current'
        ! BEAM ION RADIAL CURRENT: ripple transport
 
    INTEGER :: io_tirrips(15)  ! (mibs)
               ! XPLASMA ids for TIRRIPS profiles.
        ! 'A(radial); TF ripple loss current'
        ! BEAM ION RADIAL CURRENT: ripple transport, by species
 
    INTEGER :: io_difbx(15)  ! (mibs)
               ! XPLASMA ids for DIFBX profiles.
        ! 'cm2/sec; average anomalous diffusivity'
 
    INTEGER :: io_velbx(15)  ! (mibs)
               ! XPLASMA ids for VELBX profiles.
        ! 'cm/sec; average anomalous radial velocity'
Home Top


nbotype_torques

    use nbi_types
    type(nbotype_torques) :: ztorques   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_torques(ztorques)
 
members of nbotype_torques data type:
 
    ! mibs -- fast ion specie index
    ! generally, this block contains torques applied to thermal
    ! plasma, due to various processes.  But:
    !   tqohb is a torque from the OH circuit to *fast* ions
    !   tqrpl is a torque from JxB due to ripple loss current
    ! and the coupling of these torques to the thermal plasma
    ! are considered unknown.
    !
    ! A net total torque
    !   tqbsum = collisional torque + JxB torque + thermalization torque
    !            + anom. diffusivity transfer - charge exchange loss
    !
    !          = tqbe + tqbi + tqjxb + tqbth + tqdifb - tqbcx
    !
    ! integrated profiles, f(x) = total torque inside flux surface "x".
    !
    ! for plasma momentum balance: the recommended momentum source
    ! is   tqbsum + c1*tqrpl - c2*tqohb   where c1 and c2 are
    ! adjustable parameters (e.g. TRANSP usually assumes c1=c2=0.0)
    !
    ! also in the block is a dimensionless profile "tqbxf" giving
    ! the fraction of ion collisional torque going to all impurities.
 
    INTEGER :: io_tqbsum
               ! XPLASMA id for TQBSUM profile.
        ! 'Nt*m; summed fast ion torque'
        ! = tqbcx + tqbe + tqbi + tqbth + tqdifb + tqjxb
        ! caution: tqohb and tqrpl ** not included **
 
    INTEGER :: io_tqbcx
               ! XPLASMA id for TQBCX profile.
        ! 'Nt*m; beam charge exchange loss torque'
        ! TORQUE FROM IONS DUE TO CX WITH FAST NEUTRALS **loss term**
 
    INTEGER :: io_tqbcxs(15)  ! (mibs)
               ! XPLASMA ids for TQBCXS profiles.
        ! 'Nt*m; beam charge exchange loss torque'
        ! TORQUE FROM IONS DUE TO CX WITH FAST NEUTRALS **loss term**
        ! by fast specie.
 
    INTEGER :: io_tqbcxs_dep(15)  ! (mibs)
               ! XPLASMA ids for TQBCXS_DEP profiles.
        ! 'Nt*m; beam CX loss torque during deposition'
        ! TORQUE FROM IONS DUE TO CX WITH FAST NEUTRALS **loss term**
        ! by fast specie. (deposition only)
 
    INTEGER :: io_tqbe
               ! XPLASMA id for TQBE profile.
        ! 'Nt*m; beam collisional torque to electrons'
        ! TORQUE TO ELECTRONS FROM BEAM SLOWING DOWN
 
    INTEGER :: io_tqbes(15)  ! (mibs)
               ! XPLASMA ids for TQBES profiles.
        ! 'Nt*m; beam collisional torque to electrons'
        ! TORQUE TO ELECTRONS FROM BEAM SLOWING DOWN
        ! by fast specie.
 
    INTEGER :: io_tqbi
               ! XPLASMA id for TQBI profile.
        ! 'Nt*m; beam collisional torque to ions'
        ! TORQUE TO IONS FROM BEAM SLOWING DOWN
 
    INTEGER :: io_tqbis(15)  ! (mibs)
               ! XPLASMA ids for TQBIS profiles.
        ! 'Nt*m; beam collisional torque to ions'
        ! TORQUE TO IONS FROM BEAM SLOWING DOWN
        ! by fast specie.
 
    INTEGER :: io_tqbco_nb(320)  ! (mib)
               ! XPLASMA ids for TQBCO_NB profiles.
        ! 'Nt*m; beam collisional torque to ions and electrons'
        ! TORQUE TO IONS AND ELECTRONS FROM BEAM SLOWING DOWN
        ! by neutral beam injector
 
    INTEGER :: io_tqbth_nb(320)  ! (mib)
               ! XPLASMA ids for TQBTH_NB profiles.
        ! 'Nt*m; beam thermalization torque'
        ! by neutral beam injector
 
    INTEGER :: io_tqtot_nb(320)  ! (mib)
               ! XPLASMA ids for TQTOT_NB profiles.
        ! 'Nt*m; beam total torque'
        ! tqbco_nb+tqjxb_nb+tqbth_nb
        ! by neutral beam injector
 
    INTEGER :: io_tqbth
               ! XPLASMA id for TQBTH profile.
        ! 'Nt*m; beam thermalization torque'
        ! TORQUE TO IONS FROM BEAM THERMALIZATION
 
    INTEGER :: io_tqbths(15)  ! (mibs)
               ! XPLASMA ids for TQBTHS profiles.
        ! 'Nt*m; beam thermalization torque'
        ! TORQUE TO IONS FROM BEAM THERMALIZATION
        ! by fast specie.
 
    INTEGER :: io_tqbxf
               ! XPLASMA id for TQBXF profile.
        ! '-; frac of collisional torque to impurities'
        ! FRACTION OF TQBI GOING TO IMPURITY SPECIES
 
    INTEGER :: io_tqbxfs(15)  ! (mibs)
               ! XPLASMA ids for TQBXFS profiles.
        ! '-; frac of collisional torque to impurities'
        ! FRACTION OF TQBI GOING TO IMPURITY SPECIES
        ! by fast specie.
 
    INTEGER :: io_tqdifb
               ! XPLASMA id for TQDIFB profile.
        ! 'Nt*m; torque assoc. with anom. diffusion'
        ! MOMENTUM DISSIPATION - BEAM ANOM. DIFFUSION
 
    INTEGER :: io_tqdifbs(15)  ! (mibs)
               ! XPLASMA ids for TQDIFBS profiles.
        ! 'Nt*m; torque assoc. with anom. diffusion'
        ! MOMENTUM DISSIPATION - BEAM ANOM. DIFF BY SPECIES
        ! by fast specie.
 
    INTEGER :: io_tqjxb
               ! XPLASMA id for TQJXB profile.
        ! 'Nt*m; JxB torque'
        ! BEAM ION DEP/ORBIT J X B TORQUE TO PLASMA
 
    INTEGER :: io_tqjxbs(15)  ! (mibs)
               ! XPLASMA ids for TQJXBS profiles.
        ! 'Nt*m; JxB torque'
        ! BEAM ION DEP/ORBIT J X B TORQUE TO PLASMA
        ! by fast specie.
 
    INTEGER :: io_tqjxbs_ntr(15)  ! (mibs)
               ! XPLASMA ids for TQJXBS_NTR profiles.
        ! 'Nt*m; JxB torque'
        ! BEAM ION DEP/ORBIT J X B TORQUE TO PLASMA (part from NUTRAV only)
        ! by fast specie.
 
    INTEGER :: io_tqjxb_nb(320)  ! (mib)
               ! XPLASMA ids for TQJXB_NB profiles.
        ! 'Nt*m; JxB torque'
        ! BEAM ION DEP/ORBIT J X B TORQUE TO PLASMA
        ! by beam line
 
    INTEGER :: io_tqjxbnb_ntr(320)  ! (mib)
               ! XPLASMA ids for TQJXBNB_NTR profiles.
        ! 'Nt*m; JxB torque'
        ! BEAM ION DEP/ORBIT J X B TORQUE TO PLASMA
        ! by beam line (part from NUTRAV only)
 
    INTEGER :: io_tqjxbs_dep(15)  ! (mibs)
               ! XPLASMA ids for TQJXBS_DEP profiles.
        ! 'Nt*m; JxB torque (deposition FLR step)'
        ! BEAM ION DEP/ORBIT J X B TORQUE TO PLASMA
        ! by fast specie.  (deposition only)
 
    INTEGER :: io_tqjxb_nb_dep(320)  ! (mib)
               ! XPLASMA ids for TQJXB_NB_DEP profiles.
        ! 'Nt*m; JxB torque (deposition FLR step)'
        ! BEAM ION DEP/ORBIT J X B TORQUE TO PLASMA
        ! by beam line (deposition only)
 
    INTEGER :: io_tqohb
               ! XPLASMA id for TQOHB profile.
        ! 'Nt*m; torque to beam ions from OH circuit'
        ! OHMIC TORQUE TO BEAM IONS =? -TORQUE TO PLASMA
 
    INTEGER :: io_tqohbs(15)  ! (mibs)
               ! XPLASMA ids for TQOHBS profiles.
        ! 'Nt*m; torque to beam ions from OH circuit'
        ! OHMIC TORQUE TO BEAM IONS =? -TORQUE TO PLASMA
        ! by fast specie.
 
    INTEGER :: io_tqrpl
               ! XPLASMA id for TQRPL profile.
        ! 'Nt*m; torque due to TF ripple loss'
        ! TOTAL RIPPLE TORQUE PROFILE
        ! under assumption: radial current due to ripple
        ! creates a JxB force.  ** this could be a large number **
        ! ** not included in tqbsum **
 
    INTEGER :: io_tqrpls(15)  ! (mibs)
               ! XPLASMA ids for TQRPLS profiles.
        ! 'Nt*m; torque due to TF ripple loss'
        ! TOTAL RIPPLE TORQUE PROFILE -- separated by fast species.
Home Top


nbotype_frantic

    use nbi_types
    type(nbotype_frantic) :: zfrantic   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_frantic(zfrantic)
 
members of nbotype_frantic data type:
 
 
    INTEGER :: io_nbi_den0mn(10,50)  ! (mig,mis)
               ! XPLASMA ids for NBI_DEN0MN profiles.
        ! 'the neutral density #/m**3'
 
    INTEGER :: io_nbi_en0mn(10,50)  ! (mig,mis)
               ! XPLASMA ids for NBI_EN0MN profiles.
        ! 'KeV, the neutral temperature'
 
    INTEGER :: io_nbi_omg0mn(10,50)  ! (mig,mis)
               ! XPLASMA ids for NBI_OMG0MN profiles.
        ! 'the av. neutral toroidal velocity, m/sec'
 
    INTEGER :: io_nbi_snimn(10,50)  ! (mig,mis)
               ! XPLASMA ids for NBI_SNIMN profiles.
        ! 'the ionization ion source, #/m**3/sec'
 
    REAL*8 :: nbi_outflx(10,50)  ! (mig, mis)
        ! 'outflux rate (#/m**2/sec)'
 
    REAL*8 :: nbi_eescav(10,50)  ! (mig, mis)
        ! 'average energy (KeV/ptcl)'
 
    REAL*8 :: nbi_cexflx(10,50)  ! (mig, mis)
        ! 'outflux rate (#/m**2/sec)'
 
    INTEGER :: io_nbi_snemn(2,50)  ! (2,mis)
               ! XPLASMA ids for NBI_SNEMN profiles.
        ! '#/m**3/sec the electron source'
        ! to the plasma due to ionization of neutrals
 
    INTEGER :: io_nbi_scxmn(50)  ! (mis)
               ! XPLASMA ids for NBI_SCXMN profiles.
        ! 'the CX reaction rate #/m**3/sec'
 
    INTEGER :: io_nbi_pcxmn(50)  ! (mis)
               ! XPLASMA ids for NBI_PCXMN profiles.
        ! 'the CX power W/m**3 lost to ions'
 
    INTEGER :: io_nbi_pnimn(50)  ! (mis)
               ! XPLASMA ids for NBI_PNIMN profiles.
        ! 'the ionization source power W/m**3 to ions'
 
    INTEGER :: io_nbi_tqcxmn(50)  ! (mis)
               ! XPLASMA ids for NBI_TQCXMN profiles.
        ! 'the CX torque density Nt-m/m**3 lost to ions'
 
    INTEGER :: io_nbi_tqnimn(50)  ! (mis)
               ! XPLASMA ids for NBI_TQNIMN profiles.
        ! 'the ioniz. source torque density  Nt-m/m**3'
        !  to ions
 
    INTEGER :: io_nbi_pfcxmn(50)  ! (mis)
               ! XPLASMA ids for NBI_PFCXMN profiles.
        ! 'the CX source friction  W/m**3 to ions'
 
    INTEGER :: io_nbi_pfnimn(50)  ! (mis)
               ! XPLASMA ids for NBI_PFNIMN profiles.
        ! 'the ioniz. source friction  W/m**3 to ions'
 
    INTEGER :: io_nbi_sflx0m(2,50)  ! (2,mis)
               ! XPLASMA ids for NBI_SFLX0M profiles.
        ! '#/m**3/sec, the total div'
        !  of (electrons carried by) neutral atoms
        ! 1 -- influx
        ! 2 -- outflux
 
    INTEGER :: io_nbi_pflx0m(2,50)  ! (2,mis)
               ! XPLASMA ids for NBI_PFLX0M profiles.
        ! 'W/m**3, the total div'
        ! of (power carried by) neutral atoms
        ! 1 -- influx
        ! 2 -- outflux
 
    INTEGER :: io_nbi_tqflx0(50)  ! (mis)
               ! XPLASMA ids for NBI_TQFLX0 profiles.
        ! 'Nt-m/m**3, the total div(flux)'
        !of momentum of neutral atoms"
 
    INTEGER :: io_nbi_pb0mn(50)  ! (mis)
               ! XPLASMA ids for NBI_PB0MN profiles.
        ! 'W, power in halo neutral source'
        !  (loss from thermal ions)
 
    INTEGER :: io_nbi_pscmn(50)  ! (mis)
               ! XPLASMA ids for NBI_PSCMN profiles.
        ! 'W, beam halo power'
        !  recapture - pb0_halo
        !  (net source/sink to thermal ions)
        !  (associated particle source/sink exists)
 
    INTEGER :: io_nbi_tqb0mn(50)  ! (mis)
               ! XPLASMA ids for NBI_TQB0MN profiles.
        ! 'Nt*m, torque of halo neutral source'
        !  (loss from thermal ions)
 
    INTEGER :: io_nbi_tqscmn(50)  ! (mis)
               ! XPLASMA ids for NBI_TQSCMN profiles.
        ! 'Nt*m, beam halo torque'
        ! recapture - tqb0_halo
        !  (net source/sink to thermal ions)
        !  (associated particle source/sink exists)
Home Top


nbotype_hi_z_beams

    use nbi_types
    type(nbotype_hi_z_beams) :: zhi_z_beams   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_hi_z_beams(zhi_z_beams)
 
members of nbotype_hi_z_beams data type:
 
    ! for Z.gt.2 beams (e.g. neon beams): <Z> of partially stripped
    ! slowing down beam ions.
    ! (caution: high-Z beam model not operational-- can be revived if
    ! there is specific user interest; contact authors at PPPL).
 
    INTEGER :: io_xzbmav(15)  ! (mibs)
               ! XPLASMA ids for XZBMAV profiles.
        ! '-; avg <Z> of beam injected impurity ions'
        ! AVERAGE CHARGE STATE OF ORBITTING HEAVY IONS
Home Top


nbotype_cptimes

    use nbi_types
    type(nbotype_cptimes) :: zcptimes   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_cptimes(zcptimes)
 
members of nbotype_cptimes data type:
 
    ! (not to be MPI reduced-- time 1 cpu, assume load balance)
    ! (CPBMAX and CPBMIN -- Max and Min CPU times among all
    !  processes in an parallel run)
    ! CPBROOT - CPU time for the root processor
 
    REAL*8 :: CPBPS
        ! 'S; cpu time in plasma state data extraction'
 
    REAL*8 :: CPBSTART
        ! 'S; cpu time in setup (get profiles + NBSTART)'
        ! cpu time, seconds, in NBI_PROFGET + NBSTART
 
    REAL*8 :: CPBDEP
        ! 'S; cpu time in deposition (DEPALL)'
        ! cpu time, seconds, in DEPALL
 
    REAL*8 :: CPBORB
        ! 'S; cpu time in orbiting (ORBALL)'
        ! cpu time, seconds, in ORBALL
 
    REAL*8 :: CPBFIN
        ! 'S; cpu time in post-processing (NBFINISH)'
        ! cpu time, seconds, in NBFINISH
 
    REAL*8 :: CPBMAX
        ! 'S; Max total cpu time (MPI job)'
        ! Max cpu time, seconds, MPI Job
 
    REAL*8 :: CPBMIN
        ! 'S; Min total cpu time (MPI job)'
        ! Min cpu time, seconds, MPI Job
 
    REAL*8 :: CPBROOT
        ! 'S; total cpu time for root (MPI job)'
        ! cpu time for root, seconds, MPI Job
Home Top


nbotype_power_balance

    use nbi_types
    type(nbotype_power_balance) :: zpower_balance   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_power_balance(zpower_balance)
 
members of nbotype_power_balance data type:
 
    ! data related to scalar power balance for beam species
    !
    ! e.g. loss terms:  (for specie "i", all in watts):
    !     bpls(i) -- bad orbit (limiter) loss
    !     bpshins(i) -- shine-through power loss (deposition)
    !     bpcxins(i) -- charge exchange loss (fast ions inside plasma)
    !     bpcxots(i) -- charge exchange loss (ions in scrapeoff region)
    !     bpfshs(i) -- power loss due to fishbones (ad hoc model)
    !     (profiles pbaepms(:,:,i) -- power due to AEP (MHD) activity)
    !     bprpls(i) -- power loss due to TF ripple (ad hoc model)
    !
    ! and power to the thermal plasma...
    !     bpths(i) -- thermalization
    !       (profiles pbe(...),pbi(...) -- beam elec. and ion heating)
    !       (profiles pfe(...),pfi(...) -- fusion product heating)
    !
    ! and power balance
    !
    !     injected power (pinjs(i))
    !    +(compressional input power) (profile pbcprss(...)
    !    +prfb(i)    RF power to fast ions (zero in Monte Carlo model)
    !    +bpohs(i)   power to fast ions from OH circuit (loop voltage)
    !    +bperrs(i)  non-physical power due to inexact orbit integration[*]
    !    -bpsts(i)   power stored (d/dt(stored energy))
    !    -(loss terms)
    !    -(rotational work done)[**]
    !    -(power to thermal plasma)
    !     --------
    !     residual (should be small).
    !
    !     pbdepmc(i) actual MC power deposited
    !
    ! total beam power deposited
    ! there is information on charge exchange powers:
    !     bpcxi0s(i) -- charge exchange fast neutral source (plasma)
    !     bpcxx0s(i) -- charge exchange source (scrapeoff region)
    !     bpcxris(i) -- recapture of neutrals launched from plasma
    !     bpcxrxs(i) -- recapture of neutrals launched in scrapeoff region
    !     bpcxins(i) -- charge exchange loss (fast ions inside plasma)
    !     bpcxots(i) -- charge exchange loss (ions in scrapeoff region)
    !     bpcxers(i) -- straight line tracker positioning error [*]
    !
    ! [*] these are measurable numerical errors, they should be quite small
    ! [**] see "torque_work" section
 
    REAL*8 :: bpcxers(15)  ! (mibs)
        ! 'W; fast ion CX tracker error'
        ! BEAM CX POWER ERROR - TRACK NOT FOUND, BY SPECIES by specie
 
    REAL*8 :: bpcxi0s(15)  ! (mibs)
        ! 'W; CX fast neutral source (plasma)'
        ! BEAM POWER CX-ING, SUBJECT TO RECAPTURE, by specie
 
    REAL*8 :: bpcxins(15)  ! (mibs)
        ! 'W; net CX loss from in plasma'
        ! BEAM POWER LOST TO CHARGE EXCHANGE-- from INSIDE, by specie
 
    REAL*8 :: bpcxots(15)  ! (mibs)
        ! 'W; net CX loss from SOL'
        ! BEAM POWER TO CX-- from OUTSIDE OF THE PLASMA BY specie
 
    REAL*8 :: bpcxris(15)  ! (mibs)
        ! 'W; fast neutral recapture (plasma sce)'
        ! BEAM CX POWER RECAPTURED (INTERIOR SOURCE PT.) by specie
 
    REAL*8 :: bpcxrxs(15)  ! (mibs)
        ! 'W; fast neutral recapture (SOL sce)'
        ! BEAM CX POWER RECAPTURED (EXTERIOR SOURCE PT.) by specie
 
    REAL*8 :: bpcxx0s(15)  ! (mibs)
        ! 'W; CX fast neutral source (SOL)'
        ! BEAM POWER CX-ING, SUBJ. TO RECAPTURE (EXTERIOR) by specie
 
    REAL*8 :: bperr
        ! 'W; orbit integration error'
        ! BEAM POWER ERROR - ORBIT EQN. CHECK
 
    REAL*8 :: bperrs(15)  ! (mibs)
        ! 'W; orbit integration error'
        ! BEAM POWER ERROR - ORBIT EQN. CHECK BY SPECIES
 
    INTEGER :: io_PBAEPMS(10,15)  ! (mnkaep,mibs)
               ! XPLASMA ids for PBAEPMS profiles.
        ! 'W; power profile from AEP (MHD) activity'
        ! BEAM POWER from AEP (MHD) activity BY MODE and SPECIES
 
    REAL*8 :: bpfshs(15)  ! (mibs)
        ! 'W; fishbone loss'
        ! BEAM POWER LOST TO "FISH-BONES" BY SPECIES
 
    REAL*8 :: bpls(15)  ! (mibs)
        ! 'W; orbit loss'
        ! BEAM POWER TO LIMITER BY BEAM ION SPECIES
 
    REAL*8 :: bpls_dep(15)  ! (mibs)
        ! 'W; orbit loss (deposition calculation)'
        ! BEAM POWER TO LIMITER BY BEAM ION SPECIES (deposition calc. only)
 
    REAL*8 :: bpohs(15)  ! (mibs)
        ! 'W; power from OH circuit to fast ions'
        ! TOTAL POWER FROM OH CIRCUIT TO BEAM IONS BY SPECIES
 
    REAL*8 :: bprpls(15)  ! (mibs)
        ! 'W; TF ripple loss'
        ! BEAM POWER LOSS FROM RIPPLE BY SPECIES
 
    REAL*8 :: bpshins(15)  ! (mibs)
        ! 'W; shine-thru'
        ! BEAM SHINE THRU POWER, BY BEAM SPECIES
 
    REAL*8 :: bpsts(15)  ! (mibs)
        ! 'W; d/dt(fast ion energy)'
        ! BPST, BY FAST ION SPECIES
 
    REAL*8 :: bpths(15)  ! (mibs)
        ! 'W; thermalization power'
        ! BEAM POWER THERMALIZING INTO PLASMA, BY SPECIES
 
    REAL*8 :: pftota
        ! 'W; fusion product source'
        ! GRAND TOTAL POWER IN FUSION PRODUCT SOURCE
 
    REAL*8 :: bpprma(320)  ! (mib)
        ! 'W; estimated prompt orbit loss'
        ! EST. PROMPT ORBIT LOSS, BEAMLINE BY BEAMLINE
 
    REAL*8 :: pinjs(15)  ! (mibs)
        ! 'W; injected power'
        ! injected power (or fusion product source power), by species.
 
    REAL*8 :: pinjs_res(15)  ! (mibs)
        ! 'W; injected power'
        ! injected power (or fusion product source power) - shine through power,
        ! by species at the time step when injected power not equals zero
 
    REAL*8 :: pbdepmc(15)  ! (mibs)
        ! 'actual MC power deposited'
        ! for beam species only
        ! total beam power deposited
 
    REAL*8 :: PBDEPBA(15)  ! (mibs)
        ! 'W; beam power balance check'
        !for beam species only
        !in case when the # of deposited MC particles >= NDEP0
        !the balance will come out exact because
        !of the normalization in subroutine DEPNRM
        !(calculation is normalized to injected power, not current).
        !In case # of deposited MC particles < NDEP0
        !it won't be perfect due to statistical error.
 
    REAL*8 :: bpephis(15)  ! (mibs)
        ! 'W; power to fast ions from E_rad'
        ! watts -- power from radial electrostatic field
 
    REAL*8 :: orbrzv_Prftot(15)  ! (mibs)
        ! 'W; RF-power to fast ions from mcrf'
        ! total power calculated by mcrf
 
    REAL*8 :: orbrzv_toric_Prftot(15)  ! (mibs)
        ! 'W; RF-power to fast ions from toric'
        ! total power calculated by toric
 
    REAL*8 :: orbrzv_toric_ufrnm(15)  ! (mibs)
        ! 'RF-field renormalizer updated in this time step'
        ! toric field renormalizer updated in this time step
Home Top


nbotype_momentum_balance

    use nbi_types
    type(nbotype_momentum_balance) :: zmomentum_balance   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_momentum_balance(zmomentum_balance)
 
members of nbotype_momentum_balance data type:
 
    ! quantities related to scalar angular momentum balance (Nt-m)
    !
    ! momentum balance of slowing down fast ion population, species "i":
    !
    !    +bphdepsgc(i)    MC momentum deposited at GC
    !    +bphdeps(i)    MC momentum deposited at point of ionization
    !    +bphdshins(i)  shine-through  (deposition)
    !    +bphinjs(i)     momentum injected
    !    +bphdpba(i)   balance check
    !    +bphohbs(i)     from OH circuit (loop voltage)
    !    -bphfshs(i)    -(fishbone loss, if ad hoc fishbone model is active)
    !    -bphrpls(i)    -(ripple loss, if ad hoc ripple loss model active)
    !    -bphorbs(i)    -(orbit loss; ion strikes wall or limiter)
    !    -bph0was(i)    -(charge exchange loss, neutrals to wall)
    !    -bphjxbs(i)    -(JxB torque due to net radial motion)
    !    -bphcols(i)    -(collisional torque to thermal plasma)
    !    -bphdfbs(i)    -(momentum effect of anomalous diffusion operator)
    !    -thermalization  -(thermalization ion source)
    !    +bpherrs(i)   +momentum due to error in orbit integrator[*]
    !    -bphsts(i)    -(d/dt(fast ion momentum))
    !     ------
    !     bphcks(k)    residual-- should be near zero but not to machine
    !                             precision.
    !
    ! [*] numerical error, should be modest, or else the fast ion orbit
    !     timestep is too large.
    !
    ! charge exchange momentum balance
    !    +bphcxls(i)    charge exchange fast neutral source momentum
    !    -bphrcas(i)    -(recapture in plasma)
    !    -bph0was(i)    -(charge exchange loss, neutrals to wall)
    !     ---------
    !     residual      should be near zero but may be noisy
    !
 
    REAL*8 :: bph0was(15)  ! (mibs)
        ! 'Nt*m; CX fast ion loss to walls'
        ! CX MOMENTUM LOST TO WALLS BY SPECIES
 
    REAL*8 :: bphcks(15)  ! (mibs)
        ! 'Nt*m;  momentum balance check'
        ! BEAM MOMENTUM BALANCE CHECK (SHOULD=0)
 
    REAL*8 :: bphcols(15)  ! (mibs)
        ! 'Nt*m; collisional torque to plasma'
        ! BEAM MOMENTUM TO PLASMA VIA COLLISIONS BY SPECIES
 
    REAL*8 :: bphcons(15)  ! (mibs)
        ! 'Nt*m*S; momentum in fast ions'
        ! BEAM MOMENTUM CONTENT, BY BEAM ION SPECIES
 
    REAL*8 :: bphcxls(15)  ! (mibs)
        ! 'Nt*m; CX of fast ions'
        ! CX LOSS OF MOMENTUM (SUBJ. TO RECAPTURE)
 
    REAL*8 :: bphinjs(15)  ! (mibs)
        ! 'Nt*m; momentum injected'
        ! MOMENTUM INJECTED BY BEAM SPECIES
 
    REAL*8 :: bphdepsgc(15)  ! (mibs)
        ! 'Nt*m; deposition at GC'
        ! MOMENTUM DEPOSITION BY BEAM SPECIES at GC
 
    REAL*8 :: bphdeps(15)  ! (mibs)
        ! 'Nt*m; deposition at  point of ionization'
        ! MOMENTUM DEPOSITION BY BEAM SPECIES at point of ionization
 
    REAL*8 :: bphshins(15)  ! (mibs)
        ! 'shine through momentum Nt*m; deposition'
        ! shine through MOMENTUM DEPOSITION BY BEAM SPECIES
 
    REAL*8 :: bphdpba(15)  ! (mibs)
        ! 'Nt*m; beam momentum balance check'
 
    REAL*8 :: bphdfbs(15)  ! (mibs)
        ! 'Nt*m; anomalous diffusion torque'
        ! BEAM ANOM DIFF. TORQUE TO PLASMA BY SPECIES
 
    REAL*8 :: bpherr
        ! 'Nt*m; orbit integration error'
        ! BEAM MOMENTUM ERROR - ORBIT EQN. CHECK
        ! summed over all fast species
 
    REAL*8 :: bpherrs(15)  ! (mibs)
        ! 'Nt*m; orbit integration error'
        ! BEAM MOMENTUM ERROR - ORBIT EQN. CHECK
 
    REAL*8 :: bphfshs(15)  ! (mibs)
        ! 'Nt*m; fishbone loss'
        ! BEAM ION MOMENTUM TO FISHBONES BY SPECIES
 
    REAL*8 :: bphjxbs(15)  ! (mibs)
        ! 'Nt*m; JxB torque to plasma'
        ! BEAM ANG.MOMENTUM TO JXB TORQUE, BY SPECIES
 
    REAL*8 :: bphjxbs_ntr(15)  ! (mibs)
        ! 'Nt*m; JxB torque to plasma'
        ! BEAM ANG.MOMENTUM TO JXB TORQUE, BY SPECIES, from NUTRAV only
 
    REAL*8 :: bphjxbs_dep(15)  ! (mibs)
        ! 'Nt*m; JxB torque: deposition FLR step'
        ! BEAM ANG.MOMENTUM TO JXB TORQUE, BY SPECIES (deposition calc. only)
 
    REAL*8 :: bphohbs(15)  ! (mibs)
        ! 'Nt*m; torque to fast ions from OH circuit'
        ! BEAM ION MOMENTUM FROM OH CIRCUIT BY SPECIES
 
    REAL*8 :: bpholds(15)  ! (mibs)
        ! 'Nt*m*S; prev. timestep momentum'
        ! BEAM ION MOMENTUM BY SPECIES, PREV TIMESTEP
 
    REAL*8 :: bphorbs(15)  ! (mibs)
        ! 'Nt*m; orbit loss'
        ! BEAM MOMENTUM TO LIMITER, BY SPECIES
 
    REAL*8 :: bphorbs_dep(15)  ! (mibs)
        ! 'Nt*m; orbit loss (deposition FLR)'
        ! BEAM MOMENTUM TO LIMITER, BY SPECIES (deposition calc. only)
 
    REAL*8 :: bphrcas(15)  ! (mibs)
        ! 'Nt*m; recapture of CX fast neutrals'
        ! CX RECAPTURE OF MOMENTUM BY SPECIES
 
    REAL*8 :: bphrpls(15)  ! (mibs)
        ! 'Nt*m; ripple loss'
        ! MOMENTUM LOSS FROM RIPPLE BY SPECIES
 
    REAL*8 :: bphsts(15)  ! (mibs)
        ! 'Nt*m; d/dt(angular momentum)'
        ! RATE OF STORAGE OF FAST ION MOMENTUM BY SPECIES
 
    REAL*8 :: bphths(15)  ! (mibs)
        ! 'Nt*m; thermalization'
        ! BEAM ION MOMENTUM THERMALIZING BY SPECIES
Home Top


nbotype_torque_work

    use nbi_types
    type(nbotype_torque_work) :: ztorque_work   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_torque_work(ztorque_work)
 
members of nbotype_torque_work data type:
 
    ! these quantities are powers associated with work done by
    ! the beam (or other fast specie) on a rotating target plasma.
    !   e.g. work done, (torque) x (target angular velocity)
 
    REAL*8 :: bptcols(15)  ! (mibs)
        ! 'W; collisional torque work done'
        ! BEAM POWER TO ROTATING PLASMA ENERGY, TORQUE WORK
 
    REAL*8 :: bptdfbs(15)  ! (mibs)
        ! 'W; Anom. diffusion JxB torque work'
        ! BEAM ANOM DIFF. POWER TO ROTATION BY SPECIES
 
    REAL*8 :: bpthros(15)  ! (mibs)
        ! 'W; rotational energy via thermalization'
        ! BEAM POWER THERM INTO PLASMA ROTATION BY SPECIES
 
    REAL*8 :: bpthsfs(15)  ! (mibs)
        ! 'W; thermalization source friction'
        ! BEAM POWER THERM ROTATIONAL SCE-FRICTION CORR.
 
    REAL*8 :: bpjxbs(15)  ! (mibs)
        ! 'W; JxB torque work'
        ! BEAM POWER TO JXB TORQUE WORK, BY SPECIES
 
    REAL*8 :: bpjxbs_ntr(15)  ! (mibs)
        ! 'W; JxB torque work'
        ! BEAM POWER TO JXB TORQUE WORK, BY SPECIES, from NUTRAV only
 
    REAL*8 :: bpjxbs_dep(15)  ! (mibs)
        ! 'W; JxB torque work in deposition step'
        ! BEAM POWER TO JXB TORQUE WORK, BY SPECIES (deposition calc. only)
 
    REAL*8 :: bpthafs(15)  ! (mibs)
        ! 'W; thermalization asymmetry correction'
        ! BEAM POWER THERM ROT. SCE ASSYMETRY CORRECTION BY FAST SPECIE
Home Top


nbotype_particle_balance

    use nbi_types
    type(nbotype_particle_balance) :: zparticle_balance   ! instantiate object
 
    ! get NUBEAM calculation results:
    call nbo_get_particle_balance(zparticle_balance)
 
members of nbotype_particle_balance data type:
 
    !
    !  This block contains scalar information related to fast ion particle
    !  balance.  Some quantities are available summed over fast ion species.
    !
    !  Various combinations of these quantities can be used to check the
    !  particle balance of various aspects of the fast ion model.
    !
    !  For example, some combinations used by TRANSP:
    !
    !      -- for fast specie "i":
    !
    !  General particle balance:
    !
    !    +sfdepsc(i)    deposition source
    !    +sfxrcsc(i)    charge exchange recapture source
    !    -bxfshs(i)    -(fishbone loss, if ad hoc fishbone model is active)
    !    -bxrpls(i)    -(ripple loss, if ad hoc ripple loss model active)
    !    -bxflws(i)    -(orbit loss; ion strikes wall or limiter)
    !    -bxflws_prompt(i) -(prompt orbit loss; ion strikes wall or limiter)
    !    -snbcxs(i)    -(charge exchange loss inside plasma)
    !    -snbcxos(i)   -(charge exchange loss, scrapeoff region)
    !    -thermalization  -(thermalization ion source, cf profile sorbths)
    !    -sfdtbmc(i)   -(d/dt(fast ion population in plasma))
    !     ------
    !     (residual)    (should be near zero but not to machine precision).
    !
    !  For fast ion  deposition:
    !    +xninjs(i)     number of particles injected
    !    -xninjea(i)    energy conservation adjustment
    !    -sfshine(i)    shine-through (beams only)
    !    -sfdepmc(i)    number of particles deposited
    !     -----
    !     sfdepba(i)    residual-- should be very close to zero
    !
    !  this won't be perfect, because the calculation is normalized to
    !  injected power, not current.  A related quantity is:
    !
    !     sfdeprr(i)    Monte Carlo Russian Roulette adjustment
    !                   (will affect overall particle balance; deposition
    !                   Russian Roulette is applied to make room for new
    !                   MC ions e.g. when the fast ion population is rising).
    !
    !  which is related to an option to compute extra deposition tracks
    !  beyond the number needed for new ions, e.g. to improve statistics
    !  on fast neutral density profiles.
    !
    !  Also for beam deposition:
    !
    !     sfdepiz(i)    deposition:  impact ionization on thermal plasma
    !     sfdepcx(i)    deposition:  charge exchange with thermal plasma
    !     sfdbbiz(i)    deposition:  impact ionization on fast ions
    !     sfdbbcx(i)    deposition:  charge exchange with fast ions
    !     ----------
    !     sfdepsc(i)    total deposition source integrated over neutral tracks
    !
    !  These quantities are integrated over neutral tracks; it may be worth
    !  comparing sfdepsc(i) to sfdepmc(i); the latter is the n/sec actually
    !  added to the slowing down Monte Carlo model population.  sfdepmc(i)
    !  is noisier:  each track is collapsed to a start point for a single
    !  orbiting ion; and at the end, all weights are renormalized to give
    !  the correct injected power (watts) from input data, causing a small
    !  random error in the modeled number of particles deposited.
    !
    !  There is a slowing-down particle balance that includes Monte Carlo
    !  adjustments and which should yield a residual within machine precision
    !  of zero:
    !
    !    +sfdepmc(i)   deposition source
    !    +sfdeprr(i)   Monte Carlo Russian Roulette adjustment
    !    -bxfshs(i)    -(fishbone loss, if ad hoc fishbone model is active)
    !    -bxrpls(i)    -(ripple loss, if ad hoc ripple loss model active)
    !    -bxflws(i)    -(orbit loss; ion strikes wall or limiter)
    !    -bxflws_prompt(i) -(prompt orbit loss; ion strikes wall or limiter)
    !    -sfcxesc(i)   -charge exchange fast neutrals escaping
    !    -sfcxrr(i)    -charge exchange Monte Carlo Russian Roulette adjustment
    !    -thermalization  -(thermalization ion source, cf profile sorbths)
    !    -sfdtbmc(i)   -(d/dt(ion population in plasma))
    !    -sforbrr(i)   -orbit Monte Carlo Russian Roulette adjustment
    !     --------
    !     sforbal(i)   residual -- should be zero to REAL*4 machine precision
    !
    !  Particle balance information is available on fast ion charge exchange
    !  and fast neutral recapture:
    !
    !    +sfcx0mc(i)   Fast neutrals created (n/sec, fast specie i)
    !    -sfcxesc(i)   Fast neutrals escaping
    !    -sfcxrr(i)    Monte Carlo Russian Roulette adjustment
    !    -sfcxrmc(i)   Fast neutrals recaptured
    !     ---------
    !     sfcxbal(i)   residual -- should be zero to REAL*4 precision
    !
    !  Charge exchange recapture processes are similar to deposition processes:
    !
    !     sfxrciz(i)    recapture:  impact ionization on thermal plasma
    !     sfxrccx(i)    recapture:  charge exchange with thermal plasma
    !     sfrbbiz(i)    recapture:  impact ionization on fast ions
    !     sfrbbcx(i)    recapture:  charge exchange with fast ions
    !     ---------
    !     sfxrcsc(i)   total recapture rate
    !
    !  These quantities are integrated over charge exchange neutral tracks;
    !  it may be worth comparing sfxrcsc(i) to sfcxrmc(i); the latter will
    !  be noisier, as it reflects the reduction of each neutral track to
    !  a properly weighted random decision to recapture, or not.
    !
    !  There is analogous data on the originating charge exchange process,
    !  from the point of view of the slowing down fast ions:
    !
    !     snbxw0(i)     charge exchange on "wall" (edge source) thermal neutrals
    !     snbxv0(i)     charge exchange on "halo" (vol. source) thermal neutrals
    !     snbxbb0(i)    charge exchange on original beam neutrals
    !     snbxbb1(i)    charge exchange on fast neutrals (from charge exchange).
    !     ---------
    !     snbxtot(i)    total charge exchange sink rate
    !
    !  Which can be compared sfcx0mc(i)-- the number of fast neutrals actually
    !  launched by the Monte Carlo model (this will generally be noisier).
 
    REAL*8 :: bxflws(15)  ! (mibs)
        ! '#/S; fast ions lost to wall'
        ! BEAM IONS/SEC TO LIMITER, BY SPECIES
 
    REAL*8 :: bxflws_dep(15)  ! (mibs)
        ! '#/S; deposition FLR loss'
        ! BEAM IONS/SEC TO LIMITER, BY SPECIES (deposition calc. only)
 
    REAL*8 :: bxflws_prompt(15)  ! (mibs)
        ! '#/S;  prompt losses of fast ions to wall'
        ! BEAM IONS/SEC TO LIMITER, BY SPECIES
 
    REAL*8 :: bxfshs(15)  ! (mibs)
        ! '#/S; fishbone loss'
        ! BEAM PTCLS LOST TO "FISH-BONES" BY SPECIES
 
    REAL*8 :: bxrpls(15)  ! (mibs)
        ! '#/S; TF ripple loss'
        ! PARTICLE LOSS FROM RIPPLE BY SPECIES
 
    REAL*8 :: sbcxxs(15)  ! (mibs)
        ! '#/S; lost fast neutrals born in plasma'
        ! FAST NEUTS BORN INSIDE PLASMA WHICH ESCAPE, BY SPECIES
        ! note some neutrals may be born outside; this is the difference
        ! between sbcxx* and sfcxesc*
 
    REAL*8 :: sfcx0mc(15)  ! (mibs)
        ! '#/S; Monte Carlo fast neutral source'
        ! MONTE CARLO FAST NEUTRALS LAUNCHED, N/SEC
 
    INTEGER :: io_sfcxmc1d(15)  ! (mibs)
               ! XPLASMA ids for SFCXMC1D profiles.
        ! '#/S; Monte Carlo fast neutral source'
        ! MONTE CARLO FAST NEUTRALS LAUNCHED, N/SEC
 
    REAL*8 :: sfcxbal(15)  ! (mibs)
        ! '#/S; CX particle balance'
        ! M.C. CHARGE EXCHANGE PARTICLE BALANCE
 
    REAL*8 :: sfcxesc(15)  ! (mibs)
        ! '#/S; CX loss to walls from plasma & SOL'
        ! FAST NEUTRALS ESCAPING, N/SEC
 
    REAL*8 :: sfcxrmc(15)  ! (mibs)
        ! '#/S; CX fast neutrals recaptured'
        ! M.C. CX RECAPTURE N/SEC
 
    REAL*8 :: sfcxrr(15)  ! (mibs)
        ! '#/S; CX recapture Russian Roulette corr.'
        ! CX RECAPTURE RUSSIAN ROULETTE "LOSS", N/SEC
 
    REAL*8 :: sfdbbcx(15)  ! (mibs)
        ! '#/S; deposition by beam-beam CX'
        ! BEAM DEPOSITION BY BEAM-BEAM CHARGE EXCHANGE
 
    REAL*8 :: sfdbbiz(15)  ! (mibs)
        ! '#/S; deposition by beam-beam ionization'
        ! BEAM DEPOSITION BY BEAM-BEAM IONIZATION
 
    REAL*8 :: sfdepba(15)  ! (mibs)
        ! '#/S; deposition ptcl balance check'
        ! M.C. DEPOSITION PARTICLE BALANCE
 
    REAL*8 :: sfdepcx(15)  ! (mibs)
        ! '#/S; deposition by CX w/ thermal ions'
        ! FAST ION SCE -- BEAM DEP. BY TH. CX
 
    REAL*8 :: sfdepiz(15)  ! (mibs)
        ! '#/S; deposition, ionization by therm. ions'
        ! FAST ION SCE -- BEAM DEP. BY TH. IONIZATION
 
    REAL*8 :: sfdepmc(15)  ! (mibs)
        ! '#/S; total Monte Carlo particle deposition'
        ! MONTE CARLO DEPOSITION, N/SEC
 
    REAL*8 :: sfdeprr(15)  ! (mibs)
        ! '#/S; deposition Russian Roulette adjustment'
        ! DEPOSITION RUSSIAN ROULETTE "LOSS", N/SEC
 
    REAL*8 :: sfdepsc(15)  ! (mibs)
        ! '#/S; deposition fast ion source'
        ! FAST ION SCE -- BEAM DEPOSITION
 
    REAL*8 :: sfdtbmc(15)  ! (mibs)
        ! '#/S; d/dt(fast ion population)'
        ! D/DT(FAST ION POPULATION) MONTE CARLO EVALUATION
 
    REAL*8 :: sforbal(15)  ! (mibs)
        ! '#/S; fast ion ptcl balance'
        ! FAST ION ORBIT MONTE CARLO CODE PTCL BALANCE
 
    REAL*8 :: sforbrr(15)  ! (mibs)
        ! '#/S; orbit Russian Roulette adjustment'
        ! FAST ION ORBIT CODE RUSSIAN ROULETTE "LOSS" N/SEC
 
    REAL*8 :: sfrbbcx(15)  ! (mibs)
        ! '#/S; fast neutral recapture by beam-beam CX'
        ! RECAPTURE BY BEAM BEAM CHARGE EXCHANGE
 
    REAL*8 :: sfrbbiz(15)  ! (mibs)
        ! '#/S; fast neutral recapture by beam-beam ii'
        ! RECAPTURE BY BEAM BEAM IONIZATION
 
    REAL*8 :: sfshine(15)  ! (mibs)
        ! '#/S; beam shine through loss'
        ! BEAM SHINE THRU LOSS, N/SEC
 
    REAL*8 :: sfxrccx(15)  ! (mibs)
        ! '#/S; fast neutral recap. by therm. CX'
        ! RECAPTURE BY TH. CHARGE EXCHANGE
 
    REAL*8 :: sfxrciz(15)  ! (mibs)
        ! '#/S; fast neutral recap. by therm. ii'
        ! RECAPTURE BY TH. IONIZATION
 
    REAL*8 :: sfxrcsc(15)  ! (mibs)
        ! '#/S; fast neutral recapture (total)'
        ! FAST ION SCE -- CX RECAPTURE
 
    REAL*8 :: snbcxos(15)  ! (mibs)
        ! '#/S; CX fast neutrals created in SOL'
        ! BEAM IONS/SEC CX OUTSIDE PLASMA, BY SPECIES
 
    REAL*8 :: snbcxs(15)  ! (mibs)
        ! '#/S; CX fast neutrals created in plasma'
        ! BEAM IONS/SECOND CHARGE EXCHANGING-- INSIDE PLASMA
 
    REAL*8 :: snbxbb0(15)  ! (mibs)
        ! '#/S; 2nd gen. fast neutrals: CX w/beam'
        ! FAST ION CX: OFF NEWLY INJECTED BEAM NEUTRALS
        ! NB*N0*sigma*v
 
    REAL*8 :: snbxbb1(15)  ! (mibs)
        ! '#/S; 3rd+ generation fast neutrals'
        ! FAST ION CX: OFF CX FAST NEUTRALS
 
    REAL*8 :: snbxtot(15)  ! (mibs)
        ! '#/S; total fast neutral source'
        ! FAST ION SINK / FAST NEUTRAL SOURCE: CX
 
    INTEGER :: io_snbx1d(15)  ! (mibs)
               ! XPLASMA ids for SNBX1D profiles.
        ! '#/S; total fast neutral source'
        ! FAST ION SINK / FAST NEUTRAL SOURCE: CX
 
    REAL*8 :: snbxv0(15)  ! (mibs)
        ! '#/S; neutral source: CX w/halo neutrals'
        ! FAST ION CX: OFF VOL. SCE (HALO) NEUTRALS
 
    REAL*8 :: snbxw0(15)  ! (mibs)
        ! '#/S; neutral source: CX w/wall neutrals'
        ! FAST ION CX: OFF WALL NEUTRALS
 
    REAL*8 :: xysbcxs(15)  ! (mibs)
        ! '#/S; d/dt(fast ions in SOL)'
        ! D/DT(T BEAM IONS OUTSIDE PLASMA) by specie
 
    REAL*8 :: xninjs(15)  ! (mibs)
        ! '#/S; total fast ions injected'
        ! n/sec beam neutrals injected
 
    REAL*8 :: xninjea(15)  ! (mibs)
        ! '#/S; injected ions: energy conservation adjustment'
        ! n/sec beam neutrals injected
 
    REAL*8 :: sftota
        ! '#/S; total fusion product source'
        ! GRAND TOTAL FUSION PRODUCT SOURCE
        ! (sum of xninjs(...) for fusion product species only)
Home Top


Appendix_E_Legacy_Input_Structures_&_Methods

 
 Array dimensions must be set before any other
 input structure.
 
 Methods and structure contents are shown, with
 comments copied from nubeam/nbspec.dat ...
 
 To define the referenced fortran-90 structures,
 user code should include the statement: 
 
     use nbi_types
 
Home Top


nbitype_dims

    use nbi_types
    type(nbitype_dims) :: zdims   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_dims(zdims)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_dims(zdims,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_dims(zdims,ierr) ! retrieve from NUBEAM
    if(ierr.ne.0) [...handle error...]
    ! note: most nbi_get methods do not return ierr.
    !       nbi_get_dims can be used to check if
    !       NUBEAM dimensions have been set.
 
members of nbitype_dims data type:
 
    integer :: mib
    ! -> default value: 32
    ! -> maximum user value allowed: 320
          ! = nbeam
          ! max number of neutral beams "nbeam" in simulation.
          ! beams may be added during a simulation but not removed.
 
    integer :: mj
    ! -> default value: 55
          ! = nzones + 3
          ! mj is related to the max number of radial zones in the
          ! simulation:  mj must exceed <desired-number-of-zones> + 2
 
    integer :: mig
    ! -> default value: 7
    ! -> maximum user value allowed: 10
          ! = ngmax
          ! max number of non-impurity thermal plasma species.
          ! the number of knownn non-impurity species is "ngmax";
          ! ngmax can increase up to the max number, mig, during a run.
          ! (inside the Monte Carlo code, the number of species with
          ! non-zero density is ng, ng.le.ngmax at all times).
 
    integer :: mis
    ! -> default value: 21
    ! -> maximum user value allowed: 50
          ! = nsmax
          ! number of externally supplied thermal neutral sources:
          ! leading to neutral densities & temperatures for CX evaluation
 
    integer :: mibs
    ! -> default value: 7
    ! -> maximum user value allowed: 15
          ! = verbatim:inumfast(2)
          ! max total number of fast ion species including beam ions,
          ! fusion product ions, and RF minority ions
 
    integer :: mimpt
    ! -> default value: 300
    ! -> maximum user value allowed: 300
          ! = nrhix
          ! max number of impurity thermal plasma species "nrhix".
          ! nrhix can increase up to the max number during a run.
 
    integer :: mmini
    ! -> default value: 3
    ! -> maximum user value allowed: 10
          ! = nmini
          ! max number of RF minority species; the actual number "nmini"
          ! can increase up to the max number during a run.
 
    integer :: mtheta
    ! -> default value: 64
          ! = nthets
          ! number of poloidal grid points in bicubic spline
          ! representations of [1/B] and [J] used in orbiting
 
    integer :: miefi
    ! -> default value: 5
    ! -> maximum user value allowed: 10
          ! = nerngfi
          ! coarse energy grid (cf erngfi(1:nerngfi)) for select
          ! output profiles
 
    integer :: med2d
    ! -> default value: 10
          ! = ndifbe_2d
          ! energy grid for Diffusivity vs. (x,E) data
          !  (FD0, FDB, etc).
 
    integer :: mimxba
    ! -> default value: 50
          ! = nznbma
          ! number of pitch angle zones (evenly spaced in vpll/v) in
          ! lab frame fast ion distribution functions.
          ! note: pitch angle grid the same for all species
 
    integer :: mimxbe
    ! -> default value: 100
          ! = nznbme
          ! maximum number of energy zones in fast ion distribution
          ! functions; actual number and zone spacing can vary from
          ! fast specie to fast specie.
          ! definition of spatial zones:  see xplasma MC grid.
 
    integer :: mgyro
    ! -> default value: 4
          ! = ngyro
          ! NUMBER OF poloidal AIMING ANGLE ZONES, BEAM F-DIST. CALC.
          ! atan2(V_Z,V_R)-atan2(B_Z,B_R)
          ! zone 1 -- [-pi/4,pi/4] 	always means perpendicular to
          ! the flux surface and outward
          ! zone 2 -- [pi/4,3/4pi]  is tangential to the flux
          ! surface with an inward FLR displacement to GC
          ! zone 4 -- [-pi/4,-3/4pi] is tangential to the flux
          ! surface with an outward FLR displacement to GC
          ! zone 3 -- [3pi/4,-3/4pi] is perpendicular and inward
 
    integer :: mimxba0
    ! -> default value: 20
          ! = nznbma0
          ! number of pitch angle zones (evenly spaced in vpll/v) in
          ! lab frame for neutrals
          ! note: pitch angle grid the same for all species
 
    integer :: mimxbe0
    ! -> default value: 100
          ! = nznbme0
          ! maximum number of energy zones for neutrals
 
    integer :: miboxm
    ! -> default value: 12
    ! -> maximum user value allowed: 100
          ! = nbbox
          ! max number of "beam-in-box" 3d neutral density profiles to
          ! compute-- actual number "nbbox" can vary from timestep
          ! to timestep
 
    integer :: mitubem
    ! -> default value: 3
    ! -> maximum user value allowed: 200
          ! = nbtube
          ! max number of "beam in tube" 3d neutral density profiles to
          ! compute
 
    integer :: mituben
    ! -> default value: 100
    ! -> maximum user value allowed: 500
          ! = maxval(NSEGtube)
          ! max number of segments per tube for the "beam in tube"
 
    integer :: mnkaep
    ! -> default value: 10
    ! -> maximum user value allowed: 10
          ! = nkaep
          ! number of modes (NK) used in MHD transport operator (Mario Podesta)
 
Home Top


nbitype_sys

    use nbi_types
    type(nbitype_sys) :: zsys   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_sys(zsys)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_sys(zsys,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_sys(zsys)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_sys(zsys)   ! send to NUBEAM
 
members of nbitype_sys data type:
 
    ! basic system information for Monte Carlo code
 
    CHARACTER*32 :: runid
    !  --> default value: "NUBEAM"
        ! runid string -- alphanumeric string used as prefix for
        ! output files (e.g. state files, etc.).  Should generally
        ! be set to a runid string associated with the driver code.
 
    CHARACTER*120 :: mission
    !  --> default value:  "standard"
        ! NUBEAM "mission" in presence of Plasma State data
        !   (each supported mission requires special code; at present
        !   only "standard" is supported).
        ! "standard" means:  assume responsibility for deposition
        !   and slowing down of neutral beam and fusion product
        !   fast ion species found in the Plasma State
 
    CHARACTER*120 :: workpath
    !  --> default value:  " "
        ! work directory path -- for debug statefile...
        ! blank means current working directory
 
    INTEGER :: nonlin
    !  --> default value: 6
        ! unit number for messages.
 
    INTEGER :: nseed
    !  --> default value: 1
        ! random number seed; default not recommended!
 
    LOGICAL :: nlbout !  *updatable*
    !  --> default value: .TRUE.
        ! .TRUE. (1) to turn on "lost particle" output data accumulation
 
    INTEGER :: lunnbx
    !  --> default value: 0
        ! unit number for "lost particles" ascii output file
        ! (will be used if ref_namelist=T is set, see below).
        ! if lunnbx<=0 or lunnbx>99, an available I/O unit is
        ! selected automatically.
 
    INTEGER :: lunres
    !  --> default value: 0
        ! auxilliary unit number for ascii file i/o -- supports
        ! debug restarts and restarts of "lunnbx" file.
        ! **** this LUN will be used **** even if .NOT.NLBOUT.
        ! if lunres<=0 or lunres>99, an available I/O unit is
        ! selected automatically.
 
    INTEGER :: mrstrt
    !  --> default value: 1
        ! set to zero if there are *no* check-point / restart files
        ! (a property of the driver code).
        ! this changes the way the NB.OUT file is handled, and may
        ! have other effects in the future.
 
    INTEGER :: nclass
    !  --> default value: 0
        ! set =1 to activate beam-by-beam full:half:third
        ! energy species resolved profiles of n, Pbe, Pbi,
        ! <v.B>, <(vcrit**3/v**3)v.B> (lab frame v.B) for NCLASS
        ! fast ion interface -- see nclass output block.
        ! *** warning *** dmc Dec 2003 -- definition and
        ! construction of nclass=1 outputs is not yet complete ***
 
    LOGICAL :: only_io
    !  --> default value: .FALSE.
        ! set .TRUE. (1) when calling NUBEAM from a serial driver that
        ! will use a separate MPI-parallel process to compute the
        ! fast ion evolution.  In this mode, only the input and
        ! output structures are allocated-- NOT the large internal
        ! computational structures.  The following routines are
        ! NOT available in this mode:  NBI_INTERP_PROFILES,
        ! NBSTART, DEPALL, ORBALL, FI_FINISH; instead the timestep
        ! advance sequence is:
        !    CALL NUBEAM_WRITE_INPUT(...)
        !     (invoke local procedure for calling parallel NUBEAM
        !     as separate process)
        !    CALL NUBEAM_READ_OUTPUT(...)
        ! these calls are more fully explained elsewhere.
 
    LOGICAL :: ref_namelist
    !  --> default value: .FALSE.
        ! NOTE: this is a legacy feature -- mothballed!
        ! set .TRUE. (1) to write a reference namelist
 
    LOGICAL :: quasi_check
    !  --> default value: .TRUE.
        ! .TRUE. to check quasineutrality of density input profiles
        ! (can set .FALSE. to disable test, but this can be dangerous!)
 
    LOGICAL :: nltest_output !  *updatable*
    !  --> default value: .TRUE.
        ! Set .FALSE. (0) to suppress NBSTART output of interim state
        ! data for nubeam_test time step debug rerun capability
        ! (suppress e.g. to optimize NUBEAM mpi scaling).Default - .TRUE.
        ! debug_mpi= nltest_output for
        ! MPI job debugging
        ! debug_mpi   =.FALSE. for serial mode
        ! see below
        ! in TRANSP  analog of this switch is nlnbi_test_out
 
    INTEGER :: BLK_MPI_BCAST_INT
    !  --> default value:  2000000
        ! default value for size of a block of integer variables to be used
        ! for MPI communications (bytes)
 
    INTEGER :: BLK_MPI_BCAST_R8
    !  --> default value:   30000000
        ! default value for size of a block of real variables to be used
        ! for MPI communications (bytes)
Home Top


nbitype_times

    use nbi_types
    type(nbitype_times) :: ztimes   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_times(ztimes)     ! set defaults
       [...user code...]          ! modify elements...
    ! (nbi_set method not recommended)
 
        ... ... ... ... 
 
    call nbi_get_times(ztimes)      ! retrieve from NUBEAM
 
    ! usually, all elements are reset every timestep:
 
       [...user code...]          ! modify elements...
    call nbi_update_times(ztimes)   ! send to NUBEAM
 
members of nbitype_times data type:
 
 
    REAL*8 :: tbm1 !  *updatable*
    !  --> default value: 0.0d0
        ! start time of current timestep  -- seconds
 
    REAL*8 :: tbm2 !  *updatable*
    !  --> default value: 0.0d0
        ! stop time of current timestep  -- seconds
        ! the start time of timestep j+1 should match
        ! the stop time of timestep j (else a warning will be issued).
Home Top


nbitype_grid

    use nbi_types
    type(nbitype_grid) :: zgrid   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_grid(zgrid)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_grid(zgrid,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_grid(zgrid)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_grid(zgrid)   ! send to NUBEAM
 
members of nbitype_grid data type:
 
    ! basic grid information
 
    INTEGER :: nzones
    !  --> default value: 0
        ! number of radial zones (equally spaced in sqrt(tor.flux))
        ! this determines the grid for calculation of 1d outputs
        ! such as Pbe and Pbi; must be set to a number .le. mj-3
        ! where "mj" is a user supplied array dimension.
        ! NOTE: not included in Plasma_State_Input, because this
        ! value is used to **set** the plasma state rho_nbi grid.
 
    INTEGER :: nzone_fb
    !  --> default value: 0
        ! number of radial zones in 4d fast ion distributions
        ! (r,theta,E,vpll/v).  nzones should be an integer multiple
        ! of nzone_fb; if not, nzone_fb is increased until this
        ! condition is satisfied, or if this is not possible,
        ! nzone_fb=nzones is imposed.  Note: if id_mcgrid is set,
        ! nzone_fb is reset to match the 2d GRID in xplasma.
 
    LOGICAL :: nlsym2b
    !  --> default value:  .FALSE.
        ! .TRUE. (1) to treat fast ion dist. fcn. as up-down symmetric.
        ! Note: if id_mcgrid is set, this is overridden by the 2d
        ! "irregular" grid in xplasma.
 
    INTEGER :: nth0
    !  --> default value:  2
        ! number of poloidal zones subtending [0:pi] in the first
        ! radial zone row adjacent to the magnetic axis.
        ! Note: if id_mcgrid is set, this is overridden by the 2d
        ! "irregular" grid in xplasma.
 
    INTEGER :: id_mcgrid !  *updatable*
    !  --> default value: 0
        ! xplasma id of 2d irregular "Monte Carlo" spatial grid.
        ! **must be supplied each time and shape must not change**
        ! if this is NOT set, then, nzone_fb, nlsym2b, and nth0
        ! inputs are used to set up the irregular grid.
 
    INTEGER :: nthets
    !  --> default value: 64
        ! number of poloidal angle grid points in [J] and [1/B] 2d
        ! splines (cf nubeam/magcf.for)
 
    REAL*8 :: ebdmax
    !  --> default value: 0.0
        ! maximum energy in distribution function for beam ion species
        ! the maximum for fusion product species is set by the fusion
        ! product source energy (e.g. 3.5e6 eV for DT alphas-- adjusted
        ! upward to 5.0e6 allow for possible energy diffusion).
        ! **energy in eV**
 
    INTEGER :: xplasma_in_memory !  *updatable*
    !  --> default value: 0
        ! if >0, assume "old_xplasma" shared xplasma
        ! object has been prepositioned by caller to receive NUBEAM
        ! output; if =0, just use "old_xplasma" object; if <0, save
        ! old xplasma object for later restoration.
        !   ** most users should never touch this **
 
    INTEGER :: nznbma
    !  --> default value: 50
        ! number of pitch angle zones for distribution functions
        ! this is the same for all NUBEAM fast ion species
 
    INTEGER :: nznbme
    !  --> default value: 100
        ! number of energy zones for beam ion distribution functions
        ! note for fusion product species the number of energy zones
        ! is always equal to the maximum, mimxbe, regardless of the
        ! nznbme specification for beam species.
 
    INTEGER :: nznbma0
    !  --> default value: 10
        ! number of pitch angle zones for neutrals
 
    INTEGER :: nznbme0
    !  --> default value: 50
        ! number of energy zones for neutrals
 
    INTEGER :: ngyro !  *updatable*
    !  --> default value: 4
        ! NUMBER OF poloidal AIMING ANGLE ZONES, BEAM F-DIST. CALC.
        ! atan2(V_Z,V_R)-atan2(B_Z,B_R)
        ! must be > 0
        ! for ngyro=4
        ! zone 1 -- [-pi/4,pi/4] 	always means perpendicular to the flux surface and outward
        ! zone 2 -- [pi/4,3/4pi]  is tangential to the flux surface with an inward FLR displacement to GC
        ! zone 4 -- [-pi/4,-3/4pi] is tangential to the flux surface with an outward FLR displacement to GC
        ! zone 3 -- [3pi/4,-3/4pi] is perpendicular and inward
Home Top


nbitype_beams

    use nbi_types
    type(nbitype_beams) :: zbeams   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_beams(zbeams)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! set integer values to match the number
    ! corresponding list elements to *add* on this call
 
    call nbi_add_beams(zbeams,ierr) ! append to NUBEAM list(s)
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_beams(zbeams)      ! retrieve from NUBEAM
 
members of nbitype_beams data type:
 
    ! here *both* the beams and the thermal plasma species
    ! are defined together, because, for each beam specie
    ! there must be a thermal plasma specie for it to
    ! thermalize into.
    !
    ! except where noted, actual values must be given...
    ! in the course of a run, beams and species can be added
    ! but once added can never taken away.
 
    INTEGER :: ngmax !  *extensible list*
    !  --> default value: 0
        ! the number of thermal plasma species
 
    REAL*8 :: backz(10)  ! (1:ngmax)  *extensible list*
    !  --> default value: 0.0
        ! the Z of each thermal specie (atomic no.)
 
    REAL*8 :: aplasm(10)  ! (1:ngmax)  *extensible list*
    !  --> default value: 0.0
        ! the A of each thermal specie (AMU)
 
    INTEGER :: nbeam !  *extensible list*
    !  --> default value: 0
        ! the number of distinct neutral beam sources
 
    REAL*8 :: xzbeama(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! Z of injected ion specie (atomic no.)
 
    REAL*8 :: abeama(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! A of injected ion specie (AMU)
 
    LOGICAL :: nlco(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: .TRUE.
        ! .TRUE. (1) if injected "co", i.e. in direction
        ! of the toroidal plasma current.
 
    INTEGER :: ntrace(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0
        ! non-zero value means this beam (j) is a
        ! "trace element" of the beam indicated by
        ! the value of ntrace(j); it inherits the
        ! geometry of that beam and the interpretation
        ! of energy fractions is affected.
        !   (of course, usually, the default ntrace=0 is OK)
 
    REAL*8 :: rtcena(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! tangency major radius, cm, of centerline of beam
 
    REAL*8 :: xlbtna(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! distance, cm, from center of beam source grid to tangency point
 
    REAL*8 :: xybsca(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! elevation of center of beam source grid above vacuum vessel
        ! midplane "Z=0". (negative if located below midplane). cm.
        ! default value, 0.0, means source lies on the midplane.
        ! in an axisymmetric system, rtcena, xlbtna, xybsca suffice
        ! to specify the source grid position.
 
    REAL*8 :: xbzeta(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! toroidal angle of beam source in an (R,zeta,Z)
        ! right handed coordinate system (degrees) (specification not
        ! required except to use "tube" diagnostic simulation software).
 
    INTEGER :: nbshapa(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 1
        ! ion source grid shape: 1=rectangular, 2=circular
 
    REAL*8 :: bmwidra(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! source grid half width (or radius if circular), cm.
 
    REAL*8 :: bmwidza(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! source grid half height (ignored if circular), cm.
        ! nbshapa,bmwidra,bmwidza specify the source shape and size.
 
    REAL*8 :: divra(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! horizontal divergence of beam (radians)
        !  (for more info see  https://w3.pppl.gov/transp  --
        !   TRANSP HELP -- go to beam controls, look for "DIVR")
 
    REAL*8 :: divza(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! vertical divergence of beam (radians)
 
    REAL*8 :: foclra(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 1.0d6
        ! horizontal focal length of beam (cm)
 
    REAL*8 :: foclza(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 1.0d6
        ! vertical focal length of beam (cm)
 
    INTEGER :: nbapsha(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 1
        ! shape of main aperture to vacuum vessel (1:rectangle, 2:circle)
        ! aperture cross section is presumed normal to beam centerline
        ! this aperture must be specified
 
    REAL*8 :: rapedga(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! aperture half-width (or radius if circular), cm
 
    REAL*8 :: xzpedga(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! aperture half-height (ignored if circular), cm
 
    REAL*8 :: xlbapa(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! distance, source grid to aperture, cm
 
    REAL*8 :: xybapa(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! beam centerline at aperture:  elevation above/below vacuum
        ! vessel midplane, cm
 
    REAL*8 :: xrapoffa(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! aperture horizontal offset relative to beam centerline, cm
        ! positive value: aperture shifted outward in major radius
        !   relative to beam centerline
 
    REAL*8 :: xzapoffa(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! aperture vertical offset relative to beam centerline, cm
        ! positive value: aperture shifted vertically upward
        !   relative to beam centerline
 
    INTEGER :: nbapsh2(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 1
        ! shape of optional 2nd aperture (1:rectangle, 2:circle)
 
    REAL*8 :: rapedg2(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! 2nd aperture half-width (or radius if circular), cm
        ! value of zero means: no 2nd aperture
 
    REAL*8 :: xzpedg2(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! 2nd aperture half-height (ignored if circular), cm
        ! value of zero means: no 2nd aperture
 
    REAL*8 :: xlbapa2(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! beam centerline distance, source grid to 2nd aperture, cm
        ! value of zero means: no 2nd aperture
 
    REAL*8 :: xrapoff2(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! 2nd aperture horizontal offset relative to beam centerline, cm
        ! positive value: aperture shifted outward in major radius
        !   relative to beam centerline
 
    REAL*8 :: xzapoff2(320)  ! (1:nbeam)  *extensible list*
    !  --> default value: 0.0
        ! 2nd aperture vertical offset relative to beam centerline, cm
        ! positive value: aperture shifted vertically upward
        !   relative to beam centerline
Home Top


nbitype_impurity

    use nbi_types
    type(nbitype_impurity) :: zimpurity   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_impurity(zimpurity)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! set integer values to match the number
    ! corresponding list elements to *add* on this call
 
    call nbi_add_impurity(zimpurity,ierr) ! append to NUBEAM list(s)
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_impurity(zimpurity)      ! retrieve from NUBEAM
 
members of nbitype_impurity data type:
 
    ! Zx & Ax of impurity species
    ! can also use a single "model impurity" by
    ! giving Zx(x) and Ax(x) as average Z & A of
    ! impurities as profile input
    !
    ! in the course of a run, impurity species can be added
    ! but once added can never be taken away
 
    INTEGER :: nrhix !  *extensible list*
    !  --> default value: 0
        ! number of impurities
 
    REAL*8 :: xzimpx(300)  ! (1:nrhix)  *extensible list*
    !  --> default value: 0.0
        ! Z of (multiple) impurities (atomic no.)
 
    REAL*8 :: aimpx(300)  ! (1:nrhix)  *extensible list*
    !  --> default value: 0.0
        ! A of (multiple) impurities (AMU)
Home Top


nbitype_minority

    use nbi_types
    type(nbitype_minority) :: zminority   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_minority(zminority)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! set integer values to match the number
    ! corresponding list elements to *add* on this call
 
    call nbi_add_minority(zminority,ierr) ! append to NUBEAM list(s)
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_minority(zminority)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_minority(zminority)   ! send to NUBEAM
 
members of nbitype_minority data type:
 
    ! RF minority speciess
    ! in the course of a run, RF species can be added
    ! but once added can never be taken away
 
    INTEGER :: nmini !  *extensible list*
    !  --> default value: 0
        ! number of RF minority species
 
    REAL*8 :: xzmini(10)  ! (1:nmini)  *extensible list*
    !  --> default value: 0.0
        ! Z of RF minority specie (atomic no.)
 
    REAL*8 :: amini(10)  ! (1:nmini)  *extensible list*
    !  --> default value: 0.0
        ! A of RF minority specie (AMU)
 
    INTEGER :: nthrf !  *updatable*
    !  --> default value: 1
        ! = 1 if minority ions are currently thermal
Home Top


nbitype_powers

    use nbi_types
    type(nbitype_powers) :: zpowers   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_powers(zpowers)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_powers(zpowers,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_powers(zpowers)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_powers(zpowers)   ! send to NUBEAM
 
members of nbitype_powers data type:
 
    ! beam powers, voltages, and energy fractions
    ! energy fractions:  for H-isotope beams only
    !   ffulla(j) = fraction of beam current at full energy
    !   fhalfa(j) = fraction at half energy
    !   1-ffulla(j)-fhalfa(j) = fraction at 1/3 energy
    ! (for non-H beams we assume ffulla(j)=1, fhalfa(j)=0)
    !
    ! if f1=ffulla(j), f2=fhalfa(j), f3=1-f1-f2, and
    ! J = the beam current for beam (j), then, the
    ! relation
    !   einja(j)*J*(f1 + f2/2 +f3/3) = pinja(j)
    ! is satisfied.
    !
    ! generally the powers, voltages and (perhaps) the
    ! energy fractions should be updated every timestep.
 
    REAL*8 :: einjmin(320)  ! (1:nbeam)
    !  --> default value: 0.0
        ! minimum energy ever injected (eV)
        ! use this to prevent problems due to Einj->0 as can
        ! occur when interpolating waveform data.
        ! TRANSP uses 1/2*<Einj> where <Einj> is the power
        ! weighted average injection energy, for each beam.
        ! note this can only be set once at the start of a
        ! run; if it is defaulted, (1/4)*max(Einj) is used
        ! as the lower limit, where max(Einj) is the max
        ! Einj for the beam, seen up until the current time.
        !   (see nbi_nbsums.for)
 
    REAL*8 :: einja(320)  ! (1:nbeam)  *updatable*
    !  --> default value: 0.0
        ! beam voltages (eV)
 
    REAL*8 :: pinja(320)  ! (1:nbeam)  *updatable*
    !  --> default value: 0.0
        ! beam powers (watts)
 
    REAL*8 :: ffulla(320)  ! (1:nbeam)  *updatable*
    !  --> default value: 0.98d0
        ! full energy current fraction (dimensionless)
        ! (a realistic value should be provided)
 
    REAL*8 :: fhalfa(320)  ! (1:nbeam)  *updatable*
    !  --> default value: 0.01d0
        ! half energy current fraction (dimensionless)
        ! (a realistic value should be provided)
 
    REAL*8 :: orbrzv_toric_Prftot0(15)  ! (1:mibs)  *updatable*
    !  --> default value: 0.0
        ! total power calculated by toric in the previous step
 
    REAL*8 :: orbrzv_toric_frnm !  *updatable*
    !  --> default value: 1.0d0
        ! toric RF-field strength renormalizer
Home Top


nbitype_fusion

    use nbi_types
    type(nbitype_fusion) :: zfusion   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_fusion(zfusion)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_fusion(zfusion,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_fusion(zfusion)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_fusion(zfusion)   ! send to NUBEAM
 
members of nbitype_fusion data type:
 
    ! fusion products
 
    LOGICAL :: nlfhe3
    !  --> default value: .FALSE.
        ! .TRUE. (1) for He3 fusion product modeling
 
    LOGICAL :: nlfhe4
    !  --> default value: .FALSE.
        ! .TRUE. (1) for He4 (alpha) fusion product modeling
 
    LOGICAL :: nlfst
    !  --> default value: .FALSE.
        ! .TRUE. (1) for DD triton fusion product modeling
 
    LOGICAL :: nlfsp
    !  --> default value: .FALSE.
        ! .TRUE. (1) for DD proton fusion product modeling
        ! (no recommended-- proton velocities exceed limiting
        ! assumptions in collision operator)
 
    LOGICAL :: nlusf3 !  *updatable*
    !  --> default value: .FALSE.
        ! .TRUE. (1) to set He3 fusion product source magnitude from
        ! data instead of from past timestep fusion rates
 
    REAL*8 :: xdatsf3 !  *updatable*
    !  --> default value: 0.0
        ! source magnitude (n/sec) used to renormalize He3 fusion
        ! product source profile from previous timestep
        ! only applies if nlusf3.and.nlfhe3 both .TRUE.
 
    LOGICAL :: nlusfa !  *updatable*
    !  --> default value: .FALSE.
        ! .TRUE. (1) to set alpha fusion product source magnitude from
        ! data instead of from past timestep fusion rates
 
    REAL*8 :: xdatsfa !  *updatable*
    !  --> default value: 0.0
        ! source magnitude (n/sec) used to renormalize alpha fusion
        ! product source profile from previous timestep
        ! only applies if nlusfa.and.nlfhe4 both .TRUE.
 
    LOGICAL :: nlusft !  *updatable*
    !  --> default value: .FALSE.
        ! .TRUE. (1) to set triton fusion product source magnitude from
        ! data instead of from past timestep fusion rates
 
    REAL*8 :: xdatsft !  *updatable*
    !  --> default value: 0.0
        ! source magnitude (n/sec) used to renormalize triton fusion
        ! product source profile from previous timestep
        ! only applies if nlusft.and.nlfst both .TRUE.
 
    LOGICAL :: nlusfp !  *updatable*
    !  --> default value: .FALSE.
        ! .TRUE. (1) to set proton fusion product source magnitude from
        ! data instead of from past timestep fusion rates
 
    REAL*8 :: xdatsfp !  *updatable*
    !  --> default value: 0.0
        ! source magnitude (n/sec) used to renormalize proton fusion
        ! product source profile from previous timestep
        ! only applies if nlusfp.and.nlfsp both .TRUE.
 
    REAL*8 :: plfhe3
    !  --> default value: 100.0d0
        ! (watts) threshhold power above which full Monte Carlo
        ! statistics (NPTCLF particles) are assigned to model the
        ! slowing down of the He3 fusion product ion population
 
    REAL*8 :: plfhe4
    !  --> default value: 10000.0d0
        ! (watts) threshhold power above which full Monte Carlo
        ! statistics (NPTCLF particles) are assigned to model the
        ! slowing down of the He4 (alpha) fusion product ion population
 
    REAL*8 :: plfst
    !  --> default value: 100.0d0
        ! (watts) threshhold power above which full Monte Carlo
        ! statistics (NPTCLF particles) are assigned to model the
        ! slowing down of the triton fusion product ion population
 
    REAL*8 :: plfsp
    !  --> default value: 100.0d0
        ! (watts) threshhold power above which full Monte Carlo
        ! statistics (NPTCLF particles) are assigned to model the
        ! slowing down of the proton fusion product ion population
 
    LOGICAL :: nlfatom
    !  --> default value: .TRUE.
        ! .FALSE. (0) to suppress atomic physics calculations on
        ! slowing down fusion product ions (recommendation:
        ! leave this switch alone).
Home Top


nbitype_fpp

    use nbi_types
    type(nbitype_fpp) :: zfpp   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_fpp(zfpp)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_fpp(zfpp,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_fpp(zfpp)      ! retrieve from NUBEAM
 
members of nbitype_fpp data type:
 
    ! Monte Carlo code support for Fokker Planck model
 
    LOGICAL :: nlbfpp
    !  --> default value: .FALSE.
        ! set .TRUE. (1) if beam slowing down is to be modeled using
        ! a fokker planck code, in which case the Monte Carlo code
        ! will be used to calculate deposition only
        ! NOTE: this feature NOT implemented DMC May 2007
Home Top


nbitype_num

    use nbi_types
    type(nbitype_num) :: znum   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_num(znum)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_num(znum,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_num(znum)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_num(znum)   ! send to NUBEAM
 
members of nbitype_num data type:
 
    ! numerical controls
 
    REAL*8 :: cxsplt
    !  --> default value: 2.0d0
        ! charge exchange model: splitting factor, tracks per event.
 
    REAL*8 :: dxbsmoo
    !  --> default value: 0.05d0
        ! smoothing parameter: half-width of triangular hat
        ! function convolution smoothing, in x=sqrt(phi/philim)
        ! applied to all output profiles
        ! NOTE: if dxbsmoo.gt.0 a spline method will be applied
        !   to integrated profiles; if dxbsmoo.le.0 a piecewise
        !   linear method will be applied.  Thus:
        !      dxbsmoo .le. 0 ==> PBI is a step function
        !      dxbsmoo .gt. 0 ==> PBI is piecewise quadratic, C1.
        !   which follows because the integrated profile is
        !   differenced to get the local value.
 
    REAL*8 :: dxbsm_nc
    !  --> default value: 0.0d0
        ! (Not currently active -- left in namelist for backwards
        ! compatibility and possible later use).
        ! original intent:
        ! dxbsm_nc smoothing parameter (like dxbsmoo) for nclass
        ! profile outputs only.  Actual smoothing for these
        ! profiles will be based on max(abs(dxbsmoo),abs(dxbsm_nc));
        ! spline or linear treatment still controlled by sign of
        ! dxbsmoo; effect is optional extra smoothing for nclass
        ! outputs. NO more active MG dec.09,2008
 
    INTEGER :: nptcls !  *updatable*
    !  --> default value: 1000
        ! number of Monte Carlo particles per (normal) beam ion specie
        ! affects statistics of slowing down calculation
 
    INTEGER :: nptclf !  *updatable*
    !  --> default value: 1000
        ! number of Monte Carlo particles per fusion product specie
        ! affects statistics of slowing down calculation
 
    INTEGER :: nptclh !  *updatable*
    !  --> default value: 500
        ! number of Monte Carlo particles per heavy beam ion specie
        ! affects statistics of slowing down / stripping calculation
 
    INTEGER :: NFAST_MAP !  *updatable*
    !  --> default value: 1
        ! in NUBEAM only: NFAST_MAP=1 - use bilinear maps to evaluate
        ! R,Z coordinates and 2x2 Jacobian,
        ! if NFAST=0 - use xplasma spline maps with tol=1.e-6 (~1.5 slower)
 
    REAL*8 :: xpand_nptcl !  *updatable*
    !  --> default value: 3.0d0
        ! If xpand_nptcl.gt.0.5 it will be a limit
        ! of the total growth of the particle list
        ! after this limit (> (1.0+xpand_nptcl)*NPTCLS )
        ! revert to Russian Roulette.
        ! For xpand_nptcl.le.0.5	 it will be a fraction by which
        ! nptcl{*} can expand during
        ! deposition (see below) to avoid Russian Roulette (min val 0.05d0)
        ! (max val 0.5d0).
        ! (max(nptcls,nptclf,nptclh,nptcl_max)+1000)*1.1d0
        ! *(1+xpand_nptcl+frac_orbrr)
 
    REAL*8 :: frac_depmax
    !  --> default value: 0.25d0
        ! max fraction of nptcl{*} # of MC ptcls that can be
        ! deposited in a single step (min accepted val 0.1d0)
 
    REAL*8 :: frac_dep_lim !  *updatable*
    !  --> default value: 1.5d0
        ! nptcl{*} # of MC ptcls that can be
        ! deposited in a single step
        ! is max(1,nptcls*min(1,delt/<tau_sl>*frac_dep_lim))
 
    REAL*8 :: frac_depmin
    !  --> default value: 0.01d0
        ! min fraction of nptcl{*}, min # of MC ptcls to
        ! deposit in a single step (btw 0.0 and 0.1d0)
 
    REAL*8 :: frac_orbrr
    !  --> default value: 0.10d0
        ! fraction of population needing to be "underweight"
        ! before application of Russian Roulette in orball routine
        ! accepted values betwe 0.05d0 and 0.5d0.
 
    INTEGER :: nptcl_max
    !  --> default value: 0
        ! max number of Monte Carlo particles of any type that will
        ! ever be requested; max(nptclh,nptclf,nptcls,nptcl_max) is
        ! used.
 
    LOGICAL :: nltrk_dep0 !  *updatable*
    !  --> default value: .FALSE.
        ! .TRUE. (1) to save details of ndep0 beam neutral tracks
 
    LOGICAL :: NLDEP0_GATHER !  *updatable*
    !  --> default value:  .FALSE.
        ! IF .TRUE. fast ion birth source data (in NUBEAM_COMP_EXEC)
        ! will be collected for all time steps or only for the last one
        ! if NLDEP0_GATHER = .false.
        ! The output files <RINID>_nubeam_birth.cdf<nn> will be kept in
        ! main directory from where program was started (in NUBEAM_COMP_EXEC).
 
    INTEGER :: ndep0 !  *updatable*
    !  --> default value: 500
        ! minimum number of deposition tracks per beam ion specie--
        ! also, the number of tracks gathered, if deposition
        ! distribution data is saved for output, i.e. if
        ! nltrk_dep0 is .TRUE.
        ! Regardless of nltrk_dep0, This control
        ! affects statistics of deposition calculations (e.g.
        ! cold electron source, CX neutral sources, etc.).
        ! In an MPI run this value may be adjusted to be an exact
        ! multiple of the number of processors used.
        ! When deposition track data is gathered, there is an
        ! option to restrict the gathering to a single specific
        ! beam injector, or even a specific energy fraction for
        ! single injector.  (See ndep_set_beam and ndep_set_ien
        ! controls).  But, if this is done, the beam current
        ! fraction (call it f) of the selected beam injector can
        ! come into plan in determining the track data gathering.
        ! If f < 10%, the tracks gathered will be
        !    ndep0_use = min(ndep0,f*ndep0_max)
        ! if f < 1%, the restriction to the selected beam subset
        ! is aborted, and data, ndep0 tracks, are gathered on
        ! all beam lines.  f is output as frac_cur_dep0.
 
    INTEGER :: NDEP0_MAX !  *updatable*
    !  --> default value:    100000
        ! approximate max # of tracks to compute, when
        ! track data is gathered for only a single beam or
        ! single beam energy fraction-- used if the selected
        ! beam current fraction f is < 10%.
 
    INTEGER :: ndep_set_beam !  *updatable*
    !  --> default value: 0
        ! beam source # to which deposition data will be gathered
        ! (must be in range 0 to mib).  Default is 0:
        ! 0 - means gather data for all available beame source
        ! if ndep_set_beam set 0, then ndep_set_ien must be set 0.
        ! If beam source# was incorrectly set, then a warning is
        ! printed, and ndep_set_beam=0 is enforced.
        ! If there is no particle current for requested beam or
        ! this current is less than 1% of total ptcl. current then
        ! collect track data for all beam sources and energy fractions
        ! (i.e. revert to ndep_set_beam=0 mode).
        ! If particle current for requested beam is less than 10%
        ! of total ptcl. current - the number of tracks collected
        ! is adjusted to min(NDEP0,f*NDEP0_MAX), where f is the beam
        ! current fraction for the selected beam, relative to the
        ! total summed over all beams.
 
    INTEGER :: ndep_set_ien !  *updatable*
    !  --> default value: 0
        ! energy fractions to be used when gathering deposition data
        ! for a given beam source (ndep_set_beam .gt. 0).
        ! 1 - full energy fraction
        ! 2 - half energy fraction
        ! 3 - one third energy
        ! 0 - for all energy fraction
        ! if energy fraction# was incorrect set data is collected
        ! for all energy fractions.
        ! For beams without energy fractions (i.e. Helium neutral
        ! beams or high energy negative ion based H/D/T beams),
        ! this control is ignored.
 
    INTEGER :: nbbcal
    !  --> default value: 1000000
        ! number of interactions for [fast ion] - [fast ion]
        ! fusion rate Monte Carlo integrals-- affects statistics
        ! of this component of fusion product and neutron source
        ! calculation
 
    INTEGER :: ncx0 !  *updatable*
    !  --> default value: 100
        ! the total number of CX tracks, independent control of CX statistics
        ! if ncx0 = 0, then it will be no fbm_cx gathered and CX statistics will not be
        ! improved
 
    INTEGER :: nper_cx !  *updatable*
    !  --> default value: 4
        ! the  number of gyro phase angles between [0,2*pi] will be used for CX statistics improvement
        ! if ncx0 > 0 , nper_cx=max(1,nper_cx)
 
    INTEGER :: LEV_NBIDEP !  *updatable*
    !  --> default value:  1
        ! beam "deposision" model level:
        ! 1 -- legacy of PREACT atomic physics
        ! 2 -- ADAS atomic physics for H and He beams.
        !      He beam -- only ground state model available
        ! 3 -- PREACT ground state atomic physics
        !      ADAS interaction with impurities
        ! 4 -- ADAS ground state atomic physics
        !      PREACT interaction with impurities
 
    INTEGER :: LEVMOD_HALO !  *updatable*
    !  --> default value:  0
        ! 0 -- driver program calls FRANTIC (default)
        ! 1 -- FRANTIC will be called in NUBEAM
        ! 2 -- 3d halo model will be called in NUBEAM
        !      for 3d halo model NSPLT_GEO and NSPLT_KIN have to be set
        !      or default values will be used
        !      as 3d halo model is a 'beam in box' then
        !      NBSBOX, NBEBOX, NXBOX, NYBOX, NLBOX, NDEPBOX etc. have to be set
 
    INTEGER :: NSPLT !  *updatable*
    !  --> default value:  100
        ! activated in case LEVMOD_HALO=2
        ! max allowed spliting along each neutral track (3D halo model),
        ! NSPLT must be >= NSPLT_GEO* NSPLT_KIN
        ! if NSPLT < 0 then it  maybe use to gather 3d density 0 generation of neutrals, only
 
    INTEGER :: NSPLT_GEO !  *updatable*
    !  --> default value:  1
        ! activated in case LEVMOD_HALO=2, and NSPLT > 0
        ! max allowed spliting along each neutral track (3D halo model),
        ! max allowed geometrical spliting along each neutral track (3D halo model)
        !
 
    INTEGER :: NSPLT_KIN !  *updatable*
    !  --> default value:  1
        ! activated in case LEVMOD_HALO=2, and NSPLT > 0
        ! max allowed spliting along each neutral track (3D halo model),
        ! max allowed kinetic spliting at each CX launch point; # of velocities
        ! that are sampled from eligible ion populations (3D halo model)
 
    INTEGER :: NSPLT_GEN !  *updatable*
    !  --> default value:  1
        ! # of halo generation to be splitted at the
        ! rate NSPLT_KIN * NSPLT_GEO, and for higher generation will be no additional
        ! splitting made.  If NSPLT_GEN = 0, all halo generation will be splitted at the
        ! rate NSPLT_KIN * NSPLT_GEO. Activated in case LEVMOD_HALO=2, and NSPLT > 0
 
    INTEGER :: nmimp !  *updatable*
    !  --> default value:  1
        ! 1 -> using multiple impurities
        ! 0 -> using single tokamakium impurity
 
    REAL*8 :: AIMP !  *updatable*
    !  --> default value:    16.D0
        ! ATOMIC WEIGHT OF IMPURITY, for tokamakium model only
 
    REAL*8 :: XZIMP !  *updatable*
    !  --> default value:    8.D0
        ! IMPURITY ATOMIC NUMBER, for tokamakium model only
 
    INTEGER :: NTEST_MAX !  *updatable*
    !  --> default value:  0
        ! set 1 to simulate bi-Maxwellian FI distribusion;
        !  -1 to skip re-normalization of electric field from TORIC
        ! in RF kick off operator in NUBEAM for bi-Maxwellian FI distribusion;
        ! -10 to skip re-normalization of electric field from TORIC
        ! in RF kick off operator in NUBEAM for realistic FI distribusion
        ! this switch may be used for standalone nubeam_comp_exec program
        ! and can be modified through nubeam_comp_exec namelist
        ! 10 same as default but extra output files will be saved to be used in TORIC:
        ! some variables on sqrt(norm poloidal flux)
 
    REAL*8 :: BI_MAX_PL !  *updatable*
    !  --> default value:  1.D0
        ! factor for an E_PLL component in bi-Maxwellian FI distribusion
 
    REAL*8 :: BI_MAX_PR !  *updatable*
    !  --> default value:  1.D0
        ! factor for an E_Perp component in bi-Maxwellian FI distribusion
 
    REAL*8 :: wghta !  *updatable*
    !  --> default value: 1.0d0
        ! weight profile adjustment.  Larger values of WGHTA result
        ! in more particles with less weight per particle in the core
        ! and fewer particles with more weight per particle at the
        ! edge.  (dimensionless).
        !   wghta.ge.1.0 enforced; wghta.le.nzones enforced.
        !!! Larger WGHTA -> better statistics at core, worse at edge
        !!! Smaller WGHTA -> better statistics at edge, worse at core
 
    REAL*8 :: goocon
    !  --> default value: 10.0d0
        ! "goose" control -- strong affect on runtime!
        ! #bounces computed per min(tau(slow),tau(P.A.scatter),tau(cx)).
        ! magnitude of constraint is quadratic for diffusive processes.
        ! see also NGOOCON controls; if any of the NGOOCON controls have
        ! greater than their default values, an upper limit of 1.0d-4 is
        ! imposed on DT_ACC; otherwise upper limit of 1.0d-3 is allowed.
 
    INTEGER :: NGOOCON_VPVBIN
    !  --> default value:  0
        ! min #bounces per FBM pitch zone width P.A. scatter
        ! setting NGOOCON_VPVBIN constrains tau(bounce)/tau(P.A.scatter) by
        ! a factor of 4/(NGOOCON_VPVBIN**2*NZNBMA**2)
        ! a limit that scales as 1/(nznbma**2) on goosing is imposed if .gt.0
        ! Caution: setting this may slow the code considerably.
 
    INTEGER :: NGOOCON_EBIN
    !  --> default value:  1
        ! min #bounces per FBM energy zone width slowing down
        ! additional linear constraint on tau(bounce)/tau(slowing-down)
        ! a limit that scales as 1/nznbme on goosing is imposed
 
    INTEGER :: NGOOCON_RBIN
    !  --> default value:  1
        ! min #bounces per zone width radial transport
        ! linear constraint on tau(bounce)/tau(radial-flow)
        ! quadratic constraint on tau(bounce)/tau(radial-diffusion)
        ! limits that scale as 1/(nzone_fb) and 1/(nzone_fb**2) are imposed.
 
    REAL*8 :: cxpcon
    !  --> default value: 20.0d0
        ! adjustment on frequency of calls to charge exchange
        ! operator during slowing down.  Higher number --> more calls
        ! default value generally OK.
 
    REAL*8 :: fppcon
    !  --> default value: 8.0d0
        ! adjustment on frequency of calls to collision operator
        ! per orbit half-bounce during slowing down.  Higher number
        ! --> more calls; default value generally OK.
        ! if nclass is set, the number is increased to at least
        ! 20.0d0
 
    REAL*8 :: fdtnxy
    !  --> default value: 0.5d0
        ! reduction factor for orbit timesteps near the axis
        ! where a pseudo x-y space instead of a polar space is used
        ! to avoid effects of the axial singularity.  Default OK.
 
    INTEGER :: ndtorb
    !  --> default value: 4
        ! orbit timestep control algorithm selection switch;
        ! default value should be used.
 
    INTEGER :: nchdvp
    !  --> default value: 3
        ! orbit integrator options:
        !  =1: enforce exact conservation of angular momentum
        !  =2: enforce exact conservation of energy
        !  =3: (recommended) obtain good but not exact conservation
        !      of both quantities.
 
    REAL*8 :: dtn
    !  --> default value: 0.0
        ! ***orbit timestep adjustment parameter*** if left to zero
        ! an automatic timestep will be selected and adjusted based
        ! on orbit integration error analysis.  If set, constraints
        ! will be applied, and the time step will still be adjusted
        ! based on the error analysis.  General advice: leave at
        ! zero.  (dtn, seconds).
 
    REAL*8 :: dt_acc
    !  --> default value: 1.0d-4
        ! orbit accuracy criterion -- orbit timesteps adjusted so
        ! that error delta(E)/Einj (and a similar measure for momentum)
        ! is less than dt_acc per half bounce; another criterion
        ! is that there be at least 10 steps per half bounce so
        ! that goosing & timestep adjustment algorithms have
        ! enough data to work.
        !    dt_acc<=0.0 => no adjustment (old constant dtn used).
        ! if dt_acc > 0, 1.0e-6 <= dt_acc <= 1.0e-3 is enforced.
        ! an upper limit of 1.0e-3 is enforced unless GOOCON controls
        ! are increased from their default values in which case the
        ! upper limit is 1.0e-4
 
    INTEGER :: orbrzv_option
    !  --> default value: 0
        ! option to switch on & off ORBRZ(RZ-integrator) and ORBG
 
    INTEGER :: orbrzv_rf_option !  *updatable*
    !  --> default value: 0
        ! option to switch on & off Monte-Carlo RF calculation
 
    LOGICAL :: nlmcrf_on !  *updatable*
    !  --> default value: .false.
 
    INTEGER :: orbrzv_nr
    !  --> default value: 160
 
    INTEGER :: orbrzv_nz
    !  --> default value: 160
        ! grid resolution for RZ-interpolation in ORBRZ
 
    REAL*8 :: orbrzv_zzerr_con
    !  --> default value: 1.0e-4
        ! relative error control criterion
        ! 1.0D-4 does very expeditious job
Home Top


nbitype_atomic

    use nbi_types
    type(nbitype_atomic) :: zatomic   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_atomic(zatomic)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_atomic(zatomic,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_atomic(zatomic)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_atomic(zatomic)   ! send to NUBEAM
 
members of nbitype_atomic data type:
 
    ! atomic physics controls
    ! and controls affecting the beam deposition model
 
    INTEGER :: nsmax
    !  --> default value: 21
        ! (maximum) number of thermal neutral sources
        !   (used to be fixed at 3*ngmax due to TRANSP legacy).
 
    INTEGER :: khalo(50)  ! (1:mis)
    !  --> default value:  -1
        ! indicate which neutral sources are due to the
        ! beam halo:  1 means halo, 0 means edge source not halo,
        ! -1 means "auto-detect" based on assumption that neutral
        ! densities due to edge sources will be strongly peaked.
        ! towards the edge
 
    REAL*8 :: dn0out !  *updatable*
    !  --> default value: 1.0d11
        ! neutral gas density (/cm3) to assume beyond plasma boundary
        ! (drives "external charge exchange loss")
 
    INTEGER :: nmsigx
    !  --> default value: 2
        ! control option: select cross section set for impurity
        ! stopping of fast neutrals (deposition and cx recapture)
        ! 1: Olson (very ancient), H beams only
        !    OLSON ET AL., P.R.L. 41,NUM 3,P. 163.
        ! 2: cross section set for impurity will be defined by
        ! LEV_NBIDEP and NSIGEXC settings
        ! 2 use to be: Standard set
        !    Currently:
        !    R.A. Phaneuf, R.K. Janev, M.S. Pindzola,
        !    Atomic Data for Fusion, Vol. 5,
        !    Collisions of Carbon and Oxygen Ions with
        !    Electrons, H, H2, and He,
        !    ORNL-6090/V5 (5th volume of ORNL-6086) (Feb. 1987).
 
    LOGICAL :: nlminsv
    !  --> default value: .TRUE.
        ! .TRUE. (1) to loop over all impurities when calculating
        ! impurity stopping cross section; .FALSE. to use an
        ! "average Z" single impurity simplifying approximation.
 
    LOGICAL :: nlebei
    !  --> default value: .TRUE.
        ! .TRUE. (1) to include beam energy in approximate
        ! expression for <sigma*v> for electron impact ionization
 
    INTEGER :: nsigexc !  *updatable*
    !  --> default value: 0
        ! NSIGEXC=0 means ground state model.
        ! NSIGEXC=1 means "appropriate applicable" excited states model:
        ! ADAS for LEV_NBIDEP=2 and
        ! Janev-Boley-Post for other values of LEV_NBIDEP=1
        ! NSIGEXC=2 means Janev-Boley-Post applied to any model including ADAS.
        ! Janev/Boley/Post article, Nucl. Fusion Vol.29, No. 12 (1989)
        ! NSIGEXC=3 means ADAS excited states model (adas310 library):
        ! ADAS for LEV_NBIDEP=2 and
 
    REAL*8 :: xdepmod
    !  --> default value: 1.0d0
        ! anomalous opacity adjustment
        ! this applies a multiplicative factor to all stopping
        ! cross sections.
 
    LOGICAL :: nlbbcx !  *updatable*
    !  --> default value: .TRUE.
        ! .FALSE. (0) to disable beam-beam charge-exchange and
        ! beam-beam impact-ionization contribution to deposition.
        ! This concerns beam neutrals being stopped by collisions
        ! with slowing down beam ions.
 
    INTEGER :: nbbcx_avg !  *updatable*
    !  --> default value: 0
        ! use non average over the flux surface relative energy (ebb_rel_avg)
        ! and target temperature (rms_ebb_rel) for beam-beam reaction to calculate
        ! enhancement factor
        ! =1 then use average over the flux surface relative energy (ebb_rel_avgx)
        ! and target temperature (rms_ebb_relx)
        ! this switch is activated if nlbbcx = .TRUE.
 
    INTEGER :: nbbcx_bb !  *updatable*
    !  --> default value: 0
        ! integer switch. If nbbcx_bb=0 then contribution from beam-beam reactions to the enhancement
        ! factor will be included in case if NLBBCX=.TRUE.
        ! If nbbcx_bb.ne.0  then contribution from beam-beam reactions to the enhancement
        ! factor will be NOT included even if NLBBCX=.TRUE.
 
    INTEGER :: nbfallgr
    !  --> default value: 0
        ! if set 1, then program will be stopped, if enhancement
        ! factor computed from ADAS data set became less than 1.0.
        ! This setting will be used for a debugging purposes.
        ! If set 0,then enhancement factor computed from ADAS data set
        ! will be forced to be 1.0 if it became less than 1.0. It means that
        ! ground state data will be used for this region.
        ! This switch will be used if nlbbcx=.true.
 
    LOGICAL :: nlbeamcx
    !  --> default value: .TRUE.
        ! set .FALSE. (0) to disable beam charge exchange losses
        ! (if .FALSE. beamcx subroutine is never called).  For
        ! technical reasons nlbeamcx=.FALSE. implies nlbbcx=.FALSE.
        ! but cx stopping of neutral beams on thermal species still
        ! occurs, and a beam halo neutral source is still computed.
        ! Caution: nb*sigma*v ionization rate profile for background
        ! neutrals will be ZERO if nlbeamcx=.FALSE. -- this is for
        ! debugging only!
 
    LOGICAL :: nlhvion
    !  --> default value: .TRUE.
        ! this switch only used for heavy neutral beam deposition
        ! (i.e. experiments using neutral beams to inject Argon or
        ! Neon-- very rare).  If set .TRUE. (1), ion collisions are used
        ! in calculating the stripping of the deposited heavy ion; if
        ! .FALSE. (0) only electron collisions are used.  For ordinary
        ! (Hydrogen or Helium) beams this switch has no effect.
Home Top


nbitype_collid

    use nbi_types
    type(nbitype_collid) :: zcollid   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_collid(zcollid)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_collid(zcollid,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_collid(zcollid)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_collid(zcollid)   ! send to NUBEAM
 
members of nbitype_collid data type:
 
    ! collision operator controls
 
    REAL*8 :: xcfanbi
    !  --> default value: 1.0d0
        ! anomalous multiplier: electron drag and energy
        ! diffusion on beam ions
 
    REAL*8 :: xdfanbi
    !  --> default value: 1.0d0
        ! anomalous multiplier: ion drag and energy
        ! diffusion on beam ions
 
    REAL*8 :: xefanbi
    !  --> default value: 1.0d0
        ! anomalous multiplier: pitch angle scattering on
        ! beam ions
 
    REAL*8 :: xcfafus
    !  --> default value: 1.0d0
        ! anomalous multiplier: electron drag and energy
        ! diffusion on fusion product ions
 
    REAL*8 :: xdfafus
    !  --> default value: 1.0d0
        ! anomalous multiplier: ion drag and energy
        ! diffusion on fusion product ions
 
    REAL*8 :: xefafus
    !  --> default value: 1.0d0
        ! anomalous multiplier: pitch angle scattering on
        ! fusion product ions
 
    LOGICAL :: nlbcde
    !  --> default value: .true.
        ! .FALSE. (0) to turn off energy diffusion
 
    LOGICAL :: nlbcoh
    !  --> default value: .true.
        ! .FALSE. (0) to suppress acceleration of beam ions by
        ! toroidal electric field
 
    LOGICAL :: nlbcpa
    !  --> default value: .true.
        ! .FALSE. (0) to turn off pitch angle scattering
 
    LOGICAL :: nlorbo !  *updatable*
    !  --> default value: .false.
        ! .TRUE. (1) for "orbit only" mode: suppress all collisions
        ! used only in specialized debugging situations.
Home Top


nbitype_flr

    use nbi_types
    type(nbitype_flr) :: zflr   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_flr(zflr)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_flr(zflr,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_flr(zflr)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_flr(zflr)   ! send to NUBEAM
 
members of nbitype_flr data type:
 
    ! finite larmor radius corrections
 
    LOGICAL :: nlbflr
    !  --> default value: .TRUE.
        ! .TRUE. (1) for standard FLR treatment, based on a mod(B)
        ! at guiding center and notion of a FLR circle about
        ! the guiding center, upon which a random gyro-phase
        ! angle is taken to define the current particle position.
 
    LOGICAL :: nlfbmflr
    !  --> default value: .TRUE.
        ! .TRUE. (1) to use the FLR localized fast ion
        ! distribution for beam-beam neutron calculations.
        ! Note that recent code changes (by Marina Gorelenkova)
        ! ensure that both an FLR and a GC localized fast ion
        ! distribution are computed and output on every run.
 
    LOGICAL :: nlbgflr !  *updatable*
    !  --> default value: .FALSE.
        ! .TRUE. (1) for enhanced FLR treatment
        ! this deforms the FLR trajectory by looking at the
        ! variation of mod(B) in the guiding center vicinity,
        ! and is appropriate when the larmor radius is >~ L(B)
        ! e.g. in low field systems such as STs.  **but** this
        ! option is extremely expensive computationally!
 
    REAL*8 :: gflr_min
    !  --> default value: 0.0
        ! for nlbgflr=.TRUE., if the guiding-center estimate
        ! of larmor radius, in cm, is less than this, revert
        ! to the standard guiding-center based treatment (to
        ! save computational effort).
 
    REAL*8 :: gflr_rl
    !  --> default value: 1.0d6
        ! nlbgflr=.TRUE. expert control (do not touch)
 
    REAL*8 :: gflr_ll
    !  --> default value: 30.0d0
        ! nlbgflr=.TRUE. expert control (do not touch)
 
    REAL*8 :: gflr_xv(2)  ! (1:2)
    !  --> default value:  (/1.5d0, 0.4d0/)
        ! nlbgflr=.TRUE. expert controls (do not touch)
 
    REAL*8 :: gflr_op(15)  ! (1:15)
    !  --> default value:  (/0.d0,1.d-4,1.d-5,0.d0,3.d0,10.d0,1.d0,0.2d0,0.05d0,1.d0,2.d0,0.d0,0.d0,0.d0,0.d0/)
        ! nlbgflr=.TRUE. expert controls (do not touch)
Home Top


nbitype_saw

    use nbi_types
    type(nbitype_saw) :: zsaw   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_saw(zsaw)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_saw(zsaw,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_saw(zsaw)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_saw(zsaw)   ! send to NUBEAM
 
members of nbitype_saw data type:
 
    ! sawtooth model controls
    ! note: on every fast ion step, sawtooth mixing may be computed, but
    ! not applied.  If in fact a sawtooth occurs, a call to "sawnbi" signals
    ! that the sawtooth transformation of the Monte Carlo population should
    ! be applied.
    !
    ! The "sawnbi" call cannot change the fast ion density and energy
    ! density profiles in the driver code; instead, these profiles are
    ! computed as a part of each regular fast ion timestep.  It is up
    ! to the driver code to save these profiles and use as needed.
    !
    ! When NUBEAM is run in client-server mode, the "sawnbi" call needs
    ! to happen on the server side and is requested via a namelist
    ! setting.
    !
    ! "sawnbi" is a legacy call.  Setting sawflag=.TRUE. has the same
    ! effect as a sawnbi call (cf sawnbi.for & sawflag2 internal flag...)
 
    LOGICAL :: sawflag !  *updatable*
    !  --> default value: .FALSE.
        ! set .TRUE. (1) if sawtooth occurred since prior step
        ! (this means: apply previously calculated sawtooth
        ! mixed new start coordinates when restarting partially
        ! slowed down orbiting ions).
 
    LOGICAL :: nlsawb !  *updatable*
    !  --> default value: .TRUE.
        ! if .TRUE. (1) calculate sawtooth mixing of beam ions.
 
    LOGICAL :: nlsawf !  *updatable*
    !  --> default value: .TRUE.
        ! if .TRUE. (1) calculate sawtooth mixing of fusion products.
 
    REAL*8 :: xswfrac_allfast
    !  --> default value: 1.0d0
        ! fraction multiplier -- fast ions participating
        ! in sawtooth mixing
 
    REAL*8 :: xswfrac_beam
    !  --> default value: 1.0d0
        ! fraction multiplier -- beam ions participating
        ! in sawtooth mixing: net xswfrac_allfast*xswfrac_beam
 
    REAL*8 :: xswfrac_fusn
    !  --> default value: 1.0d0
        ! fraction multiplier -- fusn prod ions participating
        ! in sawtooth mixing: net xswfrac_allfast*xswfrac_fusn
 
    INTEGER :: nmix_kdsaw
    !  --> default value: 1
        ! KDSAW (Kadomtsev/Porcelli) mixing model option
        ! =1: standard Kadomtsev
        ! =2: Kadomtsev, ions fully mixed => flat density
        ! =3: Porcelli, two mixing regions (island annulus +
        !     interior axial region separately mixed).
        ! =4: Porcelli, ions fully mixed => flat density;
        ! -------> see KDSAW NTCC MODULE documentation
 
    REAL*8 :: fporcelli
    !  --> default value: 1.0d0
        ! (if nmix_kdsaw = 3 or 4) interior fractional
        ! width of q=1 island towards the magnetic axis;
        ! fporcelli=1 means island reaches all the way to
        ! axis => Kadomtsev-like mixing.
        !   0.0 <= fporcelli <= 1.0
        ! smaller Porcelli fractions => smaller mixing
        ! region, but the region from the axis to the q=1
        ! surface is always mixed.
        ! -------> see KDSAW NTCC MODULE documentation
Home Top


nbitype_adif

    use nbi_types
    type(nbitype_adif) :: zadif   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_adif(zadif)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_adif(zadif,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_adif(zadif)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_adif(zadif)   ! send to NUBEAM
 
members of nbitype_adif data type:
 
    ! anomalous diffusion
    ! if this is used, an anomalous diffusivity profile must be
    ! provided via xplasma (see section on input data profiles).
    ! if no profile is provided, the anomalous diffusivity will
    ! be zero and this feature will be inactive.
    !  MOD DMC 2008: (a) anomalous radial velocity profile
 
    INTEGER :: nkaep !  *updatable*
    !  --> default value:  0
        ! number of terms (NK) in expansion of MHD transport operator (Mario Podesta)
 
    REAL*8 :: AEP_ASCALE(10)  ! (1:mnkaep)  *updatable*
    !  --> default value:  0.0d0
        ! scaling factor for mode amplitudes in  MHD transport operator (Mario Podesta)
 
    REAL*8 :: AEP_USCALE !  *updatable*
    !  --> default value:  1.0d0
        ! scaling factor for electrical potential for MHD transport operator (Mario Podesta)
 
    REAL*8 :: TAEP_FAC !  *updatable*
    !  --> default value:  0.0d0
        ! scaling factor to redefine time step for MHD transport operator (Mario Podesta)
 
    INTEGER :: nmdifb !  *updatable*
    !  --> default value: 0
        ! type of fast ion diffusivity
        ! =4: 2D fast ion diffusivity from ufiles
        ! =6: fast ion diffusivity from dep code
 
    INTEGER :: nkdifb
    !  --> default value: 3
        ! =3: apply to all fast ions;
        ! =1: apply to beam ions only;
        ! =2: apply to fusion product ions only.
        ! NOTE: this variable always set to 3 when Plasma_State is
        ! used; in this case separate diffusivity profiles are
        ! provided for the beam ions and the fusion product ions.
 
    INTEGER :: ndifbe
    !  --> default value: 0
        ! number of bins in profile of energy dependence for
        ! anomalous diffusion
 
    REAL*8 :: fdifbe(20)  ! (1:ndifbe)  *updatable*
    !  --> default value: 1.0d0
        ! anomalous diffusivity multiplier, vs. energy
        ! all with reference to an anomalous diffusivity input
        ! profile Db(x) given as one of the code's profile inputs.
 
    REAL*8 :: edifbe(20)  ! (1:ndifbe)
    !  --> default value: 0.0
        ! energies (eV) for anomalous diffusivity multiplier
        ! energy dependence:
        !   fdifbe(1) applies for energy range 0 to edifbe(1)
        !   fdifbe(2) applies for energy range edifbe(1) to edifbe(2)
        !     ...
        !   fdifbe(ndifbe) applies, edifbe(ndifbe-1) to edife(ndifbe).
        ! if not in any range, a multiplier of 1.0 applies.
 
    REAL*8 :: x_qlim0 !  *updatable*
    !  --> default value:  0.0
        ! QLIM0 high diffusion region -- apply enhanced diffusivity
        ! to *all* fast species inside this radius (regardless of
        ! how nkdifb is set).  (difb profile still determines the
        ! actual diffusivity; ndifb, fdifbe, edifbe can still be
        ! used; velb used if set).
        ! (NOTE: always set to 0.0 if Plasma_State is used).
 
    INTEGER :: ndifbe_2d
    !  --> default value:  1
        ! number of energy grid points for diffusivity vs. (x,E)
        ! 2d profiles (ndifbe_2d.gt.1 indicates presence of data)
        ! this should match the energy grid of the FD0 diffusivities
        ! nbi_getprofiles will check this.
 
    REAL*8 :: dif2d_conv
    !  --> default value:  0.0
        ! conversion factor to cm**2/sec
        ! (non-zero value indicates presence of data)
        ! (Plasma State has m**/sec, interface sets dif2d_conv = 1.0d4)
 
    REAL*8 :: dif2d_dpa
    !  --> default value:  0.0
        ! if non-zero, this is the target change per orbit
        ! bounce in pitch angle which affects goosing and range of
        ! search of diffusivities in pitch angle space to reduce
        ! goosing near high diffusivity regions; it matches
        ! delta(vpll/v) approximately if << 1.0.
        ! If ZERO it will be set to 1.0/goocon
 
    INTEGER :: ngradd_opt
    !  --> default value:  0
        ! grad(Db) pinch cancellation option
        ! 0, default, means automatic: active for 1d diffusivity
        ! profile inputs, inactive for 2d inputs.  Set =1 to force
        ! grad(Db) correction; set to -1 to force its absence.
Home Top


nbitype_ripple

    use nbi_types
    type(nbitype_ripple) :: zripple   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_ripple(zripple)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_ripple(zripple,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_ripple(zripple)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_ripple(zripple)   ! send to NUBEAM
 
members of nbitype_ripple data type:
 
    ! TF field ripple effects.  The available models are crude.
    ! A TFTR project to build a better model ran out of time and
    ! money.
 
    INTEGER :: nrip
    !  --> default value: 0
        ! =0: no ripple loss;  =1: simple "loss time" model
        ! =2: adjustable model based on Goldston-White-Boozer and
        !     ripple field strength. CAUTION-- calibration against
        !     a more exact model is needed.  PPPL expert help should
        !     be sought before using this model
 
    REAL*8 :: taurip !  *updatable*
    !  --> default value: 0.0
        ! must be set if nrip=1: lint* readMyid0,oss time (sec) for trapped ions
 
    INTEGER :: id_ripple !  *updatable*
    !  --> default value: 0
        ! xplasma ID for profile f(R,Z) of
        !   log((Bmax-Bmin)/(Bmax+Bmin))
        ! if not set, code looks for an xplasma function named
        ! "LOG_TF_RIPPLE".  Must be found if nrip=2.
 
    INTEGER :: id_ripple2 !  *updatable*
    !  --> default value: 0
        ! xplasma ID for profile f(R,Z) of
        !   log((Bmax-Bmin)/(Bmax+Bmin)) (2nd component ripple field)
        ! if not set, code looks for an xplasma function named
        ! "LOG_TF_RIPPLE2".  Must be found if nrip=2, AND ncoils_2 > 0.
 
    INTEGER :: ncoils
    !  --> default value: 0
        ! number of TF coils.  Must be set if nrip=2.
 
    INTEGER :: ncoils_2
    !  --> default value: 0
        ! number of TF coils (2ndary ripple field).
        ! Must be set if nrip=2 AND a 2 component ripple field is to
        ! be used.
 
    REAL*8 :: asrd
    !  --> default value: 0.0
        ! nrip=2 adjustment factor for fusion product ions
 
    REAL*8 :: bsrd
    !  --> default value: 0.0
        ! nrip=2 adjustment factor for beam ions.
Home Top


nbitype_outcon

    use nbi_types
    type(nbitype_outcon) :: zoutcon   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_outcon(zoutcon)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_outcon(zoutcon,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_outcon(zoutcon)      ! retrieve from NUBEAM
 
members of nbitype_outcon data type:
 
    ! code output control options
 
    INTEGER :: nerngfi
    !  --> default value: 1
        ! number of energy bins for trapping fraction output profiles
        ! generally only coarse binning is useful, e.g. nerngfi=5.
        ! the maximum allowed value is the (user settable) array
        ! dimension "miefi".
 
    REAL*8 :: erngfi(10,15)  ! (1:nerngfi,1:mibs)
    !  --> default value: 0.0
        ! eV
        ! coarse energy bins for trapping fraction output profiles
        ! if nerngfi=1, there is one bin: [erngfi(1),infinity]
        ! if nergnfi>1, the bins are: [erngfi(1),erngfi(2)]
        !                             [erngfi(2),erngfi(3)]
        !                               ...
        !                             [erngfi(nerngfi),infinity]
 
    INTEGER :: nsdbgb
    !  --> default value: 1
        ! index to fast ion specie selected for debug output
        ! (artifact-- not currently used).
Home Top


nbitype_fishbone

    use nbi_types
    type(nbitype_fishbone) :: zfishbone   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_fishbone(zfishbone)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_fishbone(zfishbone,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_fishbone(zfishbone)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_fishbone(zfishbone)   ! send to NUBEAM
 
members of nbitype_fishbone data type:
 
    ! fast ion fishbone loss model (ad hoc)
 
    LOGICAL :: nlfbon !  *updatable*
    !  --> default value: .FALSE.
        ! .TRUE. to turn on fishbone loss model
        ! "fishbones" are an MHD phenomenon though to be capable
        ! of ejecting fast ions.
 
    REAL*8 :: fbemin
    !  --> default value: 0.0
        ! minimum energy (eV) of affected ions
 
    REAL*8 :: fbemax
    !  --> default value: 0.0
        ! maximum energy (eV) of affected ions
 
    REAL*8 :: fvpvmn
    !  --> default value:  0.0d0
        ! minimum midplane |vpll/v| of affected ions
 
    REAL*8 :: fvpvmx
    !  --> default value:  0.0d0
        ! maximum midplane |vpll/v| of affected ions
 
    REAL*8 :: fbltim
    !  --> default value:  1.0d-7
        ! average loss time (seconds) of affected ions
 
    REAL*8 :: fshper
    !  --> default value:  5.0d-3
        ! fishbone period (cycle time, seconds)
 
    REAL*8 :: fshwid
    !  --> default value:  1.0d-3
        ! fishbone duration (seconds)
 
    REAL*8 :: tfshon
    !  --> default value:  -1000.0
        ! fishbone onset time (seconds) default always on
 
    REAL*8 :: tfshof
    !  --> default value:  +1.0d34
        ! fishbone stop time (seconds) default always on
 
    REAL*8 :: xfishmin
    !  --> default value:  0.0d0
        ! min (x) where fishbones have an effect
 
    REAL*8 :: xfishmax
    !  --> default value:  1.0d0
        ! max (x) where fishbones have an effect
        ! (x) the usual sqrt(tor.flux) normalized coordinate; average position
        ! data from last half orbit is used.
 
    INTEGER :: nfbon_vpvopt
    !  --> default value: 0
        ! =0: control vpll/v of affected ions with {fvpvmn,fvpvmx}
        ! =1: only operate on trapped ions with a trapping depth
        !     exceeding the threshold fbtrap_depth (see descr.).
        !     Note (fbemin,fbemax) constraints still apply.
 
    REAL*8 :: fbtrap_depth
    !  --> default value: 0.0
        ! trapping depth threshold (nfbon_vpvopt = 1 only)
        ! an orbit is considered trapped if either:
        !    (a) max(|B|) over orbit half-bounce > max(|B1|,|B2|)
        !        where B1 and B2 are taken at the midplane crossings (all
        !        |B|s are guiding center values), or,
        !    (b) the orbit never reaches the midplane after a multiple of
        !        tau_bounce has been exceeded (i.e. ST equilibria off-midplane
        !        trapped orbit class).
        ! IF an orbit is deemed trapped, then, its trapping depth is defined as
        !        d = (Bmax(psi_avg)-max(|B|)_orb)/(Bmax(psi_avg)-Bmin(psi_avg))
        ! and it is considered eligible for fishbones if d >= fbtrap_depth.
        ! Here, psi_avg is the "average" flux surface seen by the orbit, defined
        ! as 1/2(psi_min+psi_max), where the min and max values are taken over
        ! the last half bounce;
        !
        ! note that 0 < d < 1 is expected, and is enforced with min & max
        ! functions, as the limits could be exceeded slightly due to the
        ! psi_avg calculation procedure.
 
    INTEGER :: nfbon_species
    !  --> default value: 3
        ! species control
        !   =1 beam ions only
        !   =2 fusion product ions only
        !   =3 (default) all fast ions
Home Top


nbitype_box

    use nbi_types
    type(nbitype_box) :: zbox   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_box(zbox)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_box(zbox,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_box(zbox)      ! retrieve from NUBEAM
 
members of nbitype_box data type:
 
    ! beam-in-box neutral density calculation controls
 
    INTEGER :: nbbox
    !  --> default value: 0
        ! number of "beam-in-box" neutral density profile
        ! calculations
 
    INTEGER :: nbsbox(100)  ! (1:nbbox)
    !  --> default value: 0
        ! beam source numbers for neutral density calculation.
 
    INTEGER :: nsample_box(100)  ! (1:nbbox)
    !  --> default value: 0
        ! # of lanched MC particles in each box
 
    REAL*8 :: xninja_box(100)  ! (1:nbbox)
    !  --> default value: 0
        ! NO. OF PTCLS COMING IN Ith BOX  N/SEC
 
    REAL*8 :: xninjs_box(100)  ! (1:nbbox)
    !  --> default value: 0
        ! n/sec NO. of beam ptcls.injected, by species for BOXes subset only
 
    REAL*8 :: xninj_box
    !  --> default value: 0
        ! NO. OF PTCLS INJECTED N/SEC for BOXes subset only
 
    INTEGER :: nbebox(100)  ! (1:nbbox)
    !  --> default value: 1
        ! beam energy fractions, before which to compute a 3d
        ! neutral density profile on a Cartesian grid alligned
        ! on the beam centerline.
        !   nbsbox(i)=j  nbebox(i)=k
        ! means the i'th neutral density calculation is done in
        ! front of beam source j, using energy fraction k (for H
        ! isotope beams k=1 means full energy, k=2 means half-
        ! energy, k=3 means 1/3 energy).
 
    INTEGER :: nxbox
    !  --> default value: 1
        ! number of bins in horizontal direction (x) in front of beam
 
    INTEGER :: nybox
    !  --> default value: 1
        ! number of bins in vertical direction (y) in front of beam
 
    INTEGER :: nlbox
    !  --> default value: 100
        ! number of bins in the direction (l) of beam injection
 
    REAL*8 :: xboxhw
    !  --> default value: 5.0d0
        ! (cm) half-width of entire Cartesian box in x direction
        ! individual bins' x width = 2*xboxhw/nxbox
 
    REAL*8 :: yboxhw
    !  --> default value: 5.0d0
        ! (cm) half-height of entire Cartesian box in y direction
        ! individual bins' y width = 2*yboxhw/nybox
 
    REAL*8 :: xlbox1
    !  --> default value: 100.0d0
        ! (cm) distance from beam source at which box starts
 
    REAL*8 :: xlbox2
    !  --> default value: 500.0d0
        ! (cm) distance from beam source at which box ends
        ! individual bins' l length = (xlbox2-xlbox1)/nlbox
 
    INTEGER :: ndepbox
    !  --> default value: 500
        ! Monte Carlo statistics control:  minimum number of neutral
        ! tracks to use per calculation.
Home Top


nbitype_tube

    use nbi_types
    type(nbitype_tube) :: ztube   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_tube(ztube)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_tube(ztube,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_tube(ztube)      ! retrieve from NUBEAM
 
members of nbitype_tube data type:
 
    ! beam-in-tube neutral density variables
 
    INTEGER :: nbtube
    !  --> default value: 0
        ! number of beam-in-tube neutral density calculations
 
    INTEGER :: nbstube(200)  ! (1:nbtube)
    !  --> default value: 0
        ! tube beam source numbers
 
    INTEGER :: nbetube(200)  ! (1:nbtube)
    !  --> default value: 1
        ! beam energy fractions to be used when calculating neutral
        ! density
        !   nbstube(i)=j  nbetube(i)=k
        ! means the i'th neutral density calculation is done in
        ! front of beam source j, using energy fraction k (for H
        ! isotope beams k=1 means full energy, k=2 means half-
        ! energy, k=3 means 1/3 energy).
 
    REAL*8 :: Rtube(200)  ! (1:nbtube)
    !  --> default value: 0.
        ! radial coordinate of start of tube (cm)
 
    REAL*8 :: Ytube(200)  ! (1:nbtube)
    !  --> default value: 0.
        ! vertical (z-axis) coordinate of start of tube (cm)
 
    REAL*8 :: XZETAtube(200)  ! (1:nbtube)
    !  --> default value: 0.
        ! angular coordinate of start of tube (degrees)
 
    REAL*8 :: PHItube(200)  ! (1:nbtube)
    !  --> default value: 0.
        ! tube's sightline azimuthal angle from start of tube measured from
        ! the centerline with the positive direction in direction of the
        ! plasma current (degrees)
 
    REAL*8 :: THETAtube(200)  ! (1:nbtube)
    !  --> default value: 0.
        ! tube's sightline elevation angle from start of tube measured from
        ! the midplane (degrees)
 
    INTEGER :: LMIDtube(200)  ! (1:nbtube)
    !  --> default value: 0
        ! 0->tube data will be collected between XL1tube<s<XL2tube
        ! 1->tube data will be collected from XL1tube to XL2tube relative
        !    to the point on the tube which is closest to the beam's sightline
 
    REAL*8 :: XL1tube(200)  ! (1:nbtube)
    !  --> default value: 0.
        ! tube data will be collected between XL1tube and XL2tube along sightline.
        ! this is the distance at which data will begin to be collected (cm)
 
    REAL*8 :: XL2tube(200)  ! (1:nbtube)
    !  --> default value: 0.
        ! tube data will be collected between XL1tube and XL2tube along sightline.
        ! this is the distance at which data will stop being collected (cm)
 
    INTEGER :: NSEGtube(200)  ! (1:nbtube)
    !  --> default value: 100
        ! number of data segments between XL1tube and XL2tube in which to compute
        ! the neutral density data.  This number must be less then mituben.
 
    REAL*8 :: RHOtube
    !  --> default value:  1.d0
        ! radius of the tubes (cm) -- note that the number of trajectories used to
        ! compute the neutral particle density (tuben0) is inversely proportional
        ! to the tube radius.
 
    INTEGER :: NDEPtube
    !  --> default value: 500
        ! estimated number of beam intersections per tube assuming no beam loss and a tube
        ! perfectly centered within the beam aperture.  The number of trajectories which
        ! will be attempted will be  NDEPtube*sqrt(area_aperture)/2*RHOtube
Home Top


nbitype_misc

    use nbi_types
    type(nbitype_misc) :: zmisc   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_misc(zmisc)     ! set defaults
       [...user code...]          ! modify elements...
 
    ! this can only be done ONCE:
    call nbi_set_misc(zmisc,ierr) ! send to NUBEAM
    if(ierr.ne.0) [...handle error...]
 
        ... ... ... ... 
 
    call nbi_get_misc(zmisc)      ! retrieve from NUBEAM
 
    ! the following should be preceeded by a nbi_get call.
    ! only items marked as updatable are affected
    ! inside NUBEAM by this call (see element description)
 
       [...user code...]          ! modify elements...
    call nbi_update_misc(zmisc)   ! send to NUBEAM
 
members of nbitype_misc data type:
 
    ! miscellaneous
 
    REAL*8 :: plhgt !  *updatable*
    !  --> default value: 0.0
        ! (updown symmetric geometries only) height of plasma
        ! midplane above/below vacuum vessel midplane (cm);
        ! neutral beam component (e.g. ion source, aperture)
        ! elevations are given with respect to the vacuum vessel
        ! midplane.  (In updown asymmetric cases the vertical
        ! offset is presumed to be given in the MHD equilibrium).
        !   **time dependent quantity**
 
    LOGICAL :: nlcprb
    !  --> default value: .TRUE.
        ! set .FALSE. (0) to suppress compression operator and other
        ! effects of time varying MHD equilibrium on beam ions
        ! (recommendation: leave default, .TRUE., alone).
 
    LOGICAL :: nlpsirz
    !  --> default value: .FALSE.
        ! set .TRUE. (1) if an accurate Psi(R,Z) (free boundary) MHD
        ! equilibrium, extending beyond the plasma boundary, is
        ! available.
 
    REAL*8 :: edbfac !  *updatable*
    !  --> default value: 10.0d0
        ! debug tripwire -- if an ion reaches edbfac x its initial
        ! deposition energy, kill the run. (dimensionless).
 
    INTEGER :: nmcurb
    !  --> default value: 1
        ! set to 0 to suppress fast ion driven current.
        ! nmcurb=1 gives an aspect-ratio approximate neoclassical
        ! shielding calculation for the current; nmcurb=2 gives
        ! the simplified shielding correction (1-1/Zeff).
        ! nmcurb=3  gives neoclassical shielding calculation for the current
        ! by Lin-Liu formula Phys.Plasmas 4(11),p.4179, 1997. Other
        ! non-zero values of nmcurb give the same result as nmcurb=1
        ! (for now), but, a fully generalized geometry neoclassical
        ! shielding calculation will be implemented at some point
        ! in the future, and nmcurb=3 may be used to select this,
        ! when it exists.
        ! NMCURB  = 4, shielding calculation by Honda M., Kikuchi M., Azumi M.
        ! "Collisionality dependence on shielding factor of beam driven current"
        ! Nuclear Fusion, submitted by October 2011. Martix inversion method are used
        ! to include collisionality dependence on a shielding factor at arbitrary aspect ratio.
 
    LOGICAL :: nlfdep
    !  --> default value: .FALSE.
        ! set .TRUE. (1) to compute midplane index oriented deposition
        ! distribution function in the lab frame using the "fbm"
        ! grids for pitch and energy, with particles mapped to
        ! their outer midplane crossing (a few particles which
        ! never cross the midplane at R > Raxis will be missed!).
        ! setting this switch causes a specialized, rarely used
        ! output data structure to be created
        ! nlfdep ***DISABLED*** DMC May 2 2007
        ! deposition data is now output on original chordal tracks
Home Top


nbitype_profiles

    use nbi_types
    type(nbitype_profiles) :: zprofiles   ! instantiate object
    integer :: ierr               ! status code, 0=OK
 
    call nbi_init_profiles(zprofiles)     ! set defaults
       [...user code...]          ! modify elements...
    ! (nbi_set method not recommended)
 
        ... ... ... ... 
 
    call nbi_get_profiles(zprofiles)      ! retrieve from NUBEAM
 
    ! usually, all elements are reset every timestep:
 
       [...user code...]          ! modify elements...
    call nbi_update_profiles(zprofiles)   ! send to NUBEAM
 
members of nbitype_profiles data type:
 
    ! xplasma ids of profile inputs to the Monte Carlo fast
    ! ion calculation: generally, plasma parameter profiles.
    ! the code also expects an xplasma equilibrium description
    ! with vacuum region and limiters defined.
    ! the flux coordinate "x" is normalized sqrt-toroidal-flux
    ! (0 at axis, 1 at plasma bdy).
    ! note: all xplasma quantities are MKS; temperatures are KeV
    ! (the beam code converts to cgs-eV when it interpolates the
    ! profiles to the Monte Carlo code grid).
    ! note: loop voltage profile is in volts.
    !       radial electrostatic potential is in volts.
 
    INTEGER :: id_te !  *updatable*
    !  --> default value: 0
        ! electron temperature vs "x"
 
    INTEGER :: id_ti !  *updatable*
    !  --> default value: 0
        ! ion temperature vs "x"
 
    INTEGER :: id_tifusn !  *updatable*
    !  --> default value: 0
        ! ion temperature for fusion calculations vs. "x"
        ! id_ti = id_tifusn is not unusual.  Sometimes id_ti
        ! is affected by impurities, and id_tifusn is supplied
        ! as slightly more accurate for the reactive non-impurity
        ! species.
 
    INTEGER :: id_ne !  *updatable*
    !  --> default value: 0
        ! electron density /m**3 in xplasma
        ! converted to /cm**3 internally
 
    INTEGER :: ng !  *updatable*
    !  --> default value: 0
        ! current number of gases
 
    INTEGER :: id_nh(10)  ! (1:ngmax)  *updatable*
    !  --> default value: 0
        ! non-impurity thermal ion densities
 
    INTEGER :: id_nimp(300)  ! (1:nrhix)  *updatable*
    !  --> default value: 0
        ! impurity thermal ion densities
 
    INTEGER :: id_nrf(10)  ! (1:nmini)  *updatable*
    !  --> default value: 0
        ! RF minority specie densities
 
    INTEGER :: id_nfast(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! fast density profiles can be input e.g. if a fokker
        ! planck package (instead of the Monte Carlo package)
        ! is used for slowing down calculations.
 
    INTEGER :: id_eperpfast(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! fast ion <Eperp>, lab frame can be input
 
    INTEGER :: id_epllfast(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! fast ion <Epll>, lab frame can be input
 
    INTEGER :: id_aimp !  *updatable*
    !  --> default value: 0
        ! Aimp vs. x (allowed if there is a single "model impurity")
        ! AMU; non-integer values allowed as this represents an
        ! amalgum of impurities.
 
    INTEGER :: id_zimp !  *updatable*
    !  --> default value: 0
        ! Zimp vs. x (allowed if there is a single "model impurity")
        ! atomic number; non-integer values allowed as this
        ! represents an amalgum of impurities.
 
    INTEGER :: id_omega !  *updatable*
    !  --> default value: 0
        ! plasma angular velocity profile "omega" (1/sec)
        ! locally Vphi = R*omega
 
    INTEGER :: id_epot !  *updatable*
    !  --> default value: 0
        ! radial electrostatic potential profile (volts)
 
    INTEGER :: id_vpoh !  *updatable*
    !  --> default value: 0
        ! toroidal loop voltage profile
 
    INTEGER :: id_curt !  *updatable*
    !  --> default value: 0
        ! enclosed toroidal current vs. flux surface x (amps)
        !------------------
        ! one can either specify these profiles and use nkdifb to control application:
 
    INTEGER :: id_difb !  *updatable*
    !  --> default value: 0
        ! anomalous diffusivity profile (all species) (cm2/sec)
 
    INTEGER :: id_velb !  *updatable*
    !  --> default value: 0
        ! anomalous radial velocity profile (all species) (cm/sec)
        !------------------
        ! or specify anomalous transport separately for beam ions and fusion ions:
 
    INTEGER :: id_difb_bi !  *updatable*
    !  --> default value: 0
        ! anomalous diffusivity profile (beam ions) (cm2/sec)
 
    INTEGER :: id_velb_bi !  *updatable*
    !  --> default value: 0
        ! anomalous radial velocity profile (beam ions) (cm/sec)
 
    INTEGER :: id_difb_fi !  *updatable*
    !  --> default value: 0
        ! anomalous diffusivity profile (fusion ions) (cm2/sec)
 
    INTEGER :: id_velb_fi !  *updatable*
    !  --> default value: 0
        ! anomalous radial velocity profile (fusion ions) (cm/sec)
        !------------------
        ! or specify orbit-topology-dependent diffusivities vs. (x,E) separately for
        ! each fast ion species  (dmc: 2010 collab w/ B. Heidbrink & N. Gorelenkov).
 
    INTEGER :: id_fd0(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! diffusivities: deeply trapped orbits
 
    INTEGER :: id_fdb(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! diffusivities: barely trapped orbits
 
    INTEGER :: id_fdp(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! diffusivities: barely passing "co" orbits
 
    INTEGER :: id_fdq(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! diffusivities: deeply passing "co" orbits
 
    INTEGER :: id_fdr(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! diffusivities: barely passing "ctr" orbits
 
    INTEGER :: id_fds(15)  ! (1:nsfast)  *updatable*
    !  --> default value: 0
        ! diffusivities: deeply passing "ctr" orbits
        !------------------
 
    INTEGER :: id_n0(50,10)  ! (1:nsmax,1:ngmax)  *updatable*
    !  --> default value: 0
        ! neutral density profiles
        ! id_n0(is,ig) = neutral density of gas ig due to source is
        !   (because of charge exchange, a source of one specie
        !   generally produces non-zero neutral densities for several
        !   species).
        ! source numbering:
        !   is=1 -- wall source, gas ig=1
        !   is=2 -- halo source, gas ig=1
        !   is=3 -- optional 2nd wall source, gas ig=1
        !           if no 2nd wall source leave id_n0(is,1:inum_ng0)=0
        !   is=4 -- wall source, gas ig=2
        !   is=5 -- halo source, gas ig=2
        !   is=6 -- optional 2nd wall source, gas ig=2
        !    ...
        !   is=3*inum_ng0-2 -- wall source, gas ig=inum_ng0
        !   is=3*inum_ng0-1 -- halo source, gas ig=inum_ng0
        !   is=3*inum_ng0   -- optional 2nd wall source,
        !                      gas ig=inum_ng0
        !
        ! note: at present the neutrals profiles must be given
        ! as flux surface averages, but in the future, 2d
        ! profiles f(x,theta) will be allowed.
 
    INTEGER :: id_t0(50,10)  ! (1:nsmax,1:ngmax)  *updatable*
    !  --> default value: 0
        ! neutral "temperature" (or 2/3 <E>) profiles
        ! same indexing as id_n0
 
    INTEGER :: id_omeg0(50,10)  ! (1:nsmax,1:ngmax)  *updatable*
    !  --> default value: 0
        ! neutral populations' average angular velocity profiles
        ! same indexing as id_n0
Home Top


About this document

This Document was created by hlptohtml

  • Written By:
  • Manish Vachharajani(mvachhar@pppl.gov)