ASCOT5
Loading...
Searching...
No Matches
E_field.c File Reference

Electric field interface. More...

#include <stdio.h>
#include "ascot5.h"
#include "error.h"
#include "print.h"
#include "E_field.h"
#include "B_field.h"
#include "Efield/E_TC.h"
#include "Efield/E_1DS.h"

Go to the source code of this file.

Functions

void E_field_free (E_field_data *data)
 Free allocated resources.
 
void E_field_offload (E_field_data *data)
 Offload data to the accelerator.
 
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

Electric field interface.

This is an interface through which electric field data is initialized and accessed. Reading e.g. from disk is done elsewhere.

To add a new electric field instance, make sure these functions are implemented and called from this interface, and that E_field.h contains enum type for the new instance.

The interface checks which instance given data corresponds to from E_field_offload_data.type and E_field_data.type from the struct that is given as an argument, and calls the relevant function for that instance.

Definition in file E_field.c.

Function Documentation

◆ E_field_free()

void E_field_free ( E_field_data * data)

Free allocated resources.

Parameters
datapointer to the data struct

Definition at line 30 of file E_field.c.

◆ E_field_offload()

void E_field_offload ( E_field_data * data)

Offload data to the accelerator.

Parameters
datapointer to the data struct

Definition at line 46 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 82 of file E_field.c.