7.0
general documentation
cs_source_term.h
Go to the documentation of this file.
1 #ifndef __CS_SOURCE_TERM_H__
2 #define __CS_SOURCE_TERM_H__
3 
4 /*============================================================================
5  * Functions and structures to deal with source term computation
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 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_cdo_quantities.h"
36 #include "cs_cdo_local.h"
37 #include "cs_param_types.h"
38 #include "cs_quadrature.h"
39 #include "cs_xdef.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 #define CS_N_MAX_SOURCE_TERMS 8 // Max number of source terms in an equation
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
60 typedef struct {
61 
62  cs_real_t g[3]; /* gravity vector */
63  cs_real_t rho0; /* reference value for the mass density */
64  cs_real_t beta; /* dilatation coefficient */
65  cs_real_t var0; /* reference value of the variable */
66  cs_real_t *var; /* array of values of the variable */
67 
69 
70 /*----------------------------------------------------------------------------*/
82 /*----------------------------------------------------------------------------*/
83 
84 typedef void
86  const cs_cell_mesh_t *cm,
87  cs_real_t time_eval,
89  void *input,
90  double *values);
91 
92 
93 /*============================================================================
94  * Public function prototypes
95  *============================================================================*/
96 
97 /*----------------------------------------------------------------------------*/
104 /*----------------------------------------------------------------------------*/
105 
106 void
108  const cs_cdo_connect_t *connect);
109 
110 /*----------------------------------------------------------------------------*/
119 /*----------------------------------------------------------------------------*/
120 
121 void
123  cs_flag_t *state_flag,
124  cs_flag_t *meta_flag);
125 
126 /*----------------------------------------------------------------------------*/
134 /*----------------------------------------------------------------------------*/
135 
136 void
138  cs_flag_t flag);
139 
140 /*----------------------------------------------------------------------------*/
148 /*----------------------------------------------------------------------------*/
149 
150 cs_flag_t
152 
153 /*----------------------------------------------------------------------------*/
167 /*----------------------------------------------------------------------------*/
168 
171  const int n_source_terms,
172  cs_xdef_t *const *source_terms,
173  cs_source_term_cellwise_t *compute_source[],
174  cs_flag_t *sys_flag,
175  cs_mask_t *source_mask[]);
176 
177 /*----------------------------------------------------------------------------*/
192 /*----------------------------------------------------------------------------*/
193 
194 void
195 cs_source_term_compute_cellwise(const int n_source_terms,
196  cs_xdef_t *const *source_terms,
197  const cs_cell_mesh_t *cm,
198  const cs_mask_t *source_mask,
199  cs_source_term_cellwise_t *compute_source[],
200  cs_real_t time_eval,
201  void *input,
202  cs_cell_builder_t *cb,
203  cs_real_t *result);
204 
205 /*----------------------------------------------------------------------------*/
221 /*----------------------------------------------------------------------------*/
222 
223 void
225  const cs_cell_mesh_t *cm,
226  cs_real_t time_eval,
227  cs_cell_builder_t *cb,
228  void *input,
229  double *values);
230 
231 /*----------------------------------------------------------------------------*/
247 /*----------------------------------------------------------------------------*/
248 
249 void
251  const cs_cell_mesh_t *cm,
252  cs_real_t time_eval,
253  cs_cell_builder_t *cb,
254  void *input,
255  double *values);
256 
257 /*----------------------------------------------------------------------------*/
270 /*----------------------------------------------------------------------------*/
271 
272 void
274  const cs_cell_mesh_t *cm,
275  cs_real_t time_eval,
276  cs_cell_builder_t *cb,
277  void *input,
278  double *values);
279 
280 /*----------------------------------------------------------------------------*/
293 /*----------------------------------------------------------------------------*/
294 
295 void
297  const cs_cell_mesh_t *cm,
298  cs_real_t time_eval,
299  cs_cell_builder_t *cb,
300  void *input,
301  double *values);
302 
303 /*----------------------------------------------------------------------------*/
316 /*----------------------------------------------------------------------------*/
317 
318 void
320  const cs_cell_mesh_t *cm,
321  cs_real_t time_eval,
322  cs_cell_builder_t *cb,
323  void *input,
324  double *values);
325 
326 /*----------------------------------------------------------------------------*/
339 /*----------------------------------------------------------------------------*/
340 
341 void
343  const cs_cell_mesh_t *cm,
344  cs_real_t time_eval,
345  cs_cell_builder_t *cb,
346  void *input,
347  double *values);
348 
349 /*----------------------------------------------------------------------------*/
365 /*----------------------------------------------------------------------------*/
366 
367 void
369  const cs_cell_mesh_t *cm,
370  cs_real_t time_eval,
371  cs_cell_builder_t *cb,
372  void *input,
373  double *values);
374 
375 /*----------------------------------------------------------------------------*/
391 /*----------------------------------------------------------------------------*/
392 
393 void
395  const cs_cell_mesh_t *cm,
396  cs_real_t time_eval,
397  cs_cell_builder_t *cb,
398  void *input,
399  double *values);
400 
401 /*----------------------------------------------------------------------------*/
417 /*----------------------------------------------------------------------------*/
418 
419 void
421  const cs_cell_mesh_t *cm,
422  cs_real_t time_eval,
423  cs_cell_builder_t *cb,
424  void *input,
425  double *values);
426 
427 /*----------------------------------------------------------------------------*/
445 /*----------------------------------------------------------------------------*/
446 
447 void
449  const cs_cell_mesh_t *cm,
450  cs_real_t time_eval,
451  cs_cell_builder_t *cb,
452  void *input,
453  double *values);
454 
455 /*----------------------------------------------------------------------------*/
471 /*----------------------------------------------------------------------------*/
472 
473 void
475  const cs_cell_mesh_t *cm,
476  cs_real_t time_eval,
477  cs_cell_builder_t *cb,
478  void *input,
479  double *values);
480 
481 /*----------------------------------------------------------------------------*/
497 /*----------------------------------------------------------------------------*/
498 
499 void
501  const cs_cell_mesh_t *cm,
502  cs_real_t time_eval,
503  cs_cell_builder_t *cb,
504  void *input,
505  double *values);
506 
507 /*----------------------------------------------------------------------------*/
521 /*----------------------------------------------------------------------------*/
522 
523 void
525  const cs_cell_mesh_t *cm,
526  cs_real_t time_eval,
527  cs_cell_builder_t *cb,
528  void *input,
529  double *values);
530 
531 /*----------------------------------------------------------------------------*/
545 /*----------------------------------------------------------------------------*/
546 
547 void
549  const cs_cell_mesh_t *cm,
550  cs_real_t time_eval,
551  cs_cell_builder_t *cb,
552  void *input,
553  double *values);
554 
555 /*----------------------------------------------------------------------------*/
569 /*----------------------------------------------------------------------------*/
570 
571 void
573  const cs_cell_mesh_t *cm,
574  cs_real_t time_eval,
575  cs_cell_builder_t *cb,
576  void *input,
577  double *values);
578 
579 /*----------------------------------------------------------------------------*/
594 /*----------------------------------------------------------------------------*/
595 
596 void
598  const cs_cell_mesh_t *cm,
599  cs_real_t time_eval,
600  cs_cell_builder_t *cb,
601  void *input,
602  double *values);
603 
604 /*----------------------------------------------------------------------------*/
621 /*----------------------------------------------------------------------------*/
622 
623 void
625  const cs_cell_mesh_t *cm,
626  cs_real_t time_eval,
627  cs_cell_builder_t *cb,
628  void *input,
629  double *values);
630 
631 /*----------------------------------------------------------------------------*/
645 /*----------------------------------------------------------------------------*/
646 
647 void
649  const cs_cell_mesh_t *cm,
650  cs_real_t time_eval,
651  cs_cell_builder_t *cb,
652  void *input,
653  double *values);
654 
655 /*----------------------------------------------------------------------------*/
668 /*----------------------------------------------------------------------------*/
669 
670 void
672  const cs_cell_mesh_t *cm,
673  cs_real_t time_eval,
674  cs_cell_builder_t *cb,
675  void *input,
676  double *values);
677 
678 /*----------------------------------------------------------------------------*/
695 /*----------------------------------------------------------------------------*/
696 
697 void
699  const cs_cell_mesh_t *cm,
700  cs_real_t time_eval,
701  cs_cell_builder_t *cb,
702  void *input,
703  double *values);
704 
705 /*----------------------------------------------------------------------------*/
719 /*----------------------------------------------------------------------------*/
720 
721 void
723  const cs_cell_mesh_t *cm,
724  cs_real_t time_eval,
725  cs_cell_builder_t *cb,
726  void *input,
727  double *values);
728 
729 /*----------------------------------------------------------------------------*/
742 /*----------------------------------------------------------------------------*/
743 
744 void
746  const cs_cell_mesh_t *cm,
747  cs_real_t time_eval,
748  cs_cell_builder_t *cb,
749  void *input,
750  double *values);
751 
752 /*----------------------------------------------------------------------------*/
766 /*----------------------------------------------------------------------------*/
767 
768 void
770  const cs_cell_mesh_t *cm,
771  cs_real_t time_eval,
772  cs_cell_builder_t *cb,
773  void *input,
774  double *values);
775 
776 /*----------------------------------------------------------------------------*/
791 /*----------------------------------------------------------------------------*/
792 
793 void
795  const cs_cell_mesh_t *cm,
796  cs_real_t time_eval,
797  cs_cell_builder_t *cb,
798  void *input,
799  double *values);
800 
801 /*----------------------------------------------------------------------------*/
816 /*----------------------------------------------------------------------------*/
817 
818 void
820  const cs_cell_mesh_t *cm,
821  cs_real_t time_eval,
822  cs_cell_builder_t *cb,
823  void *input,
824  double *values);
825 
826 /*----------------------------------------------------------------------------*/
839 /*----------------------------------------------------------------------------*/
840 
841 void
843  const cs_cell_mesh_t *cm,
844  cs_real_t time_eval,
845  cs_cell_builder_t *cb,
846  void *input,
847  double *values);
848 
849 /*----------------------------------------------------------------------------*/
850 
851 
852 
854 
855 #endif /* __CS_SOURCE_TERM_H__ */
cs_real_t * var
Definition: cs_source_term.h:66
void cs_source_term_dcsd_q5o3_by_analytic(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.c:1583
cs_flag_t cs_source_term_get_flag(const cs_xdef_t *st)
Get metadata related to the given source term structure.
Definition: cs_source_term.c:467
void cs_source_term_pcvd_bary_by_analytic(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.c:2192
cs_eflag_t cs_source_term_init(cs_param_space_scheme_t space_scheme, const int n_source_terms, cs_xdef_t *const *source_terms, cs_source_term_cellwise_t *compute_source[], cs_flag_t *sys_flag, cs_mask_t *source_mask[])
Initialize data to build the source terms.
Definition: cs_source_term.c:492
cs_real_t rho0
Definition: cs_source_term.h:63
void cs_source_term_hhovd_by_analytic(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 of a source term for a cell and add it to the given array of values...
Definition: cs_source_term.c:2673
unsigned char cs_mask_t
Definition: cs_flag.h:143
void cs_source_term_dcsd_bary_by_analytic(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.c:1194
void cs_source_term_pvsp_by_value(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.c:910
void cs_source_term_hhosd_by_analytic(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 of a source term for a cell and add it to the given array of values...
Definition: cs_source_term.c:2551
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
void cs_source_term_dcsd_by_value(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.c:1017
Set of local quantities and connectivities related to a mesh cell This is a key structure for all cel...
Definition: cs_cdo_local.h:159
void cs_source_term_dcsd_q10o2_by_analytic(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.c:1381
Definition: cs_cdo_connect.h:76
cs_real_t beta
Definition: cs_source_term.h:64
void cs_source_term_dcsd_q1o1_by_analytic(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.c:1300
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
Definition: cs_cdo_quantities.h:124
void cs_source_term_pcsd_by_value(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.c:1794
void cs_source_term_dfsf_by_value(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.c:2791
cs_param_space_scheme_t
Type of numerical scheme for the discretization in space.
Definition: cs_param_types.h:172
void cs_source_term_set_reduction(cs_xdef_t *st, cs_flag_t flag)
Set advanced parameters which are defined by default in a source term structure.
Definition: cs_source_term.c:412
cs_real_t var0
Definition: cs_source_term.h:65
void cs_source_term_set_shared_pointers(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect)
Set shared pointers to main domain members.
Definition: cs_source_term.c:344
Structure storing the parameters related to the Boussinesq source term.
Definition: cs_source_term.h:60
void cs_source_term_pcvd_by_dof_func(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.c:1881
void cs_source_term_vcsp_by_analytic(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.c:1736
void cs_source_term_pvsp_by_analytic(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.c:965
void cs_source_term_pcvd_by_value(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 the given array of values...
Definition: cs_source_term.c:1931
void cs_source_term_dcsd_by_array(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.c:1099
void cs_source_term_pcsd_by_dof_func(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.c:1833
void cs_source_term_hhosd_by_value(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 of a source term for a cell and add it to the given array of values...
Definition: cs_source_term.c:2422
Set of local and temporary buffers useful for building the algebraic system with a cellwise process...
Definition: cs_cdo_local.h:69
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:154
void cs_source_term_dcvd_by_value(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.c:1058
void cs_source_term_pcsd_by_analytic(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 of a source term for a cell and add it to the given array of values...
Definition: cs_source_term.c:2020
void cs_source_term_set_default_flag(cs_param_space_scheme_t scheme, cs_flag_t *state_flag, cs_flag_t *meta_flag)
Set the default flag related to a source term according to the numerical scheme chosen for discretizi...
Definition: cs_source_term.c:364
void cs_source_term_pcvd_by_analytic(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 of a source term for a cell and add it to the given array of values...
Definition: cs_source_term.c:2242
#define END_C_DECLS
Definition: cs_defs.h:496
unsigned short int cs_flag_t
Definition: cs_defs.h:309
void cs_source_term_compute_cellwise(const int n_source_terms, cs_xdef_t *const *source_terms, const cs_cell_mesh_t *cm, const cs_mask_t *source_mask, cs_source_term_cellwise_t *compute_source[], cs_real_t time_eval, void *input, cs_cell_builder_t *cb, cs_real_t *result)
Compute the local contributions of source terms in a cell.
Definition: cs_source_term.c:846
unsigned int cs_eflag_t
Definition: cs_flag.h:166
void cs_source_term_dcsd_by_dof_func(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.c:1141
void cs_source_term_pcsd_bary_by_analytic(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.c:1973
void cs_source_term_pcvd_by_array(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 of a source term for a cell and add it to the given array of values...
Definition: cs_source_term.c:2375
void cs_source_term_vcsp_by_value(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.c:1681
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:85
void cs_source_term_pcsd_by_array(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.c:2148