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
NTHEP = (ISYM-1)*(2**(MN+NDOUB) + ISYM) + 1 - 2*ISYM
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.)
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 instance
CALL 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.