Main Page | File List | File Members

Esc2Any.c File Reference

ESC API. More...

#include "esc_local.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <fenv.h>

Defines

#define NDAT   21

Functions

int ESCInitStr ()
void esc00_ (char *MachineRunID, int *na)
void esc00 (char *MachineRunID, int *na)
void esc0_ (char *MachineRunID)
void esc0x_ (char *MachineNm)
void esc_ (int *Ffail, int *Fjob, int *Mpol, double *sTime)
void esc1_ ()
void esc0 (char *MachineNm)
void esc0x (char *MachineNm)
void ESC0 (char *MachineNm)
void esc (int *Ffail, int *Fjob, int *Mpol, double *sTime)
void ESC (int *Ffail, int *Fjob, int *Mpol, double *sTime)
void esc1 ()
void ESC1 ()
void ESexit (int i)
int JET2escEnd ()
int JET2esc ()
int EFIT2esc ()
int ESFirstSetSplDD ()
int ESSetSplDD (double A)
int splRDD (double *f, double *df, int k)
int EFIT2ESPlPrCr ()
int DCON2ESPlPrCr ()
int DCON2esc ()
void astra2e_ (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext, double *gFtor)
void e2astra_ (double *Rmaxis, double *Zmaxis, double *gFtor, double *Fpol, double *gM, double *G22, double *G33, double *D2, double *D3, double *Sside, double *Sside1)
void EZastra2e (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext, double *gFtor)
void ASTRA2E (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext, double *gFtor)
void e2astra (double *Rmaxis, double *Zmaxis, double *gFtor, double *Fpol, double *gM, double *G22, double *G33, double *D2, double *D3, double *Sside, double *Sside1)
void E2ASTRA (double *Rmaxis, double *Zmaxis, double *gFtor, double *Fpol, double *gM, double *G22, double *G33, double *D2, double *D3, double *Sside, double *Sside1)
void tr2esc_ (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext, double *gFtor)
void esc2tr_ (double *Rmaxis, double *Zmaxis, double *gFtor, double *gYpol, double *RBtor, double *gM, int *nRadGrid, int *MStorage, int *NaStorage, double *Rcs, double *Zcs, int *nMoments)
void escin_ (double *pProf, double *jProf, double *aProf, int *nProf, int *hH, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void escin (double *pProf, double *jProf, double *aProf, int *nProf, int *hH, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void Esc_p_jparallel (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void esc_p_jparallel_ (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void esc_p_jparallel (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void ESC_P_JPARALLEL (double *Pressure, double *Jparallel, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void Esc_p_q (double *Pressure, double *qprofile, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void esc_p_q_ (double *Pressure, double *qprofile, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void esc_p_q (double *Pressure, double *qprofile, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
void ESC_P_Q (double *Pressure, double *qprofile, double *Rpv, double *Zpv, int *Npv, double *RBtor, double *Rext)
int ESgetDataProfile (double *Pprofile, double *Jprofile)
void esgetdataprofile_ (double *Pprofile, double *Jprofile)
void esgetdataprofile (double *Pprofile, double *Jprofile)
void ESGETDATAPROFILE (double *Pprofile, double *Jprofile)
int esc2orbit_ ()
int esc2orbitB ()
void ESC2ORBIT ()
void esc2orbit ()
void ESC2ORBITB ()
void esc2orbitb_ ()
void esc2orbitb ()
int ESFreeRZspaceEq ()
int ESWriteESI0 ()
int ESWriteESI (char *CoordNm, double *sr, double *sz, double *aB, double *gH, int Na, int Np)

Variables

double EZcr2
double EZcr3
double EZcr4
double EZcr6
double EZcr12
double EZcgp
double EZc2gp
double EZcgp_4
double EZcr2gp
double EZcgm0
double EZcrgm0
int ESNa
int ESNa1
int ESNp
int ESNp1
int ESFp
int ESFp1
int TFCNt
int TFCNp
int ESLt
int ESNt
int ESMp
int ESMp1
int ES2Mp
int ES2Mp1
int ESnMp
int ESiAx
int ESEqSolvFl
int ESEqSolvIt
int ESEqSolvRadC
int ESEqSolvInPr
int ESEqSolvInCr
int ESFail
double ESxDtPr []
double ESxDtCr []
double * ESaR0
double * ESaZ0
double * ESsa
double * ESpa
int ESnDtPr
int ESnDtCr
int ECEqIterFl
double ESBt
double ESRBt
double ESRext
double * ESaF
double * ESaF1a
double * ESaF2a
double * ESgF
double * ESgF1a
double * ESgF2a
double * ESgm
double * ESgm1a
double * ESgm2a
double * ESFF
double * ESFF1a
double * ESFF2a
double * ESgt
double * ESsb
double * ESsb1a
double * ESsb2a
double * rcT
double * rcT1a
double * rcT2a
double * rsT
double * rsT1a
double * rsT2a
double * EScs1
double * ESsn1
double * R0T
double * Z0T
double * bT
double * EZvr
double * EZvz
double * ESg22c
double * ESg22c1
double * ESg22c2
double * ESDPc
double * ESDPc1
double * ESDPc2
double * ESLc
double * ESLc1
double * ESLc2
double * ESVc
double * ESVc1
double * ESVc2
char ESMachineNm []
char ESRunID []
double ESTime
int FlagEFIT
int ESNMSE
double ESrMSE []
double ESgiMSE []
double EcRjet []
double EcZjet []
int EcNjet
double * ESRC
double * ESRC1a
double * ESRC2a
double * ESqgF
double * ESqgF1a
double * ESqgF2a
double * ESqgY
double * ESqgY1a
double * ESqgY2a
double * ESsh
double * ESsh1a
double * ESsh2a
double * ESqV
double * ESqV1a
double * ESqV2a
double * ESjp
double * ESjp1a
double * ESjp2a
double * ESsp
double * ESsp1a
double * ESsp2a
double * ESPs
double * ESPs1a
double * ESPs2a
double * ESgb
double * ESgb1a
double * ESgb2a
double * ESgB
double * ESgB1a
double * ESgB2a
double * ESjs
double * ESjs1a
double * ESjs2a
double * ESjb
double * ESjb1a
double * ESjb2a
double * ESaJ
double * ESaJ1a
double * ESaJ2a
double * ESaT
double * ESaT1a
double * ESaT2a
double * ESjB
double * ESjB1a
double * ESjB2a
double * ESsq
double * ESsq1a
double * ESsq2a
double * ESgY
double * ESgY1a
double * ESgY2a
double * ESdgY
double * ESdgY1a
double * ESdgY2a
double * ESsr
double * ESsra
double * ESsrt
double * ESsrat
double * ESsz
double * ESsza
double * ESszt
double * ESszat
double * ESaB
double * ESaBa
double * ESaBt
double * ESaBat
double * ESgH
double * ESgHa
double * ESgHt
double * ESgHat
int ESXNa
int ESXNa1
double * ESXsx
double * ESXsr
double * ESXsj
double * ESXsp
double * ESXsq
double * ESXsi
int FlagPoints


Detailed Description

ESC API.

This file contains a list of procedures to (in this order):

To enable linking with Fortran on UNIX workstations, each API routine is in addition shadowed by equivalent routines bearing the same name but in lower case with and without underescore appended. On Crays, entry points in upper case are also included.

Author:
L. E. Zakharov, A. Pletzer

Function Documentation

void esc00_ char *  MachineRunID,
int *  na
 

Another way of initializing Esc. Call this routine instead of esc0_ if you want to control the internal number of radial zones in Esc (which is set to 20 when calling esc0_).

Parameters:
MachineRunID a string of the form '<machine>.<runid>' with '.' as separator (input). For instance MachineRunID = "NSTX.123456Z12".
na no. of radial intervals <=128 (input)
Author:
L. E. Zakharov
See also:
esc0_, esc1_

void esc0_ char *  MachineRunID  ) 
 

Initialization routine. This procedure should be called prior to any other ESC call, or after complete de-initialization.

Parameters:
MachineRunID a string of the form '<machine>.<runid>' with '.' as separator (input). For instance MachineRunID = "NSTX.123456Z12".
Author:
L. E. Zakharov
See also:
esc1_

void esc1_  ) 
 

De-initialization. This will deallocate and clean up internal variables. Call this procedure once all desired data have been extracted. You must invoke esc1_ to prevent memory leaks.

Author:
L. E. Zakharov
See also:
esc0_

void esc_ int *  Ffail,
int *  Fjob,
int *  Mpol,
double *  sTime
 

Execution of ESC. This procedure can be called once ESC has been initialized (esc0_ or esc00_) and the geometry and profiles have been specified (using escin_, Esc_p_q or Esc_p_jparallel). Alternatively, instead of, or in addition to specifying the profiles, a previously saved geometry can be loaded by setting Fjob to 2 or 3.

Parameters:
Fjob job assignment (input)
  • 0 nothing special was requested
  • 1 save the geometry in file <machinerunid>.es file
  • 2 load the geometry & profiles from file <machinerunid>.es
  • 3 load from and then save the geometry & profiles in file <machinerunid>.es
Mpol number of poloidal Fourier modes (<=12) (input). Typically Mpol should be 3 or 4.
sTime used when Fjob != 0 to tag the equilibrium data in dump file <machinerunid>.es
Ffail: completion flag (output).
  • 0 sucess
  • 1 some problems
  • 2 problems near the boundary
  • 4 problems near the axis
  • 8 problems in the middle
  • 3, 11, 15 are usually mild problems associated with localized inaccuracies.
See also:
Esc_p_q, Esc_p_jparallel, escin_

void Esc_p_jparallel double *  Pressure,
double *  Jparallel,
double *  Rpv,
double *  Zpv,
int *  Npv,
double *  RBtor,
double *  Rext
 

Profile and geometry specification. This procedure must be called immediately prior to execution (Esc).

  • Profiles: both Pressure and Jparallel profiles are arrays of length 21 and are defined on the uniform sqrt(toroidal flux) mesh.
  • Geometry: Npv denotes the number of input points Rpv and Zpv.
    • 4 <= Npv <= 12: the points must be ordered according to left, right, top, bottom, then North-east, North-west, South-West, South-East, North-east, etc.
    • Npv > 12: boundary points must be adjacent (can go clockwise or anticlockwise) with the last point identical to the first Rpv[Npv-1] = Rpv[0], and likewise for Zpv.

Note: consider using escin_ for more flexibility in the input profiles.

Parameters:
Pressure array[21] for the pressure in [mu0 Pa] (input).
Jparallel array[21] for <j.B>/(R0 <B.grad phi> in [T/m] (input); R0=magnetic axis.
Rpv array[Npv] for the plasma-vacuum boundary radius in [m] (input).
Zpv array[Npv] for the plasma-vacuum boundary elevation in [m] (input).
RBtor covariant toroidal magnetic field in vacuum [T m] (input).
Rext major radius estimate in [m] (input). A suitable Rext can reduce the Fourier spectrum.
Author:
L. E. Zakharov, A. Pletzer
See also:
Esc_p_q, escin_

void Esc_p_q double *  Pressure,
double *  qprofile,
double *  Rpv,
double *  Zpv,
int *  Npv,
double *  RBtor,
double *  Rext
 

Profile and geometry specification. This procedure must be called immediately prior to execution (Esc).

  • Profiles: both Pressure and qprofile profiles are arrays of length 21 and are defined on the uniform sqrt(toroidal flux) mesh.
  • Geometry: Npv denotes the number of input points Rpv and Zpv.
    • 4 <= Npv <= 12: the points must be ordered according to left, right, top, bottom, then North-east, North-west, South-West, South-East, North-east, etc.
    • Npv > 12: boundary points must be adjacent (can go clockwise or anticlockwise) with the last point identical to the first Rpv[Npv-1] = Rpv[0], and likewise for Zpv.

Note: consider using escin_ for more flexibility in the input profiles.

Parameters:
Pressure array[21] for the pressure in [mu0 Pa] (input).
qprofile array[21] for the q profile (input).
Rpv array[Npv] for the plasma-vacuum boundary radius in [m] (input).
Zpv array[Npv] for the plasma-vacuum boundary elevation in [m] (input).
RBtor covariant toroidal magnetic field in vacuum [T m] (input).
Rext major radius estimate in [m] (input). A suitable Rext can reduce the Fourier spectrum.
Author:
L. E. Zakharov, A. Pletzer
See also:
Esc Esc_p_jparallel, esc_in

void escin_ double *  pProf,
double *  jProf,
double *  aProf,
int *  nProf,
int *  hH,
double *  Rpv,
double *  Zpv,
int *  Npv,
double *  RBtor,
double *  Rext
 

General input profile selection routine. Various combinations of pressure/current profiles can be chosen as equilibrium input. *Note* that some profiles are in rationalized units while others are in MKS units.

Parameters:
pProf pressure-like profile, see hH switch, an array of size nProf (input).
jProf current-like profile, see hH switch, an array of size nProf (input).
aProf normalized sqrt(Phi) square root of toroidal flux radial coordinate (input).
hH two-digit pressure and current profile specification. First digit (i.e., hH/10) can be 0 (j_p = R0 dp/dpsi), 1 (P=dp/dpsi) or 2 (p in MPa). Second digit (i.e., hH%10) can be 0 (js=F/R0 + R0 dp/dpsi in MA/m^2), 1 (j//=<J.B>/(R0 B.gradPhi> in MA/m^2), 3 (FF'), 6 (q), 7 (1/q). For example set hH=26 to supply p and q, hH=21 to supply p and j//, hH=0 to supply jp and js. Possible choices of hH are 0,1,6,7, 10,11,16,17, 21,26,27.
Note:

1) Unless otherwise stated pressure is in rationalized units (pressure in mu0 Pa)

2) Currents are in MA: 1 MA = 1 [T/m] / (0.4*pi)

3) R0 is the magnetic axis.

Parameters:
Rpv array[Npv] for the plasma-vacuum boundary radius in [m] (input).
Zpv array[Npv] for the plasma-vacuum boundary elevation in [m] (input).
Npv number of the plasma-vacuum input boundary points.
RBtor covariant toroidal magnetic field in vacuum [T m] (input).
Rext a reference major radius in [m] (input). Specifies the reference vacuum magnetic field as Bext= RBext/Rext, which may enter in definitions of non-invariant variables, like beta.
Author:
L. E. Zakharov
See also:
Esc_p_q, Esc_p_jparallel

int ESgetDataProfile double *  Pprofile,
double *  Jprofile
 

Profile recovery routine. This procedure can be invoked to recover input profiles used in an equilibrium restored from a dump file (<Machine.Runid>.es).

Parameters:
Pprofile pressure-like profile (output). The exact type depends on internal settings
Jprofile current-like profile (output).
Author:
L. E. Zakharov


Generated on Tue Sep 28 17:56:37 2010 by  doxygen 1.3.9.1