ASCOT5
|
A module for handling Wiener processes. More...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "../../ascot5.h"
#include "../../consts.h"
#include "../../error.h"
#include "mccc_wiener.h"
Go to the source code of this file.
Functions | |
void | mccc_wiener_initialize (mccc_wienarr *w, real initime) |
Initializes a struct that stores generated Wiener processes. | |
a5err | mccc_wiener_generate (mccc_wienarr *w, real t, int *windex, real *rand5) |
Generates a new Wiener process at a given time instant. | |
a5err | mccc_wiener_clean (mccc_wienarr *w, real t) |
Removes Wiener processes from the array that are no longer required. | |
Variables | |
const int | MCCC_EMPTY = -1 |
A module for handling Wiener processes.
A module for handling Wiener processes. When adaptive time step is used (and steps are rejected), Wiener processes are generated using the so-called Brownian bridge. This module contains associated helper routines.
Definition in file mccc_wiener.c.
void mccc_wiener_initialize | ( | mccc_wienarr * | w, |
real | initime ) |
Initializes a struct that stores generated Wiener processes.
w | Wiener struct to be initialized |
initime | time when a Wiener process begins |
Definition at line 36 of file mccc_wiener.c.
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.
w | array that stores the Wiener processes |
t | time for which the new process will be generated |
windex | index of the generated Wiener process in the Wiener array |
rand5 | array of 5 normal distributed random numbers |
Definition at line 66 of file mccc_wiener.c.
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.
w | array that stores the Wiener processes |
t | time for which the new process will be generated |
Definition at line 173 of file mccc_wiener.c.
const int MCCC_EMPTY = -1 |
Indicates an empty slot in wiener array
Definition at line 27 of file mccc_wiener.c.