ASCOT5
Loading...
Searching...
No Matches
Functions | Variables
mccc_wiener.c File Reference

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
 

Detailed Description

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.

Function Documentation

◆ mccc_wiener_initialize()

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()

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()

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.

Variable Documentation

◆ MCCC_EMPTY

const int MCCC_EMPTY = -1

Indicates an empty slot in wiener array

Definition at line 27 of file mccc_wiener.c.