MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
turbulence.h File Reference

Data Structures

struct  genatm_t

Functions

map_t * genatm_simple (real r0, real L0, real slope, real dx, long nx, int seed)
dmat * genatm_loc (loc_t *loc, real r0, real L0, real slope, int seed)
mapcell * genscreen (genatm_t *data)
mapcell * genscreen_str (const char *keywords)
dmat * turbcov (dmat *r, real rmax, real r0, real L0)
void spatial_psd (dmat **out, long nx, long ny, real dx, real strength, real L0, real fmin, real fmax, real slope, real power)
dmat * turbpsd (long nx, long ny, real dx, real r0, real L0, real slope, real power)
real calc_aniso (real r0, int nht, real *ht, real *wt)
real calc_greenwood (real r0, int nps, real *ws, real *wt)
real calc_aniso2 (real r0, int nht, real *ht, real *wt, real hc1, real hc2)

Detailed Description

Contains routines to generate atmospheric turbulence screens


Data Structure Documentation

◆ genatm_t

struct genatm_t
Collaboration diagram for genatm_t:
Data Fields
rand_t * rstat

The random stream

real * wt

The layer weights

real r0

The Fried Parameter

real * L0

The outer scale

real dx

The sampling

real fmin

Minimum spatial frequency

real fmax

Maximum spatial frequency

real slope

Power slope of PSD. -11/3 for Von Karman, -4 for Biharmonic. -1 for fractal.

long nx

Number of pixels along x

long ny

Number of pixels along y

long nlayer

The number of layers

long ninit

In Fractal method, the size of initial screen

long share

Use file backend for sharing of atmosphere

dmat * r0logpsds

Spatial PSD of log(r0) (m)=beta*f^alpha. [alpha, beta, minfreq, maxfreq]

mapcell * screen

The destination screen pointer

Function Documentation

◆ genatm_simple()

map_t * genatm_simple ( real r0,
real L0,
real slope,
real dx,
long nx,
int seed )

A simpler interface to gerate a single screen.

Parameters
[in]r0Fried parameter (m) at 0.5 micron.
[in]L0Outer scale (m).
[in]slopePSD slope. 0 means -11/3.
[in]dxSampling (m).
[in]nxNumber of points along x and y.
[in]seedRandom seed.
Returns
Newly allocated screen. The caller frees it.

◆ genatm_loc()

dmat * genatm_loc ( loc_t * loc,
real r0,
real dsa,
real slope,
int seed )

Generate atmosphere and map onto loc.

Parameters
[in]locGrid coordinate.
[in]r0Fried parameter (m) at 0.5 micron.
[in]dsaOuter scale (m) of the generated screen.
[in]slopePSD slope. 0 means -11/3.
[in]seedRandom seed.
Returns
Newly allocated OPD (m) defined on loc. The caller frees it.

◆ genscreen()

mapcell * genscreen ( genatm_t * data)

Generates multiple screens from spectrum. Note that if data->share=1, the atmosphere will be different from data->share=0 due to different algorithms used.

Parameters
[in,out]dataAtmosphere generation parameters. The random stream is consumed.
Returns
Newly allocated screens, one per layer. If data->share is set, they are memory mapped from the cache file. The caller frees it.

◆ genscreen_str()

mapcell * genscreen_str ( const char * keywords)

Generate screen according to a header. It has multiple possible options. 1) If is a filename. load from file 2) if mode and petal is not set. generate screen from PSD with the following keys L0 (Outer scale) slope (optional, default is -11/3) seed (optional) 3) If mode is set. generate from a zernike mode with the following keys mode (zernike mode) 4) If petal is set. generate randomized petal modes each with rms value. petal sets total number of petals theta0 sets petal gap orientation angular offset in radian. 0 means a gap is along y axis. seed piston: generates piston mode if set tip: generate tip mode if set tilt: generates tilt mode if set The following common parameters are used: r0 (Fried parameter in m) or rms (in nm) dx (sampling) nx (number of points)

Parameters
[in]keywordsFile name or a string of key=value pairs as described above.
Returns
Newly allocated screens. The caller frees it.

◆ turbcov()

dmat * turbcov ( dmat * r,
real rmax,
real r0,
real L0 )

Compute the covariance for separation of r, and put the values in cov. In kolmogorov spectrum, the variance are defined as half of the structure function between two points separated by rmax.

Parameters
[in]rSeparation (m).
[in]rmaxMaximum separation (m). Only used for kolmogorov spectrum.
[in]r0Fried parameter (m) at 0.5 micron.
[in]L0Outer scale (m). Infinity means kolmogorov spectrum.
Returns
Newly allocated OPD covariance (m^2) with the same size as r. The caller frees it.

◆ spatial_psd()

void spatial_psd ( dmat ** pout,
long nx,
long ny,
real dx,
real strength,
real outerscale,
real minfreq,
real maxfreq,
real slope,
real power )

Creates 2-d PSD at size nx*ny: psd=(strength*(f^2+L0^-2)^(slope/2))^power. Zero frequency component is in the corner P(psd,0).

Parameters
[in,out]poutOutput. Reused if the size matches, otherwise (re)allocated.
[in]nxThe size along x.
[in]nyThe size along y.
[in]dxThe sampling of spatial coordinate (m).
[in]strengthStrength coefficient.
[in]outerscaleOuterscale (m). 0 means infinity.
[in]minfreqLow end frequency cut off (1/m).
[in]maxfreqHigh end frequency cut off (1/m). 0 means infinity.
[in]slopeshould be -11/3 for von karman or kolmogorov screens, or -4 for biharmonic screen (just testing only). 0 means -11/3.
[in]poweroptionally do a power of psd.

◆ turbpsd()

dmat * turbpsd ( long nx,
long ny,
real dx,
real r0,
real L0,
real slope,
real power )

Compute spatial PSD of turbulence spectrum.

Parameters
[in]nxThe size along x.
[in]nyThe size along y.
[in]dxThe sampling (m).
[in]r0Fried parameter (m) at 0.5 micron.
[in]L0Outer scale (m).
[in]slopePSD slope. 0 means -11/3.
[in]powerPower to apply to the PSD (e.g., 0.5 for the amplitude spectrum).
Returns
Newly allocated PSD with zero frequency at the corner. The caller frees it.

◆ calc_aniso()

real calc_aniso ( real r0,
int nps,
real * ht,
real * wt )

Estimate anisoplanatic angle theta0 from Fried parameter r0, layer height and weights.

Parameters
[in]r0Fried parameter (m).
[in]npsNumber of layers.
[in]htLayer heights (m).
[in]wtLayer weights. Layers with weight below 0.01 are ignored.
Returns
Isoplanatic angle (radian).

◆ calc_greenwood()

real calc_greenwood ( real r0,
int nps,
real * ws,
real * wt )

Estimate Green wood frequency

Parameters
[in]r0Fried parameter (m).
[in]npsNumber of layers.
[in]wsLayer wind speeds (m/s).
[in]wtLayer weights.
Returns
Greenwood frequency (Hz).

◆ calc_aniso2()

real calc_aniso2 ( real r0,
int nps,
real * ht,
real * wt,
real hc1,
real hc2 )

Estimate generalized aniso angle theta2 from Fried parameter r0, and layer height and weights, and deformable mirror conjugation heights hc1 hc2 of the ground and altitude DMs.

Parameters
[in]r0Fried parameter (m).
[in]npsNumber of layers.
[in]htLayer heights (m).
[in]wtLayer weights.
[in]hc1Conjugation height (m) of the ground DM.
[in]hc2Conjugation height (m) of the altitude DM.
Returns
Generalized isoplanatic angle (radian).