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-2021 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_field.h"
35 #include "cs_flag.h"
36 #include "cs_param_types.h"
37 #include "cs_xdef.h"
38 #include "cs_xdef_cw_eval.h"
39 #include "cs_xdef_eval.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
43 BEGIN_C_DECLS
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /* Common property names (property which is shared between different module) */
50 
51 #define CS_PROPERTY_MASS_DENSITY   "mass_density"
52 
53 /*!
54  * @defgroup cdo_property_flags Flags specifying metadata related to the
55  *  post-processing for a property
56  * @{
57  */
58 
59 /*!  1: Perform the computation and post-processing of the Fourier number */
60 #define CS_PROPERTY_POST_FOURIER  (1 << 0)
61 
62 /*! @} */
63 
64 /*!
65  * @defgroup cdo_property_type Flags specifying metadata related to the
66  *  the type of property
67  * @{
68  */
69 
70 /*! \var CS_PROPERTY_ISO
71  *  1: Isotropic behavior (one real number is sufficient to describe the
72  *  property) */
73 #define CS_PROPERTY_ISO           (1 << 0)
74 
75 /*! \var CS_PROPERTY_ORTHO
76  *  2: Orthotropic behavior (three real numbers describe the behavior assuming
77  *  that the different behavior is aligned with Cartesian axis) */
78 #define CS_PROPERTY_ORTHO         (1 << 1)
79 
80 /*! \var CS_PROPERTY_ANISO
81  *  4: Anisotropic behavior (a 3x3 tensor describe the behavior). This tensor
82  *  should be symmetric positive definite (i.e 6 real numbers describe the
83  *  behavior) but by default a 3x3 tensor is used. */
84 #define CS_PROPERTY_ANISO         (1 << 2)
85 
86 /*! \var CS_PROPERTY_ANISO_SYM
87  *  8: Anisotropic behavior. This tensor is represented with 6 real numbers
88  *  since the tensor is symmetric */
89 #define CS_PROPERTY_ANISO_SYM     (1 << 3)
90 
91 /*! \var CS_PROPERTY_BY_PRODUCT
92  *  16: The property is defined as the product of two other properties
93  */
94 #define CS_PROPERTY_BY_PRODUCT    (1 << 4)
95 
96 /*! @} */
97 
98 /*============================================================================
99  * Type definitions
100  *============================================================================*/
101 
102 typedef cs_flag_t cs_property_type_t;
103 
104 /*! \enum cs_property_key_t
105  *  \brief List of available keys for setting options on a property
106  *
107  * \var CS_PTYKEY_POST_FOURIER
108  * Perform the computation (and post-processing) of the Fourier number
109  */
110 
111 typedef enum {
112 
113   CS_PTYKEY_POST_FOURIER,
114   CS_PTYKEY_N_KEYS
115 
116 } cs_property_key_t;
117 
118 /* ======================================== */
119 /* Set of parameters attached to a property */
120 /* ======================================== */
121 
122 /*!
123  * \struct cs_property_t
124  * \brief Structure associated to the definition of a property relying on the
125  * \ref cs_xdef_t structure
126  */
127 
128 typedef struct _cs_property_t cs_property_t;
129 
130 struct _cs_property_t {
131 
132   char  *restrict      name;
133   int                  id;
134   cs_flag_t            state_flag;
135   cs_flag_t            process_flag;
136   cs_property_type_t   type;
137 
138   /* Reference value wich is used as default when nothing else is set. This
139    * value can also be used to renormalized quantities related to this property
140    * By default, this is set to 1
141    */
142   cs_real_t            ref_value;
143 
144   /* Property is up to now only defined on the whole domain (volume) */
145   int                  n_definitions;  /* Current number of definitions used */
146   cs_xdef_t          **defs;           /* List of definitions */
147 
148   /* Store the definition id for each cell, NULL if there is only one
149      definition set */
150   short int           *def_ids;
151 
152   /* Function pointers to handle generic tasks related to a property. There
153      is one function related to each definition. Some functions may not be
154      allocated according to the kind of property */
155 
156   /* Retrieve the evaluation of the property at the cell center for each
157      definition */
158   cs_xdef_eval_t     **get_eval_at_cell;
159 
160   /* Same thing as the previous one but now with the usage of cellwise algo.
161      relying on a cs_cell_mesh_t structure */
162   cs_xdef_cw_eval_t  **get_eval_at_cell_cw;
163 
164   /* For properties relying on other properties for their definition, one
165    * stores the pointers to these related properties */
166   int                     n_related_properties;
167   const cs_property_t   **related_properties;
168 
169 };
170 
171 
172 /*!
173  * \struct cs_property_data_t
174  * \brief Structure storing the evaluation of a property and its related
175  *        data
176  */
177 
178 typedef struct {
179 
180   const cs_property_t   *property; /* shared pointer */
181 
182   bool                   is_iso;   /* Detect if this an easier case */
183   bool                   is_unity; /* Detect if this a simple case */
184 
185   bool                   need_eigen;
186   cs_real_t              eigen_max;
187   cs_real_t              eigen_ratio;
188 
189   bool                   need_tensor;
190   cs_real_t              tensor[3][3];
191   cs_real_t              value;
192 
193 } cs_property_data_t;
194 
195 /*============================================================================
196  * Global variables
197  *============================================================================*/
198 
199 /*============================================================================
200  * Static inline public function prototypes
201  *============================================================================*/
202 
203 /*----------------------------------------------------------------------------*/
204 /*!
205  * \brief  returns true if the property is steady and uniform, otherwise false
206  *
207  * \param[in]    pty    pointer to a property to test
208  *
209  * \return  true or false
210  */
211 /*----------------------------------------------------------------------------*/
212 
213 static inline bool
cs_property_is_constant(const cs_property_t * pty)214 cs_property_is_constant(const cs_property_t   *pty)
215 {
216   if (pty == NULL)
217     return true; /* Treated as the "unity" property */
218 
219   if (pty->state_flag & CS_FLAG_STATE_STEADY) {
220     if (pty->state_flag & CS_FLAG_STATE_UNIFORM)
221       return true;
222     else
223       return false;
224   }
225   else
226     return false;
227 }
228 
229 /*----------------------------------------------------------------------------*/
230 /*!
231  * \brief  returns true if the property is steady, otherwise false
232  *
233  * \param[in]    pty    pointer to a property to test
234  *
235  * \return  true or false
236  */
237 /*----------------------------------------------------------------------------*/
238 
239 static inline bool
cs_property_is_steady(const cs_property_t * pty)240 cs_property_is_steady(const cs_property_t   *pty)
241 {
242   if (pty == NULL)
243     return true; /* Treated as the "unity" property */
244 
245   if (pty->state_flag & CS_FLAG_STATE_STEADY)
246     return true;
247   else
248     return false;
249 }
250 
251 /*----------------------------------------------------------------------------*/
252 /*!
253  * \brief  returns true if the property is uniform, otherwise false
254  *
255  * \param[in]    pty    pointer to a property to test
256  *
257  * \return  true or false
258  */
259 /*----------------------------------------------------------------------------*/
260 
261 static inline bool
cs_property_is_uniform(const cs_property_t * pty)262 cs_property_is_uniform(const cs_property_t   *pty)
263 {
264   if (pty == NULL)
265     return true; /* Treated as the "unity" property */
266 
267   if (pty->state_flag & CS_FLAG_STATE_UNIFORM)
268     return true;
269   else
270     return false;
271 }
272 
273 /*----------------------------------------------------------------------------*/
274 /*!
275  * \brief  returns true if the property is isotropic, otherwise false
276  *
277  * \param[in]    pty    pointer to a property to test
278  *
279  * \return  true or false
280  */
281 /*----------------------------------------------------------------------------*/
282 
283 static inline bool
cs_property_is_isotropic(const cs_property_t * pty)284 cs_property_is_isotropic(const cs_property_t   *pty)
285 {
286   if (pty == NULL)
287     return false;
288 
289   if (pty->type & CS_PROPERTY_ISO)
290     return true;
291   else
292     return false;
293 }
294 
295 /*----------------------------------------------------------------------------*/
296 /*!
297  * \brief  Retrieve the name of a property
298  *
299  * \param[in]    pty    pointer to a property
300  *
301  * \return  the name of the related property
302  */
303 /*----------------------------------------------------------------------------*/
304 
305 static inline const char *
cs_property_get_name(const cs_property_t * pty)306 cs_property_get_name(const cs_property_t   *pty)
307 {
308   if (pty == NULL)
309     return NULL;
310 
311   return pty->name;
312 }
313 
314 /*----------------------------------------------------------------------------*/
315 /*!
316  * \brief  Retrieve the type of a property
317  *
318  * \param[in]    pty    pointer to a property
319  *
320  * \return  the type of the related property
321  */
322 /*----------------------------------------------------------------------------*/
323 
324 static inline cs_property_type_t
cs_property_get_type(const cs_property_t * pty)325 cs_property_get_type(const cs_property_t   *pty)
326 {
327   if (pty == NULL)
328     return 0; /* means undefined */
329 
330   return pty->type;
331 }
332 
333 /*----------------------------------------------------------------------------*/
334 /*!
335  * \brief  Retrieve the dimension of the property
336  *
337  * \param[in]    pty    pointer to a property
338  *
339  * \return  the value of the dimension
340  */
341 /*----------------------------------------------------------------------------*/
342 
343 static inline int
cs_property_get_dim(const cs_property_t * pty)344 cs_property_get_dim(const cs_property_t   *pty)
345 {
346   if (pty == NULL)
347     return 0; /* means undefined */
348 
349   if (pty->type & CS_PROPERTY_ISO)
350     return 1;
351   else if (pty->type & CS_PROPERTY_ORTHO)
352     return 3;
353   else if (pty->type & CS_PROPERTY_ANISO_SYM)
354     return 6;
355   else if (pty->type & CS_PROPERTY_ANISO)
356     return 9;
357   else
358     return 0; /* means undefined */
359 }
360 
361 /*============================================================================
362  * Public function prototypes
363  *============================================================================*/
364 
365 /*----------------------------------------------------------------------------*/
366 /*!
367  * \brief  Set shared pointers to main domain members
368  *
369  * \param[in]  quant       additional mesh quantities struct.
370  * \param[in]  connect     pointer to a cs_cdo_connect_t struct.
371  */
372 /*----------------------------------------------------------------------------*/
373 
374 void
375 cs_property_set_shared_pointers(const cs_cdo_quantities_t    *quant,
376                                 const cs_cdo_connect_t       *connect);
377 
378 /*----------------------------------------------------------------------------*/
379 /*!
380  * \brief  Retrieve the number of properties
381  *
382  * \return the number of properties
383  */
384 /*----------------------------------------------------------------------------*/
385 
386 int
387 cs_property_get_n_properties(void);
388 
389 /*----------------------------------------------------------------------------*/
390 /*!
391  * \brief  Create and initialize a new property structure
392  *
393  * \param[in]  name          name of the property
394  * \param[in]  type          type of property
395  *
396  * \return a pointer to a new allocated cs_property_t structure
397  */
398 /*----------------------------------------------------------------------------*/
399 
400 cs_property_t *
401 cs_property_add(const char            *name,
402                 cs_property_type_t     type);
403 
404 /*----------------------------------------------------------------------------*/
405 /*!
406  * \brief  Define a cs_property_t structure thanks to the product of two
407  *         properties
408  *         The type is infered from that of the related properties
409  *         The value of the property is given as:
410  *         value_ab = value_a * value_b
411  *
412  * \param[in]       name      name of the property
413  * \param[in]       pty_a     pointer to a cs_property_t structure
414  * \param[in]       pty_b     pointer to a cs_property_t structure
415  *
416  * \return a pointer to a new allocated cs_property_t structure
417  */
418 /*----------------------------------------------------------------------------*/
419 
420 cs_property_t *
421 cs_property_add_as_product(const char             *name,
422                            const cs_property_t    *pty_a,
423                            const cs_property_t    *pty_b);
424 
425 /*----------------------------------------------------------------------------*/
426 /*!
427  * \brief  Find the related property definition from its name
428  *
429  * \param[in]  name    name of the property to find
430  *
431  * \return NULL if not found otherwise the associated pointer
432  */
433 /*----------------------------------------------------------------------------*/
434 
435 cs_property_t *
436 cs_property_by_name(const char   *name);
437 
438 /*----------------------------------------------------------------------------*/
439 /*!
440  * \brief  Find the related property definition from its id
441  *
442  * \param[in]  id      id of the property to find
443  *
444  * \return NULL if not found otherwise the associated pointer
445  */
446 /*----------------------------------------------------------------------------*/
447 
448 cs_property_t *
449 cs_property_by_id(int         id);
450 
451 /*----------------------------------------------------------------------------*/
452 /*!
453  * \brief  Set optional parameters related to a cs_property_t structure
454  *
455  * \param[in, out]  pty       pointer to a cs_property_t structure
456  * \param[in]       key       key related to a setting option
457  */
458 /*----------------------------------------------------------------------------*/
459 
460 void
461 cs_property_set_option(cs_property_t       *pty,
462                        cs_property_key_t    key);
463 
464 /*----------------------------------------------------------------------------*/
465 /*!
466  * \brief  Set the reference value associated to a \ref cs_property_t structure
467  *         This is a real number even whatever the type of property is.
468  *
469  * \param[in, out]  pty      pointer to a cs_property_t structure
470  * \param[in]       refval   value to set
471  */
472 /*----------------------------------------------------------------------------*/
473 
474 void
475 cs_property_set_reference_value(cs_property_t    *pty,
476                                 double            refval);
477 
478 /*----------------------------------------------------------------------------*/
479 /*!
480  * \brief  Free all cs_property_t structures and the array storing all the
481  *         structures
482  */
483 /*----------------------------------------------------------------------------*/
484 
485 void
486 cs_property_destroy_all(void);
487 
488 /*----------------------------------------------------------------------------*/
489 /*!
490  * \brief  Last stage of the definition of a property based on several
491  *         definitions (i.e. definition by subdomains)
492  */
493 /*----------------------------------------------------------------------------*/
494 
495 void
496 cs_property_finalize_setup(void);
497 
498 /*----------------------------------------------------------------------------*/
499 /*!
500  * \brief  Initialize a \ref cs_property_data_t structure. If property is NULL
501  *         then one considers that this is a unitary property
502  *
503  * \param[in]      need_tensor  true if one needs a tensor-valued evaluation
504  * \param[in]      need_eigen   true if one needs an evaluation of eigen values
505  * \param[in]      property     pointer to the \ref cs_property_t structure
506  * \param[in, out] data         structure to initialize (already allocated)
507  */
508 /*----------------------------------------------------------------------------*/
509 
510 void
511 cs_property_data_init(bool                     need_tensor,
512                       bool                     need_eigen,
513                       const cs_property_t     *property,
514                       cs_property_data_t      *data);
515 
516 /*----------------------------------------------------------------------------*/
517 /*!
518  * \brief  Define a single uniform and steady isotropic definition for the
519  *         given cs_property_t structure.
520  *         This is a specialized variant of \ref cs_property_def_iso_by_value
521  *         since several assumptions are satisfied.
522  *
523  * \param[in, out]  pty      pointer to a cs_property_t structure
524  * \param[in]       val      value to set
525  *
526  * \return a pointer to the resulting cs_xdef_t structure
527  */
528 /*----------------------------------------------------------------------------*/
529 
530 cs_xdef_t *
531 cs_property_def_constant_value(cs_property_t    *pty,
532                                double            val);
533 
534 /*----------------------------------------------------------------------------*/
535 /*!
536  * \brief  Define an isotropic cs_property_t structure by value for entities
537  *         related to a volume zone
538  *
539  * \param[in, out]  pty      pointer to a cs_property_t structure
540  * \param[in]       zname    name of the associated zone (if NULL or "" all
541  *                           cells are considered)
542  * \param[in]       val      value to set
543  *
544  * \return a pointer to the resulting cs_xdef_t structure
545  */
546 /*----------------------------------------------------------------------------*/
547 
548 cs_xdef_t *
549 cs_property_def_iso_by_value(cs_property_t    *pty,
550                              const char       *zname,
551                              double            val);
552 
553 /*----------------------------------------------------------------------------*/
554 /*!
555  * \brief  Define an orthotropic cs_property_t structure by value for entities
556  *         related to a volume zone
557  *
558  * \param[in, out]  pty      pointer to a cs_property_t structure
559  * \param[in]       zname    name of the associated zone (if NULL or "" all
560  *                           cells are considered)
561  * \param[in]       val      values to set (vector of size 3)
562  *
563  * \return a pointer to the resulting cs_xdef_t structure
564  */
565 /*----------------------------------------------------------------------------*/
566 
567 cs_xdef_t *
568 cs_property_def_ortho_by_value(cs_property_t    *pty,
569                                const char       *zname,
570                                double            val[]);
571 
572 /*----------------------------------------------------------------------------*/
573 /*!
574  * \brief  Define an anisotropic cs_property_t structure by value for entities
575  *         related to a volume zone
576  *
577  * \param[in, out]  pty      pointer to a cs_property_t structure
578  * \param[in]       zname    name of the associated zone (if NULL or "" all
579  *                           cells are considered)
580  * \param[in]       tens     values to set (3x3 tensor)
581  *
582  * \return a pointer to the resulting cs_xdef_t structure
583  */
584 /*----------------------------------------------------------------------------*/
585 
586 cs_xdef_t *
587 cs_property_def_aniso_by_value(cs_property_t    *pty,
588                                const char       *zname,
589                                cs_real_t         tens[3][3]);
590 
591 /*----------------------------------------------------------------------------*/
592 /*!
593  * \brief  Define an anisotropic cs_property_t structure by value for entities
594  *         related to a volume zone
595  *
596  * \param[in, out]  pty      pointer to a cs_property_t structure
597  * \param[in]       zname    name of the associated zone (if NULL or "" all
598  *                           cells are considered)
599  * \param[in]       tens     values to set (3x3 tensor)
600  *
601  * \return a pointer to the resulting cs_xdef_t structure
602  */
603 /*----------------------------------------------------------------------------*/
604 
605 cs_xdef_t *
606 cs_property_def_aniso_sym_by_value(cs_property_t    *pty,
607                                    const char       *zname,
608                                    cs_real_t         symtens[6]);
609 
610 /*----------------------------------------------------------------------------*/
611 /*!
612  * \brief  Define a cs_property_t structure thanks to an analytic function in
613  *         a subdomain attached to the mesh location named ml_name
614  *
615  * \param[in, out]  pty      pointer to a cs_property_t structure
616  * \param[in]       zname    name of the associated zone (if NULL or "" all
617  *                           cells are considered)
618  * \param[in]       func     pointer to a cs_analytic_func_t function
619  * \param[in]       input    NULL or pointer to a structure cast on-the-fly
620  *
621  * \return a pointer to the resulting cs_xdef_t structure
622  */
623 /*----------------------------------------------------------------------------*/
624 
625 cs_xdef_t *
626 cs_property_def_by_time_func(cs_property_t      *pty,
627                              const char         *zname,
628                              cs_time_func_t     *func,
629                              void               *input);
630 
631 /*----------------------------------------------------------------------------*/
632 /*!
633  * \brief  Define a cs_property_t structure thanks to an analytic function in
634  *         a subdomain attached to the mesh location named ml_name
635  *
636  * \param[in, out]  pty      pointer to a cs_property_t structure
637  * \param[in]       zname    name of the associated zone (if NULL or "" all
638  *                           cells are considered)
639  * \param[in]       func     pointer to a cs_analytic_func_t function
640  * \param[in]       input    NULL or pointer to a structure cast on-the-fly
641  *
642  * \return a pointer to the resulting cs_xdef_t structure
643  */
644 /*----------------------------------------------------------------------------*/
645 
646 cs_xdef_t *
647 cs_property_def_by_analytic(cs_property_t        *pty,
648                             const char           *zname,
649                             cs_analytic_func_t   *func,
650                             void                 *input);
651 
652 /*----------------------------------------------------------------------------*/
653 /*!
654  * \brief  Define a cs_property_t structure thanks to law depending on one
655  *         scalar variable in a subdomain attached to the mesh location named
656  *         ml_name
657  *
658  * \param[in, out]  pty      pointer to a cs_property_t structure
659  * \param[in]       zname    name of the associated zone (if NULL or "" all
660  *                           cells are considered)
661  * \param[in]       context              pointer to a structure (may be NULL)
662  * \param[in]       get_eval_at_cell     pointer to a function
663  * \param[in]       get_eval_at_cell_cw  pointer to a function
664  *
665  * \return a pointer to the resulting cs_xdef_t structure
666  */
667 /*----------------------------------------------------------------------------*/
668 
669 cs_xdef_t *
670 cs_property_def_by_func(cs_property_t         *pty,
671                         const char            *zname,
672                         void                  *context,
673                         cs_xdef_eval_t        *get_eval_at_cell,
674                         cs_xdef_cw_eval_t     *get_eval_at_cell_cw);
675 
676 /*----------------------------------------------------------------------------*/
677 /*!
678  * \brief  Define a cs_property_t structure thanks to an array of values
679  *
680  * \param[in, out]  pty       pointer to a cs_property_t structure
681  * \param[in]       loc       information to know where are located values
682  * \param[in]       array     pointer to an array
683  * \param[in]       is_owner  transfer the lifecycle to the cs_xdef_t structure
684  *                            (true or false)
685  * \param[in]       index     optional pointer to the array index
686  *
687  * \return a pointer to the resulting cs_xdef_t structure
688  */
689 /*----------------------------------------------------------------------------*/
690 
691 cs_xdef_t *
692 cs_property_def_by_array(cs_property_t    *pty,
693                          cs_flag_t         loc,
694                          cs_real_t        *array,
695                          bool              is_owner,
696                          cs_lnum_t        *index);
697 
698 /*----------------------------------------------------------------------------*/
699 /*!
700  * \brief  Define a cs_property_t structure thanks to a field structure
701  *
702  * \param[in, out]  pty       pointer to a cs_property_t structure
703  * \param[in]       field     pointer to a cs_field_t structure
704  */
705 /*----------------------------------------------------------------------------*/
706 
707 void
708 cs_property_def_by_field(cs_property_t    *pty,
709                          cs_field_t       *field);
710 
711 /*----------------------------------------------------------------------------*/
712 /*!
713  * \brief  Evaluate the value of the property at each cell. Store the
714  *         evaluation in the given array.
715  *
716  * \param[in]       t_eval      physical time at which one evaluates the term
717  * \param[in]       pty         pointer to a cs_property_t structure
718  * \param[out]      pty_stride  = 0 if uniform, =1 otherwise
719  * \param[in, out]  pty_vals    pointer to an array of values. Allocated if not
720  *                              The size of the allocation depends on the value
721  *                              of the pty_stride
722  */
723 /*----------------------------------------------------------------------------*/
724 
725 void
726 cs_property_iso_get_cell_values(cs_real_t               t_eval,
727                                 const cs_property_t    *pty,
728                                 int                    *pty_stride,
729                                 cs_real_t             **p_pty_vals);
730 
731 /*----------------------------------------------------------------------------*/
732 /*!
733  * \brief  Evaluate the value of the property at each cell. Store the
734  *         evaluation in the given array.
735  *
736  * \param[in]       t_eval   physical time at which one evaluates the term
737  * \param[in]       pty      pointer to a cs_property_t structure
738  * \param[in, out]  array    pointer to an array of values (must be allocated)
739  */
740 /*----------------------------------------------------------------------------*/
741 
742 void
743 cs_property_eval_at_cells(cs_real_t               t_eval,
744                           const cs_property_t    *pty,
745                           cs_real_t              *array);
746 
747 /*----------------------------------------------------------------------------*/
748 /*!
749  * \brief  Compute the value of the tensor attached to a property at the cell
750  *         center
751  *
752  * \param[in]      c_id          id of the current cell
753  * \param[in]      t_eval        physical time at which one evaluates the term
754  * \param[in]      pty           pointer to a cs_property_t structure
755  * \param[in]      do_inversion  true or false
756  * \param[in, out] tensor        3x3 matrix
757  */
758 /*----------------------------------------------------------------------------*/
759 
760 void
761 cs_property_get_cell_tensor(cs_lnum_t               c_id,
762                             cs_real_t               t_eval,
763                             const cs_property_t    *pty,
764                             bool                    do_inversion,
765                             cs_real_t               tensor[3][3]);
766 
767 /*----------------------------------------------------------------------------*/
768 /*!
769  * \brief  Compute the value of a property at the cell center
770  *
771  * \param[in]   c_id     id of the current cell
772  * \param[in]   t_eval   physical time at which one evaluates the term
773  * \param[in]   pty      pointer to a cs_property_t structure
774  *
775  * \return the value of the property for the given cell
776  */
777 /*----------------------------------------------------------------------------*/
778 
779 cs_real_t
780 cs_property_get_cell_value(cs_lnum_t              c_id,
781                            cs_real_t              t_eval,
782                            const cs_property_t   *pty);
783 
784 /*----------------------------------------------------------------------------*/
785 /*!
786  * \brief  Compute the value of the tensor attached to a property at the cell
787  *         center
788  *         Version using a cs_cell_mesh_t structure
789  *
790  * \param[in]      cm            pointer to a cs_cell_mesh_t structure
791  * \param[in]      pty           pointer to a cs_property_t structure
792  * \param[in]      t_eval        physical time at which one evaluates the term
793  * \param[in]      do_inversion  true or false
794  * \param[in, out] tensor        3x3 matrix
795  */
796 /*----------------------------------------------------------------------------*/
797 
798 void
799 cs_property_tensor_in_cell(const cs_cell_mesh_t   *cm,
800                            const cs_property_t    *pty,
801                            cs_real_t               t_eval,
802                            bool                    do_inversion,
803                            cs_real_t               tensor[3][3]);
804 
805 /*----------------------------------------------------------------------------*/
806 /*!
807  * \brief  Compute the value of a property at the cell center
808  *         Version using a cs_cell_mesh_t structure
809  *
810  * \param[in]  cm        pointer to a cs_cell_mesh_t structure
811  * \param[in]  pty       pointer to a cs_property_t structure
812  * \param[in]  t_eval    physical time at which one evaluates the term
813  *
814  * \return the value of the property for the given cell
815  */
816 /*----------------------------------------------------------------------------*/
817 
818 cs_real_t
819 cs_property_value_in_cell(const cs_cell_mesh_t   *cm,
820                           const cs_property_t    *pty,
821                           cs_real_t               t_eval);
822 
823 /*----------------------------------------------------------------------------*/
824 /*!
825  * \brief   Compute the Fourier number in each cell
826  *
827  * \param[in]      pty       pointer to the diffusive property struct.
828  * \param[in]      t_eval    physical time at which one evaluates the term
829  * \param[in]      dt        value of the current time step
830  * \param[in, out] fourier   pointer to an array storing Fourier numbers
831  */
832 /*----------------------------------------------------------------------------*/
833 
834 void
835 cs_property_get_fourier(const cs_property_t    *pty,
836                         cs_real_t               t_eval,
837                         double                  dt,
838                         cs_real_t               fourier[]);
839 
840 /*----------------------------------------------------------------------------*/
841 /*!
842  * \brief  Print a summary of the settings for all defined cs_property_t
843  *         structures
844  */
845 /*----------------------------------------------------------------------------*/
846 
847 void
848 cs_property_log_setup(void);
849 
850 /*----------------------------------------------------------------------------*/
851 
852 END_C_DECLS
853 
854 #endif /* __CS_PROPERTY_H__ */
855