-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoisy.h
43 lines (31 loc) · 1.19 KB
/
noisy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
noisy:
Generate a gaussian random field in 2D with
locally anisotropic correlation function,
locally varying correlation time.
Follows the technique of
Lindgren, Rue, and Lindstr\:om 2011, J.R. Statist. Soc. B 73, pp 423-498.
https://rss.onlinelibrary.wiley.com/doi/10.1111/j.1467-9868.2011.00777.x
in particular, implements eq. 17, which has power spectrum given by eq. 18.
Based on work by
David Daeyoung Lee
Charles Gammie
on applications in disk turbulence.
CFG 22 Dec 2019
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
/* size of image. notice that solution time scales as N^4 */
#define N 256
#define SMALL 1.e-10
/* set parameters of model */
#define PARAM_FOV 1.0 /* field of view */
#define PARAM_EPS 1.0 /* strength of forcing */
#define PARAM_AMP 0.05 /* strength of perturbation; image = exp(-AMP*del)*envelope */
#define PARAM_LAM 0.5 /* ratio of correlation length to local radius */
#define PARAM_TAU 1.0 /* product of correlation time and local Keplerian frequency */
#define PARAM_RCH 0.2 /* scaling radius */
#define PARAM_RAT 0.1 /* ratio of diffusion coefficients */