ASCOT5
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
E_field.h File Reference

Header file for E_field.c. More...

#include "offload_acc_omp.h"
#include "ascot5.h"
#include "error.h"
#include "B_field.h"
#include "Efield/E_TC.h"
#include "Efield/E_1DS.h"

Go to the source code of this file.

Data Structures

struct  E_field_offload_data
 Electric field offload data. More...
 
struct  E_field_data
 Electric field simulation data. More...
 

Typedefs

typedef enum E_field_type E_field_type
 Electric field types.
 

Enumerations

enum  E_field_type { E_field_type_TC , E_field_type_1DS }
 Electric field types. More...
 

Functions

int E_field_init_offload (E_field_offload_data *offload_data, real **offload_array)
 Load electric field data and prepare parameters.
 
void E_field_free_offload (E_field_offload_data *offload_data, real **offload_array)
 Free offload array and reset parameters.
 
int E_field_init (E_field_data *Edata, E_field_offload_data *offload_data, real *offload_array)
 Initialize electric field data struct on target.
 
a5err E_field_eval_E (real E[3], real r, real phi, real z, real t, E_field_data *Edata, B_field_data *Bdata)
 Evaluate electric field.
 

Detailed Description

Header file for E_field.c.

Contains a list declaring all E_field_types, and declaration of E_field_offload_data and E_field_data structs.

Definition in file E_field.h.

Typedef Documentation

◆ E_field_type

typedef enum E_field_type E_field_type

Electric field types.

Electric field types are used in the electric field interface (E_field.c) to direct function calls to correct electric field instances. Each electric field instance must have a corresponding type.

Enumeration Type Documentation

◆ E_field_type

Electric field types.

Electric field types are used in the electric field interface (E_field.c) to direct function calls to correct electric field instances. Each electric field instance must have a corresponding type.

Enumerator
E_field_type_TC 

Trivial Cartesian electric field

E_field_type_1DS 

Spline-interpolated radial electric field

Definition at line 25 of file E_field.h.

Function Documentation

◆ E_field_init_offload()

int E_field_init_offload ( E_field_offload_data * offload_data,
real ** offload_array )

Load electric field data and prepare parameters.

This function fills the relevant electric field 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.

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

Definition at line 41 of file E_field.c.

◆ E_field_free_offload()

void E_field_free_offload ( E_field_offload_data * offload_data,
real ** offload_array )

Free offload array and reset parameters.

This function deallocates the offload_array.

This function is host only.

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

Definition at line 85 of file E_field.c.

◆ E_field_init()

int E_field_init ( E_field_data * Edata,
E_field_offload_data * offload_data,
real * offload_array )

Initialize electric field data struct on target.

This function copies the electric field parameters from the offload struct to the struct on target and sets the electric field 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.

Parameters
Edatapointer to data struct on target
offload_datapointer to offload data struct
offload_arraythe offload array
Returns
Non-zero integer if offload was not initialized beforehand

Definition at line 116 of file E_field.c.

◆ E_field_eval_E()

a5err E_field_eval_E ( real E[3],
real r,
real phi,
real z,
real t,
E_field_data * Edata,
B_field_data * Bdata )

Evaluate electric field.

This function evaluates the electric field at the given coordinates. Note that magnetic field data is also required in case electric field is e.g. a flux quantity.

The values are stored in the given array as:

  • E[0] = ER
  • E[1] = Ephi
  • E[2] = Ez

This is a SIMD function.

Parameters
Epointer to array where electric field values are stored
rR coordinate [m]
phiphi coordinate [deg]
zz coordinate [m]
ttime coordinate [s]
Edatapointer to electric field data struct
Bdatapointer to magnetic field data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 166 of file E_field.c.