General initialization of the nested mesh hierarchy. More...
Go to the source code of this file.
Functions | |
static int | dom_decomp (const int Nx, const int Ny, const int Nz, const int Np, int *pNGx, int *pNGy, int *pNGz) |
calls auto domain decomposition functions | |
static int | dom_decomp_2d (const int Nx, const int Ny, const int Np, int *pNGx, int *pNGy) |
finds optimum domain decomposition in 2D | |
static int | dom_decomp_3d (const int Nx, const int Ny, const int Nz, const int Np, int *pNGx, int *pNGy, int *pNGz) |
finds optimum domain decomposition in 3D | |
void | init_mesh (MeshS *pM) |
General initialization of the nested mesh hierarchy. | |
void | get_myGridIndex (DomainS *pD, const int myID, int *pi, int *pj, int *pk) |
Searches GData[][][] array to find i,j,k components of block being updated on this processor. |
General initialization of the nested mesh hierarchy.
PURPOSE: General initialization of the nested mesh hierarchy. Works for both nested and uniform meshes, on single and multiple processors. Each Mesh contains one or more levels, each level contains one or more Domains (regions with the same grid resolution), and depending on the parallelization each Domain contains one or more Grids (however there can never be more than one Grid per Domain being updated on any given processor). In the Mesh, this hierarchy is stored as an "array" of Domains indexed as Domain[nlevel][ndomain]. Since ndomain is different for each level, this "array" is not square, (really it is nlevel pointers, each to ndomain[nlevel] Domains).
Note for a uniform mesh on a single processor:
For a nested mesh on multiple processors, there is no relationship between these quantaties in general.
This function:
This function supercedes init_domain() from v3.2. The init_grid() function initializes the data in each Grid structure in each Domain, including finding all child and parent Grids with SMR.
CONTAINS PUBLIC FUNCTIONS:
PRIVATE FUNCTION PROTOTYPES:
Definition in file init_mesh.c.
static int dom_decomp | ( | const int | Nx, | |
const int | Ny, | |||
const int | Nz, | |||
const int | Np, | |||
int * | pNGx, | |||
int * | pNGy, | |||
int * | pNGz | |||
) | [static] |
calls auto domain decomposition functions
Calls apropriate 2D or 3D auto decomposition routines Functions written by T.A.G., added May 2007.
Definition at line 886 of file init_mesh.c.
References dom_decomp_2d(), and dom_decomp_3d().
Referenced by init_mesh().
static int dom_decomp_2d | ( | const int | Nx, | |
const int | Ny, | |||
const int | Np, | |||
int * | pNGx, | |||
int * | pNGy | |||
) | [static] |
finds optimum domain decomposition in 2D
Pptimizes domain decomposition in 2D.
The TOTAL amount of data communicated (summed over all processes and all INTERNAL boundaries) divided by 2*nghost (where the 2 is for two messages per internal interface) is computed and stored in the variable I, the minimum of which is I0. This assumes that in the x-direction we communicate only computational cells, while in the y-direction we comunicate the computational cells and x-direction ghost cells. Then Total x-communication is (rx - 1)*Ny*(2*nghost) Total y-communication is (ry - 1)*(Nx + rx*(2*nghost))*(2*nghost)
Definition at line 923 of file init_mesh.c.
Referenced by dom_decomp(), and dom_decomp_3d().
static int dom_decomp_3d | ( | const int | Nx, | |
const int | Ny, | |||
const int | Nz, | |||
const int | Np, | |||
int * | pNGx, | |||
int * | pNGy, | |||
int * | pNGz | |||
) | [static] |
finds optimum domain decomposition in 3D
Optimizes domain decomposition in 3D.
See the comments for dom_decomp_2d() for more about the algorithm
Definition at line 997 of file init_mesh.c.
References dom_decomp_2d(), rx, ry, and rz.
Referenced by dom_decomp().
void get_myGridIndex | ( | DomainS * | pD, | |
const int | myID, | |||
int * | pi, | |||
int * | pj, | |||
int * | pk | |||
) |
Searches GData[][][] array to find i,j,k components of block being updated on this processor.
Definition at line 861 of file init_mesh.c.
References ath_error(), DomainS::GData, GridsDataS::ID_Comm_world, and DomainS::NGrid.
Referenced by bvals_grav(), bvals_grav_init(), bvals_mhd(), bvals_mhd_init(), exchange_feedback_init(), grid_limit(), init_grid(), integrate_3d_ctu(), RemapEy_ix1(), RemapEy_ox1(), set_bvals_particle_init(), ShearingSheet_ix1(), and ShearingSheet_ox1().
void init_mesh | ( | MeshS * | pM | ) |
General initialization of the nested mesh hierarchy.
Definition at line 84 of file init_mesh.c.
References ath_error(), MeshS::BCFlag_ix1, MeshS::BCFlag_ix2, MeshS::BCFlag_ix3, MeshS::BCFlag_ox1, MeshS::BCFlag_ox2, MeshS::BCFlag_ox3, calloc_1d_array(), calloc_3d_array(), DomainS::Comm_Children, DomainS::Comm_Domain, DomainS::Comm_Parent, dim, GridsDataS::Disp, DomainS::Disp, dom_decomp(), MeshS::Domain, MeshS::DomainsPerLevel, DomainS::DomNumber, DomainS::dx, MeshS::dx, free_1d_array(), DomainS::GData, DomainS::Grid, DomainS::Group_Children, DomainS::Group_Domain, GridsDataS::ID_Comm_Children, GridsDataS::ID_Comm_Domain, GridsDataS::ID_Comm_Parent, GridsDataS::ID_Comm_world, SideS::ijkl, SideS::ijkr, DomainS::InputBlock, DomainS::Level, DomainS::MaxX, DomainS::MinX, myID_Comm_world, n, DomainS::NGrid, MeshS::NLevels, MeshS::nstep, GridsDataS::Nx, DomainS::Nx, MeshS::Nx, Nx, MeshS::outfilename, par_exist(), par_getd(), par_geti(), par_geti_def(), par_gets(), par_seti(), DomainS::RootMaxX, MeshS::RootMaxX, DomainS::RootMinX, MeshS::RootMinX, and MeshS::time.
Referenced by main().