ASCOT5
|
Header file for mhd.c. More...
#include "ascot5.h"
#include "error.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.
Data Structures | |
struct | mhd_offload_data |
MHD offload data. More... | |
struct | mhd_data |
MHD simulation data. More... | |
Macros | |
#define | MHD_INCLUDE_ALL -1 |
includemode parameter to include all modes (default) | |
Typedefs | |
typedef enum mhd_type | mhd_type |
MHD input types. | |
Enumerations | |
enum | mhd_type { mhd_type_stat , mhd_type_nonstat } |
MHD input types. More... | |
Functions | |
int | mhd_init_offload (mhd_offload_data *offload_data, real **offload_array) |
Load MHD data and prepare parameters. | |
void | mhd_free_offload (mhd_offload_data *offload_data, real **offload_array) |
Free offload array and reset parameters. | |
int | mhd_init (mhd_data *data, mhd_offload_data *offload_data, real *offload_array) |
Initialize MHD data struct on target. | |
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. | |
DECLARE_TARGET_SIMD_UNIFORM (boozerdata, mhddata, Bdata, pertonly, includemode) a5err mhd_perturbations(real pert_field[7] | |
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. | |
Variables | |
real | r |
real real | phi |
real real real | z |
real real real real | t |
real real real real int | pertonly |
real real real real int int | includemode |
real real real real int int boozer_data * | boozerdata |
real real real real int int boozer_data mhd_data * | mhddata |
real real real real int int boozer_data mhd_data B_field_data * | Bdata |
Header file for mhd.c.
Contains a list declaring all mhd_types, and declaration of mhd_offload_data and mhd_data structs.
Definition in file mhd.h.
#define MHD_INCLUDE_ALL -1 |
MHD input types.
MHD types are used in the MHD interface (mhd.c) to direct function calls to correct MHD instances. Each MHD instance must have a corresponding type.
enum mhd_type |
MHD input types.
MHD types are used in the MHD interface (mhd.c) to direct function calls to correct MHD instances. Each MHD instance must have a corresponding type.
Enumerator | |
---|---|
mhd_type_stat | MHD where mode amplitude does not depend on time |
mhd_type_nonstat | MHD where mode amplitude depends on time |
int mhd_init_offload | ( | mhd_offload_data * | offload_data, |
real ** | offload_array ) |
Load MHD data and prepare parameters.
This function fills the relevant MHD offload struct with parameters and allocates and fills the offload array.
The offload data has to have a type when this function is called as it should be set when the offload data is constructed from inputs.
This function is host only.
offload_data | pointer to offload data struct |
offload_array | pointer to pointer to offload array |
void mhd_free_offload | ( | mhd_offload_data * | offload_data, |
real ** | offload_array ) |
int mhd_init | ( | mhd_data * | mhddata, |
mhd_offload_data * | offload_data, | ||
real * | offload_array ) |
Initialize MHD data struct on target.
This function copies the electric field parameters from the offload struct to the struct on target and sets the MHD data pointers to correct offsets in the offload array.
This function returns error if the offload data has not been initialized. The instances themselves should not return an error since all they do is assign pointers and values.
mhddata | pointer to data struct on target |
offload_data | pointer to offload data struct |
offload_array | the offload array |
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 |
int mhd_get_n_modes | ( | mhd_data * | mhddata | ) |
const int * mhd_get_nmode | ( | mhd_data * | mhddata | ) |
const int * mhd_get_mmode | ( | mhd_data * | mhddata | ) |
real real real real int int boozer_data mhd_data B_field_data* Bdata |