39 int ntheta,
int nthetag,
real* nu,
real* theta,
54 THETAMIN-padding, THETAMAX+padding);
57 data->
rs = (
real*) malloc( nrzs *
sizeof(
real) );
58 data->
zs = (
real*) malloc( nrzs *
sizeof(
real) );
59 for(
int i = 0; i < nrzs; i++) {
67 npsi, psi_min, psi_max);
137 real psi[4], rho[2], r0, z0;
149 if(!err && psi[0] < boozerdata->
psi_max &&
150 psi[0] > boozerdata->
psi_min) {
173 psithetazeta[0]=psi[0];
174 psithetazeta[1]=psi[1];
176 psithetazeta[3]=psi[3];
180 asq = (r - r0) * (r - r0)
181 + (z - z0) * (z - z0);
183 dthgeo_dr=-(z-z0)/asq;
185 dthgeo_dz=(r-r0)/asq;
188 psithetazeta[4]=theta[0];
189 psithetazeta[5]=theta[1]*psi[1]+theta[2]*dthgeo_dr;
191 psithetazeta[7]=theta[1]*psi[3]+theta[2]*dthgeo_dz;
195 psithetazeta[9]=nu[1]*psi[1]+nu[2]*psithetazeta[5];
196 psithetazeta[10]=1.0;
197 psithetazeta[11]=nu[1]*psi[3]+nu[2]*psithetazeta[7];
204 if(!err && interperr) {
a5err B_field_eval_psi_dpsi(real psi_dpsi[4], real r, real phi, real z, real t, B_field_data *Bdata)
Evaluate poloidal flux psi and its derivatives.
a5err B_field_eval_rho(real rho[2], real psi, B_field_data *Bdata)
Evaluate normalized poloidal flux rho and its psi derivative.
a5err B_field_get_axis_rz(real rz[2], B_field_data *Bdata, real phi)
Return magnetic axis Rz-coordinates.
Header file for B_field.c.
Main header file for ASCOT5.
void boozer_offload(boozer_data *data)
Offload data to the accelerator.
void boozer_free(boozer_data *data)
Free allocated resources.
int boozer_init(boozer_data *data, int npsi, real psi_min, real psi_max, int ntheta, int nthetag, real *nu, real *theta, int nrzs, real *rs, real *zs)
Initialize boozer coordinate transformation.
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.
Header file for boozer.c.
Header file containing physical and mathematical constants.
unsigned long int a5err
Simulation error flag.
static DECLARE_TARGET_SIMD a5err error_raise(error_type type, int line, error_file file)
Raise a new error.
Spline interpolation library.
int interp2Dcomp_setup(interp2D_data *str, real *f, int n_x, int n_y, int bc_x, int bc_y, real x_min, real x_max, real y_min, real y_max)
Set up splines to interpolate 2D scalar data.
DECLARE_TARGET_END a5err interp2Dcomp_eval_df(real *f_df, interp2D_data *str, real x, real y)
Evaluate interpolated value and 1st and 2nd derivatives of 2D field.
int math_point_in_polygon(real r, real z, real *rv, real *zv, int n)
Check if coordinates are within polygon.
real fmod(real x, real y)
Compute the modulus of two real numbers.
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
Magnetic field simulation data.
Data for mapping between the cylindrical and Boozer coordinates.
interp2D_data theta_psithetageom
interp2D_data nu_psitheta