9.2
general documentation
cs_mesh_adaptive_refinement.cpp File Reference
#include "base/cs_defs.h"
#include <float.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <mpi.h>
#include "bft/bft_error.h"
#include "bft/bft_printf.h"
#include "fvm/fvm_io_num.h"
#include "fvm/fvm_triangulate.h"
#include "alge/cs_cell_to_vertex.h"
#include "alge/cs_gradient.h"
#include "alge/cs_matrix_default.h"
#include "base/cs_array.h"
#include "base/cs_boundary_conditions.h"
#include "base/cs_ext_neighborhood.h"
#include "base/cs_field.h"
#include "base/cs_field_default.h"
#include "base/cs_field_operator.h"
#include "base/cs_field_pointer.h"
#include "base/cs_math.h"
#include "base/cs_mem.h"
#include "base/cs_parall.h"
#include "base/cs_renumber.h"
#include "base/cs_physical_constants.h"
#include "base/cs_renumber_update.h"
#include "base/cs_timer_stats.h"
#include "mesh/cs_mesh.h"
#include "mesh/cs_mesh_adjacencies.h"
#include "mesh/cs_mesh_coarsen.h"
#include "mesh/cs_mesh_coherency.h"
#include "mesh/cs_mesh_location.h"
#include "mesh/cs_mesh_quantities.h"
#include "mesh/cs_mesh_refine.h"
#include "mesh/cs_redistribute.h"
#include "mesh/cs_partition.h"
#include "mesh/cs_mesh_adaptive_refinement.h"
+ Include dependency graph for cs_mesh_adaptive_refinement.cpp:

Functions

static void _build_cell_r_level (cs_mesh_t *m, int *c_r_level)
 
static void _realloc_and_update_field_refinement (cs_field_t *f, const cs_lnum_t n_old, const cs_lnum_t o2n_idx[], const cs_lnum_t new_idx[], const cs_real_3_t cog[], const cs_real_3_t cell_cen[], const cs_real_t measure[])
 
static void _realloc_and_update_bc_coeffs_refinement (const cs_field_t *f, const cs_lnum_t n_old, const cs_lnum_t o2n_idx[])
 
static void _realloc_and_update_field_coarsening (cs_field_t *f, const cs_lnum_t n_old, const cs_lnum_t n2o_idx[], const cs_lnum_t n2o[], const cs_real_t measure[], const cs_lnum_t i_face_map[])
 
static void _realloc_and_update_bc_coeffs_coarsening (cs_field_t *f, const cs_lnum_t n_old, const cs_lnum_t n2o_idx[], const cs_lnum_t n2o[], const cs_real_t measure[])
 
static void _halo_sync_std_owner (cs_field_t *f, const cs_halo_t *halo)
 Sync a standard field. More...
 
static void _halo_sync_series_owner (cs_field_t *f, const cs_halo_t *halo)
 Sync a field which is a series owner and has subfields. More...
 
static void _halo_sync (cs_field_t *f)
 Sync a field. More...
 
static void _realloc_and_interp_after_refinement (cs_mesh_t *mesh, int location_id, const cs_lnum_t n_i_elts, const cs_lnum_t o2n_idx[], const cs_lnum_t new_idx[], const cs_real_3_t o_cog[], const cs_real_3_t n_cog[], const cs_real_t measure[])
 
static void _realloc_and_interp_after_coarsening (cs_mesh_t *mesh, int location_id, const cs_lnum_t n_i_elts, const cs_lnum_t n2o_idx[], const cs_lnum_t n2o[], const cs_real_t measure[], const cs_lnum_t i_face_map[])
 
static void _propagate_refinement (cs_mesh_t *m, int indic[])
 
static void _build_coarsen_refine_buffer_zone (cs_mesh_t *mesh, int indic[])
 
static void _load_balance (cs_mesh_t *mesh)
 
static void _free_gradients (void)
 
static void _update_mesh_quantities (cs_mesh_t *mesh)
 
static void _update_boundary_conditions (void)
 
static void _update_amr_mesh_data (cs_mesh_t *mesh)
 
static void _refine_step (const int indic[])
 
static void _coarsen_step (const int indic[])
 
static void _amr_finalize (void)
 Finalize AMR. More...
 
void cs_adaptive_refinement_define (int n_layers, int nt_interval, cs_amr_indicator_t *indic_func, const void *indic_input, int interpolation, bool load_balance)
 Activation and Initializing af the global AMR structure. More...
 
void cs_adaptive_refinement_update_gradients (void)
 Compute field gradients when necessary (for fields interpolation) More...
 
void cs_adaptive_refinement_free_gradients (void)
 Free field gradients. More...
 
void cs_adaptive_refinement_step (void)
 Perform a refinement / coarsening step. More...
 

Variables

static cs_amr_info_t _amr_info
 
cs_amr_info_tcs_glob_amr_info = &_amr_info
 
static cs_timer_counter_t _amr_t_tot
 
static cs_timer_counter_t _amr_t_coarsen
 
static cs_timer_counter_t _amr_t_refine
 
static cs_timer_counter_t _amr_t_data
 
static cs_timer_counter_t _amr_t_load_balance
 
static cs_timer_counter_t _amr_t_renumber
 
static int _amr_stat_id = -1
 

Function Documentation

◆ _amr_finalize()

static void _amr_finalize ( void  )
static

Finalize AMR.

This simply logs associated timers.

◆ _build_cell_r_level()

static void _build_cell_r_level ( cs_mesh_t m,
int *  c_r_level 
)
static

◆ _build_coarsen_refine_buffer_zone()

static void _build_coarsen_refine_buffer_zone ( cs_mesh_t mesh,
int  indic[] 
)
static

◆ _coarsen_step()

static void _coarsen_step ( const int  indic[])
static

◆ _free_gradients()

static void _free_gradients ( void  )
static

◆ _halo_sync()

static void _halo_sync ( cs_field_t f)
static

Sync a field.

Parameters
[in]fpointer to cs_field_t

◆ _halo_sync_series_owner()

static void _halo_sync_series_owner ( cs_field_t f,
const cs_halo_t halo 
)
static

Sync a field which is a series owner and has subfields.

Parameters
[in]fpointer to cs_field_t
[in]halopointer to cs_halo_t

◆ _halo_sync_std_owner()

static void _halo_sync_std_owner ( cs_field_t f,
const cs_halo_t halo 
)
static

Sync a standard field.

Parameters
[in]fpointer to cs_field_t
[in]halopointer to cs_halo_t

◆ _load_balance()

static void _load_balance ( cs_mesh_t mesh)
static

◆ _propagate_refinement()

static void _propagate_refinement ( cs_mesh_t m,
int  indic[] 
)
static

◆ _realloc_and_interp_after_coarsening()

static void _realloc_and_interp_after_coarsening ( cs_mesh_t mesh,
int  location_id,
const cs_lnum_t  n_i_elts,
const cs_lnum_t  n2o_idx[],
const cs_lnum_t  n2o[],
const cs_real_t  measure[],
const cs_lnum_t  i_face_map[] 
)
static

◆ _realloc_and_interp_after_refinement()

static void _realloc_and_interp_after_refinement ( cs_mesh_t mesh,
int  location_id,
const cs_lnum_t  n_i_elts,
const cs_lnum_t  o2n_idx[],
const cs_lnum_t  new_idx[],
const cs_real_3_t  o_cog[],
const cs_real_3_t  n_cog[],
const cs_real_t  measure[] 
)
static

◆ _realloc_and_update_bc_coeffs_coarsening()

static void _realloc_and_update_bc_coeffs_coarsening ( cs_field_t f,
const cs_lnum_t  n_old,
const cs_lnum_t  n2o_idx[],
const cs_lnum_t  n2o[],
const cs_real_t  measure[] 
)
static

◆ _realloc_and_update_bc_coeffs_refinement()

static void _realloc_and_update_bc_coeffs_refinement ( const cs_field_t f,
const cs_lnum_t  n_old,
const cs_lnum_t  o2n_idx[] 
)
static

◆ _realloc_and_update_field_coarsening()

static void _realloc_and_update_field_coarsening ( cs_field_t f,
const cs_lnum_t  n_old,
const cs_lnum_t  n2o_idx[],
const cs_lnum_t  n2o[],
const cs_real_t  measure[],
const cs_lnum_t  i_face_map[] 
)
static

◆ _realloc_and_update_field_refinement()

static void _realloc_and_update_field_refinement ( cs_field_t f,
const cs_lnum_t  n_old,
const cs_lnum_t  o2n_idx[],
const cs_lnum_t  new_idx[],
const cs_real_3_t  cog[],
const cs_real_3_t  cell_cen[],
const cs_real_t  measure[] 
)
static

◆ _refine_step()

static void _refine_step ( const int  indic[])
static

◆ _update_amr_mesh_data()

static void _update_amr_mesh_data ( cs_mesh_t mesh)
static

◆ _update_boundary_conditions()

static void _update_boundary_conditions ( void  )
static

◆ _update_mesh_quantities()

static void _update_mesh_quantities ( cs_mesh_t mesh)
static

◆ cs_adaptive_refinement_define()

void cs_adaptive_refinement_define ( int  n_layers,
int  nt_interval,
cs_amr_indicator_t indic_func,
const void *  indic_input,
int  interpolation,
bool  load_balance 
)

Activation and Initializing af the global AMR structure.

Parameters
[in]n_layersnumber of layers of refinement around user criteria
[in]nt_intervaltime_step interval between adaptation steps
[in]indic_funcuser function marking cells that should be refined
[in]indic_inputinput for indic_func or nullptr
[in]load_balanceactivate load balancing post mesh adapation

◆ cs_adaptive_refinement_free_gradients()

void cs_adaptive_refinement_free_gradients ( void  )

Free field gradients.

◆ cs_adaptive_refinement_step()

void cs_adaptive_refinement_step ( void  )

Perform a refinement / coarsening step.

◆ cs_adaptive_refinement_update_gradients()

void cs_adaptive_refinement_update_gradients ( void  )

Compute field gradients when necessary (for fields interpolation)

Variable Documentation

◆ _amr_info

cs_amr_info_t _amr_info
static
Initial value:
= {
false,
0,
cs_time_control_t(-1, -1, -1, false, false, false),
nullptr,
nullptr,
nullptr,
nullptr,
0,
nullptr,
false
}
Definition: cs_time_control.h:92

◆ _amr_stat_id

int _amr_stat_id = -1
static

◆ _amr_t_coarsen

cs_timer_counter_t _amr_t_coarsen
static

◆ _amr_t_data

cs_timer_counter_t _amr_t_data
static

◆ _amr_t_load_balance

cs_timer_counter_t _amr_t_load_balance
static

◆ _amr_t_refine

cs_timer_counter_t _amr_t_refine
static

◆ _amr_t_renumber

cs_timer_counter_t _amr_t_renumber
static

◆ _amr_t_tot

cs_timer_counter_t _amr_t_tot
static

◆ cs_glob_amr_info

cs_amr_info_t* cs_glob_amr_info = &_amr_info