Linear wave problem generator for 3D problems. More...
Go to the source code of this file.
Functions | |
static Real | A1 (const Real x1, const Real x2, const Real x3) |
A1: 1-component of vector potential, using a gauge such that Ax = 0, and Ay, Az are functions of x and y alone. | |
static Real | A2 (const Real x1, const Real x2, const Real x3) |
A2: 2-component of vector potential. | |
static Real | A3 (const Real x1, const Real x2, const Real x3) |
void | problem (DomainS *pDomain) |
Problem initial conditions, edited for each problem. | |
void | problem_write_restart (MeshS *pM, FILE *fp) |
Problem specific subroutine for use with writing restart files, Edited for each problem. | |
void | problem_read_restart (MeshS *pM, FILE *fp) |
Problem specific subroutine for use with reading restart files, Edited for each problem. | |
ConsFun_t | get_usr_expr (const char *expr) |
Sets pointer to expression for special output data. | |
VOutFun_t | get_usr_out_fun (const char *name) |
Returns a user defined output function pointer. | |
void | get_eta_user (GridS *pG, int i, int j, int k, Real *eta_O, Real *eta_H, Real *eta_A) |
void | Userwork_in_loop (MeshS *pM) |
Problem work executed during each step in the main Athena loop, see main.c. | |
void | Userwork_after_loop (MeshS *pM) |
Problem work executed after the main Athena loop, see main.c Edited for each problem. | |
Variables | |
static ConsS *** | RootSoln = NULL |
static Real | bx0 |
static Real | by0 |
static Real | bz0 |
static Real | dby |
static Real | dbz |
static int | wave_flag |
static Real | ang_2 |
static Real | ang_3 |
static Real | sin_a2 |
static Real | cos_a2 |
static Real | sin_a3 |
static Real | cos_a3 |
static Real | lambda |
static Real | k_par |
Linear wave problem generator for 3D problems.
PURPOSE: Linear wave problem generator for 3D problems. The generalization of linear_wave.c to handle 1D, 2D, and 3D problems seemed more complex than neccessary, so this special routine has been written to handle only 3D problems. This routine automatically sets the wavevector along the domain diagonal (cannot run grid-aligned waves).
Can be used for either standing (problem/vflow=1.0) or travelling (problem/vflow=0.0) waves.
Configure --with-gravity=fft to check Jeans stability of plane waves propagating parallel to grid.
Configure --enable-resistivity and/or --with-viscosity=ns to check damping of linear waves by resistivity/ambipolar diffusion and/or viscosity
This code is most easily understood in terms of a one dimensional problem in the coordinate system (x,y,z). Two coordinate rotations are applied to obtain a new wave vector in a 3D space in the (x1,x2,x3) coordinate system.
First rotate about the y axis:
Next rotate about the z' axis:
Expanding this out we get:
This inverts to:
The magnetic field is given by:
PRIVATE FUNCTION PROTOTYPES:
USERWORK_AFTER_LOOP function computes L1 error norm in solution by comparing to initial conditions. Problem must be evolved for an integer number of wave periods for this to work (only works for ideal MHD).
Definition in file linear_wave3d.c.
A1: 1-component of vector potential, using a gauge such that Ax = 0, and Ay, Az are functions of x and y alone.
Definition at line 685 of file linear_wave3d.c.
References bx0, by0, bz0, cos_a2, cos_a3, dby, dbz, k_par, sin_a2, and sin_a3.
Referenced by problem().
Definition at line 446 of file linear_wave3d.c.
ConsFun_t get_usr_expr | ( | const char * | expr | ) |
Sets pointer to expression for special output data.
Definition at line 436 of file linear_wave3d.c.
VOutFun_t get_usr_out_fun | ( | const char * | name | ) |
Returns a user defined output function pointer.
Definition at line 441 of file linear_wave3d.c.
void problem | ( | DomainS * | pDomain | ) |
Problem initial conditions, edited for each problem.
Definition at line 100 of file linear_wave3d.c.
References A1(), A2(), A3(), amp, ang_2, ang_3, ath_error(), ath_pout(), ConsS::B1c, GridS::B1i, ConsS::B2c, GridS::B2i, ConsS::B3c, GridS::B3i, bx0, by0, bz0, calloc_3d_array(), cc_pos(), cos_a2, cos_a3, ConsS::d, d0, d_ind, dby, dbz, GridS::dx1, GridS::dx2, GridS::dx3, ConsS::E, esys_roe_adb_hyd(), esys_roe_adb_mhd(), esys_roe_iso_hyd(), esys_roe_iso_mhd(), eta_Ohm, four_pi_G, free_3d_array(), Gamma, Gamma_1, grav_mean_rho, DomainS::Grid, GridS::ie, GridS::is, Iso_csound, GridS::je, GridS::js, k_par, GridS::ke, GridS::ks, lambda, DomainS::Level, ConsS::M1, ConsS::M2, ConsS::M3, n, nx1, nx2, nx3, p0, par_getd(), par_getd_def(), par_geti(), Q_AD, DomainS::RootMaxX, DomainS::RootMinX, s, sin_a2, sin_a3, Soln, GridS::U, and wave_flag.
void problem_read_restart | ( | MeshS * | pM, | |
FILE * | fp | |||
) |
Problem specific subroutine for use with reading restart files, Edited for each problem.
Definition at line 431 of file linear_wave3d.c.
void problem_write_restart | ( | MeshS * | pM, | |
FILE * | fp | |||
) |
Problem specific subroutine for use with writing restart files, Edited for each problem.
Definition at line 426 of file linear_wave3d.c.
void Userwork_after_loop | ( | MeshS * | pM | ) |
Problem work executed after the main Athena loop, see main.c Edited for each problem.
Definition at line 467 of file linear_wave3d.c.
References ath_fname(), ath_perr(), ConsS::B1c, ConsS::B2c, ConsS::B3c, DomainS::Comm_Domain, ConsS::d, MeshS::Domain, ConsS::E, error, DomainS::Grid, GridS::ie, GridS::is, GridS::je, GridS::js, GridS::ke, GridS::ks, ConsS::M1, ConsS::M2, ConsS::M3, DomainS::Nx, GridS::U, and wave_flag.
void Userwork_in_loop | ( | MeshS * | pM | ) |
Problem work executed during each step in the main Athena loop, see main.c.
Edited for each problem.
Definition at line 457 of file linear_wave3d.c.
Definition at line 79 of file linear_wave3d.c.
Referenced by problem().
Definition at line 79 of file linear_wave3d.c.
Referenced by problem().
Definition at line 76 of file linear_wave3d.c.
Definition at line 76 of file linear_wave3d.c.
Referenced by A1(), A2(), A3(), integrate_2d_ctu(), and problem().
Definition at line 76 of file linear_wave3d.c.
Definition at line 81 of file linear_wave3d.c.
Definition at line 81 of file linear_wave3d.c.
Referenced by problem().
Definition at line 71 of file linear_wave3d.c.
int wave_flag [static] |
Definition at line 78 of file linear_wave3d.c.
Referenced by problem(), and Userwork_after_loop().