8.2
general documentation
Loading...
Searching...
No Matches
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/*----------------------------------------------------------------------------*/
78/*----------------------------------------------------------------------------*/
79
82 int poly_degree,
83 int n_iter);
84
85/*----------------------------------------------------------------------------*/
93/*----------------------------------------------------------------------------*/
94
95void
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
109void
110cs_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_ini <-- initial solution (vx if nonzero, nullptr if zero)
130 * vx <-> system solution
131 * aux_size <-- number of elements in aux_vectors (in bytes)
132 * aux_vectors --- optional working area (internal allocation if NULL)
133 *
134 * returns:
135 * convergence state
136 *----------------------------------------------------------------------------*/
137
139cs_multigrid_smoother_solve(void *context,
140 const char *name,
141 const cs_matrix_t *a,
142 int verbosity,
143 double precision,
144 double r_norm,
145 int *n_iter,
146 double *residual,
147 const cs_real_t *rhs,
148 cs_real_t *vx_ini,
149 cs_real_t *vx,
150 size_t aux_size,
151 void *aux_vectors);
152
153/*----------------------------------------------------------------------------
154 * Free iterative sparse linear equation solver setup context.
155 *
156 * This function frees resolution-related data, such as
157 * buffers and preconditioning but does not free the whole context,
158 * as info used for logging (especially performance data) is maintained.
159
160 * parameters:
161 * context <-> pointer to iterative sparse linear solver info
162 * (actual type: cs_multigrid_smoother_t *)
163 *----------------------------------------------------------------------------*/
164
165void
167
168/*----------------------------------------------------------------------------
169 * Log sparse linear equation solver info.
170 *
171 * parameters:
172 * context <-> pointer to iterative sparse linear solver info
173 * (actual type: cs_multigrid_smoother_t *)
174 * log_type <-- log type
175 *----------------------------------------------------------------------------*/
176
177void
178cs_multigrid_smoother_log(const void *context,
179 cs_log_t log_type);
180
181/*----------------------------------------------------------------------------
182 * Return iterative solver type.
183 *
184 * parameters:
185 * context <-- pointer to iterative solver info and context
186 *
187 * returns:
188 * selected solver type
189 *----------------------------------------------------------------------------*/
190
193
194/*----------------------------------------------------------------------------*/
195
197
198#endif /* __CS_MULTIGRID_SMOOTHER_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:528
double cs_real_t
Floating-point value.
Definition cs_defs.h:332
#define END_C_DECLS
Definition cs_defs.h:529
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:2099
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:2209
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:2403
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