ASCOT5
Loading...
Searching...
No Matches
E_field.c
Go to the documentation of this file.
1
16#include <stdio.h>
17#include "ascot5.h"
18#include "error.h"
19#include "print.h"
20#include "E_field.h"
21#include "B_field.h"
22#include "Efield/E_TC.h"
23#include "Efield/E_1DS.h"
24
31 switch(data->type) {
33 E_1DS_free(&data->E1DS);
34 break;
35 case E_field_type_TC:
36 E_TC_free(&data->ETC);
37 break;
38 }
39}
40
47 switch(data->type) {
49 E_1DS_offload(&data->E1DS);
50 break;
51 case E_field_type_TC:
52 E_TC_offload(&data->ETC);
53 break;
54 }
55}
56
83 E_field_data* Edata, B_field_data* Bdata) {
84 a5err err = 0;
85
86 switch(Edata->type) {
87
89 err = E_1DS_eval_E(E, r, phi, z, &(Edata->E1DS), Bdata);
90 break;
91
92 case E_field_type_TC:
93 err = E_TC_eval_E(E, r, phi, z, &(Edata->ETC), Bdata);
94 break;
95
96 default:
97 /* Unregonized input. Produce error. */
98 err = error_raise( ERR_UNKNOWN_INPUT, __LINE__, EF_E_FIELD );
99 break;
100 }
101
102 return err;
103}
Header file for B_field.c.
void E_1DS_free(E_1DS_data *data)
Free allocated resources.
Definition E_1DS.c:58
void E_1DS_offload(E_1DS_data *data)
Offload data to the accelerator.
Definition E_1DS.c:67
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.
Definition E_1DS.c:89
Header file for E_1DS.c.
void E_TC_offload(E_TC_data *data)
Offload data to the accelerator.
Definition E_TC.c:51
a5err E_TC_eval_E(real E[3], real r, real phi, real z, E_TC_data *Edata, B_field_data *Bdata)
Evaluate electric field.
Definition E_TC.c:70
void E_TC_free(E_TC_data *data)
Free allocated resources.
Definition E_TC.c:42
Header file for E_TC.c.
void E_field_free(E_field_data *data)
Free allocated resources.
Definition E_field.c:30
void E_field_offload(E_field_data *data)
Offload data to the accelerator.
Definition E_field.c:46
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.
Definition E_field.c:82
Header file for E_field.c.
@ E_field_type_TC
Definition E_field.h:26
@ E_field_type_1DS
Definition E_field.h:27
Main header file for ASCOT5.
double real
Definition ascot5.h:85
Error module for ASCOT5.
unsigned long int a5err
Simulation error flag.
Definition error.h:17
@ EF_E_FIELD
Definition error.h:43
@ ERR_UNKNOWN_INPUT
Definition error.h:64
static DECLARE_TARGET_SIMD a5err error_raise(error_type type, int line, error_file file)
Raise a new error.
Definition error.h:86
Macros for printing console output.
Magnetic field simulation data.
Definition B_field.h:41
Electric field simulation data.
Definition E_field.h:36
E_TC_data ETC
Definition E_field.h:38
E_field_type type
Definition E_field.h:37
E_1DS_data E1DS
Definition E_field.h:39