ASCOT5
|
MHD module interface. More...
#include <stdlib.h>
#include "ascot5.h"
#include "error.h"
#include "print.h"
#include "mhd.h"
#include "B_field.h"
#include "boozer.h"
#include "mhd/mhd_stat.h"
#include "mhd/mhd_nonstat.h"
Go to the source code of this file.
Functions | |
void | mhd_free (mhd_data *data) |
Free allocated resources. | |
void | mhd_offload (mhd_data *data) |
Offload data to the accelerator. | |
a5err | mhd_eval (real mhd_dmhd[10], real r, real phi, real z, real t, int includemode, boozer_data *boozerdata, mhd_data *mhddata, B_field_data *Bdata) |
Evaluate the needed quantities from MHD mode for orbit following. | |
a5err | mhd_perturbations (real pert_field[7], real r, real phi, real z, real t, int pertonly, int includemode, boozer_data *boozerdata, mhd_data *mhddata, B_field_data *Bdata) |
Evaluate perturbed fields Btilde, Etilde and potential Phi explicitly. | |
int | mhd_get_n_modes (mhd_data *mhddata) |
Return number of modes. | |
const int * | mhd_get_nmode (mhd_data *mhddata) |
Return mode toroidal numbers. | |
const int * | mhd_get_mmode (mhd_data *mhddata) |
Return mode poloidal numbers. | |
const real * | mhd_get_amplitude (mhd_data *mhddata) |
Return mode amplitudes. | |
const real * | mhd_get_frequency (mhd_data *mhddata) |
Return mode frequencies. | |
const real * | mhd_get_phase (mhd_data *mhddata) |
Return mode phases. | |
MHD module interface.
This is an interface through which MHD data is initialized and accessed. Reading e.g. from disk is done elsewhere. The MHD module produces helical EM perturbations in to the EM field using the boozer module in making the coordinate transformations between cylindrical and straight-field-line coordinates.
To add a new MHD instance, make sure these functions are implemented and called from this interface, and that mhd.h contains enum type for the new instance.
The interface checks which instance given data corresponds to from mhd_offload_data.type and mhd_data.type from the struct that is given as an argument, and calls the relevant function for that instance.
Definition in file mhd.c.
void mhd_free | ( | mhd_data * | data | ) |
void mhd_offload | ( | mhd_data * | data | ) |
a5err mhd_eval | ( | real | mhd_dmhd[10], |
real | r, | ||
real | phi, | ||
real | z, | ||
real | t, | ||
int | includemode, | ||
boozer_data * | boozerdata, | ||
mhd_data * | mhddata, | ||
B_field_data * | Bdata ) |
Evaluate the needed quantities from MHD mode for orbit following.
The quantities to be evaluated are alpha, phi, grad alpha, grad phi, partial t alpha, partial t phi
The values are stored in the given array as:
mhd_dmhd | |
r | R coordinate [m] |
phi | phi coordinate [rad] |
z | z coordinate [m] |
t | time coordinate [s] |
includemode | mode number to be included or MHD_INCLUDE_ALL |
boozerdata | pointer to boozer data |
mhddata | pointer to mhd data |
Bdata | pointer to magnetic field data |
a5err mhd_perturbations | ( | real | pert_field[7], |
real | r, | ||
real | phi, | ||
real | z, | ||
real | t, | ||
int | pertonly, | ||
int | includemode, | ||
boozer_data * | boozerdata, | ||
mhd_data * | mhddata, | ||
B_field_data * | Bdata ) |
Evaluate perturbed fields Btilde, Etilde and potential Phi explicitly.
The values are stored in the given array as
Only the perturbation values for the magnetic field are returned if pertonly=1, otherwise, the total perturbed field is returned. This is done to avoid double evaluation of the magnetic field e.g. in field line tracing. For electric field only the perturbation component is returned always.
pert_field | perturbation field components |
r | R coordinate [m] |
phi | phi coordinate [rad] |
z | z coordinate [m] |
t | time coordinate [s] |
pertonly | flag whether to return the whole field or only perturbation |
includemode | mode number to be included or MHD_INCLUDE_ALL |
boozerdata | pointer to boozer data |
mhddata | pointer to mhd data |
Bdata | pointer to magnetic field data |
int mhd_get_n_modes | ( | mhd_data * | mhddata | ) |
const int * mhd_get_nmode | ( | mhd_data * | mhddata | ) |
const int * mhd_get_mmode | ( | mhd_data * | mhddata | ) |