20#include "fasp_functs.h"
26#include "PreMGUtil.inl"
27#include "PreMGSmoother.inl"
50 const SHORT maxit = 3;
60 const REAL tol = param->
tol*1e-4;
63 INT l, i, lvl, num_cycle;
64 REAL alpha = 1.0, relerr;
73 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
74 printf(
"### DEBUG: n=%d, nnz=%d\n", mgl[0].A.row, mgl[0].
A.
nnz);
78 printf(
"FMG_level = %d, ILU_level = %d\n", nl, param->
ILU_levels);
100 switch (coarse_solver) {
105 fasp_pardiso_solve(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, &mgl[nl-1].pdata, 0);
120 fasp_umfpack_solve(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, mgl[nl-1].Numeric, 0);
134 fasp_coarse_itsolver(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, tol, prtlvl);
142 for ( i=1; i<nl; i++ ) {
145 switch (coarse_solver) {
150 fasp_pardiso_solve(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, &mgl[nl-1].pdata, 0);
165 fasp_umfpack_solve(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, mgl[nl-1].Numeric, 0);
179 fasp_coarse_itsolver(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, tol, prtlvl);
191 alpha =
MIN(alpha, 1.0);
204 num_cycle = 0; relerr =
BIGREAL;
206 while ( relerr > param->
tol && num_cycle < maxit) {
216 for ( lvl=0; lvl<i; lvl++ ) {
219 if (l<param->ILU_levels) {
222 else if (l<mgl->SWZ_levels) {
223 switch (mgl[l].Schwarz.SWZ_type) {
235 fasp_dcsr_presmoothing(smoother,&mgl[l].A,&mgl[l].b,&mgl[l].x,param->
presmooth_iter,
236 0,mgl[l].
A.
row-1,1,relax,ndeg,smooth_order,mgl[l].
cfmark.
val);
261 switch (coarse_solver) {
266 fasp_pardiso_solve(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, &mgl[nl-1].pdata, 0);
281 fasp_umfpack_solve(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, mgl[nl-1].Numeric, 0);
295 fasp_coarse_itsolver(&mgl[nl-1].A, &mgl[nl-1].b, &mgl[nl-1].x, tol, prtlvl);
300 for ( lvl=0; lvl<i; lvl++ ) {
308 alpha =
MIN(alpha, 1.0);
323 if (l<param->ILU_levels) {
326 else if (l<mgl->SWZ_levels) {
327 switch (mgl[l].Schwarz.SWZ_type) {
339 fasp_dcsr_postsmoothing(smoother,&mgl[l].A,&mgl[l].b,&mgl[l].x,param->
postsmooth_iter,
340 0,mgl[l].
A.
row-1,-1,relax,ndeg,smooth_order,mgl[l].
cfmark.
val);
350 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
void fasp_darray_cp(const INT n, const REAL *x, REAL *y)
Copy an array to the other y=x.
void fasp_dvec_set(INT n, dvector *x, const REAL val)
Initialize dvector x[i]=val for i=0:n-1.
REAL fasp_blas_darray_dotprod(const INT n, const REAL *x, const REAL *y)
Inner product of two arraies x and y.
void fasp_dcsr_swz_forward(SWZ_data *swzdata, SWZ_param *swzparam, dvector *x, dvector *b)
Schwarz smoother: forward sweep.
void fasp_dcsr_swz_backward(SWZ_data *swzdata, SWZ_param *swzparam, dvector *x, dvector *b)
Schwarz smoother: backward sweep.
void fasp_blas_dcsr_mxv_agg(const dCSRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = A*x (nonzeros of A = 1)
void fasp_blas_dcsr_mxv(const dCSRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = A*x.
void fasp_blas_dcsr_aAxpy_agg(const REAL alpha, const dCSRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = alpha*A*x + y (nonzeros of A = 1)
REAL fasp_blas_dcsr_vmv(const dCSRmat *A, const REAL *x, const REAL *y)
vector-Matrix-vector multiplication alpha = y'*A*x
void fasp_blas_dcsr_aAxpy(const REAL alpha, const dCSRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = alpha*A*x + y.
REAL fasp_blas_dvec_norm2(const dvector *x)
L2 norm of dvector x.
void fasp_smoother_dcsr_ilu(dCSRmat *A, dvector *b, dvector *x, void *data)
ILU method as a smoother.
void fasp_solver_fmgcycle(AMG_data *mgl, AMG_param *param)
Solve Ax=b with non-recursive full multigrid K-cycle.
int fasp_solver_mumps_steps(dCSRmat *ptrA, dvector *b, dvector *u, Mumps_data *mumps)
Solve Ax=b by MUMPS in three steps.
int fasp_solver_superlu(dCSRmat *ptrA, dvector *b, dvector *u, const SHORT prtlvl)
Solve Au=b by SuperLU.
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
#define SCHWARZ_SYMMETRIC
#define BIGREAL
Some global constants.
#define ON
Definition of switch.
dCSRmat A
pointer to the matrix at level level_num
Mumps_data mumps
data for MUMPS
dvector b
pointer to the right-hand side at level level_num
dvector x
pointer to the iterative solution at level level_num
SHORT num_levels
number of levels in use <= max_levels
dvector w
temporary work space
ivector cfmark
pointer to the CF marker at level level_num
Parameters for AMG methods.
SHORT print_level
print level for AMG
SHORT polynomial_degree
degree of the polynomial smoother
SHORT coarse_scaling
switch of scaling of the coarse grid correction
SHORT ILU_levels
number of levels use ILU smoother
SHORT AMG_type
type of AMG method
REAL tol
stopping tolerance for AMG solver
SHORT coarse_solver
coarse solver type
REAL relaxation
relaxation parameter for Jacobi and SOR smoother
SHORT smoother
smoother type
INT SWZ_blksolver
type of Schwarz block solver
SHORT postsmooth_iter
number of postsmoothers
INT SWZ_levels
number of levels use Schwarz smoother
SHORT presmooth_iter
number of presmoothers
SHORT smooth_order
smoother order
Parameters for Schwarz method.
INT SWZ_blksolver
type of Schwarz block solver
INT row
row number of matrix A, m
INT nnz
number of nonzero entries
REAL * val
actual vector entries
INT * val
actual vector entries