ParMooN
 All Classes Functions Variables Friends Pages
amg_solve_main.h
1 /****************************************************************************/
2 /* */
3 /* File: amg_solve_main.h */
4 /* */
5 /* Purpose: header file for amg_solve_main.c */
6 /* */
7 /* Author: Peter Bastian */
8 /* Institut fuer Computeranwendungen III */
9 /* Universitaet Stuttgart */
10 /* Pfaffenwaldring 27 */
11 /* 70550 Stuttgart */
12 /* email: peter@ica3.uni-stuttgart.de */
13 /* phone: 0049-(0)711-685-7003 */
14 /* fax : 0049-(0)711-685-7000 */
15 /* */
16 /* History: 05 FEB 1996 Begin */
17 /* 02 OKT 1997 redesign */
18 /* */
19 /* Remarks: */
20 /* */
21 /* Author: Volker John */
22 /* Otto--von--Guericke Universitaet Magdeburg */
23 /* Institut fuer Analysis und Numerik */
24 /* Postfach 4120 */
25 /* 39016 Magdeburg */
26 /* email : volker.john@mathematik.uni-magdeburg.de */
27 /* */
28 /* History: 1998/02/19 start using this library for MooN_MD */
29 /* */
30 /* Remarks: */
31 /* */
32 /****************************************************************************/
33 
34 /****************************************************************************/
35 /* */
36 /* auto include mechanism and other include files */
37 /* */
38 /****************************************************************************/
39 
40 #ifndef __AMG_SOLVE__
41 #define __AMG_SOLVE__
42 
43 #include "amg_coarsen.h"
44 
45 /****************************************************************************/
46 /* */
47 /* defines in the following order */
48 /* */
49 /* compile time constants defining static data size (i.e. arrays) */
50 /* other constants */
51 /* macros */
52 /* */
53 /****************************************************************************/
54 
55 /****************************************************************************/
56 /* */
57 /* data structures exported by the corresponding source file */
58 /* */
59 /****************************************************************************/
60 
61 #define AMG_DJAC 1 /* smoother types */
62 #define AMG_SOR 2
63 #define AMG_SSOR 3
64 #define AMG_ILU 4
65 #define AMG_MGC 5
66 #define AMG_ILUT 6
67 #define AMG_SCHUR_COMPLEMENT 7
68 #define AMG_SCHUR_CG 8
69 #define AMG_SCHUR_GMRES 9
70 #define AMG_SCHUR_GMRES_BCGS 10
71 #define AMG_BRAESAR 11
72 #define AMG_EX 17 /* same as solver */
73 #define AMG_NO_PRECONDITIONER -4711
74 
75 #define AMG_LS 11 /* solver types */
76 #define AMG_CG 12
77 #define AMG_BCGS 13
78 #define AMG_GMRES_LEFT 14
79 #define AMG_GMRES_RIGHT 15
80 #define AMG_GMRES_FLEX 16
81 #define AMG_EXACT 17
82 #define AMG_MIXED_BCGS_CGS 18
83 #define AMG_LCD 19
84 
85 #define SCALAR1 0 /* scalar system with 1 rhs */
86 #define SCALAR2 1 /* scalar system with 2 rhs */
87 #define SCALAR3 2 /* scalar system with 3 rhs */
88 #define SCALAR6 5 /* scalar system with 6 rhs */
89 
90 #define SADDLE_1 10
91 #define SADDLE_1_TYPE_1 11 /* scalar mortar systems */
92 #define SADDLE_2_TYPE_1 12 /* 2D Stokes type systems */
93 #define SADDLE_2_TYPE_2 13 /* 2D Oseen type systems mit SDFEM */
94 #define SADDLE_2_TYPE_3 14 /* 2D Oseen type systems mit SDFEM */
95 #define SADDLE_2_TYPE_4 15 /* 2D Oseen type systems with all A blocks */
96 #define BRAESS_SARAZIN_SADDLE_2_TYPE_1 16 /* Braess--Sarzin smoother for 2D Stokes type systems */
97 #define BRAESS_SARAZIN_SADDLE_2_TYPE_2 17 /* Braess--Sarzin smoother for 2D Stokes type systems */
98 #define BRAESS_SARAZIN_SADDLE_2_TYPE_3 18 /* Braess--Sarzin smoother for 2D Stokes type systems */
99 #define BRAESS_SARAZIN_SADDLE_2_TYPE_4 19 /* Braess--Sarzin smoother for 2D Stokes type systems */
100 
101 #define SADDLE_2_TYPE_2_MORTAR 22 /* 2D Oseen type systems with Mortar */
102 
103 #define SADDLE_3 100
104 #define SADDLE_3_TYPE_1 112 /* 3D Stokes type systems */
105 #define SADDLE_3_TYPE_2 113 /* 3D Oseen type systems mit SDFEM */
106 #define SADDLE_3_TYPE_3 114 /* 3D Oseen type systems mit SDFEM */
107 #define SADDLE_3_TYPE_4 115 /* 3D Oseen type systems with all A blocks */
108 #define BRAESS_SARAZIN_SADDLE_3_TYPE_1 116 /* Braess--Sarzin smoother for 3D Stokes type systems */
109 #define BRAESS_SARAZIN_SADDLE_3_TYPE_2 117 /* Braess--Sarzin smoother for 3D Stokes type systems */
110 #define BRAESS_SARAZIN_SADDLE_3_TYPE_3 118 /* Braess--Sarzin smoother for 3D Stokes type systems */
111 #define BRAESS_SARAZIN_SADDLE_3_TYPE_4 119 /* Braess--Sarzin smoother for 3D Stokes type systems */
112 
113 #define SCALAR_VAL_LAZ_2 101 /* Vassilevski/Lazarov preconditioner */
114 
115 #define ILUT_QUICK_SPLIT_0 0
116 #define ILUT_QUICK_SPLIT_1 1
117 #define ILUT_QUICK_SPLIT_2 2
118 
119 #define AMG_MAX_GMRES_RESTART 1000
120 #define AMG_MAX_SCHUR_GMRES_RESTART 100
121 #define max_switch 100 /* cgs-bcgstab */
122 
123 #define AMG_CONV_RATE_BACK 10
124 
125 #define CONSTANT 0
126 #define PLUS_CONSTANT 1
127 #define TIMES_CONSTANT 2
128 #define SQUARED 3
129 
130 typedef struct
131 { /* parameters for solver */
132  int verbose; /* be verbose */
133  int system_type; /* type of the system */
134 
135  /* fine grid solver */
136  int solver; /* type of solver to be used */
137  int preconditioner; /* type of preconditioner */
138  int maxit; /* max number of iterations */
139  int minit; /* min number of iterations */
140  int ex_maxit; /* 1 to execute exactly maxit iterations */
141  double red_factor; /* required reduction in residual norm */
142  double res_norm_min; /* convergence limit */
143  int amg_prec_it; /* number preconditioner of iterations */
144  double amg_prec_red_factor; /* required reduction in residual norm for preconditioner */
145  int gmres_restart; /* restart parameter in gmres, also used in LCD */
146  int lcd_start_vector; /* choose starting lcd vector */
147  double mixed_bcgs_cgs_switch_tol; /* switching tolerance in mixed_bcgs_cgs */
148  double div_factor; /* factor for increase in residual norm for divergence */
149  int row_equilibration; /* apply row equilibration */
150 
151  /* coarse grid solver */
152  int coarse_smoother; /* type of smoother on coarse grid */
153  int coarse_maxit; /* iteration number for coarse grid sol */
154  double coarse_red_factor; /* required reduction in residual norm */
155  double omega_coarse[AMG_MAX_COMP]; /* damping factor per component */
156 
157  /* multigrid cycle */
158  int n1[AMG_MAX_LEVELS]; /* pre smoothing */
159  int n2[AMG_MAX_LEVELS]; /* post smoothing */
160  int gamma; /* cycle form */
161  double omega_p[AMG_MAX_COMP]; /* damping factor for interpolation */
162  int smoothing_steps; /* number of smoothing steps on coarser grids */
163  int n1_param; /* parameter for changing pre smoothing steps */
164  int n2_param; /* parameter for changing post smoothing steps */
165 
166  /* smoother */
167  int smoother; /* type of smoother to be used */
168  double smoother_red_factor; /* required reduction in residual norm */
169  double omega[AMG_MAX_COMP]; /* damping factor per component */
170  int step_length_control_fine; /* step length control on the finest level */
171  int step_length_control_all; /* step length control on all levels */
172  double ilu_beta; /* parameter for ilu(beta) */
173 
174  /*ilut*/
175  double ilut_tol; /* tolerance for first dropping criterion */
176  int ilut_absolute_fillin; /* number of additional fill in's */
177  double ilut_relative_fillin; /* relative fill in to matrix dimension in percent */
178  int ilut_sort; /* sorting strategy for ilut */
179  double sor_omega; /* damping factor in Jacobi, SOR, SSOR */
180 
181  /* saddle point problems parameter */
182  int schur_inv_of_A; /* method to approximate inv(A) */
183  int schur_inv_of_A_maxit; /* max number of iterations if inv(A) is approximated by an iterative method */
184  double schur_iteration_damp; /* damping factor in schur complement iteration */
185  int schur_iteration_maxit; /* maximal number of it. in schur complement iteration */
186  int schur_step_length_control; /* step length control in schur complement iteration */
187  int condense; /* condense after symmetrizing the problem */
188 
189  double vas_laz_delta; /* delta for Vassilevski/Lazaroc preconditioner */
190  int braess_sarazin_matrix; /* matrix for Braess-Sarazin smoother */
191  double braess_sarazin_alpha; /* damping factor for Braess-Sarazin smoother */
192 
193 
195 
196 typedef int (*IterProcPtr) (AMG_SolverContext *sc, int level, int depth,
197  AMG_MATRIX *A[AMG_MAX_LEVELS], AMG_GRAPH *G[AMG_MAX_LEVELS],
198  AMG_MATRIX *M[AMG_MAX_LEVELS],AMG_MATRIX *B[AMG_MAX_LEVELS],
199  AMG_VECTOR *x[AMG_MAX_LEVELS],AMG_VECTOR *b[AMG_MAX_LEVELS],
200  AMG_VECTOR *d[AMG_MAX_LEVELS]);
201 
202 typedef int (*MultProcPtr) (AMG_VECTOR *x, AMG_MATRIX *A, AMG_MATRIX **B,
203  AMG_VECTOR *y);
204 
205 typedef int (*RestrictProcPtr) (AMG_GRAPH *g,AMG_GRAPH *g1, AMG_VECTOR *fine, AMG_VECTOR *coarse);
206 
207 typedef int (*InterpolationProcPtr) (AMG_GRAPH *g,AMG_GRAPH *g1, AMG_VECTOR *fine, AMG_VECTOR *coarse, double *damp);
208 
209 /****************************************************************************/
210 /* */
211 /* functions */
212 /* */
213 /****************************************************************************/
214 
215 int AMG (AMG_SolverContext *sc, AMG_CoarsenContext *cc, AMG_MATRIX *A, AMG_MATRIX **B,
216  AMG_VECTOR *x, AMG_VECTOR *b);
217 
218 int AMG_Build (AMG_SolverContext *sc, AMG_CoarsenContext *cc, AMG_MATRIX *A,
219  AMG_MATRIX **B0, AMG_VECTOR *x, AMG_VECTOR *b);
220 
221 int AMG_Solve (AMG_SolverContext *sc, AMG_CoarsenContext *cc, AMG_MATRIX *A,
222  AMG_MATRIX **B0, AMG_VECTOR *x, AMG_VECTOR *b);
223 
224 int AMG_Delete (AMG_SolverContext *sc, AMG_CoarsenContext *cc, AMG_MATRIX *A,
225  AMG_MATRIX **B0, AMG_VECTOR *x, AMG_VECTOR *b);
226 
227 #endif
228 
Definition: amg_coarsen.h:66
Definition: amg_sp.h:70
Definition: amg_coarsen.h:82
Definition: amg_sp.h:96
Definition: amg_solve.h:90