programmer's documentation
cs_property.h
Go to the documentation of this file.
1 #ifndef __CS_PROPERTY_H__
2 #define __CS_PROPERTY_H__
3 
4 /*============================================================================
5  * Manage the definition/setting of properties
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_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 /* Type of property considered */
53 typedef enum {
54 
55  CS_PROPERTY_ISO, // isotropic
56  CS_PROPERTY_ORTHO, // orthotropic
57  CS_PROPERTY_ANISO, // anisotropic
59 
61 
62 typedef struct _cs_property_t cs_property_t;
63 
64 /*============================================================================
65  * Global variables
66  *============================================================================*/
67 
68 /*============================================================================
69  * Public function prototypes
70  *============================================================================*/
71 
72 /*----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------*/
81 
82 void
84  const cs_cdo_connect_t *connect,
85  const cs_time_step_t *time_step);
86 
87 /*----------------------------------------------------------------------------*/
93 /*----------------------------------------------------------------------------*/
94 
95 void
97 
98 /*----------------------------------------------------------------------------*/
108 /*----------------------------------------------------------------------------*/
109 
110 cs_property_t *
111 cs_property_create(const char *name,
112  const char *key_type,
113  int n_subdomains);
114 
115 /*----------------------------------------------------------------------------*/
123 /*----------------------------------------------------------------------------*/
124 
125 cs_property_t *
126 cs_property_free(cs_property_t *pty);
127 
128 /*----------------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------------*/
138 
139 bool
140 cs_property_check_name(const cs_property_t *pty,
141  const char *ref_name);
142 
143 /*----------------------------------------------------------------------------*/
151 /*----------------------------------------------------------------------------*/
152 
153 bool
154 cs_property_is_uniform(const cs_property_t *pty);
155 
156 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 const char *
167 cs_property_get_name(const cs_property_t *pty);
168 
169 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
180 cs_property_get_type(const cs_property_t *pty);
181 
182 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 void
191 cs_property_summary(const cs_property_t *pty);
192 
193 /*----------------------------------------------------------------------------*/
202 /*----------------------------------------------------------------------------*/
203 
204 void
205 cs_property_def_by_value(cs_property_t *pty,
206  const char *ml_name,
207  const char *key_val);
208 
209 /*----------------------------------------------------------------------------*/
218 /*----------------------------------------------------------------------------*/
219 
220 void
221 cs_property_iso_def_by_value(cs_property_t *pty,
222  const char *ml_name,
223  double val);
224 
225 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 void
237 cs_property_ortho_def_by_value(cs_property_t *pty,
238  const char *ml_name,
239  const double val[]);
240 
241 /*----------------------------------------------------------------------------*/
250 /*----------------------------------------------------------------------------*/
251 
252 void
253 cs_property_aniso_def_by_value(cs_property_t *pty,
254  const char *ml_name,
255  const double tens[3][3]);
256 
257 /*----------------------------------------------------------------------------*/
266 /*----------------------------------------------------------------------------*/
267 
268 void
269 cs_property_def_by_analytic(cs_property_t *pty,
270  const char *ml_name,
271  cs_analytic_func_t *func);
272 
273 /*----------------------------------------------------------------------------*/
284 /*----------------------------------------------------------------------------*/
285 
286 void
287 cs_property_def_by_law(cs_property_t *pty,
288  const char *ml_name,
289  const void *context,
290  cs_onevar_law_func_t *func);
291 
292 /*----------------------------------------------------------------------------*/
303 /*----------------------------------------------------------------------------*/
304 
305 void
306 cs_property_def_by_twovar_law(cs_property_t *pty,
307  const char *ml_name,
308  const void *context,
309  cs_twovar_law_func_t *func);
310 
311 /*----------------------------------------------------------------------------*/
322 /*----------------------------------------------------------------------------*/
323 
324 void
325 cs_property_def_by_scavec_law(cs_property_t *pty,
326  const char *ml_name,
327  const void *context,
328  cs_scavec_law_func_t *func);
329 
330 /*----------------------------------------------------------------------------*/
338 /*----------------------------------------------------------------------------*/
339 
340 void
341 cs_property_def_by_array(cs_property_t *pty,
342  cs_desc_t desc,
343  cs_real_t *array);
344 
345 /*----------------------------------------------------------------------------*/
353 /*----------------------------------------------------------------------------*/
354 
355 void
356 cs_property_set_array(cs_property_t *pty,
357  cs_desc_t desc,
358  cs_real_t *array);
359 
360 /*----------------------------------------------------------------------------*/
368 /*----------------------------------------------------------------------------*/
369 
370 void
371 cs_property_set_second_array(cs_property_t *pty,
372  cs_desc_t desc,
373  cs_real_t *array);
374 
375 /*----------------------------------------------------------------------------*/
385 /*----------------------------------------------------------------------------*/
386 
387 void
389  const cs_property_t *pty,
390  bool do_inversion,
391  cs_real_3_t *tensor);
392 
393 /*----------------------------------------------------------------------------*/
402 /*----------------------------------------------------------------------------*/
403 
404 cs_real_t
406  const cs_property_t *pty);
407 
408 /*----------------------------------------------------------------------------*/
416 /*----------------------------------------------------------------------------*/
417 
418 void
419 cs_property_get_fourier(const cs_property_t *pty,
420  double dt,
421  cs_real_t fourier[]);
422 
423 /*----------------------------------------------------------------------------*/
424 
426 
427 #endif /* __CS_PROPERTY_H__ */
time step descriptor
Definition: cs_time_step.h:51
void( cs_scavec_law_func_t)(double var1_value, const double var2_vect[], const void *law_param, cs_get_t *retval)
Compute the value of a quantity according to a law depending only on two variables (the first one is ...
Definition: cs_cdo.h:228
Definition: cs_cdo.h:112
void cs_property_def_by_array(cs_property_t *pty, cs_desc_t desc, cs_real_t *array)
Define a cs_property_t structure thanks to an array of values.
Definition: cs_property.c:1028
const char * cs_property_get_name(const cs_property_t *pty)
Retrieve the name of a property.
Definition: cs_property.c:638
Definition: cs_property.h:56
void( cs_twovar_law_func_t)(double var1_value, double var2_value, const void *law_param, cs_get_t *retval)
Compute the value of a quantity according to a law depending only on two variables. This law is described by a set of parameters stored in a structure. result = law(var1_value, var2_value)
Definition: cs_cdo.h:207
cs_property_t * cs_property_create(const char *name, const char *key_type, int n_subdomains)
Create and initialize a new property structure.
Definition: cs_property.c:481
cs_property_type_t
Definition: cs_property.h:53
void cs_property_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_property.c:439
#define BEGIN_C_DECLS
Definition: cs_defs.h:448
void cs_property_def_by_scavec_law(cs_property_t *pty, const char *ml_name, const void *context, cs_scavec_law_func_t *func)
Define a cs_property_t structure by a law (using as arguments a scalar and a vector) for entities att...
Definition: cs_property.c:1005
cs_property_type_t cs_property_get_type(const cs_property_t *pty)
Retrieve the type of a property.
Definition: cs_property.c:657
Definition: cs_cdo_connect.h:67
void cs_property_get_cell_tensor(cs_lnum_t c_id, const cs_property_t *pty, bool do_inversion, cs_real_3_t *tensor)
Compute the value of the tensor attached a property at the cell center.
Definition: cs_property.c:1107
void cs_property_def_by_law(cs_property_t *pty, const char *ml_name, const void *context, cs_onevar_law_func_t *func)
Define a cs_property_t structure thanks to law depending on one scalar variable in a subdomain attach...
Definition: cs_property.c:953
double cs_real_t
Floating-point value.
Definition: cs_defs.h:296
Definition: cs_cdo_quantities.h:100
bool cs_property_check_name(const cs_property_t *pty, const char *ref_name)
Check if the given property has the name ref_name.
Definition: cs_property.c:586
void cs_property_set_array(cs_property_t *pty, cs_desc_t desc, cs_real_t *array)
Set the "array" member of a cs_property_t structure.
Definition: cs_property.c:1059
void cs_property_summary(const cs_property_t *pty)
Print a summary of a cs_property_t structure.
Definition: cs_property.c:674
void( cs_onevar_law_func_t)(double var_value, const void *law_param, cs_get_t *retval)
Compute the value of a quantity according to a law depending only on one variable. This law is described by a set of parameters stored in a structure. result = law(var_value)
Definition: cs_cdo.h:188
Definition: cs_property.h:55
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
void cs_property_set_timer_stats(int level)
Initialize cs_timer_stats_t structure for monitoring purpose.
Definition: cs_property.c:458
void cs_property_def_by_value(cs_property_t *pty, const char *ml_name, const char *key_val)
Define a cs_property_t structure by value for entities attached to the mesh location named ml_name...
Definition: cs_property.c:777
void cs_property_get_fourier(const cs_property_t *pty, double dt, cs_real_t fourier[])
Compute the Fourier number in each cell.
Definition: cs_property.c:1323
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:308
void cs_property_def_by_twovar_law(cs_property_t *pty, const char *ml_name, const void *context, cs_twovar_law_func_t *func)
Define a cs_property_t structure thanks to a law depending on two scalars variables in a subdomain at...
Definition: cs_property.c:979
void cs_property_iso_def_by_value(cs_property_t *pty, const char *ml_name, double val)
Define an isotropic cs_property_t structure by value for entities attached to the mesh location named...
Definition: cs_property.c:827
cs_property_t * cs_property_free(cs_property_t *pty)
Free a cs_property_t structure.
Definition: cs_property.c:550
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
#define END_C_DECLS
Definition: cs_defs.h:449
cs_real_t cs_property_get_cell_value(cs_lnum_t c_id, const cs_property_t *pty)
Compute the value of a property at the cell center.
Definition: cs_property.c:1233
void cs_property_ortho_def_by_value(cs_property_t *pty, const char *ml_name, const double val[])
Define orthotropic cs_property_t structure by value for entities attached to the mesh location named ...
Definition: cs_property.c:856
void cs_property_def_by_analytic(cs_property_t *pty, const char *ml_name, cs_analytic_func_t *func)
Define a cs_property_t structure thanks to an analytic function in a subdomain attached to the mesh l...
Definition: cs_property.c:929
Definition: cs_property.h:58
void cs_property_set_second_array(cs_property_t *pty, cs_desc_t desc, cs_real_t *array)
Set the second "array" member of a cs_property_t structure.
Definition: cs_property.c:1082
Definition: cs_property.h:57
void cs_property_aniso_def_by_value(cs_property_t *pty, const char *ml_name, const double tens[3][3])
Define an anisotropic cs_property_t structure by value for entities attached to the mesh location nam...
Definition: cs_property.c:888
bool cs_property_is_uniform(const cs_property_t *pty)
returns true if the property is uniform, otherwise false
Definition: cs_property.c:616