Functions | Variables

prob/turb.c File Reference

Problem generator for driven and decaying turbulence. More...

Go to the source code of this file.

Functions

static void pspect (ath_fft_data *ampl)
 computes component of velocity with specific power spectrum in Fourier space determined by ispect
static void project ()
 Makes velocity perturbations divergence free.
static void transform ()
 Generate velocities from fourier transform.
static void generate ()
 Generate the velocity perturbations.
static void perturb (Grid *pGrid, Real dt)
 Shifts velocities so no net momentum change, normalizes to keep dedt fixed, and then sets velocities.
static void initialize (Grid *pGrid, Domain *pD)
 Allocate memory and initialize FFT plans.
static Real hst_dEk (const Grid *pG, const int i, const int j, const int k)
 Dump kinetic energy in perturbations.
static Real hst_dEb (const Grid *pG, const int i, const int j, const int k)
 Dump magnetic energy in perturbations.
static double ran2 (long int *idum)
void problem (Grid *pGrid, Domain *pD)
void Userwork_in_loop (Grid *pGrid, Domain *pD)
void Userwork_after_loop (Grid *pGrid, Domain *pD)
void problem_write_restart (Grid *pG, Domain *pD, FILE *fp)
void problem_read_restart (Grid *pG, Domain *pD, FILE *fp)
Gasfun_t get_usr_expr (const char *expr)
 Sets pointer to expression for special output data.
VGFunout_t get_usr_out_fun (const char *name)
 Returns a user defined output function pointer.

Variables

static struct ath_3d_fft_planplan
static ath_fft_data * fv1 = NULL
static ath_fft_data * fv2 = NULL
static ath_fft_data * fv3 = NULL
static Real *** dv1 = NULL
static Real *** dv2 = NULL
static Real *** dv3 = NULL
static Real klow
static Real khigh
static Real kpeak
static Real expo
static Real dkx
static Real dedt
static Real tdrive
static Real dtdrive
static int ispect
static int idrive
static int nx1
static int nx2
static int nx3
static int gnx1
static int gnx2
static int gnx3
static int gis
static int gie
static int gjs
static int gje
static int gks
static int gke
long int rseed
static Real beta
static Real B0
static const Real rhobar = 1.0

Detailed Description

Problem generator for driven and decaying turbulence.

PURPOSE: Problem generator for driven and decaying turbulence. Only works in 3D with periodic BC. Arbitrary power spectrum specified using ispect:

HISTORY:

REFERENCE: "Dissipation in Compressible MHD Turbulence", by J. Stone, E. Ostriker, & C. Gammie, ApJ 508, L99 (1998)

Definition in file turb.c.


Function Documentation

static void generate (  )  [inline, static]

Generate the velocity perturbations.

Definition at line 257 of file turb.c.

References fv1, fv2, fv3, project(), pspect(), and transform().

Referenced by problem(), problem_read_restart(), and Userwork_in_loop().

Here is the call graph for this function:

Here is the caller graph for this function:

Gasfun_t get_usr_expr ( const char *  expr  ) 

Sets pointer to expression for special output data.

Definition at line 658 of file turb.c.

VGFunout_t get_usr_out_fun ( const char *  name  ) 

Returns a user defined output function pointer.

Definition at line 661 of file turb.c.

static Real hst_dEb ( const Grid *  pG,
const int  i,
const int  j,
const int  k 
) [static]

Dump magnetic energy in perturbations.

Definition at line 684 of file turb.c.

References B0.

Referenced by initialize().

Here is the caller graph for this function:

static Real hst_dEk ( const Grid *  pG,
const int  i,
const int  j,
const int  k 
) [static]

Dump kinetic energy in perturbations.

Definition at line 675 of file turb.c.

Referenced by initialize().

Here is the caller graph for this function:

static void initialize ( Grid *  pGrid,
Domain *  pD 
) [static]

Allocate memory and initialize FFT plans.

Definition at line 411 of file turb.c.

References ath_3d_fft_malloc(), ath_3d_fft_quick_plan(), ath_error(), ATH_FFT_BACKWARD, B0, beta, calloc_3d_array(), dedt, dkx, dtdrive, dump_history_enroll(), dv1, dv2, dv3, expo, fv1, fv2, fv3, gie, gis, gje, gjs, gke, gks, gnx1, gnx2, gnx3, hst_dEb(), hst_dEk(), idrive, Iso_csound2, ispect, khigh, klow, kpeak, nx1, nx2, nx3, par_getd(), par_geti(), and rhobar.

Referenced by problem(), and problem_read_restart().

Here is the call graph for this function:

Here is the caller graph for this function:

static void perturb ( Grid *  pGrid,
Real  dt 
) [static]

Shifts velocities so no net momentum change, normalizes to keep dedt fixed, and then sets velocities.

Definition at line 280 of file turb.c.

References ath_error(), dedt, dv1, dv2, dv3, fv1, fv2, fv3, gnx1, gnx2, gnx3, idrive, and s.

Referenced by problem(), and Userwork_in_loop().

Here is the call graph for this function:

Here is the caller graph for this function:

void problem ( Grid *  pGrid,
Domain *  pD 
)

Definition at line 521 of file turb.c.

References ath_3d_fft_free(), ath_pout(), B0, dtdrive, dv1, dv2, dv3, free_3d_array(), fv1, fv2, fv3, generate(), idrive, initialize(), perturb(), rhobar, rseed, and tdrive.

Here is the call graph for this function:

void problem_read_restart ( Grid *  pG,
Domain *  pD,
FILE *  fp 
)

Definition at line 645 of file turb.c.

References generate(), idrive, initialize(), rseed, and tdrive.

Here is the call graph for this function:

void problem_write_restart ( Grid *  pG,
Domain *  pD,
FILE *  fp 
)

Definition at line 642 of file turb.c.

static void project (  )  [static]

Makes velocity perturbations divergence free.

Definition at line 193 of file turb.c.

References fv1, fv2, fv3, gis, gjs, gks, gnx1, gnx2, gnx3, nx1, nx2, and nx3.

Referenced by generate().

Here is the caller graph for this function:

static void pspect ( ath_fft_data *  ampl  )  [static]

computes component of velocity with specific power spectrum in Fourier space determined by ispect

Velocity power spectrum returned in ampl

  • klow = multiple of 2 pi/L for cut-off at low wavenumbers
  • khigh = multiple of 2 pi/L for cut-off at high wavenumbers
  • expo = exponent of power law
  • ispect = integer flag which specifies spectrum

Note that the fourier amplitudes are stored in an array with no ghost zones

Definition at line 135 of file turb.c.

References dkx, expo, ispect, khigh, klow, kpeak, nx1, nx2, nx3, ran2(), and rseed.

Referenced by generate().

Here is the call graph for this function:

Here is the caller graph for this function:

static double ran2 ( long int *  idum  )  [static]

Definition at line 726 of file turb.c.

static void transform (  )  [inline, static]

Generate velocities from fourier transform.

Definition at line 238 of file turb.c.

References ath_3d_fft(), fv1, fv2, and fv3.

Referenced by generate().

Here is the call graph for this function:

Here is the caller graph for this function:

void Userwork_after_loop ( Grid *  pGrid,
Domain *  pD 
)

Definition at line 635 of file turb.c.

void Userwork_in_loop ( Grid *  pGrid,
Domain *  pD 
)

Definition at line 591 of file turb.c.

References ath_error(), dtdrive, generate(), idrive, perturb(), and tdrive.

Here is the call graph for this function:


Variable Documentation

Real B0 [static]

Definition at line 89 of file turb.c.

Referenced by hst_dEb(), initialize(), and problem().

Real beta [static]

Definition at line 89 of file turb.c.

Referenced by initialize().

Real dedt [static]

Definition at line 77 of file turb.c.

Referenced by initialize(), and perturb().

Real dkx [static]

Definition at line 73 of file turb.c.

Referenced by initialize(), pspect(), selfg_fft_2d(), selfg_fft_3d(), and selfg_fft_obc_3d().

Real dtdrive [static]

Definition at line 77 of file turb.c.

Referenced by initialize(), problem(), and Userwork_in_loop().

Real*** dv1 = NULL [static]

Definition at line 71 of file turb.c.

Referenced by initialize(), Integrate_Particles(), perturb(), and problem().

Real *** dv2 = NULL [static]

Definition at line 71 of file turb.c.

Referenced by initialize(), Integrate_Particles(), perturb(), and problem().

Real *** dv3 = NULL [static]

Definition at line 71 of file turb.c.

Referenced by initialize(), Integrate_Particles(), perturb(), and problem().

Real expo [static]

Definition at line 73 of file turb.c.

Referenced by initialize(), and pspect().

ath_fft_data* fv1 = NULL [static]

Definition at line 68 of file turb.c.

Referenced by generate(), initialize(), perturb(), problem(), project(), and transform().

ath_fft_data * fv2 = NULL [static]

Definition at line 68 of file turb.c.

Referenced by generate(), initialize(), perturb(), problem(), project(), and transform().

ath_fft_data * fv3 = NULL [static]

Definition at line 68 of file turb.c.

Referenced by generate(), initialize(), perturb(), problem(), project(), and transform().

int gie [static]

Definition at line 83 of file turb.c.

Referenced by ath_2d_fft_quick_plan(), ath_3d_fft_quick_plan(), and initialize().

int gis [static]

Definition at line 83 of file turb.c.

Referenced by ath_2d_fft_quick_plan(), ath_3d_fft_quick_plan(), initialize(), and project().

int gje [static]

Definition at line 83 of file turb.c.

Referenced by ath_2d_fft_quick_plan(), ath_3d_fft_quick_plan(), and initialize().

int gjs [static]

Definition at line 83 of file turb.c.

Referenced by ath_2d_fft_quick_plan(), ath_3d_fft_quick_plan(), initialize(), and project().

int gke [static]

Definition at line 83 of file turb.c.

Referenced by ath_3d_fft_quick_plan(), and initialize().

int gks [static]

Definition at line 83 of file turb.c.

Referenced by ath_3d_fft_quick_plan(), initialize(), and project().

int gnx1 [static]

Definition at line 81 of file turb.c.

Referenced by ath_2d_fft_quick_plan(), ath_3d_fft_quick_plan(), initialize(), perturb(), and project().

int gnx2 [static]

Definition at line 81 of file turb.c.

Referenced by ath_2d_fft_quick_plan(), ath_3d_fft_quick_plan(), initialize(), perturb(), and project().

int gnx3 [static]

Definition at line 81 of file turb.c.

Referenced by ath_3d_fft_quick_plan(), initialize(), perturb(), and project().

int idrive [static]

Definition at line 79 of file turb.c.

Referenced by initialize(), perturb(), problem(), problem_read_restart(), and Userwork_in_loop().

int ispect [static]

Definition at line 79 of file turb.c.

Referenced by initialize(), and pspect().

Real khigh [static]

Definition at line 73 of file turb.c.

Referenced by initialize(), and pspect().

Real klow [static]

Definition at line 73 of file turb.c.

Referenced by initialize(), and pspect().

Real kpeak [static]

Definition at line 73 of file turb.c.

Referenced by initialize(), and pspect().

int nx1 [static]
int nx2 [static]
int nx3 [static]
struct ath_3d_fft_plan* plan [static]

Definition at line 65 of file turb.c.

const Real rhobar = 1.0 [static]

Definition at line 92 of file turb.c.

Referenced by initialize(), and problem().

long int rseed

Definition at line 85 of file turb.c.

Referenced by problem(), problem_read_restart(), and pspect().

Real tdrive [static]

Definition at line 77 of file turb.c.

Referenced by problem(), problem_read_restart(), and Userwork_in_loop().