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

header file for mccc_wiener.c More...

#include "../../ascot5.h"
#include "../../error.h"

Go to the source code of this file.

Data Structures

struct  mccc_wienarr
 Struct for storing Wiener processes. More...
 

Macros

#define MCCC_NDIM   5
 
#define MCCC_NSLOTS   WIENERSLOTS
 

Functions

DECLARE_TARGET_SIMD void mccc_wiener_initialize (mccc_wienarr *w, real initime)
 Initializes a struct that stores generated Wiener processes.
 
DECLARE_TARGET_SIMD a5err mccc_wiener_generate (mccc_wienarr *w, real t, int *windex, real *rand5)
 Generates a new Wiener process at a given time instant.
 
DECLARE_TARGET_SIMD a5err mccc_wiener_clean (mccc_wienarr *w, real t)
 Removes Wiener processes from the array that are no longer required.
 

Detailed Description

header file for mccc_wiener.c

Definition in file mccc_wiener.h.

Macro Definition Documentation

◆ MCCC_NDIM

#define MCCC_NDIM   5

Wiener process dimension. NDIM=5 because only guiding centers are simulated with adaptive time step

Definition at line 15 of file mccc_wiener.h.

◆ MCCC_NSLOTS

#define MCCC_NSLOTS   WIENERSLOTS

Maximum slots in Wiener array which means this is the maximum number of time step reductions.

Definition at line 21 of file mccc_wiener.h.

Function Documentation

◆ mccc_wiener_initialize()

DECLARE_TARGET_SIMD void mccc_wiener_initialize ( mccc_wienarr * w,
real initime )

Initializes a struct that stores generated Wiener processes.

Parameters
wWiener struct to be initialized
initimetime when a Wiener process begins

Definition at line 36 of file mccc_wiener.c.

◆ mccc_wiener_generate()

DECLARE_TARGET_SIMD a5err mccc_wiener_generate ( mccc_wienarr * w,
real t,
int * windex,
real * rand5 )

Generates a new Wiener process at a given time instant.

Generates a new Wiener process. The generated process is drawn from normal distribution unless there exists a Wiener process at future time-instance, in which case the process is created using the Brownian bridge.

Parameters
warray that stores the Wiener processes
ttime for which the new process will be generated
windexindex of the generated Wiener process in the Wiener array
rand5array of 5 normal distributed random numbers
Returns
zero if generation succeeded

Definition at line 66 of file mccc_wiener.c.

◆ mccc_wiener_clean()

DECLARE_TARGET_SIMD a5err mccc_wiener_clean ( mccc_wienarr * w,
real t )

Removes Wiener processes from the array that are no longer required.

Processes W(t') are redundant if t' < t, where t is the current simulation time. Note that W(t) should exist before W(t') are removed. This routine should be called each time when simulation time is advanced.

Parameters
warray that stores the Wiener processes
ttime for which the new process will be generated
Returns
zero if cleaning succeeded

Definition at line 173 of file mccc_wiener.c.