This mode of operation is particularly suited for embedding J-Solver into a larger program. A call to J-Solver follows at least three steps: the first ensures that enough memory is allocated, the second consists in running the core J-Solver and the third ensures that the previously allocated memory is freed.

CALL jsoInit(MN, NDOUB, ISYM) ! initialize and ! allocate memory ! ... (list of optional ``set'' routines) CALL jsoExec( & FACIMP, & GZEROS, & KMAX, NPSIT, & PPRIME_S, AJB, & XBND, ZBND, & PSIBAR0, & X, Z, & IERROR) ! ... (list of optional ``get'' routines) CALL jsoFree ! reclaim memory

where

- MN -(input) Determines the initial grid size to be
2
^{MN}+1 poloidally, and 2^{MN}radially. - NDOUB -(input) Number of times the grid is doubled. After
*NDOUB*mesh doublings have occurred, the grid size becomes 2^{MN + NDOUB}+1 times 2^{MN + NDOUB}. - ISYM -(input) Plasma up-down symmetry switch: 0 (asymmetric) or 1 (symmetric).
- FACIMP -(input) Error tolerance for inner loop elliptic equation solver. If FACIMP is negative, will be used as the error tolerance, and will be divided by 5 after each grid doubling.
- GZEROS -(input) Toroidal field normalization at the plasma edge ().
- KMAX -(input) Number of independent plasma-vacuum boundary points. The total number of
boundary points is
*KMAX*+1. - NPSIT -(input) Size of input profile arrays.
- PPRIME_S -(input) Pressure gradient profile , where .
- AJB -(input) Parallel current density array .
- XBND -(input) Radial coordinate of the plasma-vacuum boundary of size . Due to periodicity, the last node XBND(KMAX+1) must coincide with XBND(1).
- ZBND -(input) Vertical coordinate of the plasma-vacuum boundary of size . The last node ZBND(KMAX+1) must coincide with ZBND(1).
- PSIBAR0 -(input/output) Total poloidal flux enclosed by the plasma.
- X -(input/output) Radial coordinate of the plasma mesh returned as a
one-dimensional array of size NTHEP*NPSI, where
*NTHEP*= (*ISYM*-1)*(2**(*MN*+*NDOUB*) +*ISYM*) + 1 - 2**ISYM*and

*NPSI*= 2**(*MN*+*NDOUB*) + 1.Neighboring poloidal points are contiguous in memory. (The values of

*NTHEP*and*NPSI*can be obtained using a ``get'' call, see below.) - Z -(input/output) Vertical coordinate of the plasma mesh returned as a one-dimensional array of size NTHEP*NPSI. As for X, neighboring poloidal points are contiguous in memory.
- IERROR -(output) Integer error flag. A value of 0 indicates successful
completion.
Between initialization and memory clean-up, all quantities defined in the f90 common-modules can be accessed and modified through ``get'' and ``set'' routine calls, respectively. The list of admissible ``set'' calls includes all the parameters that are otherwise accessible in the

*inequ*file plus some additional ones. For instanceCALL jsoSetNimax(11)

resets the number of inner-loops before the metric is updated.All these input parameters take default values that need not be changed for most applications. Thus the ``set'' routines allows the users to concentrate on those parameters that are critical to their simulations while ensuring that the default parameters are not inadvertently changed.

Similarly there are ``get'' routines to access internal variables. At present, only a limited set of these calls are implemented; users are encouraged to write their own access routines to suit to their needs. In the following example,

CALL jsoGetPp(PPRIME)

the pressure gradient profile is accessed. The size of PPRIME must be NPSI.

Mon May 10 12:32:55 EDT 1999