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-2015 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_param.h"
36 #include "cs_cdo_connect.h"
37 #include "cs_cdo_quantities.h"
38 #include "cs_time_step.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 typedef struct _cs_adv_field_t cs_adv_field_t;
53 
54 /*============================================================================
55  * Global variables
56  *============================================================================*/
57 
58 /*============================================================================
59  * Public function prototypes
60  *============================================================================*/
61 
62 /*----------------------------------------------------------------------------*/
73 /*----------------------------------------------------------------------------*/
74 
75 cs_adv_field_t *
76 cs_advection_field_create(const char *name,
77  const cs_cdo_quantities_t *cdoq,
78  const cs_cdo_connect_t *connect,
79  const cs_time_step_t *time_step);
80 
81 /*----------------------------------------------------------------------------*/
89 /*----------------------------------------------------------------------------*/
90 
91 cs_adv_field_t *
92 cs_advection_field_free(cs_adv_field_t *adv);
93 
94 /*----------------------------------------------------------------------------*/
103 /*----------------------------------------------------------------------------*/
104 
105 bool
106 cs_advection_field_check_name(const cs_adv_field_t *adv,
107  const char *ref_name);
108 
109 /*----------------------------------------------------------------------------*/
117 /*----------------------------------------------------------------------------*/
118 
119 bool
120 cs_advection_field_is_uniform(const cs_adv_field_t *adv);
121 
122 /*----------------------------------------------------------------------------*/
131 /*----------------------------------------------------------------------------*/
132 
133 bool
134 cs_advection_field_is_cellwise(const cs_adv_field_t *adv);
135 
136 /*----------------------------------------------------------------------------*/
144 /*----------------------------------------------------------------------------*/
145 
146 const char *
147 cs_advection_field_get_name(const cs_adv_field_t *adv);
148 
149 /*----------------------------------------------------------------------------*/
155 /*----------------------------------------------------------------------------*/
156 
157 void
158 cs_advection_field_summary(const cs_adv_field_t *adv);
159 
160 /*----------------------------------------------------------------------------*/
168 /*----------------------------------------------------------------------------*/
169 
170 void
171 cs_advection_field_set_option(cs_adv_field_t *adv,
172  const char *keyname,
173  const char *keyval);
174 
175 /*----------------------------------------------------------------------------*/
182 /*----------------------------------------------------------------------------*/
183 
184 void
185 cs_advection_field_def_by_value(cs_adv_field_t *adv,
186  const char *val);
187 
188 /*----------------------------------------------------------------------------*/
195 /*----------------------------------------------------------------------------*/
196 
197 void
198 cs_advection_field_def_by_analytic(cs_adv_field_t *adv,
199  cs_analytic_func_t *func);
200 
201 /*----------------------------------------------------------------------------*/
209 /*----------------------------------------------------------------------------*/
210 
211 void
212 cs_advection_field_def_by_array(cs_adv_field_t *adv,
213  cs_flag_t support,
214  const cs_real_t *array);
215 
216 /*----------------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------------*/
223 
224 void
225 cs_advection_field_create_field(cs_adv_field_t *adv);
226 
227 /*----------------------------------------------------------------------------*/
235 /*----------------------------------------------------------------------------*/
236 
237 void
239  const cs_adv_field_t *adv,
240  cs_nvec3_t *vect);
241 
242 /*----------------------------------------------------------------------------*/
249 /*----------------------------------------------------------------------------*/
250 
251 void
252 cs_advection_field_at_cells(const cs_adv_field_t *adv,
253  cs_real_t *cell_values);
254 
255 /*----------------------------------------------------------------------------*/
262 /*----------------------------------------------------------------------------*/
263 
264 void
265 cs_advection_field_at_vertices(const cs_adv_field_t *adv,
266  cs_real_t *vtx_values);
267 
268 /*----------------------------------------------------------------------------*/
278 /*----------------------------------------------------------------------------*/
279 
280 void
282  const cs_param_advection_t a_info,
283  const cs_adv_field_t *adv,
284  cs_real_t *fluxes);
285 
286 /*----------------------------------------------------------------------------*/
299 /*----------------------------------------------------------------------------*/
300 
301 cs_real_t
303  cs_lnum_t e_id,
304  cs_lnum_t f_id,
305  const cs_param_advection_t a_info,
306  const cs_adv_field_t *adv);
307 
308 /*----------------------------------------------------------------------------*/
314 /*----------------------------------------------------------------------------*/
315 
316 void
317 cs_advection_field_update(cs_adv_field_t *adv);
318 
319 /*----------------------------------------------------------------------------*/
325 /*----------------------------------------------------------------------------*/
326 
327 void
328 cs_advection_field_post(const cs_adv_field_t *adv);
329 
330 /*----------------------------------------------------------------------------*/
331 
333 
334 #endif /* __CS_ADVECTION_FIELD_H__ */
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:1181
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:299
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:682
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:346
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
void cs_advection_field_def_by_array(cs_adv_field_t *adv, cs_flag_t support, const cs_real_t *array)
Define a cs_adv_field_t structure thanks to an array of values.
Definition: cs_advection_field.c:519
Definition: cs_cdo_connect.h:67
Definition: cs_cdo_quantities.h:86
Definition: cs_cdo.h:63
Definition: cs_param.h:204
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:610
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:96
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:1060
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:363
cs_adv_field_t * cs_advection_field_create(const char *name, const cs_cdo_quantities_t *cdoq, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
Create and initialize a new advection field structure.
Definition: cs_advection_field.c:198
void cs_advection_field_post(const cs_adv_field_t *adv)
Perform the postprocessing if needed.
Definition: cs_advection_field.c:1221
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:784
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:475
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:540
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:498
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296
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:322
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:244
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:918
unsigned short int cs_flag_t
Definition: cs_cdo.h:50
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:269
void cs_advection_field_set_option(cs_adv_field_t *adv, const char *keyname, const char *keyval)
Set optional parameters related to a cs_adv_field_t structure.
Definition: cs_advection_field.c:414