AmrManager
Functions
-
double quad_dS(double dx)
compute cell face area, handle 2D/3D
- Parameters:
dx – [in] The length of a quadrant
- Returns:
The face area of a quadrant
-
double quad_dV(double dx)
compute cell volume, handle 2D/3D
- Parameters:
dx – [in] The length of a quadrant
- Returns:
The volume of a quadrant
-
class AmrManager
- #include “AmrManager.h”
Amr manager to handle amr cycle operations.
A AmrManager object handles all the operations related to adaptive mesh refinement through the p4est library. It relies mostly on p4est wrap (see p4est_wrap.h). It also handles p4est connectivity limited to brick (see p4est_connectivity.h) in canoP.
Public Functions
-
AmrManager(SettingManager *stg_mgr, MPI_Comm mpicomm, int qdata_t_sizeof)
We need to pass here qdata size to initialize p4est struct.
- Parameters:
stg_mgr – [in] a SettingManager object (to parse input setting file)
mpicomm – [in] MPI communicator
qdata_t_sizeof – [in] size of qdata_t hold by each p4est quadrant
-
~AmrManager()
-
p4est_connectivity_t *get_connectivity()
get the p4est brick connectivity struct used in canoP
Check p4est_connectivity.h for details.
- Returns:
a p4est connectivity structure
-
int adapt()
Perform p4est_wrap_adapt on p4est wrap stucture.
Check p4est_wrap.h for details.
- Returns:
1 if the forest changed 0 otherwise
-
int partition()
Perform p4est_wrap_partition on p4est wrap stucture.
Check p4est_wrap.h for details.
- Returns:
1 if the forest changed 0 otherwise
-
void complete()
Perform p4est_wrap_complete on p4est wrap stucture.
Check p4est_wrap.h for details.
-
double quad_dx(p4est_quadrant_t *quad)
Compute the real length of a quadrant.
This function assumes the tree in which the quadrant resides is a square/cube.
- Parameters:
quad – [in] A p4est quadrant.
- Returns:
The length of the quadrant.
-
void quad_centre(p4est_topidx_t tree, p4est_quadrant_t *quad, double x[3])
Compute the coordinates of the center of a quadrant.
Uses the p4est_qcoord_to_vertex() function to compute the coordinates of the lower left corner and the quadrant_length() function to compute the length of the quadrant. The center is then: x_c = x_0 + h / 2
- Parameters:
tree – [in] The tree id of the tree quad belongs to.
quad – [in] A p4est quadrant.
xyz – [out] The coordinates of the center.
Public Members
-
SettingManager *m_stg_mgr
pointer to the setting manager
-
p4est_wrap_t *m_wrap
p4est structures wrapper.
-
double m_ltree
physical size of a p4est tree (default 1.0)
-
int m_min_quadrants
minimal number of quadrants per MPI processor (default 16)
-
int m_min_refine
minimum level of refinement (default 5)
-
int m_max_refine
maximum level of refinement (default 7)
-
double m_epsilon_refine
threshold value used in refine callback (default 0.1)
-
double m_epsilon_coarsen
threshold value used in coarsen callback (default 0.1)
-
int m_ntree_x
number of p4est trees in the x direction (default 1)
-
int m_ntree_y
number of p4est trees in the y direction (default 1)
-
int m_ntree_z
number of p4est trees in the z direction (default 1)
-
int m_periodic_x
periodicity in the x direction (default 0, options 0 or 1)
-
int m_periodic_y
periodicity in the y direction (default 0, options 0 or 1)
-
int m_periodic_z
periodicity in the z direction (default 0, options 0 or 1)
-
int m_minlevel
the min level over MPI in the forest
-
int m_maxlevel
the max level over MPI in the forest
-
int m_restart_enabled
is this a restart run ? (default 0, options 0 or 1)
-
std::string m_restart_filename
filename of data from a previous run (default data.p4est)
-
AmrManager(SettingManager *stg_mgr, MPI_Comm mpicomm, int qdata_t_sizeof)