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

Header file for diag_orb.c. More...

#include <stdio.h>
#include "../particle.h"

Go to the source code of this file.

Data Structures

struct  diag_orb_offload_data
 Orbit diagnostics offload data struct. More...
 
struct  diag_orb_data
 Orbit diagnostics data struct. More...
 

Macros

#define DIAG_ORB_POINCARE   0
 
#define DIAG_ORB_INTERVAL   1
 
#define DIAG_ORB_MAXPOINCARES   30
 
#define DIAG_ORB_FOFIELDS   16
 
#define DIAG_ORB_GCFIELDS   16
 
#define DIAG_ORB_MLFIELDS   11
 
#define DIAG_ORB_HYBRIDFIELDS   19
 
#define DIAG_ORB_FO   1
 
#define DIAG_ORB_GC   2
 
#define DIAG_ORB_ML   3
 

Functions

real diag_orb_check_plane_crossing (real fang, real iang, real ang0)
 Check if marker has crossed a plane.
 
real diag_orb_check_radial_crossing (real fr, real ir, real r0)
 Check if marker has crossed given rho.
 
void diag_orb_init (diag_orb_data *data, diag_orb_offload_data *offload_data, real *offload_array)
 Initializes orbit diagnostics offload data.
 
void diag_orb_free (diag_orb_data *data)
 Free orbit diagnostics data.
 
void diag_orb_update_fo (diag_orb_data *data, particle_simd_fo *p_f, particle_simd_fo *p_i)
 Collects orbit diagnostics when marker represents a particle.
 
void diag_orb_update_gc (diag_orb_data *data, particle_simd_gc *p_f, particle_simd_gc *p_i)
 Collects orbit diagnostics when marker represents a guiding center.
 
void diag_orb_update_ml (diag_orb_data *data, particle_simd_ml *p_f, particle_simd_ml *p_i)
 Collects orbit diagnostics when marker represents a field line.
 

Detailed Description

Header file for diag_orb.c.

This file also contains definitions for orbit diagnostics data structures.

Definition in file diag_orb.h.

Macro Definition Documentation

◆ DIAG_ORB_POINCARE

#define DIAG_ORB_POINCARE   0

Poincare mode flag

Definition at line 13 of file diag_orb.h.

◆ DIAG_ORB_INTERVAL

#define DIAG_ORB_INTERVAL   1

Interval mode flag

Definition at line 14 of file diag_orb.h.

◆ DIAG_ORB_MAXPOINCARES

#define DIAG_ORB_MAXPOINCARES   30

Maximum number of Poincare planes

Definition at line 15 of file diag_orb.h.

◆ DIAG_ORB_FOFIELDS

#define DIAG_ORB_FOFIELDS   16

Number of coordinates in FO output

Definition at line 17 of file diag_orb.h.

◆ DIAG_ORB_GCFIELDS

#define DIAG_ORB_GCFIELDS   16

Number of coordinates in GC output

Definition at line 18 of file diag_orb.h.

◆ DIAG_ORB_MLFIELDS

#define DIAG_ORB_MLFIELDS   11

Number of coordinates in ML output

Definition at line 19 of file diag_orb.h.

◆ DIAG_ORB_HYBRIDFIELDS

#define DIAG_ORB_HYBRIDFIELDS   19

Number of coordinates in hybrid output

Definition at line 20 of file diag_orb.h.

◆ DIAG_ORB_FO

#define DIAG_ORB_FO   1

Data stored in FO mode

Definition at line 22 of file diag_orb.h.

◆ DIAG_ORB_GC

#define DIAG_ORB_GC   2

Data stored in GC mode

Definition at line 23 of file diag_orb.h.

◆ DIAG_ORB_ML

#define DIAG_ORB_ML   3

Data stored in ML mode

Definition at line 24 of file diag_orb.h.

Function Documentation

◆ diag_orb_check_plane_crossing()

real diag_orb_check_plane_crossing ( real fang,
real iang,
real ang0 )

Check if marker has crossed a plane.

This helper function checks whether the angle, either toroidal or poloidal, that defines a Poincare plane is between marker's initial and final angles (of single timestep).

Parameters
fangmarker final angle in radians.
iangmarker initial angle in radians.
ang0Poincare plane angle.
Returns
zero if no-crossing, number k, ang0 = k + (fang - iang), otherwise.

Definition at line 758 of file diag_orb.c.

◆ diag_orb_check_radial_crossing()

real diag_orb_check_radial_crossing ( real frho,
real irho,
real rho0 )

Check if marker has crossed given rho.

This helper function checks whether given rho that defines a Poincare plane is between marker's initial and final rhos (of single timestep).

Parameters
frhomarker final rho in metres.
irhomarker initial rho in metres.
rho0Poincare plane rho.
Returns
zero if no-crossing, number k, rho0 = k * (frho - irho), otherwise.

Definition at line 792 of file diag_orb.c.

◆ diag_orb_init()

void diag_orb_init ( diag_orb_data * data,
diag_orb_offload_data * offload_data,
real * offload_array )

Initializes orbit diagnostics offload data.

The offload array should have a length of Nfld * Nmrk * Npnt and elements initialized to zero. The orbit data will be stored in this field as arr[i_field*N_markers*N_points + i_marker*N_points + i_point].

Note that not all markers fill all space assigned to them before their simulation is terminated.

Parameters
dataorbit diagnostics data struct
offload_dataorbit diagnostics offload data struct
offload_arrayoffload data array

Definition at line 28 of file diag_orb.c.

◆ diag_orb_free()

void diag_orb_free ( diag_orb_data * data)

Free orbit diagnostics data.

Parameters
dataorbit diagnostics data struct

Definition at line 147 of file diag_orb.c.

◆ diag_orb_update_fo()

void diag_orb_update_fo ( diag_orb_data * data,
particle_simd_fo * p_f,
particle_simd_fo * p_i )

Collects orbit diagnostics when marker represents a particle.

Parameters
dataorbit diagnostics data struct
p_fpointer to SIMD struct storing marker states at the end of current time-step
p_ipointer to SIMD struct storing marker states at the beginning of current time-step

Definition at line 161 of file diag_orb.c.

◆ diag_orb_update_gc()

void diag_orb_update_gc ( diag_orb_data * data,
particle_simd_gc * p_f,
particle_simd_gc * p_i )

Collects orbit diagnostics when marker represents a guiding center.

Parameters
dataorbit diagnostics data struct
p_fpointer to SIMD struct storing marker states at the end of current time-step
p_ipointer to SIMD struct storing marker states at the beginning of current time-step

Definition at line 367 of file diag_orb.c.

◆ diag_orb_update_ml()

void diag_orb_update_ml ( diag_orb_data * data,
particle_simd_ml * p_f,
particle_simd_ml * p_i )

Collects orbit diagnostics when marker represents a field line.

Parameters
dataorbit diagnostics data struct
p_fpointer to SIMD struct storing marker states at the end of current time-step
p_ipointer to SIMD struct storing marker states at the beginning of current time-step

Definition at line 574 of file diag_orb.c.