ASCOT5
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
mhd_nonstat.h File Reference

Header file for mhd_nonstat.c. More...

#include "../ascot5.h"
#include "../error.h"
#include "../boozer.h"
#include "../spline/interp.h"
#include "../B_field.h"

Go to the source code of this file.

Data Structures

struct  mhd_nonstat_offload_data
 MHD parameters that will be offloaded to target. More...
 
struct  mhd_nonstat_data
 MHD parameters on the target. More...
 

Functions

int mhd_nonstat_init_offload (mhd_nonstat_offload_data *offload_data, real **offload_array)
 Load MHD data and prepare parameters for offload.
 
void mhd_nonstat_free_offload (mhd_nonstat_offload_data *offload_data, real **offload_array)
 Free offload array.
 
void mhd_nonstat_init (mhd_nonstat_data *mhddata, mhd_nonstat_offload_data *offload_data, real *offload_array)
 Initialize MHD data struct on target.
 
a5err mhd_nonstat_eval (real mhd_dmhd[10], real r, real phi, real z, real t, int includemode, boozer_data *boozerdata, mhd_nonstat_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_nonstat_perturbations(real pert_field[7]
 

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_nonstat_datamhddata
 
real real real real int int boozer_data mhd_nonstat_data B_field_dataBdata
 

Detailed Description

Header file for mhd_nonstat.c.

Definition in file mhd_nonstat.h.

Function Documentation

◆ mhd_nonstat_init_offload()

int mhd_nonstat_init_offload ( mhd_nonstat_offload_data * offload_data,
real ** offload_array )

Load MHD data and prepare parameters for offload.

This function fills the MHD offload struct with parameters and allocates and fills the offload array. Sets offload array length in the offload struct.

It is assumed that the offload_data struct is completely filled before calling this function (except for the offload_array_length and rhogrid). Furthermore, offload array should contain following data:

  • offload_array[j*nrho + i] : alpha(mode_j, rho_i).
  • offload_array[n_modes*nrho + j*nrho + i] : phi(mode_j, rho_i).

1D splines are constructed here and stored to offload array which is reallocated.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array
Returns
zero if initialization succeeded.

Definition at line 37 of file mhd_nonstat.c.

◆ mhd_nonstat_free_offload()

void mhd_nonstat_free_offload ( mhd_nonstat_offload_data * offload_data,
real ** offload_array )

Free offload array.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array

Definition at line 109 of file mhd_nonstat.c.

◆ mhd_nonstat_init()

void mhd_nonstat_init ( mhd_nonstat_data * mhddata,
mhd_nonstat_offload_data * offload_data,
real * offload_array )

Initialize MHD data struct on target.

Parameters
mhddatapointer to data struct on target
offload_datapointer to offload data struct
offload_arraypointer to offload array

Definition at line 121 of file mhd_nonstat.c.

◆ mhd_nonstat_eval()

a5err mhd_nonstat_eval ( real mhd_dmhd[10],
real r,
real phi,
real z,
real t,
int includemode,
boozer_data * boozerdata,
mhd_nonstat_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 include 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 184 of file mhd_nonstat.c.

Variable Documentation

◆ r

real r

Definition at line 73 of file mhd_nonstat.h.

◆ phi

real real phi

Definition at line 73 of file mhd_nonstat.h.

◆ z

Definition at line 73 of file mhd_nonstat.h.

◆ t

Definition at line 74 of file mhd_nonstat.h.

◆ pertonly

real real real real int pertonly

Definition at line 74 of file mhd_nonstat.h.

◆ includemode

real real real real int int includemode

Definition at line 74 of file mhd_nonstat.h.

◆ boozerdata

real real real real int int boozer_data* boozerdata

Definition at line 75 of file mhd_nonstat.h.

◆ mhddata

Definition at line 76 of file mhd_nonstat.h.

◆ Bdata

Definition at line 76 of file mhd_nonstat.h.