8.3
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-2024 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/* Set of macros defined in order to match MUMPS documentation (because of the
51 * difference between C/FORTRAN programming language)
52 */
53
54#define ICNTL(I) icntl[(I)-1]
55#define CNTL(I) cntl[(I)-1]
56#define INFOG(I) infog[(I)-1]
57#define INFO(I) info[(I)-1]
58#define RINFOG(I) rinfog[(I)-1]
59#define RINFO(I) rinfo[(I)-1]
60#define KEEP(I) keep[(I)-1]
61
62/*============================================================================
63 * Type definitions
64 *============================================================================*/
65
66/*----------------------------------------------------------------------------*/
79/*----------------------------------------------------------------------------*/
80
81typedef void
83 void *context,
84 void *mumps);
85
86/* MUMPS solver context (opaque) */
87
88typedef struct _cs_sles_mumps_t cs_sles_mumps_t;
89
90/*============================================================================
91 * Global variables
92 *============================================================================*/
93
94/*=============================================================================
95 * User function prototypes
96 *============================================================================*/
97
98/*----------------------------------------------------------------------------*/
116/*----------------------------------------------------------------------------*/
117
118void
120 void *context,
121 void *pmumps);
122
123/*=============================================================================
124 * Public function prototypes
125 *============================================================================*/
126
127/*----------------------------------------------------------------------------*/
136/*----------------------------------------------------------------------------*/
137
138void
140
141/*----------------------------------------------------------------------------*/
150/*----------------------------------------------------------------------------*/
151
152void
154
155/*----------------------------------------------------------------------------*/
181/*----------------------------------------------------------------------------*/
182
184cs_sles_mumps_define(int f_id,
185 const char *name,
186 const cs_param_sles_t *slesp,
187 cs_sles_mumps_setup_hook_t *setup_hook,
188 void *context);
189
190/*----------------------------------------------------------------------------*/
198/*----------------------------------------------------------------------------*/
199
202
203/*----------------------------------------------------------------------------*/
214/*----------------------------------------------------------------------------*/
215
218 cs_sles_mumps_setup_hook_t *setup_hook,
219 void *context);
220
221/*----------------------------------------------------------------------------*/
232/*----------------------------------------------------------------------------*/
233
234void *
235cs_sles_mumps_copy(const void *context);
236
237/*----------------------------------------------------------------------------*/
248/*----------------------------------------------------------------------------*/
249
250void
251cs_sles_mumps_free(void *context);
252
253/*----------------------------------------------------------------------------*/
260/*----------------------------------------------------------------------------*/
261
262void
263cs_sles_mumps_destroy(void **context);
264
265/*----------------------------------------------------------------------------*/
275/*----------------------------------------------------------------------------*/
276
277void
278cs_sles_mumps_setup(void *context,
279 const char *name,
280 const cs_matrix_t *a,
281 int verbosity);
282
283/*----------------------------------------------------------------------------*/
306/*----------------------------------------------------------------------------*/
307
309cs_sles_mumps_solve(void *context,
310 const char *name,
311 const cs_matrix_t *a,
312 int verbosity,
313 double precision,
314 double r_norm,
315 int *n_iter,
316 double *residual,
317 const cs_real_t *rhs,
318 cs_real_t *vx_ini,
319 cs_real_t *vx,
320 size_t aux_size,
321 void *aux_vectors);
322
323/*----------------------------------------------------------------------------*/
331/*----------------------------------------------------------------------------*/
332
333void
334cs_sles_mumps_log(const void *context,
335 cs_log_t log_type);
336
337/*----------------------------------------------------------------------------*/
343/*----------------------------------------------------------------------------*/
344
345void
347
348/*----------------------------------------------------------------------------*/
349
351
352#endif /* __CS_SLES_MUMPS_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
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 ((Sparse Linear Equation Solver) settings stored inside a cs...
cs_sles_convergence_state_t
Definition: cs_sles.h:56
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.cpp:2707
void cs_sles_mumps_free(void *context)
Free MUMPS linear equation solver setup context.
Definition: cs_sles_mumps.cpp:2823
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:82
void cs_sles_mumps_library_info(cs_log_t log_type)
Print information on MUMPS library.
Definition: cs_sles_mumps.cpp:3767
void cs_sles_mumps_set_zero_sthreshold(double thr)
Modifiy the default value used as a threshold to clean matrix values sent to MUMPS in case of factori...
Definition: cs_sles_mumps.cpp:2640
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.cpp:2957
void cs_sles_mumps_destroy(void **context)
Destroy MUMPS linear system solver info and context.
Definition: cs_sles_mumps.cpp:2925
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.cpp:2598
struct _cs_sles_mumps_t cs_sles_mumps_t
Definition: cs_sles_mumps.h:88
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.cpp:2795
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 *residual, const cs_real_t *rhs, cs_real_t *vx_ini, cs_real_t *vx, size_t aux_size, void *aux_vectors)
Call MUMPS linear equation solver.
Definition: cs_sles_mumps.cpp:3446
void cs_sles_mumps_log(const void *context, cs_log_t log_type)
Log sparse linear equation solver info.
Definition: cs_sles_mumps.cpp:3681
void cs_sles_mumps_set_zero_dthreshold(double thr)
Modifiy the default value used as a threshold to clean matrix values sent to MUMPS in case of factori...
Definition: cs_sles_mumps.cpp:2623
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.cpp:2746
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.cpp:2674
struct _cs_sles_pc_t cs_sles_pc_t
Definition: cs_sles_pc.h:66
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:64