programmer's documentation
cs_advection_field.h
Go to the documentation of this file.
1 #ifndef __CS_ADVECTION_FIELD_H__
2 #define __CS_ADVECTION_FIELD_H__
3 
4 /*============================================================================
5  * Manage the definition/setting of advection fields
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_cdo.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_property.h"
40 #include "cs_time_step.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Type definitions
52  *============================================================================*/
53 
54 typedef struct _cs_adv_field_t cs_adv_field_t;
55 
56 /* List of available keys for setting an advection field */
57 typedef enum {
58 
64 
66 
67 /*============================================================================
68  * Global variables
69  *============================================================================*/
70 
71 /*============================================================================
72  * Public function prototypes
73  *============================================================================*/
74 
75 /*----------------------------------------------------------------------------*/
83 /*----------------------------------------------------------------------------*/
84 
85 void
87  const cs_cdo_connect_t *connect,
88  const cs_time_step_t *time_step);
89 
90 /*----------------------------------------------------------------------------*/
98 /*----------------------------------------------------------------------------*/
99 
100 cs_adv_field_t *
101 cs_advection_field_create(const char *name);
102 
103 /*----------------------------------------------------------------------------*/
111 /*----------------------------------------------------------------------------*/
112 
113 cs_adv_field_t *
114 cs_advection_field_free(cs_adv_field_t *adv);
115 
116 /*----------------------------------------------------------------------------*/
125 /*----------------------------------------------------------------------------*/
126 
127 bool
128 cs_advection_field_check_name(const cs_adv_field_t *adv,
129  const char *ref_name);
130 
131 /*----------------------------------------------------------------------------*/
139 /*----------------------------------------------------------------------------*/
140 
141 bool
142 cs_advection_field_is_uniform(const cs_adv_field_t *adv);
143 
144 /*----------------------------------------------------------------------------*/
153 /*----------------------------------------------------------------------------*/
154 
155 bool
156 cs_advection_field_is_cellwise(const cs_adv_field_t *adv);
157 
158 /*----------------------------------------------------------------------------*/
166 /*----------------------------------------------------------------------------*/
167 
168 const char *
169 cs_advection_field_get_name(const cs_adv_field_t *adv);
170 
171 /*----------------------------------------------------------------------------*/
180 /*----------------------------------------------------------------------------*/
181 
183 cs_advection_field_get_deftype(const cs_adv_field_t *adv);
184 
185 /*----------------------------------------------------------------------------*/
191 /*----------------------------------------------------------------------------*/
192 
193 void
194 cs_advection_field_summary(const cs_adv_field_t *adv);
195 
196 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void
207 cs_advection_field_set_option(cs_adv_field_t *adv,
209  const char *keyval);
210 
211 /*----------------------------------------------------------------------------*/
218 /*----------------------------------------------------------------------------*/
219 
220 void
221 cs_advection_field_def_by_value(cs_adv_field_t *adv,
222  const char *val);
223 
224 /*----------------------------------------------------------------------------*/
231 /*----------------------------------------------------------------------------*/
232 
233 void
234 cs_advection_field_def_by_analytic(cs_adv_field_t *adv,
235  cs_analytic_func_t *func);
236 
237 /*----------------------------------------------------------------------------*/
245 /*----------------------------------------------------------------------------*/
246 
247 void
248 cs_advection_field_def_by_array(cs_adv_field_t *adv,
249  cs_desc_t desc,
250  const cs_real_t *array);
251 
252 /*----------------------------------------------------------------------------*/
258 /*----------------------------------------------------------------------------*/
259 
260 void
261 cs_advection_field_create_field(cs_adv_field_t *adv);
262 
263 /*----------------------------------------------------------------------------*/
271 /*----------------------------------------------------------------------------*/
272 
273 void
275  const cs_adv_field_t *adv,
276  cs_nvec3_t *vect);
277 
278 /*----------------------------------------------------------------------------*/
286 /*----------------------------------------------------------------------------*/
287 
288 void
289 cs_advection_field_get_at_xyz(const cs_adv_field_t *adv,
290  const cs_real_3_t xyz,
291  cs_nvec3_t *vect);
292 
293 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 void
303 cs_advection_field_at_cells(const cs_adv_field_t *adv,
304  cs_real_t *cell_values);
305 
306 /*----------------------------------------------------------------------------*/
313 /*----------------------------------------------------------------------------*/
314 
315 void
316 cs_advection_field_at_vertices(const cs_adv_field_t *adv,
317  cs_real_t *vtx_values);
318 
319 /*----------------------------------------------------------------------------*/
327 /*----------------------------------------------------------------------------*/
328 
329 double
330 cs_advection_field_get_cell_max(const cs_adv_field_t *adv);
331 
332 /*----------------------------------------------------------------------------*/
342 /*----------------------------------------------------------------------------*/
343 
344 void
346  const cs_param_advection_t a_info,
347  const cs_adv_field_t *adv,
348  cs_real_t *fluxes);
349 
350 /*----------------------------------------------------------------------------*/
366 /*----------------------------------------------------------------------------*/
367 
368 cs_real_t
369 cs_advection_field_get_flux_tef(const cs_adv_field_t *adv,
370  const cs_param_advection_t a_info,
371  const cs_cell_mesh_t *cm,
372  short int f,
373  short int e,
374  short int v1,
375  short int v2);
376 
377 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 
392 cs_real_t
394  cs_lnum_t e_id,
395  cs_lnum_t f_id,
396  const cs_param_advection_t a_info,
397  const cs_adv_field_t *adv);
398 
399 /*----------------------------------------------------------------------------*/
405 /*----------------------------------------------------------------------------*/
406 
407 void
408 cs_advection_field_update(cs_adv_field_t *adv);
409 
410 /*----------------------------------------------------------------------------*/
418 /*----------------------------------------------------------------------------*/
419 
420 bool
421 cs_advection_field_needs_post(const cs_adv_field_t *adv);
422 
423 /*----------------------------------------------------------------------------*/
445 /*----------------------------------------------------------------------------*/
446 
447 void
449  int mesh_id,
450  int cat_id,
451  int ent_flag[5],
452  cs_lnum_t n_cells,
453  cs_lnum_t n_i_faces,
454  cs_lnum_t n_b_faces,
455  const cs_lnum_t cell_list[],
456  const cs_lnum_t i_face_list[],
457  const cs_lnum_t b_face_list[],
458  const cs_time_step_t *time_step);
459 
460 /*----------------------------------------------------------------------------*/
468 /*----------------------------------------------------------------------------*/
469 
470 void
471 cs_advection_get_peclet(const cs_adv_field_t *adv,
472  const cs_property_t *diff,
473  cs_real_t peclet[]);
474 
475 /*----------------------------------------------------------------------------*/
483 /*----------------------------------------------------------------------------*/
484 
485 void
486 cs_advection_get_courant(const cs_adv_field_t *adv,
487  double dt,
488  cs_real_t courant[]);
489 
490 /*----------------------------------------------------------------------------*/
491 
493 
494 #endif /* __CS_ADVECTION_FIELD_H__ */
Definition: cs_advection_field.h:61
time step descriptor
Definition: cs_time_step.h:51
void cs_advection_field_update(cs_adv_field_t *adv)
Update the values of the related field(s)
Definition: cs_advection_field.c:1414
bool cs_advection_field_is_uniform(const cs_adv_field_t *adv)
returns true if the advection field is uniform, otherwise false
Definition: cs_advection_field.c:241
void cs_advection_field_at_cells(const cs_adv_field_t *adv, cs_real_t *cell_values)
Compute the value of the advection field at cell centers.
Definition: cs_advection_field.c:717
void cs_advection_field_get_at_xyz(const cs_adv_field_t *adv, const cs_real_3_t xyz, cs_nvec3_t *vect)
Compute the value of the advection field for a given face.
Definition: cs_advection_field.c:666
void cs_advection_get_peclet(const cs_adv_field_t *adv, const cs_property_t *diff, cs_real_t peclet[])
Compute the Peclet number in each cell.
Definition: cs_advection_field.c:1658
Definition: cs_cdo.h:112
Definition: cs_advection_field.h:62
double cs_advection_field_get_cell_max(const cs_adv_field_t *adv)
Compute the max. value of the advection field among cells.
Definition: cs_advection_field.c:967
const char * cs_advection_field_get_name(const cs_adv_field_t *adv)
Retrieve the name of an advection field.
Definition: cs_advection_field.c:288
#define BEGIN_C_DECLS
Definition: cs_defs.h:448
void cs_advection_field_def_by_array(cs_adv_field_t *adv, cs_desc_t desc, const cs_real_t *array)
Define a cs_adv_field_t structure thanks to an array of values.
Definition: cs_advection_field.c:489
cs_advection_field_key_t
Definition: cs_advection_field.h:57
Definition: cs_advection_field.h:60
bool cs_advection_field_needs_post(const cs_adv_field_t *adv)
Check if additional predefined postprocessing is requested.
Definition: cs_advection_field.c:1456
Definition: cs_cdo_local.h:73
Definition: cs_cdo_connect.h:67
void cs_advection_field_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_advection_field.c:128
double cs_real_t
Floating-point value.
Definition: cs_defs.h:296
Definition: cs_cdo_quantities.h:100
cs_param_def_type_t cs_advection_field_get_deftype(const cs_adv_field_t *adv)
Retrieve the type of definition used to set the current advection field structure.
Definition: cs_advection_field.c:308
Definition: cs_cdo.h:121
Definition: cs_param.h:218
void cs_advection_field_get_cell_vector(cs_lnum_t c_id, const cs_adv_field_t *adv, cs_nvec3_t *vect)
Compute the value of the advection field at the cell center.
Definition: cs_advection_field.c:583
void cs_advection_get_courant(const cs_adv_field_t *adv, double dt, cs_real_t courant[])
Compute the Courant number in each cell.
Definition: cs_advection_field.c:1704
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
Definition: cs_field_pointer.h:64
cs_real_t cs_advection_field_get_flux_svef(cs_lnum_t v_id, cs_lnum_t e_id, cs_lnum_t f_id, const cs_param_advection_t a_info, const cs_adv_field_t *adv)
Compute the value of the flux of the advection field across the triangle defined by a vertex...
Definition: cs_advection_field.c:1292
static int input(void)
void cs_advection_field_summary(const cs_adv_field_t *adv)
Print a summary of a cs_adv_field_t structure.
Definition: cs_advection_field.c:325
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:308
Definition: cs_advection_field.h:59
Definition: cs_advection_field.h:63
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
void cs_advection_field_at_vertices(const cs_adv_field_t *adv, cs_real_t *vtx_values)
Compute the value of the advection field at vertices.
Definition: cs_advection_field.c:819
void cs_advection_field_def_by_value(cs_adv_field_t *adv, const char *val)
Define the value of a cs_adv_field_t structure.
Definition: cs_advection_field.c:445
void cs_advection_field_create_field(cs_adv_field_t *adv)
Create a cs_field_t structure related to an advection field.
Definition: cs_advection_field.c:515
void cs_advection_field_def_by_analytic(cs_adv_field_t *adv, cs_analytic_func_t *func)
Define a cs_adv_field_t structure thanks to an analytic function.
Definition: cs_advection_field.c:468
cs_adv_field_t * cs_advection_field_create(const char *name)
Create and initialize a new advection field structure.
Definition: cs_advection_field.c:149
#define END_C_DECLS
Definition: cs_defs.h:449
cs_real_t cs_advection_field_get_flux_tef(const cs_adv_field_t *adv, const cs_param_advection_t a_info, const cs_cell_mesh_t *cm, short int f, short int e, short int v1, short int v2)
Compute the value of the flux of the advection field across the triangle defined by the two vertices ...
Definition: cs_advection_field.c:1163
void cs_advection_field_set_option(cs_adv_field_t *adv, cs_advection_field_key_t key, const char *keyval)
Set optional parameters related to a cs_adv_field_t structure.
Definition: cs_advection_field.c:376
void cs_advection_field_extra_post(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_list[], const cs_lnum_t i_face_list[], const cs_lnum_t b_face_list[], const cs_time_step_t *time_step)
Predefined post-processing output for advection fields. Prototype of this function is fixed since it ...
Definition: cs_advection_field.c:1494
bool cs_advection_field_is_cellwise(const cs_adv_field_t *adv)
returns true if the advection field is uniform in each cell otherwise false
Definition: cs_advection_field.c:264
cs_adv_field_t * cs_advection_field_free(cs_adv_field_t *adv)
Free a cs_adv_field_t structure.
Definition: cs_advection_field.c:186
void cs_advection_field_get_flux_dfaces(cs_lnum_t c_id, const cs_param_advection_t a_info, const cs_adv_field_t *adv, cs_real_t *fluxes)
Compute the value of the flux of the advection field across the the dual faces of a cell...
Definition: cs_advection_field.c:1021
cs_param_def_type_t
Definition: cs_param.h:82
bool cs_advection_field_check_name(const cs_adv_field_t *adv, const char *ref_name)
Check if the given advection field has the name ref_name.
Definition: cs_advection_field.c:211