AdH Kraken 0.0.0
Next generation Adaptive Hydraulics
Loading...
Searching...
No Matches
bcgstab_solver.c File Reference
#include "adh.h"

Functions

int solve_linear_sys_bcgstab (double *x, int *indptr_diag, int *cols_diag, double *vals_diag, int *indptr_off_diag, int *cols_off_diag, double *vals_off_diag, double *b, double *scale_vect, int local_size, int size, int rank, int *ghosts, int nghost)
 Solves a system of already scaled equations in split CSR format using bcgstab this is also assuming there is some scaling prior to solve in scale_vect. If no scaling, then scale_vect needs to be all 1's. Preconditioning of block diagonal (local to process) via umfpack is employed. More...
 
void umfpack_clear (void)
 Short helper function that clears umfpack structures. More...
 
int prep_umfpack (int *indptr_diag, int *cols_diag, double *vals_diag, int nrow)
 Function that pre-factors matrix, used for preconditioner, modifies the static Symbolic and Numeric structures. More...
 
int solve_umfpack (double *x, int *indptr_diag, int *cols_diag, double *vals_diag, double *b, int nrow)
 Function that solves system Ax=b using umfpack, provided A is in CSR format. More...
 
void free_bcgstab (void)
 Frees all data structures allocate within this file. More...
 

Detailed Description

This file has functions responsible for solving linear system in split CSR format using BCG-stabilized method

Function Documentation

◆ free_bcgstab()

void free_bcgstab ( void  )

Frees all data structures allocate within this file.

Author
Mark Loveland
Bug:
none
Warning
none

◆ prep_umfpack()

int prep_umfpack ( int *  indptr_diag,
int *  cols_diag,
double *  vals_diag,
int  nrow 
)

Function that pre-factors matrix, used for preconditioner, modifies the static Symbolic and Numeric structures.

Author
Mark Loveland
Bug:
none
Warning
none
Parameters
[in]indptr_diag(int*) - array of integers with first/last indeces of each row in CSR matrix
[in]cols_diag(int*) - array of integers that are local (to process) column numbers
[in]vals_diag(double*) - the values of the sparse matrix
[in]nrow(int) - number of equations in system /returns (integer) status of umfpack routine

◆ solve_linear_sys_bcgstab()

int solve_linear_sys_bcgstab ( double *  x,
int *  indptr_diag,
int *  cols_diag,
double *  vals_diag,
int *  indptr_off_diag,
int *  cols_off_diag,
double *  vals_off_diag,
double *  b,
double *  scale_vect,
int  local_size,
int  size,
int  rank,
int *  ghosts,
int  nghost 
)

Solves a system of already scaled equations in split CSR format using bcgstab this is also assuming there is some scaling prior to solve in scale_vect. If no scaling, then scale_vect needs to be all 1's. Preconditioning of block diagonal (local to process) via umfpack is employed.

Ref: H. A. vanderVorst, "Bi-CGStab: A fast and smoothly converging variant to Bi-CG for the solution of nonsymmetric systems", SIAM J. Sci. Statist. Comput., 13 (1992), pp. 631-644.

or C. T. Kelley, "Iterative Methods for Linear and Nonlinear Equations", SIAM, Philadelphia, PA, 1995.

In general, the Bi-CGStab solver constructs bases for the Krylov subspaces (A,b) and (A^T,c), where b is the right-hand-side vector and c is usually chosen so that c=b. The method may break down, although this does not seem to happen often in practice.

Author
Mark Loveland
Bug:
none
Warning
none
Parameters
[in,out]x(double*) - solution to system Ax=b
[in]indptr_diag(int*) - indeces of first/last index for each row in diagonal block (local to process) in split CSR matrix
[in]cols_diag(int*) - column numbers (local to process) of diagonal block in split CSR matrix
[in]vals_diag(double*) - array of doubles that are the nonzero entries of diagonal block (local to process) in split CSR matrix
[in]indptr_off_diag(int*) - indeces of first/last index for each row in off-diagonal block (local to process) in split CSR matrix
[in]cols_off_diag(int*) - column numbers (global) of off-diagonal block in split CSR matrix
[in]vals_off_diag(double*) - array of doubles that are the nonzero entries of off-diagonal block (local to process) in split CSR matrix
[in]b(double*) - scaled rhs of the linear system
[in]scale_vect(double*) - the vector that scaled the system of equations prior to solve, used for rescaling after solve is finished
[in]local_size(int) - number of equations (rows in the matrix) owned by the process
[in]size(int) - number of rows + number of ghost d.o.f.s present
[in]rank(int) - MPI rank
[in]ghosts(int*) - array of global dof numbers that are ghosts on the process
[in]nghost(int) - number of ghost d.o.f.s on the process
Returns
integer that is a code if the solve worked or not
Note

◆ solve_umfpack()

int solve_umfpack ( double *  x,
int *  indptr_diag,
int *  cols_diag,
double *  vals_diag,
double *  b,
int  nrow 
)

Function that solves system Ax=b using umfpack, provided A is in CSR format.

Author
Mark Loveland
Bug:
none
Warning
none
Parameters
[in,out]x(double*) - solution array to system Ax=b
[in]indptr_diag(int*) - array of integers with first/last indeces of each row in CSR matrix
[in]cols_diag(int*) - array of integers that are local (to process) column numbers
[in]vals_diag(double*) - the values of the sparse matrix
[in]b(double*) - rhs of system Ax=b
[in]nrow(int) - number of equations in system /returns (integer) status of umfpack routine

◆ umfpack_clear()

void umfpack_clear ( void  )

Short helper function that clears umfpack structures.

Author
Mark Loveland
Bug:
none
Warning
none
Note
Clears structure that factors matrix, should this be done after each solve or only after refinement?