⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 solver.h

📁 cfd求解器使用与gmsh网格的求解
💻 H
字号:
/* * Copyright (C) 1997-2006 P. Dular, C. Geuzaine * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. * * Please report all bugs and problems to <getdp@geuz.org>. * * Contributor(s): *   Jean-Francois Remacle *   Benoit Meys *   Johan Gyselinck *   Ruth Sabariego */#ifndef _SOLVER_H_#define _SOLVER_H_#include "List.h"#define ELAP      1#define KUL       2#define NONE      0#define SPARSE    1#define DENSE     2#define CSR       1  /* Compressed Sparse Row */#define CSC       2  /* Compressed Sparse Column */#define MSR       3  /* Modified Sparse Row */#define COO       4  /* Coordinate */#define CG        1#define CGNR      2#define BCG       3#define DBCG      4#define BCGSTAB   5#define TFQMR     6#define FOM       7#define GMRES     8#define FGMRES    9#define DQGMRES   10#define LU        11#define PGMRES    12#define ILUT      1#define ILUTP     2#define ILUD      3#define ILUDP     4#define ILUK      5#define ILU0      6#define MILU0     7#define DIAGONAL  8#define RCMK      1#define DIAG_SCALING    1#define MAX_SCALING     2#define NORM1_SCALING   3#define NORM2_SCALING   4#if defined(HAVE_ILU_FLOAT)#define scalar float#else#define scalar double#endiftypedef struct {  /* sparse matrix */  List_T  *a;  List_T  *jptr, *ai, *ptr;  /* permuted matrix */  double  *a_rcmk ;  int     *ia_rcmk, *ja_rcmk;  /* permutation vectors */  int     *permr, *permp, *rpermr;  /* ILU decomposition */  scalar  *alu;  int     *jlu, *ju;}Sparse_Matrix;typedef struct {  int      LU_Exist;  double  *a, *lu;}Dense_Matrix;typedef struct{  int T, N, changed, ILU_Exists, notranspose, scaled;  double  *rowscal, *colscal;  Sparse_Matrix   S;   Dense_Matrix    F;}Matrix;typedef struct {  int    Matrix_Format;  int    Matrix_Printing;  int    Matrix_Storage;  int    Scaling ;  int    Renumbering_Technique;  int    Preconditioner;  int    Preconditioner_Position;  int    Nb_Fill;  double Dropping_Tolerance;  double Permutation_Tolerance;  double Diagonal_Compensation;  int    Re_Use_ILU;  int    Algorithm;  int    Krylov_Size;  double IC_Acceleration;  int    Iterative_Improvement;  int    Re_Use_LU;  int    Nb_Iter_Max;  double Stopping_Test;}Solver_Params;/* Parser.c */void init_solver (Solver_Params *p , char *name) ;void init_solver_option (Solver_Params *p , char *name, char *value);/* Matrix.c */void init_matrix (int Nb, Matrix *M, Solver_Params *p);void init_vector (int Nb, double **V);void zero_matrix (Matrix *M);void zero_matrix2 (Matrix *M);void zero_vector (int Nb, double *V);void copy_vector (int Nb, double *U , double *V );void add_vector_vector (int Nb, double *U , double *V );void add_vector_prod_vector_double (int Nb, double *U, double *V, double d);void add_matrix_double (Matrix *M, int il, int ic, double val);void add_matrix_matrix (Matrix *M, Matrix *N);void add_matrix_prod_matrix_double (Matrix *M, Matrix *N, double d);void sub_vector_vector_1 (int Nb, double *U, double *V);void sub_vector_vector_2 (int Nb, double *U, double *V);void prod_vector_double (int Nb, double *U, double a);void prodsc_vector_vector (int Nb, double *U, double *V, double *prosca);void prodsc_vectorconj_vector (int Nb, double *U, double *V, double *proscar, double *proscai);void prod_matrix_vector (Matrix *M, double *v, double *res);void prod_matrix_double (Matrix *M, double v);void multi_prod_matrix_double(int n, Matrix **Mat, double *coef, Matrix *MatRes);void multi_prod_vector_double(int n, int Sizevec, double **Vec, double *coef, double *VecRes);void multi_prod_matrix_vector(int n, int Sizevec, Matrix **Mat, double **Vec, double *VecRes);void norm2_vector(int Nb, double *U, double *norm);void norminf_vector(int Nb, double *U, double *norm);void identity_matrix (Matrix *M);void scale_matrix (int scaling, Matrix *M);void scale_vector (int ROW_or_COLUMN, Matrix *M, double *V);void get_column_in_matrix (Matrix *M, int col, double *V);void get_element_in_matrix (Matrix *M, int row, int col, double *V);void formatted_write_matrix (FILE *pfile, Matrix *M, int style);void formatted_write_vector (FILE *pfile, int Nb, double *V, int style);void formatted_read_matrix (Matrix *M, char *name, char *ext, int style);void formatted_read_vector (int Nb, double *V, char *name, char *ext, int style);void binary_write_matrix (Matrix *M, char *name, char *ext);void binary_write_vector (int Nb, double *V, char *name, char *ext);void binary_read_matrix (Matrix *M, char *name, char *ext);void binary_read_vector (int Nb, double **V, char *name, char *ext);void print_matrix (Matrix *M);void print_vector (double *v, int N);void print_vector_int (int *v, int N);void print_matrix_info_CSR (int N, int *jptr, int *ai);void print_matrix_info_MSR (int N, scalar *a, int *jptr);void print_matrix_info_DENSE (int N);/* CSR.c */void csr_format (Sparse_Matrix *M, int N);void restore_format (Sparse_Matrix *M);/* Solver.c */void solve_matrix (Matrix *M, Solver_Params *p, double *b, double *x);void print_parametres (Solver_Params *p);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -