138 #define BPATH "/bfield/B_2DS_XXXXXXXXXX/"
142 real r_min, r_max, z_min, z_max;
144 f, qid, __FILE__, __LINE__) ) {
return 1;}
146 f, qid, __FILE__, __LINE__) ) {
return 1;}
148 f, qid, __FILE__, __LINE__) ) {
return 1;}
150 f, qid, __FILE__, __LINE__) ) {
return 1;}
152 f, qid, __FILE__, __LINE__) ) {
return 1;}
154 f, qid, __FILE__, __LINE__) ) {
return 1;}
162 f, qid, __FILE__, __LINE__) ) {
return 1;}
164 f, qid, __FILE__, __LINE__) ) {
return 1;}
166 f, qid, __FILE__, __LINE__) ) {
return 1;}
168 f, qid, __FILE__, __LINE__) ) {
return 1;}
172 f, qid, __FILE__, __LINE__) ) {
return 1;}
174 f, qid, __FILE__, __LINE__) ) {
return 1;}
176 f, qid, __FILE__, __LINE__) ) {
return 1;}
178 f, qid, __FILE__, __LINE__) ) {
return 1;}
180 int err =
B_2DS_init(data, n_r, r_min, r_max, n_z, z_min, z_max,
181 axisr, axisz,
psi0,
psi1, psi, br, bphi, bz);
238 #define BPATH "/bfield/B_3DS_XXXXXXXXXX/"
241 int b_n_r, b_n_phi, b_n_z;
242 real b_r_min, b_r_max, b_phi_min, b_phi_max, b_z_min, b_z_max;
244 f, qid, __FILE__, __LINE__) ) {
return 1;}
246 f, qid, __FILE__, __LINE__) ) {
return 1;}
248 f, qid, __FILE__, __LINE__) ) {
return 1;}
250 f, qid, __FILE__, __LINE__) ) {
return 1;}
252 f, qid, __FILE__, __LINE__) ) {
return 1;}
254 f, qid, __FILE__, __LINE__) ) {
return 1;}
257 f, qid, __FILE__, __LINE__) ) {
return 1;}
259 f, qid, __FILE__, __LINE__) ) {
return 1;}
261 f, qid, __FILE__, __LINE__) ) {
return 1;}
269 real p_r_min, p_r_max, p_z_min, p_z_max;
271 f, qid, __FILE__, __LINE__) ) {
return 1;}
273 f, qid, __FILE__, __LINE__) ) {
return 1;}
275 f, qid, __FILE__, __LINE__) ) {
return 1;}
277 f, qid, __FILE__, __LINE__) ) {
return 1;}
279 f, qid, __FILE__, __LINE__) ) {
return 1;}
281 f, qid, __FILE__, __LINE__) ) {
return 1;}
285 real* br = (
real*)malloc(b_n_r*b_n_phi*b_n_z*
sizeof(
real));
286 real* bphi = (
real*)malloc(b_n_r*b_n_phi*b_n_z*
sizeof(
real));
287 real* bz = (
real*)malloc(b_n_r*b_n_phi*b_n_z*
sizeof(
real));
289 f, qid, __FILE__, __LINE__) ) {
return 1;}
291 f, qid, __FILE__, __LINE__) ) {
return 1;}
293 f, qid, __FILE__, __LINE__) ) {
return 1;}
295 f, qid, __FILE__, __LINE__) ) {
return 1;}
300 f, qid, __FILE__, __LINE__) ) {
return 1;}
302 f, qid, __FILE__, __LINE__) ) {
return 1;}
306 f, qid, __FILE__, __LINE__) ) {
return 1;}
308 f, qid, __FILE__, __LINE__) ) {
return 1;}
310 int err =
B_3DS_init(data, p_n_r, p_r_min, p_r_max, p_n_z, p_z_min, p_z_max,
311 b_n_r, b_r_min, b_r_max, b_n_phi, b_phi_min, b_phi_max,
312 b_n_z, b_z_min, b_z_max, axisr, axisz,
psi0,
psi1,
380 #define BPATH "/bfield/B_STS_XXXXXXXXXX/"
383 int b_n_r, b_n_phi, b_n_z;
384 real b_r_min, b_r_max, b_z_min, b_z_max, b_phi_min, b_phi_max;
386 f, qid, __FILE__, __LINE__) ) {
return 1;}
388 f, qid, __FILE__, __LINE__) ) {
return 1;}
390 f, qid, __FILE__, __LINE__) ) {
return 1;}
392 f, qid, __FILE__, __LINE__) ) {
return 1;}
394 f, qid, __FILE__, __LINE__) ) {
return 1;}
396 f, qid, __FILE__, __LINE__) ) {
return 1;}
399 f, qid, __FILE__, __LINE__) ) {
return 1;}
401 f, qid, __FILE__, __LINE__) ) {
return 1;}
403 f, qid, __FILE__, __LINE__) ) {
return 1;}
410 int p_n_r, p_n_phi, p_n_z;
411 real p_r_min, p_r_max, p_z_min, p_z_max, p_phi_min, p_phi_max;
413 f, qid, __FILE__, __LINE__) ) {
return 1;}
415 f, qid, __FILE__, __LINE__) ) {
return 1;}
417 f, qid, __FILE__, __LINE__) ) {
return 1;}
419 f, qid, __FILE__, __LINE__) ) {
return 1;}
421 f, qid, __FILE__, __LINE__) ) {
return 1;}
423 f, qid, __FILE__, __LINE__) ) {
return 1;}
426 f, qid, __FILE__, __LINE__) ) {
return 1;}
428 f, qid, __FILE__, __LINE__) ) {
return 1;}
430 f, qid, __FILE__, __LINE__) ) {
return 1;}
438 real axis_min, axis_max;
440 f, qid, __FILE__, __LINE__) ) {
return 1;}
442 f, qid, __FILE__, __LINE__) ) {
return 1;}
444 f, qid, __FILE__, __LINE__) ) {
return 1;}
453 f, qid, __FILE__, __LINE__) ) {
return 1;}
455 f, qid, __FILE__, __LINE__) ) {
return 1;}
458 real* psi = (
real*)malloc(p_n_r*p_n_phi*p_n_z*
sizeof(
real));
459 real* br = (
real*)malloc(b_n_r*b_n_phi*b_n_z*
sizeof(
real));
460 real* bphi = (
real*)malloc(b_n_r*b_n_phi*b_n_z*
sizeof(
real));
461 real* bz = (
real*)malloc(b_n_r*b_n_phi*b_n_z*
sizeof(
real));
463 f, qid, __FILE__, __LINE__) ) {
return 1;}
465 f, qid, __FILE__, __LINE__) ) {
return 1;}
467 f, qid, __FILE__, __LINE__) ) {
return 1;}
469 f, qid, __FILE__, __LINE__) ) {
return 1;}
475 f, qid, __FILE__, __LINE__) ) {
return 1;}
477 f, qid, __FILE__, __LINE__) ) {
return 1;}
478 int err =
B_STS_init(data, p_n_r, p_r_min, p_r_max,
479 p_n_phi, p_phi_min, p_phi_max, p_n_z, p_z_min, p_z_max,
480 b_n_r, b_r_min, b_r_max, b_n_phi, b_phi_min, b_phi_max,
481 b_n_z, b_z_min, b_z_max, naxis, axis_min, axis_max,
482 axisr, axisz,
psi0,
psi1, psi, br, bphi, bz);
522 #define BPATH "/bfield/B_TC_XXXXXXXXXX/"
524 real axisr, axisz, psival, rhoval, B[3], dB[9];
526 f, qid, __FILE__, __LINE__) ) {
return 1;}
528 f, qid, __FILE__, __LINE__) ) {
return 1;}
530 f, qid, __FILE__, __LINE__) ) {
return 1;}
532 f, qid, __FILE__, __LINE__) ) {
return 1;}
534 f, qid, __FILE__, __LINE__) ) {
return 1;}
536 f, qid, __FILE__, __LINE__) ) {
return 1;}
537 int err =
B_TC_init(data, axisr, axisz, psival, rhoval, B, dB);
570 #define BPATH "/bfield/B_GS_XXXXXXXXXX/"
573 real R0, z0, raxis, zaxis, B_phi0,
psi0,
psi1, psi_mult, psi_coeff[14];
575 f, qid, __FILE__, __LINE__) ) {
return 1;}
577 f, qid, __FILE__, __LINE__) ) {
return 1;}
579 f, qid, __FILE__, __LINE__) ) {
return 1;}
581 f, qid, __FILE__, __LINE__) ) {
return 1;}
583 f, qid, __FILE__, __LINE__) ) {
return 1;}
585 f, qid, __FILE__, __LINE__) ) {
return 1;}
587 f, qid, __FILE__, __LINE__) ) {
return 1;}
589 f, qid, __FILE__, __LINE__) ) {
return 1;}
591 f, qid, __FILE__, __LINE__) ) {
return 1;}
595 real delta0, alpha0, a0;
597 f, qid, __FILE__, __LINE__) ) {
return 1;}
599 f, qid, __FILE__, __LINE__) ) {
return 1;}
601 f, qid, __FILE__, __LINE__) ) {
return 1;}
603 f, qid, __FILE__, __LINE__) ) {
return 1;}
605 psi_mult, psi_coeff, Nripple, a0, alpha0, delta0);
int B_2DS_init(B_2DS_data *data, int n_r, real r_min, real r_max, int n_z, real z_min, real z_max, real axis_r, real axis_z, real psi0, real psi1, real *psi, real *B_r, real *B_phi, real *B_z)
Initialize magnetic field data.
int B_3DS_init(B_3DS_data *data, int p_n_r, real p_r_min, real p_r_max, int p_n_z, real p_z_min, real p_z_max, int b_n_r, real b_r_min, real b_r_max, int b_n_phi, real b_phi_min, real b_phi_max, int b_n_z, real b_z_min, real b_z_max, real axis_r, real axis_z, real psi0, real psi1, real *psi, real *B_r, real *B_phi, real *B_z)
Initialize magnetic field data.
int B_GS_init(B_GS_data *data, real R0, real z0, real raxis, real zaxis, real B_phi0, real psi0, real psi1, real psi_mult, real c[14], int Nripple, real a0, real alpha0, real delta0)
Initialize magnetic field data.
int B_STS_init(B_STS_data *data, int p_n_r, real p_r_min, real p_r_max, int p_n_phi, real p_phi_min, real p_phi_max, int p_n_z, real p_z_min, real p_z_max, int b_n_r, real b_r_min, real b_r_max, int b_n_phi, real b_phi_min, real b_phi_max, int b_n_z, real b_z_min, real b_z_max, int naxis, real axis_min, real axis_max, real *axis_r, real *axis_z, real psi0, real psi1, real *psi, real *B_r, real *B_phi, real *B_z)
Initialize magnetic field data.
int B_TC_init(B_TC_data *data, real axisr, real axisz, real psival, real rhoval, real B[3], real dB[9])
Initialize magnetic field data.
Header file for B_field.c.
Main header file for ASCOT5.
Header file containing physical and mathematical constants.
int hdf5_bfield_read_GS(hid_t f, B_GS_data *data, char *qid)
Read magnetic field data of type B_GS.
int hdf5_bfield_read_TC(hid_t f, B_TC_data *data, char *qid)
Read magnetic field data of type B_TC.
int hdf5_bfield_read_3DS(hid_t f, B_3DS_data *data, char *qid)
Read magnetic field data of type B_3DS.
int hdf5_bfield_read_STS(hid_t f, B_STS_data *data, char *qid)
Read magnetic field data of type B_STS.
int hdf5_bfield_init(hid_t f, B_field_data *data, char *qid)
Initialize magnetic field data from HDF5 file.
int hdf5_bfield_read_2DS(hid_t f, B_2DS_data *data, char *qid)
Read magnetic field data of type B_2DS.
Header file for hdf5_bfield.c.
herr_t hdf5_find_group(hid_t loc, const char *path)
Checks if given group exists within given hdf5 file. Negative value is returned if the group doesn't ...
int hdf5_read_double(const char *var, real *ptr, hid_t file, char *qid, const char *errfile, int errline)
Read double-valued data from ASCOT5 HDF5 file.
char * hdf5_gen_path(const char *original, char *qid, char *path)
Generate a valid path from a given template and qid.
int hdf5_read_int(const char *var, int *ptr, hid_t file, char *qid, const char *errfile, int errline)
Read int-valued data from ASCOT5 HDF5 file.
Header file for hdf5_helpers.h.
#define math_deg2rad(a)
Convert degrees to radians.
Macros for printing console output.
2D magnetic field parameters
3D magnetic field parameters
Analytic magnetic field parameters on the target.
stellarator magnetic field parameters on the target
TC magnetic field parameters on the target.
Magnetic field simulation data.