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

Header file for neutral.c. More...

#include "ascot5.h"
#include "error.h"
#include "neutral/N0_1D.h"
#include "neutral/N0_3D.h"

Go to the source code of this file.

Data Structures

struct  neutral_offload_data
 Neutral offload data. More...
 
struct  neutral_data
 Neutral simulation data. More...
 

Typedefs

typedef enum neutral_type neutral_type
 Neutral data types.
 

Enumerations

enum  neutral_type { neutral_type_1D , neutral_type_3D }
 Neutral data types. More...
 

Functions

int neutral_init_offload (neutral_offload_data *offload_data, real **offload_array)
 Load neutral data and prepare parameters.
 
void neutral_free_offload (neutral_offload_data *offload_data, real **offload_array)
 Free offload array and reset parameters.
 
int neutral_init (neutral_data *ndata, neutral_offload_data *offload_data, real *offload_array)
 Initialize neutral data struct on target.
 
a5err neutral_eval_n0 (real *n0, real rho, real r, real phi, real z, real t, neutral_data *ndata)
 Evaluate neutral density.
 
a5err neutral_eval_t0 (real *t0, real rho, real r, real phi, real z, real t, neutral_data *ndata)
 Evaluate neutral temperature.
 
int neutral_get_n_species (neutral_data *ndata)
 Get the number of neutral species.
 

Detailed Description

Header file for neutral.c.

Contains a list declaring all neutral_types, and declaration of neutral_offload_data and neutral_data structs.

Definition in file neutral.h.

Typedef Documentation

◆ neutral_type

typedef enum neutral_type neutral_type

Neutral data types.

Neutral data types are used in the neutral interface (neutral.c) to direct function calls to correct neutral data instances. Each neutral data instance must have a corresponding type.

Enumeration Type Documentation

◆ neutral_type

Neutral data types.

Neutral data types are used in the neutral interface (neutral.c) to direct function calls to correct neutral data instances. Each neutral data instance must have a corresponding type.

Enumerator
neutral_type_1D 

Linearly-interpolated 1D neutral data

neutral_type_3D 

Linearly-interpolated 3D neutral data

Definition at line 23 of file neutral.h.

Function Documentation

◆ neutral_init_offload()

int neutral_init_offload ( neutral_offload_data * offload_data,
real ** offload_array )

Load neutral data and prepare parameters.

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

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 neutral.c.

◆ neutral_free_offload()

void neutral_free_offload ( neutral_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 81 of file neutral.c.

◆ neutral_init()

int neutral_init ( neutral_data * ndata,
neutral_offload_data * offload_data,
real * offload_array )

Initialize neutral data struct on target.

This function copies the neutral data parameters from the offload struct to the struct on target and sets the neutral data pointers to correct offsets in the offload array.

Parameters
ndatapointer to data struct on target
offload_datapointer to offload data struct
offload_arraypointer to offload array
Returns
Zero if initialization succeeded

Definition at line 106 of file neutral.c.

◆ neutral_eval_n0()

a5err neutral_eval_n0 ( real * n0,
real rho,
real r,
real phi,
real z,
real t,
neutral_data * ndata )

Evaluate neutral density.

This function evaluates the neutral density n0 at the given coordinates.

This is a SIMD function.

Parameters
n0pointer where neutral density is stored [m^-3]
rhonormalized poloidal flux coordinate
rR coordinate [m]
phiphi coordinate [deg]
zz coordinate [m]
ttime coordinate [s]
ndatapointer to neutral density data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 147 of file neutral.c.

◆ neutral_eval_t0()

a5err neutral_eval_t0 ( real * t0,
real rho,
real r,
real phi,
real z,
real t,
neutral_data * ndata )

Evaluate neutral temperature.

This function evaluates the neutral temperature t0 at the given coordinates.

This is a SIMD function.

Parameters
t0pointer where neutral temperature is stored [J]
rhonormalized poloidal flux coordinate
rR coordinate [m]
phiphi coordinate [deg]
zz coordinate [m]
ttime coordinate [s]
ndatapointer to neutral temperature data struct
Returns
Non-zero a5err value if evaluation failed, zero otherwise

Definition at line 189 of file neutral.c.

◆ neutral_get_n_species()

int neutral_get_n_species ( neutral_data * ndata)

Get the number of neutral species.

Retrieve the number of how many neutral species the data contains.

This is a SIMD function.

Parameters
ndatapointer to neutral data struct
Returns
The number of neutral species

Definition at line 225 of file neutral.c.