programmer's documentation
cs_equation_common.h
Go to the documentation of this file.
1 #ifndef __CS_EQUATION_COMMON_H__
2 #define __CS_EQUATION_COMMON_H__
3 
4 /*============================================================================
5  * Routines to handle common equation features for building algebraic system
6  * in CDO schemes
7  *============================================================================*/
8 
9 /*
10  This file is part of Code_Saturne, a general-purpose CFD tool.
11 
12  Copyright (C) 1998-2018 EDF S.A.
13 
14  This program is free software; you can redistribute it and/or modify it under
15  the terms of the GNU General Public License as published by the Free Software
16  Foundation; either version 2 of the License, or (at your option) any later
17  version.
18 
19  This program is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22  details.
23 
24  You should have received a copy of the GNU General Public License along with
25  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26  Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 */
28 
29 /*----------------------------------------------------------------------------
30  * Local headers
31  *----------------------------------------------------------------------------*/
32 
33 #include "cs_cdo_bc.h"
34 #include "cs_cdo_connect.h"
35 #include "cs_cdo_quantities.h"
36 #include "cs_cdo_time.h"
37 #include "cs_domain.h"
38 #include "cs_equation_param.h"
39 #include "cs_flag.h"
40 #include "cs_matrix.h"
41 #include "cs_time_step.h"
42 #include "cs_timer.h"
43 #include "cs_source_term.h"
44 
45 /*----------------------------------------------------------------------------*/
46 
48 
49 /*============================================================================
50  * Macro definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Type definitions
55  *============================================================================*/
56 
62 typedef struct {
63 
88  bool reac_pty_uniform[CS_CDO_N_MAX_REACTIONS];
107 
149 
150 /*============================================================================
151  * Inline public function prototypes
152  *============================================================================*/
153 
154 /*----------------------------------------------------------------------------*/
163 /*----------------------------------------------------------------------------*/
164 
165 static inline cs_flag_t
167  const cs_equation_builder_t *eqb)
168 {
169  cs_flag_t _flag = eqb->msh_flag | eqb->st_msh_flag;
170 
171  if (cell_flag & CS_FLAG_BOUNDARY)
172  _flag |= eqb->bd_msh_flag;
173 
174  return _flag;
175 }
176 
177 /*============================================================================
178  * Public function prototypes
179  *============================================================================*/
180 
181 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 
198 void
200  const cs_cdo_quantities_t *quant,
201  const cs_time_step_t *time_step,
202  const cs_domain_cdo_context_t *cc);
203 
204 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 void
219 
220 /*----------------------------------------------------------------------------*/
230 /*----------------------------------------------------------------------------*/
231 
234  const cs_mesh_t *mesh);
235 
236 /*----------------------------------------------------------------------------*/
243 /*----------------------------------------------------------------------------*/
244 
245 void
247 
248 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
258 void
259 cs_equation_write_monitoring(const char *eqname,
260  const cs_equation_builder_t *eqb);
261 
262 /*----------------------------------------------------------------------------*/
273 /*----------------------------------------------------------------------------*/
274 
275 void
277  const cs_equation_builder_t *eqb,
278  double *tpty_val,
279  double *rpty_vals,
280  cs_cell_builder_t *cb);
281 
282 /*----------------------------------------------------------------------------*/
291 /*----------------------------------------------------------------------------*/
292 
293 void
295  cs_lnum_t c_id,
296  cs_flag_t c_flag,
297  cs_cell_builder_t *cb);
298 
299 /*----------------------------------------------------------------------------*/
309 /*----------------------------------------------------------------------------*/
310 
311 void
313  const cs_cell_mesh_t *cm,
314  cs_flag_t c_flag,
315  cs_cell_builder_t *cb);
316 
317 /*----------------------------------------------------------------------------*/
329 /*----------------------------------------------------------------------------*/
330 
331 void
333  const cs_range_set_t *rset,
334  const cs_equation_param_t *eqp,
335  cs_real_t *rhs,
336  cs_real_t *sources,
338 
339 /*----------------------------------------------------------------------------*/
351 /*----------------------------------------------------------------------------*/
352 
353 void
355  const cs_range_set_t *rset,
356  const cs_equation_param_t *eqp,
357  int n_face_dofs,
358  cs_real_t *rhs,
360 
361 /*----------------------------------------------------------------------------*/
367 /*----------------------------------------------------------------------------*/
368 
369 const cs_adjacency_t *
371 
372 /*----------------------------------------------------------------------------*/
378 /*----------------------------------------------------------------------------*/
379 
380 const cs_adjacency_t *
382 
383 /*----------------------------------------------------------------------------*/
391 /*----------------------------------------------------------------------------*/
392 
393 cs_real_t *
395 
396 /*----------------------------------------------------------------------------*/
402 /*----------------------------------------------------------------------------*/
403 
404 size_t
406 
407 /*----------------------------------------------------------------------------*/
408 
410 
411 #endif /* __CS_EQUATION_COMMON_H__ */
cs_timer_counter_t tca
Definition: cs_equation_common.h:136
Store common elements used when building an algebraic system related to an equation.
Definition: cs_equation_common.h:62
time step descriptor
Definition: cs_time_step.h:51
cs_timer_counter_t tcd
Definition: cs_equation_common.h:134
const cs_range_set_t * rset
Definition: cs_equation_priv.h:308
const cs_adjacency_t * cs_equation_get_f2f_index(void)
Get the connectivity face->faces for the local rank.
Definition: cs_equation_common.c:1136
unsigned char cs_mask_t
Definition: cs_flag.h:128
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:150
struct _cs_matrix_assembler_values_t cs_matrix_assembler_values_t
Definition: cs_matrix_assembler.h:66
cs_timer_counter_t tcr
Definition: cs_equation_common.h:138
void cs_equation_free_builder(cs_equation_builder_t **p_builder)
Free a cs_equation_builder_t structure.
Definition: cs_equation_common.c:716
Definition: cs_mesh_adjacencies.h:89
#define BEGIN_C_DECLS
Definition: cs_defs.h:461
void cs_equation_set_diffusion_property(const cs_equation_param_t *eqp, cs_lnum_t c_id, cs_flag_t c_flag, cs_cell_builder_t *cb)
Set the diffusion property inside a cell and its related quantities.
Definition: cs_equation_common.c:833
Definition: cs_cdo_local.h:133
Definition: cs_cdo_bc.h:95
cs_flag_t msh_flag
Definition: cs_equation_common.h:69
#define CS_FLAG_BOUNDARY
Definition: cs_flag.h:49
Definition: cs_cdo_connect.h:69
cs_cdo_bc_t * face_bc
Definition: cs_equation_common.h:121
cs_timer_counter_t tcb
Definition: cs_equation_common.h:132
void() cs_source_term_cellwise_t(const cs_xdef_t *source, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb, void *input, double *values)
Compute the contribution for a cell related to a source term and add it the given array of values...
Definition: cs_source_term.h:70
void cs_equation_assemble_f(const cs_cell_sys_t *csys, const cs_range_set_t *rset, const cs_equation_param_t *eqp, int n_face_dofs, cs_real_t *rhs, cs_matrix_assembler_values_t *mav)
Assemble a cellwise system related to cell faces into the global algebraic system.
Definition: cs_equation_common.c:986
Definition: cs_domain.h:79
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:94
Definition: cs_cdo_local.h:94
Definition: cs_mesh.h:63
bool time_pty_uniform
Definition: cs_equation_common.h:87
cs_flag_t bd_msh_flag
Definition: cs_equation_common.h:72
cs_flag_t st_msh_flag
Definition: cs_equation_common.h:75
const cs_adjacency_t * cs_equation_get_v2v_index(void)
Get the connectivity vertex->vertices for the local rank.
Definition: cs_equation_common.c:1122
cs_equation_builder_t * cs_equation_init_builder(const cs_equation_param_t *eqp, const cs_mesh_t *mesh)
Allocate a new structure to handle the building of algebraic system related to an cs_equation_t struc...
Definition: cs_equation_common.c:638
void cs_equation_set_diffusion_property_cw(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_flag_t c_flag, cs_cell_builder_t *cb)
Set the diffusion property inside a cell and its related quantities. Cellwise version using a cs_cell...
Definition: cs_equation_common.c:870
cs_real_t * cs_equation_get_tmpbuf(void)
Retrieve a pointer to a buffer of size at least the 2*n_cells The size of the temporary buffer can be...
Definition: cs_equation_common.c:1152
Definition: cs_range_set.h:57
cs_timer_counter_t tce
Definition: cs_equation_common.h:142
Definition: cs_cdo_local.h:71
cs_timer_counter_t tcs
Definition: cs_equation_common.h:140
cs_equation_compute_source_t * compute_source
Definition: cs_equation_priv.h:326
void cs_equation_common_free(const cs_domain_cdo_context_t *cc)
Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory ...
Definition: cs_equation_common.c:568
cs_flag_t sys_flag
Definition: cs_equation_common.h:78
cs_real_t * rhs
Definition: cs_equation_priv.h:301
#define CS_CDO_N_MAX_REACTIONS
Definition: cs_param_cdo.h:52
bool diff_pty_uniform
Definition: cs_equation_common.h:86
void cs_equation_write_monitoring(const char *eqname, const cs_equation_builder_t *eqb)
Print a message in the performance output file related to the monitoring of equation.
Definition: cs_equation_common.c:747
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
void cs_equation_assemble_v(const cs_cell_sys_t *csys, const cs_range_set_t *rset, const cs_equation_param_t *eqp, cs_real_t *rhs, cs_real_t *sources, cs_matrix_assembler_values_t *mav)
Assemble a cellwise system related to cell vertices into the global algebraic system.
Definition: cs_equation_common.c:909
#define END_C_DECLS
Definition: cs_defs.h:462
unsigned short int cs_flag_t
Definition: cs_defs.h:299
void cs_equation_common_allocate(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, const cs_domain_cdo_context_t *cc)
Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory ...
Definition: cs_equation_common.c:341
#define CS_N_MAX_SOURCE_TERMS
Definition: cs_source_term.h:50
static cs_flag_t cs_equation_get_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_common.h:166
void cs_equation_init_properties(const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, double *tpty_val, double *rpty_vals, cs_cell_builder_t *cb)
Initialize all properties for an algebraic system.
Definition: cs_equation_common.c:786
size_t cs_equation_get_tmpbuf_size(void)
Get the allocation size of the temporary buffer.
Definition: cs_equation_common.c:1166
cs_mask_t * source_mask
Definition: cs_equation_common.h:97
Structure and routines handling the specific settings related to a cs_equation_t structure.
Definition: mesh.f90:26
Definition: cs_timer.h:57