My Project
programmer's documentation
cs_evaluate.h
Go to the documentation of this file.
1 #ifndef __CS_EVALUATE_H__
2 #define __CS_EVALUATE_H__
3 
4 /*============================================================================
5  * Functions and structures to deal with evaluation of quantities
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2019 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_connect.h"
36 #include "cs_cdo_local.h"
37 #include "cs_cdo_quantities.h"
38 #include "cs_param.h"
39 #include "cs_xdef.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Public function prototypes
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------*/
64 /*----------------------------------------------------------------------------*/
65 
66 void
68  const cs_cdo_connect_t *connect);
69 
70 /*----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------*/
81 
82 void
84  const cs_xdef_t *def,
85  cs_real_t time_eval,
86  cs_real_t retval[]);
87 
88 /*----------------------------------------------------------------------------*/
98 /*----------------------------------------------------------------------------*/
99 
100 void
102  const cs_xdef_t *def,
103  cs_real_t retval[]);
104 
105 /*----------------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------------*/
116 
117 void
119  const cs_xdef_t *def,
120  cs_real_t time_eval,
121  cs_real_t retval[]);
122 
123 /*----------------------------------------------------------------------------*/
135 /*----------------------------------------------------------------------------*/
136 
137 void
139  const cs_xdef_t *def,
140  cs_real_t vvals[],
141  cs_real_t wvals[]);
142 
143 /*----------------------------------------------------------------------------*/
151 /*----------------------------------------------------------------------------*/
152 
153 void
155  const cs_xdef_t *def,
156  cs_real_t retval[]);
157 
158 /*----------------------------------------------------------------------------*/
165 /*----------------------------------------------------------------------------*/
166 
167 void
169  cs_real_t retval[]);
170 
171 /*----------------------------------------------------------------------------*/
180 /*----------------------------------------------------------------------------*/
181 
182 void
184  cs_real_t time_eval,
185  cs_real_t retval[]);
186 
187 /*----------------------------------------------------------------------------*/
194 /*----------------------------------------------------------------------------*/
195 
196 void
198  cs_real_t retval[]);
199 
200 /*----------------------------------------------------------------------------*/
207 /*----------------------------------------------------------------------------*/
208 
209 void
211  cs_real_t retval[]);
212 
213 /*----------------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------------*/
223 
224 void
226  cs_real_t time_eval,
227  cs_real_t retval[]);
228 
229 /*----------------------------------------------------------------------------*/
239 /*----------------------------------------------------------------------------*/
240 
241 cs_real_t
243  const cs_real_t *array_val);
244 
245 /*============================================================================
246  * Inline public function prototypes
247  *============================================================================*/
248 
249 /*----------------------------------------------------------------------------*/
257 /*----------------------------------------------------------------------------*/
258 
259 static inline void
261  cs_real_t time_eval,
262  cs_real_t retval[])
263 {
264  /* Sanity checks */
265  assert(def != NULL);
266 
267  switch (def->type) {
268 
269  case CS_XDEF_BY_VALUE:
271  break;
272 
274  cs_evaluate_average_on_faces_by_analytic(def, time_eval, retval);
275  break;
276 
277  default:
278  bft_error(__FILE__, __LINE__, 0, " %s: Case not handled yet.", __func__);
279 
280  }
281 }
282 
283 /*----------------------------------------------------------------------------*/
291 /*----------------------------------------------------------------------------*/
292 
293 static inline void
295  cs_real_t time_eval,
296  cs_real_t retval[])
297 {
298  /* Sanity checks */
299  assert(def != NULL);
300 
301  switch (def->type) {
302 
303  case CS_XDEF_BY_VALUE:
305  break;
306 
308  cs_evaluate_average_on_cells_by_analytic(def, time_eval, retval);
309  break;
310 
311  case CS_XDEF_BY_ARRAY:
313 
314  default:
315  bft_error(__FILE__, __LINE__, 0, " %s: Case not handled yet.", __func__);
316 
317  }
318 }
319 
320 /*----------------------------------------------------------------------------*/
321 
323 
324 #endif /* __CS_EVALUATE_H__ */
cs_evaluate_average_on_cells_by_value
void cs_evaluate_average_on_cells_by_value(const cs_xdef_t *def, cs_real_t retval[])
Evaluate the average of a function on the cells.
Definition: cs_evaluate.c:2271
cs_xdef_t
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:126
cs_evaluate_average_on_faces_by_value
void cs_evaluate_average_on_faces_by_value(const cs_xdef_t *def, cs_real_t retval[])
Evaluate the average of a function on the faces.
Definition: cs_evaluate.c:2133
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
CS_XDEF_BY_VALUE
Definition: cs_xdef.h:90
CS_XDEF_BY_ANALYTIC_FUNCTION
Definition: cs_xdef.h:84
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
cs_evaluate_potential_by_qov
void cs_evaluate_potential_by_qov(cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t vvals[], cs_real_t wvals[])
Define a value to each DoF in the case of a potential field in order to put a given quantity inside t...
Definition: cs_evaluate.c:1973
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_evaluate_average_on_cells_by_array
void cs_evaluate_average_on_cells_by_array(const cs_xdef_t *def, cs_real_t retval[])
Evaluate the average of a function on the cells.
Definition: cs_evaluate.c:2312
cs_evaluate_average_on_faces
static void cs_evaluate_average_on_faces(const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[])
Evaluate the average of a function on the faces.
Definition: cs_evaluate.h:260
cs_evaluate_potential_by_analytic
void cs_evaluate_potential_by_analytic(cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[])
Evaluate the quantity attached to a potential field for all the DoFs when the definition relies on an...
Definition: cs_evaluate.c:1826
cs_cdo_quantities.h
bft_error
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
cs_xdef.h
cs_evaluate_average_on_cells
static void cs_evaluate_average_on_cells(const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[])
Evaluate the average of a function on the cells.
Definition: cs_evaluate.h:294
cs_evaluate_average_on_cells_by_analytic
void cs_evaluate_average_on_cells_by_analytic(const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[])
Evaluate the average of a function on the cells Warning: retval has to be initialize before calling t...
Definition: cs_evaluate.c:2373
cs_evaluate_scal_domain_integral_by_array
cs_real_t cs_evaluate_scal_domain_integral_by_array(cs_flag_t array_loc, const cs_real_t *array_val)
Evaluate the integral over the full computational domain of a quantity defined by an array.
Definition: cs_evaluate.c:2442
cs_evaluate_density_by_value
void cs_evaluate_density_by_value(cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t retval[])
Evaluate the quantity defined by a value in the case of a density field for all the degrees of freedo...
Definition: cs_evaluate.c:1769
cs_cdo_quantities_t
Definition: cs_cdo_quantities.h:94
CS_XDEF_BY_ARRAY
Definition: cs_xdef.h:85
cs_xdef_t::type
cs_xdef_type_t type
Definition: cs_xdef.h:160
cs_cdo_connect_t
Definition: cs_cdo_connect.h:74
cs_evaluate_potential_by_value
void cs_evaluate_potential_by_value(cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t retval[])
Evaluate the quantity attached to a potential field for all the DoFs.
Definition: cs_evaluate.c:2023
cs_cdo_connect.h
cs_evaluate_average_on_faces_by_analytic
void cs_evaluate_average_on_faces_by_analytic(const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[])
Evaluate the average of a function on the faces Warning: retval has to be initialize before calling t...
Definition: cs_evaluate.c:2211
cs_flag_t
unsigned short int cs_flag_t
Definition: cs_defs.h:304
cs_evaluate_set_shared_pointers
void cs_evaluate_set_shared_pointers(const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect)
Set shared pointers to main domain members.
Definition: cs_evaluate.c:1680
cs_evaluate_density_by_analytic
void cs_evaluate_density_by_analytic(cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[])
Compute the value related to each DoF in the case of a density field The value defined by the analyti...
Definition: cs_evaluate.c:1701
cs_param.h
cs_base.h
cs_cdo_local.h