8.0
general documentation
Loading...
Searching...
No Matches
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-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 * 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/*----------------------------------------------------------------------------*/
69/*----------------------------------------------------------------------------*/
70
71static inline void
73 const cs_cell_sys_t *csys)
74{
75 for (short int i = 0; i < csys->n_dofs; i++) {
76 if (csys->dof_flag[i] & CS_CDO_BC_HMG_DIRICHLET)
77 if (fabs(csys->dir_values[i]) > 100*DBL_MIN)
78 bft_error(__FILE__, __LINE__, 0,
79 " %s: Invalid value for a homogeneous Dirichlet condition",
80 fname);
81 }
82}
83
84/*============================================================================
85 * Public function prototypes
86 *============================================================================*/
87
88/*----------------------------------------------------------------------------*/
97/*----------------------------------------------------------------------------*/
98
99bool
101 const cs_cell_mesh_t *cm,
102 const cs_cell_sys_t *csys);
103
104/*----------------------------------------------------------------------------*/
119/*----------------------------------------------------------------------------*/
120
121void
122cs_dbg_array_fprintf(FILE *fp,
123 const char *fname,
124 cs_real_t thd,
125 cs_lnum_t n_elts,
126 const cs_real_t array[],
127 int n_cols);
128
129/*----------------------------------------------------------------------------*/
141/*----------------------------------------------------------------------------*/
142
143void
144cs_dbg_fprintf_system(const char *eqname,
145 int id,
146 int level,
147 const cs_real_t *sol,
148 const cs_real_t *rhs,
149 cs_lnum_t size);
150
151/*----------------------------------------------------------------------------*/
160/*----------------------------------------------------------------------------*/
161
162void
163cs_dbg_darray_to_listing(const char *header,
164 const cs_lnum_t size,
165 const cs_real_t array[],
166 int n_cols);
167
168/*----------------------------------------------------------------------------*/
177/*----------------------------------------------------------------------------*/
178
179void
180cs_dbg_iarray_to_listing(const char *header,
181 const cs_lnum_t size,
182 const cs_lnum_t array[],
183 int n_cols);
184
185/*----------------------------------------------------------------------------*/
192/*----------------------------------------------------------------------------*/
193
194void
196 const cs_matrix_t *matrix);
197
198/*----------------------------------------------------------------------------*/
212/*----------------------------------------------------------------------------*/
213
214void
215cs_dbg_dump_linear_system(const char *eqname,
216 cs_lnum_t size,
217 int verbosity,
218 const cs_real_t x[],
219 const cs_real_t b[],
220 const cs_lnum_t row_index[],
221 const cs_lnum_t col_id[],
222 const cs_real_t xval[],
223 const cs_real_t dval[]);
224
225/*----------------------------------------------------------------------------*/
226
228
229#endif /* __CS_DBG_H__ */
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
void cs_dbg_dump_local_scalar_msr_matrix(const char *name, const cs_matrix_t *matrix)
In debug mode, dump a linear system. Case of scalar-valued entries.
Definition cs_dbg.c:308
static void cs_dbg_check_hmg_dirichlet_cw(const char *fname, const cs_cell_sys_t *csys)
Check if there is no invalid setting for a homogeneous Dirichlet.
Definition cs_dbg.h:72
void cs_dbg_array_fprintf(FILE *fp, const char *fname, cs_real_t thd, cs_lnum_t n_elts, const cs_real_t array[], int n_cols)
Print an array. Print into the file f if given otherwise open a new file named fname if given otherwi...
Definition cs_dbg.c:144
void cs_dbg_iarray_to_listing(const char *header, const cs_lnum_t size, const cs_lnum_t array[], int n_cols)
In debug mode, dump an array of integer into the log.
Definition cs_dbg.c:275
void cs_dbg_darray_to_listing(const char *header, const cs_lnum_t size, const cs_real_t array[], int n_cols)
In debug mode, dump an array of double into the log.
Definition cs_dbg.c:240
bool cs_dbg_cw_test(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_cell_sys_t *csys)
Function used to select which element deserves a dump or specific treatment during a debugging stage.
Definition cs_dbg.c:83
void cs_dbg_dump_linear_system(const char *eqname, cs_lnum_t size, int verbosity, const cs_real_t x[], const cs_real_t b[], const cs_lnum_t row_index[], const cs_lnum_t col_id[], const cs_real_t xval[], const cs_real_t dval[])
In debug mode, dump a linear system.
Definition cs_dbg.c:352
void cs_dbg_fprintf_system(const char *eqname, int id, int level, const cs_real_t *sol, const cs_real_t *rhs, cs_lnum_t size)
In debug mode, print into a file the solution and its right-hand side.
Definition cs_dbg.c:205
#define BEGIN_C_DECLS
Definition cs_defs.h:509
double cs_real_t
Floating-point value.
Definition cs_defs.h:319
#define END_C_DECLS
Definition cs_defs.h:510
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:313
struct _cs_matrix_t cs_matrix_t
Definition cs_matrix.h:110
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
#define CS_CDO_BC_HMG_DIRICHLET
Definition cs_cdo_bc.h:77
Set of local quantities and connectivities related to a mesh cell.
Definition cs_cdo_local.h:203
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:147
double * dir_values
Definition cs_cdo_local.h:172
cs_flag_t * dof_flag
Definition cs_cdo_local.h:153
int n_dofs
Definition cs_cdo_local.h:151
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition cs_equation_param.h:192