AMR: Adaptive Mesh Refinement

Contents

rhea_amr.h
rhea_stokes_problem_amr.h


rhea_amr.h [source]

Typedefs

typedef double (*rhea_amr_flag_elements_fn_t)(p4est_t *p4est, void *data, p4est_gloidx_t *n_flagged_coar, p4est_gloidx_t *n_flagged_refn)

Flags elements of a p4est mesh for coarsening/refinement.

Param p4est:

[in] p4est mesh

Param [in/out]:

data User data

Param n_flagged_coar:

[out] #elements flagged for coarsening

Param n_flagged_refn:

[out] #elements flagged for refinement

Return:

Relative #elements flagged for coarsening + refinement

typedef void (*rhea_amr_data_initialize_fn_t)(p4est_t *p4est, void *data)

Initializes data before mesh is altered through coarsening/refinement.

Param p4est:

[in] p4est mesh before AMR

Param [in/out]:

data User data

typedef void (*rhea_amr_data_finalize_fn_t)(p4est_t *p4est, void *data)

Finalizes data after AMR is finished.

Param p4est:

[in] p4est mesh after AMR

Param [in/out]:

data User data

typedef void (*rhea_amr_data_project_fn_t)(p4est_t *p4est, void *data)

Projects data to an adapted (i.e., coarsened/refined) mesh.

Param p4est:

[in] Adapted p4est mesh

Param [in/out]:

data User data

typedef void (*rhea_amr_data_partition_fn_t)(p4est_t *p4est, void *data)

Partitions data from one mesh to another.

Param p4est:

[in] Adapted & partitioned p4est mesh

Param [in/out]:

data User data

typedef struct rhea_amr_refine_depth_data rhea_amr_refine_depth_data_t

Enums

enum rhea_amr_flag_t

Values:

enumerator RHEA_AMR_FLAG_COARSEN = -1
enumerator RHEA_AMR_FLAG_NO_CHANGE = 0
enumerator RHEA_AMR_FLAG_REFINE = +1
enumerator RHEA_AMR_FLAG_INIT = 101

Functions

void rhea_amr_add_options(ymir_options_t *opt_sup)

Defines options and adds them as sub-options.

void rhea_amr_perfmon_init(const int activate, const int skip_if_active)

Initializes performance counters.

void rhea_amr_perfmon_print(sc_MPI_Comm mpicomm, const int print_wtime, const int print_n_calls, const int print_flops)

Prints statistics collected by performance monitors.

int rhea_amr_init_refine(p4est_t *p4est, int level_min, int level_max, rhea_domain_options_t *domain_options)

Performs initial refinement of a p4est mesh.

int rhea_amr_flag_is_valid(const rhea_amr_flag_t amr_flag)

Checks whether an element has a valid AMR flag, i.e., one of coarsening/refinement/no change.

int rhea_amr(p4est_t *p4est, const int n_cycles, const int n_cycles_uniform, const double flagged_elements_thresh_begin, const double flagged_elements_thresh_cycle, rhea_amr_flag_elements_fn_t flag_elements_fn, void *flag_elements_data, rhea_amr_data_initialize_fn_t data_initialize_fn, rhea_amr_data_finalize_fn_t data_finalize_fn, rhea_amr_data_project_fn_t data_project_fn, rhea_amr_data_partition_fn_t data_partition_fn, void *data)

Performs adaptive coarsening and refinement of a p4est mesh.

int rhea_amr_coarsen_all_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
int rhea_amr_refine_all_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
int rhea_amr_coarsen_to_level_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
int rhea_amr_refine_to_level_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
int rhea_amr_coarsen_half_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
int rhea_amr_refine_half_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
int rhea_amr_refine_depth_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
int rhea_amr_refine_depth_box_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
double rhea_amr_get_global_num_flagged(const p4est_locidx_t n_flagged_coar_loc, const p4est_locidx_t n_flagged_refn_loc, p4est_t *p4est, p4est_gloidx_t *n_flagged_coar_glo, p4est_gloidx_t *n_flagged_refn_glo)

Sums local contributions to get the global number of flagged quadrants.

Parameters:
  • n_flagged_coar_loc[in] Local #elements flagged for coarsening

  • n_flagged_refn_loc[in] Local #elements flagged for refinement

  • p4est[in] p4est mesh

  • n_flagged_coar_glo[out] Global #elements flagged for coarsening

  • n_flagged_refn_glo[out] Global #elements flagged for refinement

Returns:

Relative #elements flagged for coarsening + refinement

double rhea_amr_flag_coarsen_half_fn(p4est_t *p4est, void *data, p4est_gloidx_t *n_flagged_coar, p4est_gloidx_t *n_flagged_refn)

Flags half of domain for coarsening/refinement. (Callback function of type rhea_amr_flag_elements_fn_t)

double rhea_amr_flag_refine_half_fn(p4est_t *p4est, void *data, p4est_gloidx_t *n_flagged_coar, p4est_gloidx_t *n_flagged_refn)
double rhea_amr_flag_coarsen_to_level_fn(p4est_t *p4est, void *data, p4est_gloidx_t *n_flagged_coar, p4est_gloidx_t *n_flagged_refn)

Flags for coarsening/refinement until reaching a specific max/min level. (Callback function of type rhea_amr_flag_elements_fn_t)

double rhea_amr_flag_refine_to_level_fn(p4est_t *p4est, void *data, p4est_gloidx_t *n_flagged_coar, p4est_gloidx_t *n_flagged_refn)
struct rhea_amr_refine_depth_data

Public Members

int *depth
int count
int level_min
double p4est_zmax

rhea_stokes_problem_amr.h [source]

Defines

RHEA_STOKES_PROBLEM_AMR_VERBOSE (1)

RHEA_STOKES_PROBLEM_AMR

Provides the adaptive mesh refinement (AMR) for Stokes problems.

RHEA_STOKES_PROBLEM_AMR_VERBOSE_VTK (0)

Functions

void rhea_stokes_problem_amr_add_options(ymir_options_t *opt_sup)

Defines options and adds them as sub-options.

void rhea_stokes_problem_amr_process_options()

Processes options and stores them.

void rhea_stokes_problem_amr_set_init_type_name(const char *type_name)

Sets AMR types.

void rhea_stokes_problem_amr_set_nonlinear_type_name(const char *type_name)
void rhea_stokes_problem_amr_set_solution_type_name(const char *type_name)
int rhea_stokes_problem_init_amr(rhea_stokes_problem_t *stokes_problem, p4est_t *p4est, rhea_discretization_options_t *discr_options)

Runs AMR for the initial mesh.

int rhea_stokes_problem_nonlinear_amr(rhea_stokes_problem_t *stokes_problem, p4est_t *p4est, rhea_discretization_options_t *discr_options, const int nonlinear_iter)

Runs AMR at nonlinear iterations.

int rhea_stokes_problem_solution_amr(rhea_stokes_problem_t *stokes_problem, p4est_t *p4est, rhea_discretization_options_t *discr_options)

Runs AMR for the solution.

int rhea_stokes_problem_amr(rhea_stokes_problem_t *stokes_problem, p4est_t *p4est, rhea_discretization_options_t *discr_options)