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

Header file for E_1DS.c. More...

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

Go to the source code of this file.

Data Structures

struct  E_1DS_offload_data
 1D spline electric field parameters that will be offloaded to target More...
 
struct  E_1DS_data
 1D spline electric field parameters on the target More...
 

Functions

int E_1DS_init_offload (E_1DS_offload_data *offload_data, real **offload_array)
 Initialize 1DS electric field data.
 
void E_1DS_free_offload (E_1DS_offload_data *offload_data, real **offload_array)
 Free offload array and reset parameters.
 
void E_1DS_init (E_1DS_data *Edata, E_1DS_offload_data *offload_data, real *offload_array)
 Initialize 1D spline electric field data struct on target.
 
a5err E_1DS_eval_E (real E[3], real r, real phi, real z, E_1DS_data *Edata, B_field_data *Bdata)
 Evaluate 1D spline radial electric field.
 

Detailed Description

Header file for E_1DS.c.

Author
Joona Kontula joona.nosp@m..kon.nosp@m.tula@.nosp@m.aalt.nosp@m.o.fi

Contains declaration of E_1DS_field_offload_data and E_1DS_field_data structs.

Definition in file E_1DS.h.

Function Documentation

◆ E_1DS_init_offload()

int E_1DS_init_offload ( E_1DS_offload_data * offload_data,
real ** offload_array )

Initialize 1DS electric field data.

This function takes pre-initialized offload data struct and offload array as inputs. The data is used to fill rest of the offload struct and to construct a cubic spline whose coefficients are stored in re-allocated offload array.

The offload data struct must have the following fields initialized:

E_1DS_offload_data.offload_array_length is set here.

The offload array must contain the following data:

  • offload_array[i] = dV_drho(rho_i) [V]

Sanity checks are printed if data was initialized succesfully.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to offload array which is reallocated here
Returns
zero if initialization succeeded

Definition at line 41 of file E_1DS.c.

◆ E_1DS_free_offload()

void E_1DS_free_offload ( E_1DS_offload_data * offload_data,
real ** offload_array )

Free offload array and reset parameters.

This function deallocates the offload_array.

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

Definition at line 78 of file E_1DS.c.

◆ E_1DS_init()

void E_1DS_init ( E_1DS_data * Edata,
E_1DS_offload_data * offload_data,
real * offload_array )

Initialize 1D spline electric field data struct on target.

This function copies the 1D spline electric field parameters from the offload struct to the struct on target and sets the 1D spline electric field data pointers to correct offsets in the offload array.

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

Definition at line 95 of file E_1DS.c.

◆ E_1DS_eval_E()

a5err E_1DS_eval_E ( real E[3],
real r,
real phi,
real z,
E_1DS_data * Edata,
B_field_data * Bdata )

Evaluate 1D spline radial electric field.

This function evaluates the 1D spline potential gradient of the plasma at the given radial coordinate using linear interpolation, and then calculates the radial electric field by multiplying that with the rho-gradient. Gradient of rho is obtained via magnetic field module.

Parameters
Earray where the electric field will be stored (E_r -> E[1], E_phi -> E[1], E_z -> E[2])
rR-coordiante [m]
phiphi-coordinate [rad]
zz-coordiante [m]
Edatapointer to electric field data
Bdatapointer to magnetic field data
Returns
zero if evaluation succeeded

Definition at line 122 of file E_1DS.c.