ASCOT5
Loading...
Searching...
No Matches
mhd.h File Reference

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_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

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.
 
 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 realmhd_get_amplitude (mhd_data *mhddata)
 Return mode amplitudes.
 
const realmhd_get_frequency (mhd_data *mhddata)
 Return mode frequencies.
 
const realmhd_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_databoozerdata
 
real real real real int int boozer_data mhd_datamhddata
 
real real real real int int boozer_data mhd_data B_field_dataBdata
 

Detailed Description

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.

Macro Definition Documentation

◆ MHD_INCLUDE_ALL

#define MHD_INCLUDE_ALL   -1

includemode parameter to include all modes (default)

Definition at line 19 of file mhd.h.

Enumeration Type Documentation

◆ mhd_type

enum mhd_type

MHD input types.

Enumerator
mhd_type_stat 

MHD where mode amplitude does not depend on time

mhd_type_nonstat 

MHD where mode amplitude depends on time

Definition at line 24 of file mhd.h.

Function Documentation

◆ mhd_free()

void mhd_free ( mhd_data * data)

Free allocated resources.

Parameters
datapointer to the data struct

Definition at line 34 of file mhd.c.

◆ mhd_offload()

void mhd_offload ( mhd_data * data)

Offload data to the accelerator.

Parameters
datapointer to the data struct

Definition at line 50 of file mhd.c.

◆ mhd_eval()

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[0] = alpha
  • mhd_dmhd[1] = dalpha/dt
  • mhd_dmhd[2] = grad alpha, r component
  • mhd_dmhd[3] = grad alpha, phi component
  • mhd_dmhd[4] = grad alpha, z component
  • mhd_dmhd[5] = phi
  • mhd_dmhd[6] = dphi/dt
  • mhd_dmhd[7] = grad phi, r component
  • mhd_dmhd[8] = grad phi, phi component
  • mhd_dmhd[9] = grad phi, z component
Parameters
mhd_dmhd
rR coordinate [m]
phiphi coordinate [rad]
zz coordinate [m]
ttime coordinate [s]
includemodemode number to be included or MHD_INCLUDE_ALL
boozerdatapointer to boozer data
mhddatapointer to mhd data
Bdatapointer to magnetic field data
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 91 of file mhd.c.

◆ mhd_get_n_modes()

int mhd_get_n_modes ( mhd_data * mhddata)

Return number of modes.

Parameters
mhddatapointer to mhd data
Returns
number of modes

Definition at line 183 of file mhd.c.

◆ mhd_get_nmode()

const int * mhd_get_nmode ( mhd_data * mhddata)

Return mode toroidal numbers.

Parameters
mhddatapointer to mhd data
Returns
mode n numbers

Definition at line 203 of file mhd.c.

◆ mhd_get_mmode()

const int * mhd_get_mmode ( mhd_data * mhddata)

Return mode poloidal numbers.

Parameters
mhddatapointer to mhd data
Returns
mode m numbers

Definition at line 223 of file mhd.c.

◆ mhd_get_amplitude()

const real * mhd_get_amplitude ( mhd_data * mhddata)

Return mode amplitudes.

Parameters
mhddatapointer to mhd data
Returns
mode amplitudes

Definition at line 243 of file mhd.c.

◆ mhd_get_frequency()

const real * mhd_get_frequency ( mhd_data * mhddata)

Return mode frequencies.

Parameters
mhddatapointer to mhd data
Returns
mode omega

Definition at line 263 of file mhd.c.

◆ mhd_get_phase()

const real * mhd_get_phase ( mhd_data * mhddata)

Return mode phases.

Parameters
mhddatapointer to mhd data
Returns
mode phases

Definition at line 283 of file mhd.c.

Variable Documentation

◆ r

real r

Definition at line 49 of file mhd.h.

◆ phi

real real phi

Definition at line 49 of file mhd.h.

◆ z

Definition at line 49 of file mhd.h.

◆ t

Definition at line 50 of file mhd.h.

◆ pertonly

real real real real int pertonly

Definition at line 50 of file mhd.h.

◆ includemode

real real real real int int includemode

Definition at line 50 of file mhd.h.

◆ boozerdata

real real real real int int boozer_data* boozerdata

Definition at line 51 of file mhd.h.

◆ mhddata

real real real real int int boozer_data mhd_data* mhddata

Definition at line 51 of file mhd.h.

◆ Bdata

Definition at line 52 of file mhd.h.