Functions | Variables

prob/linear_wave3d.c File Reference

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

Detailed Description

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.


Function Documentation

static Real A1 ( const Real  x1,
const Real  x2,
const Real  x3 
) [static]

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().

Here is the caller graph for this function:

static Real A2 ( const Real  x1,
const Real  x2,
const Real  x3 
) [static]

A2: 2-component of vector potential.

Definition at line 704 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().

Here is the caller graph for this function:

static Real A3 ( const Real  x1,
const Real  x2,
const Real  x3 
) [static]

Definition at line 723 of file linear_wave3d.c.

References bx0, by0, cos_a2, cos_a3, dby, k_par, sin_a2, and sin_a3.

void get_eta_user ( GridS pG,
int  i,
int  j,
int  k,
Real eta_O,
Real eta_H,
Real eta_A 
)

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  ) 
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.

Here is the call graph for this function:

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.


Variable Documentation

Real ang_2 [static]

Definition at line 79 of file linear_wave3d.c.

Referenced by problem().

Real ang_3 [static]

Definition at line 79 of file linear_wave3d.c.

Referenced by problem().

Real bx0 [static]

Definition at line 76 of file linear_wave3d.c.

Referenced by A1(), A2(), A3(), and problem().

Real by0 [static]

Definition at line 76 of file linear_wave3d.c.

Referenced by A1(), A2(), A3(), and problem().

Real bz0 [static]

Definition at line 76 of file linear_wave3d.c.

Referenced by A1(), A2(), and problem().

Real cos_a2 [static]

Definition at line 80 of file linear_wave3d.c.

Referenced by A1(), A2(), A3(), and problem().

Real cos_a3 [static]

Definition at line 80 of file linear_wave3d.c.

Referenced by A1(), A2(), A3(), and problem().

Real dby [static]

Definition at line 76 of file linear_wave3d.c.

Referenced by A1(), A2(), A3(), integrate_2d_ctu(), and problem().

Real dbz [static]

Definition at line 76 of file linear_wave3d.c.

Referenced by A1(), A2(), and problem().

Real k_par [static]

Definition at line 81 of file linear_wave3d.c.

Real lambda [static]

Definition at line 81 of file linear_wave3d.c.

Referenced by problem().

ConsS*** RootSoln = NULL [static]

Definition at line 71 of file linear_wave3d.c.

Real sin_a2 [static]

Definition at line 80 of file linear_wave3d.c.

Referenced by A1(), A2(), A3(), and problem().

Real sin_a3 [static]

Definition at line 80 of file linear_wave3d.c.

Referenced by A1(), A2(), A3(), and problem().

int wave_flag [static]

Definition at line 78 of file linear_wave3d.c.

Referenced by problem(), and Userwork_after_loop().