Classes | Functions | Variables

gravity/selfg_multigrid.c File Reference

Contains functions to solve Poisson's equation for self-gravity in 3D using multigrid. More...

Go to the source code of this file.

Classes

struct  MGrid
 Holds RHS, potential, and information about grid size for a given level in the multi-grid hierarchy. More...

Functions

void multig_3d (MGrid *pMG)
 Functions needed for the multigrid solver in 3D.
void Jacobi (MGrid *pMG)
 Jacobi iterations.
void Restriction_3d (MGrid *pMG_fine, MGrid *pMG_coarse)
 Averages fine grid solution onto coarse.
void Prolongation_3d (MGrid *pMG_coarse, MGrid *pMG_fine)
 Linear interpolation of coarse grid onto fine.
void set_mg_bvals (MGrid *pMG)
 Sets BC for Jacobi iterates for MPI parallel jobs.
void swap_mg_ix1 (MGrid *pMG, int cnt, int swap_flag, MPI_Request *prq)
 MPI_SWAP of boundary conditions, Inner x1 boundary.
void swap_mg_ox1 (MGrid *pMG, int cnt, int swap_flag, MPI_Request *prq)
 MPI_SWAP of boundary conditions, Outer x1 boundary.
void swap_mg_ix2 (MGrid *pMG, int cnt, int swap_flag, MPI_Request *prq)
 MPI_SWAP of boundary conditions, Inner x2 boundary.
void swap_mg_ox2 (MGrid *pMG, int cnt, int swap_flag, MPI_Request *prq)
 MPI_SWAP of boundary conditions, Outer x2 boundary.
void swap_mg_ix3 (MGrid *pMG, int cnt, int swap_flag, MPI_Request *prq)
 MPI_SWAP of boundary conditions, Inner x3 boundary.
void swap_mg_ox3 (MGrid *pMG, int cnt, int swap_flag, MPI_Request *prq)
 MPI_SWAP of boundary conditions, Outer x3 boundary.
void selfg_multig_1d (DomainS *pD)
 1-D multigrid gravity
void selfg_multig_2d (DomainS *pD)
 2-D multigrid gravity
void selfg_multig_3d (DomainS *pD)
 Do not use with periodic BCs, uses multipole expansion to compute potential at boundary.
void selfg_multig_3d_init (MeshS *pM)
 Initialize send/receive buffers needed to swap iterates during Jacobi iterations.

Variables

static double * send_buf = NULL
static double * recv_buf = NULL
Real *** error

Detailed Description

Contains functions to solve Poisson's equation for self-gravity in 3D using multigrid.

These functions work for non-periodic domains. A low-order multipole expansion is used to compute the potential on the boundaries.

HISTORY:

CONTAINS PUBLIC FUNCTIONS:

Definition in file selfg_multigrid.c.


Function Documentation

void Jacobi ( MGrid pMG  ) 

Jacobi iterations.

Do not use with periodic BCs, uses multipole expansion to compute potential at boundary

Definition at line 380 of file selfg_multigrid.c.

References MGrid::dx1, MGrid::dx2, MGrid::dx3, error, MGrid::ie, MGrid::is, MGrid::je, MGrid::js, MGrid::ke, MGrid::ks, n, MGrid::Nx3, MGrid::Phi, MGrid::rhs, and set_mg_bvals().

Referenced by multig_3d().

Here is the call graph for this function:

Here is the caller graph for this function:

void multig_3d ( MGrid pMG  ) 

Functions needed for the multigrid solver in 3D.

Definition at line 298 of file selfg_multigrid.c.

References ath_error(), calloc_3d_array(), MGrid::dx1, MGrid::dx2, MGrid::dx3, free_3d_array(), MGrid::ie, MGrid::is, Jacobi(), MGrid::je, MGrid::js, MGrid::ke, MGrid::ks, MGrid::lx1_id, MGrid::lx2_id, MGrid::lx3_id, MGrid::Nx1, MGrid::Nx2, MGrid::Nx3, MGrid::Phi, Prolongation_3d(), Restriction_3d(), MGrid::rhs, MGrid::rx1_id, MGrid::rx2_id, MGrid::rx3_id, and set_mg_bvals().

Referenced by selfg_multig_3d().

Here is the call graph for this function:

Here is the caller graph for this function:

void Prolongation_3d ( MGrid pMG_coarse,
MGrid pMG_fine 
)

Linear interpolation of coarse grid onto fine.

Definition at line 496 of file selfg_multigrid.c.

References MGrid::ie, MGrid::is, MGrid::je, MGrid::js, MGrid::ke, MGrid::ks, and MGrid::Phi.

Referenced by multig_3d().

Here is the caller graph for this function:

void Restriction_3d ( MGrid pMG_fine,
MGrid pMG_coarse 
)

Averages fine grid solution onto coarse.

Definition at line 449 of file selfg_multigrid.c.

References MGrid::dx1, MGrid::dx2, MGrid::dx3, error, MGrid::ie, MGrid::is, MGrid::je, MGrid::js, MGrid::ke, MGrid::ks, MGrid::Phi, and MGrid::rhs.

Referenced by multig_3d().

Here is the caller graph for this function:

void selfg_multig_1d ( DomainS pD  ) 

1-D multigrid gravity

Definition at line 87 of file selfg_multigrid.c.

References ath_error().

Here is the call graph for this function:

void selfg_multig_2d ( DomainS pD  ) 

2-D multigrid gravity

Definition at line 98 of file selfg_multigrid.c.

References ath_error().

Here is the call graph for this function:

void selfg_multig_3d ( DomainS pD  ) 
void selfg_multig_3d_init ( MeshS pM  ) 

Initialize send/receive buffers needed to swap iterates during Jacobi iterations.

Definition at line 1043 of file selfg_multigrid.c.

References ath_error(), calloc_3d_array(), MeshS::Domain, MeshS::DomainsPerLevel, error, DomainS::Grid, MeshS::NLevels, GridS::Nx, par_geti(), recv_buf, and send_buf.

Referenced by selfg_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void set_mg_bvals ( MGrid pMG  ) 

Sets BC for Jacobi iterates for MPI parallel jobs.

With self-gravity using multigrid, the boundary conditions at the edge of the Domain are held fixed. So only ghostzones associated with internal boundaries between MPI grids need to be passed.

This routine is largely a copy of set_bvals(). Order for updating boundary conditions must always be x1-x2-x3 in order to fill the corner cells properly

Definition at line 548 of file selfg_multigrid.c.

References ath_error(), MGrid::lx1_id, MGrid::lx2_id, MGrid::lx3_id, MGrid::Nx1, MGrid::Nx2, MGrid::Nx3, recv_buf, MGrid::rx1_id, MGrid::rx2_id, MGrid::rx3_id, swap_mg_ix1(), swap_mg_ix2(), swap_mg_ix3(), swap_mg_ox1(), swap_mg_ox2(), and swap_mg_ox3().

Referenced by Jacobi(), multig_3d(), and selfg_multig_3d().

Here is the call graph for this function:

Here is the caller graph for this function:

void swap_mg_ix1 ( MGrid pMG,
int  cnt,
int  swap_flag,
MPI_Request *  prq 
)

MPI_SWAP of boundary conditions, Inner x1 boundary.

This function does either a send (swap_flag=0), or receive (swap_flag=1) Largely copied from set_bvals/send_ix1 and set_bvals/receive_ix1

Definition at line 710 of file selfg_multigrid.c.

References ath_error(), MGrid::is, MGrid::je, jl, MGrid::js, ju, MGrid::ke, kl, MGrid::ks, ku, MGrid::lx1_id, MGrid::Nx3, MGrid::Phi, recv_buf, and send_buf.

Referenced by set_mg_bvals().

Here is the call graph for this function:

Here is the caller graph for this function:

void swap_mg_ix2 ( MGrid pMG,
int  cnt,
int  swap_flag,
MPI_Request *  prq 
)

MPI_SWAP of boundary conditions, Inner x2 boundary.

This function does either a send (swap_flag=0), or receive (swap_flag=1) Largely copied from set_bvals/send_ix2 and set_bvals/receive_ix2

Definition at line 826 of file selfg_multigrid.c.

References ath_error(), MGrid::ie, il, MGrid::is, iu, MGrid::js, MGrid::ke, kl, MGrid::ks, ku, MGrid::lx2_id, MGrid::Nx3, MGrid::Phi, and send_buf.

Referenced by set_mg_bvals().

Here is the call graph for this function:

Here is the caller graph for this function:

void swap_mg_ix3 ( MGrid pMG,
int  cnt,
int  swap_flag,
MPI_Request *  prq 
)

MPI_SWAP of boundary conditions, Inner x3 boundary.

This function does either a send (swap_flag=0), or receive (swap_flag=1) Largely copied from set_bvals/send_ix3 and set_bvals/receive_ix3

Definition at line 940 of file selfg_multigrid.c.

References ath_error(), MGrid::ie, il, MGrid::is, iu, MGrid::je, jl, MGrid::js, ju, MGrid::ks, MGrid::lx3_id, MGrid::Phi, and send_buf.

Referenced by set_mg_bvals().

Here is the call graph for this function:

Here is the caller graph for this function:

void swap_mg_ox1 ( MGrid pMG,
int  cnt,
int  swap_flag,
MPI_Request *  prq 
)

MPI_SWAP of boundary conditions, Outer x1 boundary.

This function does either a send (swap_flag=0), or receive (swap_flag=1) Largely copied from set_bvals/send_ox1 and set_bvals/receive_ox1

Definition at line 768 of file selfg_multigrid.c.

References ath_error(), MGrid::ie, MGrid::je, jl, MGrid::js, ju, MGrid::ke, kl, MGrid::ks, ku, MGrid::Nx3, MGrid::Phi, recv_buf, MGrid::rx1_id, and send_buf.

Referenced by set_mg_bvals().

Here is the call graph for this function:

Here is the caller graph for this function:

void swap_mg_ox2 ( MGrid pMG,
int  cnt,
int  swap_flag,
MPI_Request *  prq 
)

MPI_SWAP of boundary conditions, Outer x2 boundary.

This function does either a send (swap_flag=0), or receive (swap_flag=1) Largely copied from set_bvals/send_ix2 and set_bvals/receive_ix2

Definition at line 883 of file selfg_multigrid.c.

References ath_error(), MGrid::ie, il, MGrid::is, iu, MGrid::je, MGrid::ke, kl, MGrid::ks, ku, MGrid::Nx3, MGrid::Phi, MGrid::rx2_id, and send_buf.

Referenced by set_mg_bvals().

Here is the call graph for this function:

Here is the caller graph for this function:

void swap_mg_ox3 ( MGrid pMG,
int  cnt,
int  swap_flag,
MPI_Request *  prq 
)

MPI_SWAP of boundary conditions, Outer x3 boundary.

This function does either a send (swap_flag=0), or receive (swap_flag=1) Largely copied from set_bvals/send_ix1 and set_bvals/receive_ix1

Definition at line 992 of file selfg_multigrid.c.

References ath_error(), MGrid::ie, il, MGrid::is, iu, MGrid::je, jl, MGrid::js, ju, MGrid::ke, MGrid::Phi, MGrid::rx3_id, and send_buf.

Referenced by set_mg_bvals().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Real*** error
double * recv_buf = NULL [static]

Definition at line 39 of file selfg_multigrid.c.

Referenced by selfg_multig_3d_init(), set_mg_bvals(), swap_mg_ix1(), and swap_mg_ox1().

double* send_buf = NULL [static]