Utility functions used with laplacian.c.
More...
#include "laplacian.h"
Utility functions used with laplacian.c.
|
void | init_masa (pstruct *model) |
| Initializes MASA library and applies right-hand side forcing function at all solution points. More...
|
|
void | enforce_dirichlet_bc (const int row_id, const int col_id, const double value, pstruct *model) |
| Enforces a Dirichlet BC in the model system by nullifying all but the diagonal entry for the row corresponding to a given solution value. The model RHS forcing function is set to the desired Dirchlet value and the diagonal is set to unity to enforce the desired constraint. More...
|
|
void | print_matrix (pstruct *model) |
| Prints model system matrix and right-hand side vector to stdout. More...
|
|
void | assemble_matrix (const int fd_method, pstruct *model) |
| Assembles system matrix entries using a finite-difference approximation. The fd_method parameter controls the choice of underlying FD stencil. More...
|
|
void | apply_bcs (pstruct *model) |
|
void | solve_gauss (pstruct *model) |
|
int | converged (double *a, double *b, double eps, int n, double *diff) |
|
void | solve_cg (pstruct *model) |
|
double | compute_l2_error (pstruct *model) |
|
void | compute_error (pstruct *model) |
|
assemble_matrix |
( |
const int |
fd_method, |
|
|
pstruct * |
model |
|
) |
| |
Assembles system matrix entries using a finite-difference approximation. The fd_method parameter controls the choice of underlying FD stencil.
- Parameters
-
fd_method | Desired finite-difference stencil |
model | Pointer to the primary model data-structure |
enforce_dirichlet_bc |
( |
const int |
row_id, |
|
|
const int |
col_id, |
|
|
const double |
value, |
|
|
pstruct * |
model |
|
) |
| |
Enforces a Dirichlet BC in the model system by nullifying all but the diagonal entry for the row corresponding to a given solution value. The model RHS forcing function is set to the desired Dirchlet value and the diagonal is set to unity to enforce the desired constraint.
- Parameters
-
row_id | Row index to enforce the constraint |
col_id | Column index to enforce the constraint |
value | Desired solution value |
model | Pointer to the primary model data-structure |
Initializes MASA library and applies right-hand side forcing function at all solution points.
- Parameters
-
model | Pointer to the primary model data-structure |
Prints model system matrix and right-hand side vector to stdout.
- Parameters
-
model | Pointer to the primary model data-structure |