ASCOT5
Loading...
Searching...
No Matches
Data Structures | Functions
boozer.h File Reference

Header file for boozer.c. More...

#include "ascot5.h"
#include "error.h"
#include "B_field.h"
#include "spline/interp.h"

Go to the source code of this file.

Data Structures

struct  boozer_offload_data
 offload data for maps between boozer and cylindrical coordinates More...
 
struct  boozer_data
 Boozer parameters on the target. More...
 

Functions

int boozer_init_offload (boozer_offload_data *offload_data, real **offload_array)
 Load Boozer data and prepare parameters for offload.
 
void boozer_free_offload (boozer_offload_data *offload_data, real **offload_array)
 Free offload array.
 
void boozer_init (boozer_data *boozerdata, boozer_offload_data *offload_data, real *offload_array)
 Initialize boozer data struct on target.
 
a5err boozer_eval_psithetazeta (real psithetazeta[12], int *isinside, real r, real phi, real z, B_field_data *Bdata, boozer_data *boozerdata)
 Evaluate Boozer coordinates and partial derivatives.
 

Detailed Description

Header file for boozer.c.

Definition in file boozer.h.

Function Documentation

◆ boozer_init_offload()

int boozer_init_offload ( boozer_offload_data * offload_data,
real ** offload_array )

Load Boozer data and prepare parameters for offload.

This function fills the boozer offload struct with parameters and allocates and fills the offload array. Sets offload array length in the offload struct.

The offload data struct should be fully initialized before calling this function and offload array should hold the input data in order [psi, nu, theta_bzr]. This function fits splines to input data, reallocates the offload array and stores spline coefficients there.

Multidimensional arrays must be stored as

  • nu(psi_i, thetabzr_j) = array[j*npsi + i]
  • theta_bzr(psi_i, thetageo_j) = array[j*npsi + i]
  • psi(R_i, z_j) = array[j*nR + i]
Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array
Returns
zero if initialization succeeded.

Definition at line 37 of file boozer.c.

◆ boozer_free_offload()

void boozer_free_offload ( boozer_offload_data * offload_data,
real ** offload_array )

Free offload array.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array

Definition at line 154 of file boozer.c.

◆ boozer_init()

void boozer_init ( boozer_data * boozerdata,
boozer_offload_data * offload_data,
real * offload_array )

Initialize boozer data struct on target.

Parameters
boozerdatapointer to data struct on target
offload_datapointer to offload data struct
offload_arraypointer to offload array

Definition at line 108 of file boozer.c.

◆ boozer_eval_psithetazeta()

a5err boozer_eval_psithetazeta ( real psithetazeta[12],
int * isinside,
real r,
real phi,
real z,
B_field_data * Bdata,
boozer_data * boozerdata )

Evaluate Boozer coordinates and partial derivatives.

The output vector has the following elements:

  • psithetazeta[0] = psi
  • psithetazeta[1] = dpsi/dR
  • psithetazeta[2] = dpsi/dphi
  • psithetazeta[3] = dpsi/dz
  • psithetazeta[4] = theta
  • psithetazeta[5] = dtheta/dR
  • psithetazeta[6] = dtheta/dphi
  • psithetazeta[7] = dtheta/dz
  • psithetazeta[8] = zeta
  • psithetazeta[9] = dzeta/dR
  • psithetazeta[10] = dzeta/dphi
  • psithetazeta[11] = dzeta/dz
Parameters
psithetazetaevaluated Boozer coordinates and their gradients.
isinsidea flag indicating whether the queried point was inside boozer grid
rR coordinate
phiphi coordinate
zz coordinate
Bdatapointer to magnetic field data
boozerdatapointer to boozerdata
Returns
zero on success

Definition at line 188 of file boozer.c.