8.0
general documentation
cs_sles_mumps.h
Go to the documentation of this file.
1 #ifndef __CS_SLES_MUMPS_H__
2 #define __CS_SLES_MUMPS_H__
3 
4 /*============================================================================
5  * Sparse Linear Equation Solvers using MUMPS (a sparse direct solver library)
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_halo_perio.h"
36 #include "cs_matrix.h"
37 #include "cs_param_sles.h"
38 #include "cs_time_plot.h"
39 #include "cs_sles.h"
40 #include "cs_sles_pc.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 #define CS_SLES_MUMPS_JOB_INIT -1
51 
52 /* Set of macros defined in order to match MUMPS documentation (because of the
53  * difference between C/FORTRAN programming language)
54  */
55 
56 #define ICNTL(I) icntl[(I)-1]
57 #define CNTL(I) cntl[(I)-1]
58 #define INFOG(I) infog[(I)-1]
59 #define INFO(I) info[(I)-1]
60 #define RINFOG(I) rinfog[(I)-1]
61 #define RINFO(I) rinfo[(I)-1]
62 #define KEEP(I) keep[(I)-1]
63 
64 /*============================================================================
65  * Type definitions
66  *============================================================================*/
67 
68 /*----------------------------------------------------------------------------*/
81 /*----------------------------------------------------------------------------*/
82 
83 typedef void
85  void *context,
86  void *mumps);
87 
88 /* MUMPS solver context (opaque) */
89 
90 typedef struct _cs_sles_mumps_t cs_sles_mumps_t;
91 
92 /*============================================================================
93  * Global variables
94  *============================================================================*/
95 
96 /*=============================================================================
97  * User function prototypes
98  *============================================================================*/
99 
100 /*----------------------------------------------------------------------------*/
118 /*----------------------------------------------------------------------------*/
119 
120 void
122  void *context,
123  void *pmumps);
124 
125 /*=============================================================================
126  * Public function prototypes
127  *============================================================================*/
128 
129 /*----------------------------------------------------------------------------*/
155 /*----------------------------------------------------------------------------*/
156 
158 cs_sles_mumps_define(int f_id,
159  const char *name,
160  const cs_param_sles_t *slesp,
161  cs_sles_mumps_setup_hook_t *setup_hook,
162  void *context);
163 
164 /*----------------------------------------------------------------------------*/
172 /*----------------------------------------------------------------------------*/
173 
174 cs_sles_pc_t *
176 
177 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
192  cs_sles_mumps_setup_hook_t *setup_hook,
193  void *context);
194 
195 /*----------------------------------------------------------------------------*/
206 /*----------------------------------------------------------------------------*/
207 
208 void *
209 cs_sles_mumps_copy(const void *context);
210 
211 /*----------------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------------*/
223 
224 void
225 cs_sles_mumps_free(void *context);
226 
227 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 void
237 cs_sles_mumps_destroy(void **context);
238 
239 /*----------------------------------------------------------------------------*/
249 /*----------------------------------------------------------------------------*/
250 
251 void
252 cs_sles_mumps_setup(void *context,
253  const char *name,
254  const cs_matrix_t *a,
255  int verbosity);
256 
257 /*----------------------------------------------------------------------------*/
278 /*----------------------------------------------------------------------------*/
279 
281 cs_sles_mumps_solve(void *context,
282  const char *name,
283  const cs_matrix_t *a,
284  int verbosity,
285  double precision,
286  double r_norm,
287  int *n_iter,
288  double *residue,
289  const cs_real_t *rhs,
290  cs_real_t *vx,
291  size_t aux_size,
292  void *aux_vectors);
293 
294 /*----------------------------------------------------------------------------*/
302 /*----------------------------------------------------------------------------*/
303 
304 void
305 cs_sles_mumps_log(const void *context,
306  cs_log_t log_type);
307 
308 /*----------------------------------------------------------------------------*/
314 /*----------------------------------------------------------------------------*/
315 
316 void
318 
319 /*----------------------------------------------------------------------------*/
320 
322 
323 #endif /* __CS_SLES_MUMPS_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:510
cs_log_t
Definition: cs_log.h:48
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
Structure and routines handling the SLES settings stored inside a cs_param_sles_t structure.
cs_sles_convergence_state_t
Definition: cs_sles.h:56
cs_sles_mumps_t * cs_sles_mumps_define(int f_id, const char *name, const cs_param_sles_t *slesp, cs_sles_mumps_setup_hook_t *setup_hook, void *context)
Define and associate a MUMPS linear system solver for a given field or equation name.
Definition: cs_sles_mumps.c:2068
void cs_sles_mumps_free(void *context)
Free MUMPS linear equation solver setup context.
Definition: cs_sles_mumps.c:2220
void() cs_sles_mumps_setup_hook_t(const cs_param_sles_t *slesp, void *context, void *mumps)
Function pointer for user settings of a MUMPS solver. This function is called at the end of the setup...
Definition: cs_sles_mumps.h:84
cs_sles_pc_t * cs_sles_mumps_pc_create(const cs_param_sles_t *slesp)
Create a preconditioner structure relying on MUMPS solver.
Definition: cs_sles_mumps.c:2101
void cs_sles_mumps_library_info(cs_log_t log_type)
Print information on MUMPS library.
Definition: cs_sles_mumps.c:3025
void cs_sles_mumps_setup(void *context, const char *name, const cs_matrix_t *a, int verbosity)
Setup MUMPS linear equation solver.
Definition: cs_sles_mumps.c:2330
void cs_sles_mumps_destroy(void **context)
Destroy MUMPS linear system solver info and context.
Definition: cs_sles_mumps.c:2301
void cs_user_sles_mumps_hook(const cs_param_sles_t *slesp, void *context, void *pmumps)
Function pointer for advanced user settings of a MUMPS solver. This function is called two times duri...
Definition: cs_sles_mumps.c:2026
void * cs_sles_mumps_copy(const void *context)
Create MUMPS linear system solver info and context based on existing info and context.
Definition: cs_sles_mumps.c:2192
cs_sles_convergence_state_t cs_sles_mumps_solve(void *context, const char *name, const cs_matrix_t *a, int verbosity, double precision, double r_norm, int *n_iter, double *residue, const cs_real_t *rhs, cs_real_t *vx, size_t aux_size, void *aux_vectors)
Call MUMPS linear equation solver.
Definition: cs_sles_mumps.c:2706
struct _cs_sles_mumps_t cs_sles_mumps_t
Definition: cs_sles_mumps.h:90
void cs_sles_mumps_log(const void *context, cs_log_t log_type)
Log sparse linear equation solver info.
Definition: cs_sles_mumps.c:2939
cs_sles_mumps_t * cs_sles_mumps_create(const cs_param_sles_t *slesp, cs_sles_mumps_setup_hook_t *setup_hook, void *context)
Create MUMPS linear system solver info and context.
Definition: cs_sles_mumps.c:2145
struct _cs_sles_pc_t cs_sles_pc_t
Definition: cs_sles_pc.h:66
double precision, save a
Definition: cs_fuel_incl.f90:148
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:91