7.1
general documentation
cs_dbg.h
Go to the documentation of this file.
1 #ifndef __CS_DBG_H__
2 #define __CS_DBG_H__
3 
4 /*============================================================================
5  * General functions or variables for the INNOV module
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 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  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include <float.h>
33 
34 #include "cs_base.h"
35 #include "cs_cdo_bc.h"
36 #include "cs_cdo_local.h"
37 #include "cs_defs.h"
38 #include "cs_equation_param.h"
39 #include "cs_math.h"
40 #include "cs_matrix.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Type definitions
52  *============================================================================*/
53 
54 /*============================================================================
55  * Global variables
56  *============================================================================*/
57 
58 /*============================================================================
59  * Static inline function prototypes
60  *============================================================================*/
61 
62 #if defined(DEBUG) && !defined(NDEBUG)
63 /*----------------------------------------------------------------------------*/
70 /*----------------------------------------------------------------------------*/
71 
72 static inline void
73 cs_dbg_check_hmg_dirichlet_cw(const char *fname,
74  const cs_cell_sys_t *csys)
75 {
76  for (short int i = 0; i < csys->n_dofs; i++) {
77  if (csys->dof_flag[i] & CS_CDO_BC_HMG_DIRICHLET)
78  if (fabs(csys->dir_values[i]) > 100*DBL_MIN)
79  bft_error(__FILE__, __LINE__, 0,
80  " %s: Invalid value for a homogeneous Dirichlet condition",
81  fname);
82  }
83 }
84 
85 /*============================================================================
86  * Public function prototypes
87  *============================================================================*/
88 
89 /*----------------------------------------------------------------------------*/
98 /*----------------------------------------------------------------------------*/
99 
100 bool
101 cs_dbg_cw_test(const cs_equation_param_t *eqp,
102  const cs_cell_mesh_t *cm,
103  const cs_cell_sys_t *csys);
104 
105 /*----------------------------------------------------------------------------*/
120 /*----------------------------------------------------------------------------*/
121 
122 void
123 cs_dbg_array_fprintf(FILE *fp,
124  const char *fname,
125  cs_real_t thd,
126  cs_lnum_t n_elts,
127  const cs_real_t array[],
128  int n_cols);
129 
130 /*----------------------------------------------------------------------------*/
142 /*----------------------------------------------------------------------------*/
143 
144 void
145 cs_dbg_fprintf_system(const char *eqname,
146  int nt,
147  int level,
148  const cs_real_t *sol,
149  const cs_real_t *rhs,
150  cs_lnum_t size);
151 
152 /*----------------------------------------------------------------------------*/
161 /*----------------------------------------------------------------------------*/
162 
163 void
164 cs_dbg_darray_to_listing(const char *header,
165  const cs_lnum_t size,
166  const cs_real_t array[],
167  int n_cols);
168 
169 /*----------------------------------------------------------------------------*/
178 /*----------------------------------------------------------------------------*/
179 
180 void
181 cs_dbg_iarray_to_listing(const char *header,
182  const cs_lnum_t size,
183  const cs_lnum_t array[],
184  int n_cols);
185 
186 /*----------------------------------------------------------------------------*/
193 /*----------------------------------------------------------------------------*/
194 
195 void
196 cs_dbg_dump_local_scalar_msr_matrix(const char *name,
197  const cs_matrix_t *matrix);
198 
199 /*----------------------------------------------------------------------------*/
213 /*----------------------------------------------------------------------------*/
214 
215 void
216 cs_dbg_dump_linear_system(const char *eqname,
217  cs_lnum_t size,
218  int verbosity,
219  const cs_real_t x[],
220  const cs_real_t b[],
221  const cs_lnum_t row_index[],
222  const cs_lnum_t col_id[],
223  const cs_real_t xval[],
224  const cs_real_t dval[]);
225 #endif /* DEBUG */
226 
227 /*----------------------------------------------------------------------------*/
228 
230 
231 #endif /* __CS_DBG_H__ */
#define CS_CDO_BC_HMG_DIRICHLET
Definition: cs_cdo_bc.h:66
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:177
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
double * dir_values
Definition: cs_cdo_local.h:171
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:202
cs_flag_t * dof_flag
Definition: cs_cdo_local.h:152
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
void matrix(const int *iconvp, const int *idiffp, const int *ndircp, const int *isym, const cs_real_t *thetap, const int *imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t da[], cs_real_t xa[])
Definition: cs_matrix_building.c:111
Set of arrays and local (small) dense matrices related to a mesh cell This is a key structure for bui...
Definition: cs_cdo_local.h:146
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:93
int n_dofs
Definition: cs_cdo_local.h:150
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
#define END_C_DECLS
Definition: cs_defs.h:511
double precision, save b
Definition: cs_fuel_incl.f90:146