7.2
general documentation
cs_equation_builder.h
Go to the documentation of this file.
1 #ifndef __CS_EQUATION_BUILDER_H__
2 #define __CS_EQUATION_BUILDER_H__
3 
4 /*============================================================================
5  * Functions to handle the equation builder structure
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2022 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 "cs_cdo_bc.h"
33 #include "cs_cdo_connect.h"
34 #include "cs_cdo_local.h"
35 #include "cs_cdo_quantities.h"
36 #include "cs_cdo_system.h"
37 #include "cs_enforcement.h"
38 #include "cs_equation_param.h"
39 #include "cs_flag.h"
40 #include "cs_matrix.h"
41 #include "cs_source_term.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
56 
57 /*----------------------------------------------------------------------------*/
73 /*----------------------------------------------------------------------------*/
74 
75 typedef void
77  const cs_equation_builder_t *eqb,
78  const void *eqc,
79  const cs_cell_mesh_t *cm,
80  void *context,
81  cs_hodge_t *mass_hodge,
82  cs_hodge_t *diff_hodge,
83  cs_cell_sys_t *csys,
84  cs_cell_builder_t *cb);
85 
92 
93  bool init_step;
140 
148 
157 
173 
217 
237 };
238 
239 /*============================================================================
240  * Inline public function prototypes
241  *============================================================================*/
242 
243 /*----------------------------------------------------------------------------*/
252 /*----------------------------------------------------------------------------*/
253 
254 static inline cs_eflag_t
256  const cs_equation_builder_t *eqb)
257 {
258  cs_eflag_t _flag = eqb->msh_flag | eqb->st_msh_flag;
259 
260  if (cell_flag & CS_FLAG_BOUNDARY_CELL_BY_FACE)
261  _flag |= eqb->bd_msh_flag;
262 
263  return _flag;
264 }
265 
266 /*============================================================================
267  * Public function prototypes
268  *============================================================================*/
269 
270 /*----------------------------------------------------------------------------*/
280 /*----------------------------------------------------------------------------*/
281 
284  const cs_mesh_t *mesh);
285 
286 /*----------------------------------------------------------------------------*/
296 /*----------------------------------------------------------------------------*/
297 
298 const cs_matrix_t *
300  int block_id);
301 
302 /*----------------------------------------------------------------------------*/
312 /*----------------------------------------------------------------------------*/
313 
314 const cs_range_set_t *
316  int block_id);
317 /*----------------------------------------------------------------------------*/
324 /*----------------------------------------------------------------------------*/
325 
326 void
328 
329 /*----------------------------------------------------------------------------*/
335 /*----------------------------------------------------------------------------*/
336 
337 void
339 
340 /*----------------------------------------------------------------------------*/
348 /*----------------------------------------------------------------------------*/
349 
350 void
352  const cs_equation_builder_t *eqb);
353 
354 /*----------------------------------------------------------------------------*/
370 /*----------------------------------------------------------------------------*/
371 
372 bool
374  const cs_equation_builder_t *eqb,
375  const cs_cell_mesh_t *cm,
376  cs_cell_builder_t *cb);
377 
378 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 
392 void
394  const cs_equation_builder_t *eqb,
395  cs_hodge_t *diff_hodge,
396  cs_cell_builder_t *cb);
397 
398 /*----------------------------------------------------------------------------*/
416 /*----------------------------------------------------------------------------*/
417 
418 void
420  cs_cell_builder_t *cb,
421  cs_cell_sys_t *csys);
422 
423 /*----------------------------------------------------------------------------*/
441 /*----------------------------------------------------------------------------*/
442 
443 void
445  cs_cell_builder_t *cb,
446  cs_cell_sys_t *csys);
447 
448 /*----------------------------------------------------------------------------*/
449 
451 
452 #endif /* __CS_EQUATION_BUILDER_H__ */
Store common elements used when building an algebraic system related to an equation.
cs_cdo_system_helper_t * system_helper
Definition: cs_equation_builder.h:147
void cs_equation_builder_reset(cs_equation_builder_t *eqb)
Free some members of a cs_equation_builder_t structure.
Definition: cs_equation_builder.c:330
cs_timer_counter_t tcs
Definition: cs_equation_builder.h:229
cs_real_t * dir_values
Definition: cs_equation_builder.h:190
Definition: cs_equation_builder.h:91
bool diff_pty_uniform
Definition: cs_equation_builder.h:117
unsigned char cs_mask_t
Definition: cs_flag.h:158
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:186
cs_source_term_cellwise_t * compute_source[CS_N_MAX_SOURCE_TERMS]
Definition: cs_equation_builder.h:139
const cs_range_set_t * cs_equation_builder_get_range_set(const cs_equation_builder_t *builder, int block_id)
Retrieve the range set structure associated to a builder structure for the block defined in block_id ...
Definition: cs_equation_builder.c:256
static cs_eflag_t cs_equation_builder_cell_mesh_flag(cs_flag_t cell_flag, const cs_equation_builder_t *eqb)
Retrieve the flag to give for building a cs_cell_mesh_t structure.
Definition: cs_equation_builder.h:255
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
void() cs_equation_build_hook_t(const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, const void *eqc, const cs_cell_mesh_t *cm, void *context, cs_hodge_t *mass_hodge, cs_hodge_t *diff_hodge, cs_cell_sys_t *csys, cs_cell_builder_t *cb)
Generic function prototype for a hook during the cellwise building of the linear system Enable an adv...
Definition: cs_equation_builder.h:76
void * hook_context
Definition: cs_equation_builder.h:215
Definition: cs_cdo_system.h:368
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:203
bool graddiv_pty_uniform
Definition: cs_equation_builder.h:119
cs_equation_build_hook_t * hook_function
Definition: cs_equation_builder.h:216
cs_mask_t * source_mask
Definition: cs_equation_builder.h:130
Structure associated to a discrete Hodge operator *.
Definition: cs_hodge.h:186
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
cs_equation_builder_t * cs_equation_builder_create(const cs_equation_param_t *eqp, const cs_mesh_t *mesh)
Allocate a new structure to handle the building of algebraic system related to a cs_equation_t struct...
Definition: cs_equation_builder.c:100
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
void cs_equation_builder_free(cs_equation_builder_t **p_builder)
Free a cs_equation_builder_t structure.
Definition: cs_equation_builder.c:285
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
bool reac_pty_uniform[CS_CDO_N_MAX_REACTIONS]
Definition: cs_equation_builder.h:121
Set of common parameters to manage an iterative algorithm.
Definition: cs_iter_algo.h:101
Definition: cs_mesh.h:84
cs_flag_t sys_flag
Definition: cs_equation_builder.h:109
bool time_pty_uniform
Definition: cs_equation_builder.h:120
cs_real_t * enforced_values
Definition: cs_equation_builder.h:156
Definition: cs_cdo_bc.h:109
void cs_equation_builder_log_performance(const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb)
Print a message in the performance output file related to the monitoring of equation.
Definition: cs_equation_builder.c:351
cs_eflag_t st_msh_flag
Definition: cs_equation_builder.h:106
cs_cdo_bc_face_t * face_bc
Definition: cs_equation_builder.h:187
Definition: cs_range_set.h:57
Set of local and temporary buffers.
Definition: cs_cdo_local.h:60
bool curlcurl_pty_uniform
Definition: cs_equation_builder.h:118
cs_real_t * increment
Definition: cs_equation_builder.h:171
cs_eflag_t bd_msh_flag
Definition: cs_equation_builder.h:103
cs_eflag_t msh_flag
Definition: cs_equation_builder.h:100
void cs_equation_builder_enforce_block_dofs(const cs_equation_builder_t *eqb, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account the enforcement of internal DoFs. Case of matrices defined by blocks. Apply an algebraic manipulation. Update members of the cs_cell_sys_t structure related to the internal enforcement.
Definition: cs_equation_builder.c:576
#define CS_CDO_N_MAX_REACTIONS
Definition: cs_param_cdo.h:74
void cs_equation_builder_init_properties(const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, cs_hodge_t *diff_hodge, cs_cell_builder_t *cb)
Initialize all properties potentially useful to build the algebraic system. This function is shared a...
Definition: cs_equation_builder.c:440
#define END_C_DECLS
Definition: cs_defs.h:511
unsigned short int cs_flag_t
Definition: cs_defs.h:324
#define CS_N_MAX_SOURCE_TERMS
Definition: cs_source_term.h:49
bool init_step
Definition: cs_equation_builder.h:93
const cs_matrix_t * cs_equation_builder_get_matrix(const cs_equation_builder_t *builder, int block_id)
Retrieve the range set structure associated to a builder structure for the block defined in block_id ...
Definition: cs_equation_builder.c:224
unsigned int cs_eflag_t
Definition: cs_flag.h:187
bool cs_equation_builder_set_reaction_pty_cw(const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
Initialize all reaction properties. This function is shared across all CDO schemes. The cs_cell_builder_t structure stores the computed property values. If the property is uniform, a first call to the function cs_equation_builder_init_properties has to be done before the loop on cells.
Definition: cs_equation_builder.c:401
cs_iter_algo_t * incremental_algo
Definition: cs_equation_builder.h:172
cs_timer_counter_t tcb
Definition: cs_equation_builder.h:227
void cs_equation_builder_enforce_dofs(const cs_equation_builder_t *eqb, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account the enforcement of internal DoFs. Apply an algebraic manipulation. Update members of the cs_cell_sys_t structure related to the internal enforcement.
Definition: cs_equation_builder.c:504
Definition: mesh.f90:26
void() cs_source_term_cellwise_t(const cs_xdef_t *source, const cs_cell_mesh_t *cm, cs_real_t time_eval, cs_cell_builder_t *cb, void *input, double *values)
Compute the contribution for a cell related to a source term and add it to the given array of values...
Definition: cs_source_term.h:70
Definition: cs_timer.h:55
cs_timer_counter_t tce
Definition: cs_equation_builder.h:231
#define CS_FLAG_BOUNDARY_CELL_BY_FACE
(= 1) boundary cell with at least one border face
Definition: cs_flag.h:62