ASCOT5
Loading...
Searching...
No Matches
Functions
diag_orb.c File Reference

Functions to write particle and guiding center information. More...

#include "diag_orb.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "../ascot5.h"
#include "../consts.h"
#include "../simulate.h"

Go to the source code of this file.

Functions

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.
 
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 frho, real irho, real rho0)
 Check if marker has crossed given rho.
 

Detailed Description

Functions to write particle and guiding center information.

Definition in file diag_orb.c.

Function Documentation

◆ 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.

◆ 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.