programmer's 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-2016 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.h"
36 #include "cs_cdo_quantities.h"
37 #include "cs_param.h"
38 #include "cs_quadrature.h"
39 #include "cs_time_step.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /* Types of source terms */
54 typedef enum {
55 
56  CS_SOURCE_TERM_GRAVITY, // specific treatment
57  CS_SOURCE_TERM_HEADLOSS, // specific treatment (not implemented yet)
58  CS_SOURCE_TERM_MASS, // specific treatment (not implemented yet)
59  CS_SOURCE_TERM_USER, // user-defined
61 
63 
64 /* Indicate where the reduction of source terms has to be done */
65 typedef enum {
66 
67  CS_SOURCE_TERM_REDUC_DUAL, // reduction on dual entities
68  CS_SOURCE_TERM_REDUC_PRIM, // reduction on primal entities
70 
72 
73 typedef struct _cs_source_term_t cs_source_term_t;
74 
75 /*============================================================================
76  * Public function prototypes
77  *============================================================================*/
78 
79 /*----------------------------------------------------------------------------*/
87 /*----------------------------------------------------------------------------*/
88 
89 void
91  const cs_cdo_connect_t *connect,
92  const cs_time_step_t *time_step);
93 
94 /*----------------------------------------------------------------------------*/
106 /*----------------------------------------------------------------------------*/
107 
108 cs_source_term_t *
109 cs_source_term_create(const char *name,
110  int ml_id,
111  cs_source_term_type_t st_type,
113  cs_param_var_type_t var_type);
114 
115 /*----------------------------------------------------------------------------*/
123 /*----------------------------------------------------------------------------*/
124 
125 cs_source_term_t *
126 cs_source_term_free(cs_source_term_t *st);
127 
128 /*----------------------------------------------------------------------------*/
135 /*----------------------------------------------------------------------------*/
136 
137 void
138 cs_source_term_set_quadrature(cs_source_term_t *st,
139  cs_quadra_type_t quad_type);
140 
141 /*----------------------------------------------------------------------------*/
148 /*----------------------------------------------------------------------------*/
149 
150 void
151 cs_source_term_set_reduction(cs_source_term_t *st,
152  cs_source_term_reduction_t red_type);
153 
154 /*----------------------------------------------------------------------------*/
162 /*----------------------------------------------------------------------------*/
163 
164 const char *
165 cs_source_term_get_name(const cs_source_term_t *st);
166 
167 /*----------------------------------------------------------------------------*/
175 /*----------------------------------------------------------------------------*/
176 
178 cs_source_term_get_reduction(const cs_source_term_t *st);
179 
180 /*----------------------------------------------------------------------------*/
187 /*----------------------------------------------------------------------------*/
188 
189 void
190 cs_source_term_summary(const char *eqname,
191  const cs_source_term_t *st);
192 
193 /*----------------------------------------------------------------------------*/
200 /*----------------------------------------------------------------------------*/
201 
202 void
203 cs_source_term_def_by_value(cs_source_term_t *st,
204  const char *val);
205 
206 /*----------------------------------------------------------------------------*/
213 /*----------------------------------------------------------------------------*/
214 
215 void
216 cs_source_term_def_by_analytic(cs_source_term_t *st,
217  cs_analytic_func_t *func);
218 
219 /*----------------------------------------------------------------------------*/
227 /*----------------------------------------------------------------------------*/
228 
229 void
230 cs_source_term_def_by_array(cs_source_term_t *st,
231  cs_desc_t desc,
232  cs_real_t *array);
233 
234 /*----------------------------------------------------------------------------*/
242 /*----------------------------------------------------------------------------*/
243 
244 void
246  const cs_source_term_t *source,
247  double *p_values[]);
248 
249 /*----------------------------------------------------------------------------*/
250 
252 
253 #endif /* __CS_SOURCE_TERM_H__ */
time step descriptor
Definition: cs_time_step.h:51
Definition: cs_cdo.h:112
void cs_source_term_compute(cs_desc_t dof_desc, const cs_source_term_t *source, double *p_values[])
Compute the contribution related to a source term.
Definition: cs_source_term.c:427
void cs_source_term_def_by_analytic(cs_source_term_t *st, cs_analytic_func_t *func)
Define a cs_source_term_t structure thanks to an analytic function.
Definition: cs_source_term.c:382
#define BEGIN_C_DECLS
Definition: cs_defs.h:448
cs_source_term_reduction_t
Definition: cs_source_term.h:65
Definition: cs_cdo_connect.h:67
void() cs_analytic_func_t(cs_real_t time, const cs_real_3_t xyz, cs_get_t *retval)
Generic analytic function.
Definition: cs_cdo.h:154
void cs_source_term_summary(const char *eqname, const cs_source_term_t *st)
Summarize the content of a cs_source_term_t structure.
Definition: cs_source_term.c:291
double cs_real_t
Floating-point value.
Definition: cs_defs.h:296
Definition: cs_cdo_quantities.h:100
void cs_source_term_def_by_array(cs_source_term_t *st, cs_desc_t desc, cs_real_t *array)
Define a cs_source_term_t structure thanks to an array of values.
Definition: cs_source_term.c:403
Definition: cs_source_term.h:69
void cs_source_term_set_reduction(cs_source_term_t *st, cs_source_term_reduction_t red_type)
Set where the reduction has to be applied forn defining source term.
Definition: cs_source_term.c:234
void cs_source_term_set_shared_pointers(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
Set shared pointers to main domain members.
Definition: cs_source_term.c:115
Definition: cs_source_term.h:68
cs_source_term_type_t
Definition: cs_source_term.h:54
Definition: cs_source_term.h:57
Definition: cs_source_term.h:60
const char * cs_source_term_get_name(const cs_source_term_t *st)
Get the name related to a cs_source_term_t structure.
Definition: cs_source_term.c:254
Definition: cs_source_term.h:56
cs_source_term_t * cs_source_term_create(const char *name, int ml_id, cs_source_term_type_t st_type, cs_source_term_reduction_t red_type, cs_param_var_type_t var_type)
Create and initialize a cs_source_term_t structure.
Definition: cs_source_term.c:140
cs_source_term_t * cs_source_term_free(cs_source_term_t *st)
Destroy a cs_source_term_t structure.
Definition: cs_source_term.c:185
void cs_source_term_set_quadrature(cs_source_term_t *st, cs_quadra_type_t quad_type)
Set the type of quadrature to use for computing the source term.
Definition: cs_source_term.c:214
cs_quadra_type_t
Definition: cs_quadrature.h:40
#define END_C_DECLS
Definition: cs_defs.h:449
Definition: cs_source_term.h:58
cs_param_var_type_t
Definition: cs_param.h:109
Definition: cs_source_term.h:67
Definition: cs_source_term.h:59
cs_source_term_reduction_t cs_source_term_get_reduction(const cs_source_term_t *st)
Get the type of reduction applied to a cs_source_term_t structure.
Definition: cs_source_term.c:273
void cs_source_term_def_by_value(cs_source_term_t *st, const char *val)
Generic way to define the value of a cs_source_term_t structure.
Definition: cs_source_term.c:342