8.1
general documentation
cs_multigrid_smoother.h
Go to the documentation of this file.
1 #ifndef __CS_MULTIGRID_SMOOTHER_H__
2 #define __CS_MULTIGRID_SMOOTHER_H__
3 
4 /*============================================================================
5  * Sparse Linear Equation Solvers
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_sles.h"
38 #include "cs_sles_it.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /* Iterative linear solver context (opaque) */
53 
54 typedef struct _cs_multigrid_smoother_t cs_multigrid_smoother_t;
55 
56 /*============================================================================
57  * Global variables
58  *============================================================================*/
59 
60 /*=============================================================================
61  * Public function prototypes
62  *============================================================================*/
63 
64 /*----------------------------------------------------------------------------*/
78 /*----------------------------------------------------------------------------*/
79 
82  int poly_degree,
83  int n_iter);
84 
85 /*----------------------------------------------------------------------------*/
93 /*----------------------------------------------------------------------------*/
94 
95 void
97 
98 /*----------------------------------------------------------------------------
99  * Setup iterative sparse linear equation solver.
100  *
101  * parameters:
102  * context <-> pointer to iterative sparse linear solver info
103  * (actual type: cs_multigrid_smoother_t *)
104  * name <-- pointer to system name
105  * a <-- associated matrix
106  * verbosity <-- verbosity level
107  *----------------------------------------------------------------------------*/
108 
109 void
110 cs_multigrid_smoother_setup(void *context,
111  const char *name,
112  const cs_matrix_t *a,
113  int verbosity);
114 
115 /*----------------------------------------------------------------------------
116  * Call iterative sparse linear equation solver.
117  *
118  * parameters:
119  * context <-> pointer to iterative sparse linear solver info
120  * (actual type: cs_multigrid_smoother_t *)
121  * name <-- pointer to system name
122  * a <-- matrix
123  * verbosity <-- verbosity level
124  * precision <-- solver precision
125  * r_norm <-- residual normalization
126  * n_iter --> number of iterations
127  * residual --> residual
128  * rhs <-- right hand side
129  * vx <-> system solution
130  * aux_size <-- number of elements in aux_vectors (in bytes)
131  * aux_vectors --- optional working area (internal allocation if NULL)
132  *
133  * returns:
134  * convergence state
135  *----------------------------------------------------------------------------*/
136 
138 cs_multigrid_smoother_solve(void *context,
139  const char *name,
140  const cs_matrix_t *a,
141  int verbosity,
142  double precision,
143  double r_norm,
144  int *n_iter,
145  double *residual,
146  const cs_real_t *rhs,
147  cs_real_t *vx,
148  size_t aux_size,
149  void *aux_vectors);
150 
151 /*----------------------------------------------------------------------------
152  * Free iterative sparse linear equation solver setup context.
153  *
154  * This function frees resolution-related data, such as
155  * buffers and preconditioning but does not free the whole context,
156  * as info used for logging (especially performance data) is maintained.
157 
158  * parameters:
159  * context <-> pointer to iterative sparse linear solver info
160  * (actual type: cs_multigrid_smoother_t *)
161  *----------------------------------------------------------------------------*/
162 
163 void
165 
166 /*----------------------------------------------------------------------------
167  * Log sparse linear equation solver info.
168  *
169  * parameters:
170  * context <-> pointer to iterative sparse linear solver info
171  * (actual type: cs_multigrid_smoother_t *)
172  * log_type <-- log type
173  *----------------------------------------------------------------------------*/
174 
175 void
176 cs_multigrid_smoother_log(const void *context,
177  cs_log_t log_type);
178 
179 /*----------------------------------------------------------------------------
180  * Return iterative solver type.
181  *
182  * parameters:
183  * context <-- pointer to iterative solver info and context
184  *
185  * returns:
186  * selected solver type
187  *----------------------------------------------------------------------------*/
188 
191 
192 /*----------------------------------------------------------------------------*/
193 
195 
196 #endif /* __CS_MULTIGRID_SMOOTHER_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:515
cs_log_t
Definition: cs_log.h:48
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
cs_sles_it_t * cs_multigrid_smoother_create(cs_sles_it_type_t smoother_type, int poly_degree, int n_iter)
Create iterative sparse linear system solver info and context used as a smoother in a multigrid solve...
Definition: cs_multigrid_smoother.c:1933
cs_sles_convergence_state_t cs_multigrid_smoother_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, size_t aux_size, void *aux_vectors)
Call iterative sparse linear equation solver.
Definition: cs_multigrid_smoother.c:2181
struct _cs_multigrid_smoother_t cs_multigrid_smoother_t
Definition: cs_multigrid_smoother.h:54
cs_sles_it_type_t cs_multigrid_smoother_get_type(const cs_multigrid_smoother_t *context)
void cs_multigrid_smoother_free(void *context)
void cs_multigrid_smoother_destroy(void **context)
Destroy iterative sparse linear system solver info and context used as a smoother in a multigrid solv...
void cs_multigrid_smoother_setup(void *context, const char *name, const cs_matrix_t *a, int verbosity)
Setup iterative sparse linear equation solver in case of used as a multigrid smoother.
Definition: cs_multigrid_smoother.c:2042
void cs_multigrid_smoother_log(const void *context, cs_log_t log_type)
cs_sles_convergence_state_t
Definition: cs_sles.h:56
struct _cs_sles_it_t cs_sles_it_t
Definition: cs_sles_it.h:86
cs_sles_it_type_t
Definition: cs_sles_it.h:55