# CPU Specifics¶

## cpu-analytic-diffusion¶

### analytic_main.c¶

Warning

doxygenfile: Cannot find file “analytic_main.c

## cpu-serial-diffusion¶

### serial_boundaries.c¶

Implementation of boundary condition functions without threading.

Functions

void apply_initial_conditions(fp_t **conc_old, const int nx, const int ny, const int nm)

Initialize flat composition field with fixed boundary conditions.

The boundary conditions are fixed values of $$c_{hi}$$ along the lower-left half and upper-right half walls, no flux everywhere else, with an initial values of $$c_{lo}$$ everywhere. These conditions represent a carburizing process, with partial exposure (rather than the entire left and right walls) to produce an inhomogeneous workload and highlight numerical errors at the boundaries.

void apply_boundary_conditions(fp_t **conc, const int nx, const int ny, const int nm)

Set fixed value $$(c_{hi})$$ along left and bottom, zero-flux elsewhere.

### serial_discretization.c¶

Implementation of boundary condition functions without threading.

Functions

void compute_convolution(fp_t **const conc_old, fp_t **conc_lap, fp_t **const mask_lap, const int nx, const int ny, const int nm)

Perform the convolution of the mask matrix with the composition matrix.

If the convolution mask is the Laplacian stencil, the convolution evaluates the discrete Laplacian of the composition field. Other masks are possible, for example the Sobel filters for edge detection. This function is general purpose: as long as the dimensions nx, ny, and nm are properly specified, the convolution will be correctly computed.

void update_composition(fp_t **conc_old, fp_t **conc_lap, fp_t **conc_new, const int nx, const int ny, const int nm, const fp_t D, const fp_t dt)

Update composition field using explicit Euler discretization (forward-time centered space)

## cpu-openmp-diffusion¶

### openmp_boundaries.c¶

Implementation of boundary condition functions with OpenMP threading.

Functions

void apply_initial_conditions(fp_t **conc_old, const int nx, const int ny, const int nm)

Initialize flat composition field with fixed boundary conditions.

The boundary conditions are fixed values of $$c_{hi}$$ along the lower-left half and upper-right half walls, no flux everywhere else, with an initial values of $$c_{lo}$$ everywhere. These conditions represent a carburizing process, with partial exposure (rather than the entire left and right walls) to produce an inhomogeneous workload and highlight numerical errors at the boundaries.

void apply_boundary_conditions(fp_t **conc, const int nx, const int ny, const int nm)

Set fixed value $$(c_{hi})$$ along left and bottom, zero-flux elsewhere.

### openmp_discretization.c¶

Implementation of boundary condition functions with OpenMP threading.

Functions

void compute_convolution(fp_t **const conc_old, fp_t **conc_lap, fp_t **const mask_lap, const int nx, const int ny, const int nm)

Perform the convolution of the mask matrix with the composition matrix.

If the convolution mask is the Laplacian stencil, the convolution evaluates the discrete Laplacian of the composition field. Other masks are possible, for example the Sobel filters for edge detection. This function is general purpose: as long as the dimensions nx, ny, and nm are properly specified, the convolution will be correctly computed.

void update_composition(fp_t **conc_old, fp_t **conc_lap, fp_t **conc_new, const int nx, const int ny, const int nm, const fp_t D, const fp_t dt)

Update composition field using explicit Euler discretization (forward-time centered space)

## cpu-tbb-diffusion¶

### tbb_boundaries.cpp¶

Implementation of boundary condition functions with TBB threading.

Functions

void apply_initial_conditions(fp_t **conc_old, const int nx, const int ny, const int nm)

Initialize flat composition field with fixed boundary conditions.

The boundary conditions are fixed values of $$c_{hi}$$ along the lower-left half and upper-right half walls, no flux everywhere else, with an initial values of $$c_{lo}$$ everywhere. These conditions represent a carburizing process, with partial exposure (rather than the entire left and right walls) to produce an inhomogeneous workload and highlight numerical errors at the boundaries.

void apply_boundary_conditions(fp_t **conc, const int nx, const int ny, const int nm)

Set fixed value $$(c_{hi})$$ along left and bottom, zero-flux elsewhere.

### tbb_discretization.cpp¶

Implementation of boundary condition functions with TBB threading.

Functions

void compute_convolution(fp_t **const conc_old, fp_t **conc_lap, fp_t **const mask_lap, const int nx, const int ny, const int nm)

Perform the convolution of the mask matrix with the composition matrix.

If the convolution mask is the Laplacian stencil, the convolution evaluates the discrete Laplacian of the composition field. Other masks are possible, for example the Sobel filters for edge detection. This function is general purpose: as long as the dimensions nx, ny, and nm are properly specified, the convolution will be correctly computed.

void update_composition(fp_t **conc_old, fp_t **conc_lap, fp_t **conc_new, const int nx, const int ny, const int nm, const fp_t D, const fp_t dt)

Update composition field using explicit Euler discretization (forward-time centered space)

void check_solution_lambda(fp_t **conc_new, fp_t **conc_lap, const int nx, const int ny, const fp_t dx, const fp_t dy, const int nm, const fp_t elapsed, const fp_t D, fp_t *rss)