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_plan * | plan |
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 |
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.
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().
Gasfun_t get_usr_expr | ( | const char * | expr | ) |
VGFunout_t get_usr_out_fun | ( | const char * | name | ) |
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().
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().
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().
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().
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.
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.
void problem_write_restart | ( | Grid * | pG, | |
Domain * | pD, | |||
FILE * | fp | |||
) |
static void project | ( | ) | [static] |
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
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().
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().
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.
Definition at line 89 of file turb.c.
Referenced by hst_dEb(), initialize(), and problem().
Definition at line 89 of file turb.c.
Referenced by initialize().
Definition at line 73 of file turb.c.
Referenced by initialize(), pspect(), selfg_fft_2d(), selfg_fft_3d(), and selfg_fft_obc_3d().
Definition at line 77 of file turb.c.
Referenced by initialize(), problem(), and Userwork_in_loop().
Definition at line 71 of file turb.c.
Referenced by initialize(), Integrate_Particles(), perturb(), and problem().
Definition at line 71 of file turb.c.
Referenced by initialize(), Integrate_Particles(), perturb(), and problem().
Definition at line 71 of file turb.c.
Referenced by initialize(), Integrate_Particles(), perturb(), and problem().
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().
int nx1 [static] |
Definition at line 81 of file turb.c.
Referenced by Fargo(), initialize(), out_ktab(), output_pgm(), output_ppm(), output_tab_1d(), output_tab_2d(), output_tab_3d(), output_vtk_2d(), output_vtk_3d(), problem(), project(), pspect(), ScaleToBeta(), and Userwork_in_loop().
int nx2 [static] |
Definition at line 81 of file turb.c.
Referenced by Fargo(), initialize(), output_pgm(), output_ppm(), output_tab_2d(), output_tab_3d(), output_vtk_2d(), output_vtk_3d(), problem(), project(), pspect(), ScaleToBeta(), and Userwork_in_loop().
int nx3 [static] |
Definition at line 81 of file turb.c.
Referenced by Fargo(), initialize(), output_tab_3d(), output_vtk_3d(), problem(), project(), pspect(), ScaleToBeta(), and Userwork_in_loop().
struct ath_3d_fft_plan* plan [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().
Definition at line 77 of file turb.c.
Referenced by problem(), problem_read_restart(), and Userwork_in_loop().