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

Functions

void scale_linear_system (int *indptr_diag, int *cols_diag, double *vals_diag, int *indptr_off_diag, int *cols_off_diag, double *vals_off_diag, double *b, double *x, double *scale_vect, int local_size, int size, int rank, int *ghosts, int nghost)
 Scales a linear of systems based on max row entry, modifies matrix values and saves a scale_vect for later reverse scaling. More...
 
void unscale_linear_system (double *x, double *x0, double *scale_vect, int local_size)
 Rescales solution after a linear solve of system that was scaled using scale_linear_system. More...
 

Detailed Description

This file has functions responsible for scaling the linear system in split CSR format based on max row entry

Function Documentation

◆ scale_linear_system()

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

Scales a linear of systems based on max row entry, modifies matrix values and saves a scale_vect for later reverse scaling.

Author
Mark Loveland
Bug:
none
Warning
none
Parameters
[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,out]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,out]vals_off_diag(double*) - array of doubles that are the nonzero entries of off-diagonal block (local to process) in split CSR matrix
[in,out]b(double*) - scaled rhs of the linear system Ax=b
[in,out]x(double*) - scaled solution of the linear system Ax=b
[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

◆ unscale_linear_system()

void unscale_linear_system ( double *  x,
double *  x0,
double *  scale_vect,
int  local_size 
)

Rescales solution after a linear solve of system that was scaled using scale_linear_system.

Author
Mark Loveland
Bug:
none
Warning
none
Parameters
[in,out]x(double*) - solution vector that comes from solving the prescaled Ax=b system
[in]x0(double*) - the initial solution passed to iterative solver (after scaling)
[in]scale_vect(double*) - the vector that was used for scaling
[in]local_size(int) - number of d.o.f owned by process
Note
To be paired with a call to scale_linear_system BEFORE solve