8.3
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-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_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
54typedef struct _cs_multigrid_smoother_t cs_multigrid_smoother_t;
55
56/*============================================================================
57 * Global variables
58 *============================================================================*/
59
60/*=============================================================================
61 * Public function prototypes
62 *============================================================================*/
63
64/*----------------------------------------------------------------------------*/
79/*----------------------------------------------------------------------------*/
80
83 int poly_degree,
84 int n_iter);
85
86/*----------------------------------------------------------------------------*/
94/*----------------------------------------------------------------------------*/
95
96void
98
99/*----------------------------------------------------------------------------
100 * Setup iterative sparse linear equation solver.
101 *
102 * parameters:
103 * context <-> pointer to iterative sparse linear solver info
104 * (actual type: cs_multigrid_smoother_t *)
105 * name <-- pointer to system name
106 * a <-- associated matrix
107 * verbosity <-- verbosity level
108 *----------------------------------------------------------------------------*/
109
110void
111cs_multigrid_smoother_setup(void *context,
112 const char *name,
113 const cs_matrix_t *a,
114 int verbosity);
115
116/*----------------------------------------------------------------------------
117 * Call iterative sparse linear equation solver.
118 *
119 * parameters:
120 * context <-> pointer to iterative sparse linear solver info
121 * (actual type: cs_multigrid_smoother_t *)
122 * name <-- pointer to system name
123 * a <-- matrix
124 * verbosity <-- verbosity level
125 * precision <-- solver precision
126 * r_norm <-- residual normalization
127 * n_iter --> number of iterations
128 * residual --> residual
129 * rhs <-- right hand side
130 * vx_ini <-- initial solution (vx if nonzero, nullptr if zero)
131 * vx <-> system solution
132 * aux_size <-- number of elements in aux_vectors (in bytes)
133 * aux_vectors --- optional working area (internal allocation if NULL)
134 *
135 * returns:
136 * convergence state
137 *----------------------------------------------------------------------------*/
138
140cs_multigrid_smoother_solve(void *context,
141 const char *name,
142 const cs_matrix_t *a,
143 int verbosity,
144 double precision,
145 double r_norm,
146 int *n_iter,
147 double *residual,
148 const cs_real_t *rhs,
149 cs_real_t *vx_ini,
150 cs_real_t *vx,
151 size_t aux_size,
152 void *aux_vectors);
153
154/*----------------------------------------------------------------------------
155 * Free iterative sparse linear equation solver setup context.
156 *
157 * This function frees resolution-related data, such as
158 * buffers and preconditioning but does not free the whole context,
159 * as info used for logging (especially performance data) is maintained.
160
161 * parameters:
162 * context <-> pointer to iterative sparse linear solver info
163 * (actual type: cs_multigrid_smoother_t *)
164 *----------------------------------------------------------------------------*/
165
166void
168
169/*----------------------------------------------------------------------------
170 * Log sparse linear equation solver info.
171 *
172 * parameters:
173 * context <-> pointer to iterative sparse linear solver info
174 * (actual type: cs_multigrid_smoother_t *)
175 * log_type <-- log type
176 *----------------------------------------------------------------------------*/
177
178void
179cs_multigrid_smoother_log(const void *context,
180 cs_log_t log_type);
181
182/*----------------------------------------------------------------------------
183 * Return iterative solver type.
184 *
185 * parameters:
186 * context <-- pointer to iterative solver info and context
187 *
188 * returns:
189 * selected solver type
190 *----------------------------------------------------------------------------*/
191
194
195/*----------------------------------------------------------------------------*/
196
198
199#endif /* __CS_MULTIGRID_SMOOTHER_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
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.cpp:2100
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.cpp:2210
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_ini, cs_real_t *vx, size_t aux_size, void *aux_vectors)
Call iterative sparse linear equation solver.
Definition: cs_multigrid_smoother.cpp:2387
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