1 #ifndef __CS_GAS_MIX_H__
2 #define __CS_GAS_MIX_H__
3 
4 /*============================================================================
5  * Base gas mix data.
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_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
38 BEGIN_C_DECLS
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 /* Gas mix types
49    ------------- */
50 
51 typedef enum {
52 
53   CS_GAS_MIX_OFF = -1,                   /*!< gas mix model off */
54   CS_GAS_MIX_AIR_HELIUM = 0,             /*!< air/helium, helium deduced */
55   CS_GAS_MIX_AIR_HYDROGEN = 1,           /*!< air/hydrogen, hydrogen deduced */
56   CS_GAS_MIX_AIR_STEAM = 2,              /*!< air/steam, steam deduced */
57   CS_GAS_MIX_AIR_HELIUM_STEAM = 3,       /*!< helium/steam, steam deduced */
58   CS_GAS_MIX_AIR_HYDROGEN_STEAM = 4,     /*!< hydrogen/steam, steam deduced */
59   CS_GAS_MIX_HELIUM_AIR = 5,             /*!< helium/air, O2 from air deduced */
60   CS_GAS_MIX_USER                        /*!< user defined */
61 
62 } cs_gas_mix_type_t;
63 
64 /* Gas mix descriptor
65    ------------------ */
66 
67 typedef struct {
68 
69   int    n_species;             /*!< number of species in the gas mix */
70   int    n_species_solved;      /*!< number of species which
71                                   are solved variables */
72   int   *species_to_field_id;   /*!< species to field mapping
73                                   (solved variables first) */
74 
75 } cs_gas_mix_t;
76 
77 /*
78  * Gas mix modelling physical properties
79  * ------------------------------------- */
80 
81 typedef struct {
82 
83   double  mol_mas;   /* molar mass */
84   double  cp;        /* specific heat at constant pressure */
85   double  vol_dif;   /* volume diffusion */
86   double  mu_a;      /* dynamic viscosity a */
87   double  mu_b;      /* dynamic viscosity a */
88   double  lambda_a;  /* thermal conductivity a */
89   double  lambda_b;  /* thermal conductivity b */
90   double  muref;     /* ref. viscosity for Sutherland law */
91   double  lamref;    /* ref. thermal conductivity for Sutherland law */
92   double  trefmu;    /* ref. temperature for viscosity in Sutherland law */
93   double  treflam;   /* ref. temperature for conductivity Sutherland law */
94   double  smu;       /* Sutherland temperature for viscosity */
95   double  slam;      /* Sutherland temperature for conductivity */
96 
97 } cs_gas_mix_species_prop_t;
98 
99 /*============================================================================
100  * Static global variables
101  *============================================================================*/
102 
103 /* Pointer to main physical constants structure */
104 
105 extern const cs_gas_mix_t  *cs_glob_gas_mix;
106 
107 /*=============================================================================
108  * Public function prototypes
109  *============================================================================*/
110 
111 /*----------------------------------------------------------------------------*/
112 /*!
113  * \brief Get the field key for gas mix properties.
114  *
115  * \return  field key id for gas mix properties
116  */
117 /*----------------------------------------------------------------------------*/
118 
119 int
120 cs_gas_mix_get_field_key(void);
121 
122 /*----------------------------------------------------------------------------*/
123 /*!
124  * \brief Add a species field to the gas mix (set of fields).
125  *
126  * \param[in]   f_id   field id of an already created scalar model field
127  */
128 /*----------------------------------------------------------------------------*/
129 
130 void
131 cs_gas_mix_add_species(int f_id);
132 
133 /*----------------------------------------------------------------------------*/
134 /*!
135  * \brief Add a species field to the gas mix (set of fields).
136  *
137  * \param[in]  f_id         id of field representing species mixture fraction.
138  * \param[in]  mol_mass     molar mass
139  * \param[in]  cp           specific heat
140  * \param[in]  col_diff     volume diffusion
141  * \param[in]  mu_a         dynamic viscosity a
142  * \param[in]  mu_b         dynamic viscosity b
143  * \param[in]  lambda_a     thermal conductivity a
144  * \param[in]  lambda_b     thermal conductivity b
145  * \param[in]  mu_ref       reference viscosity (Sutherland)
146  * \param[in]  lambda_ref   reference conductivity (Sutherland)
147  * \param[in]  tref_mu      reference temperature for viscosity
148  * \param[in]  tref_lambda  reference temperature for conductivity
149  * \param[in]  s_mu         Sutherland temperature for viscosity
150  * \param[in]  s_lambda     Sutherland temperature for conductivity
151  */
152 /*----------------------------------------------------------------------------*/
153 
154 void
155 cs_gas_mix_add_species_with_properties(int        f_id,
156                                        cs_real_t  mol_mass,
157                                        cs_real_t  cp,
158                                        cs_real_t  vol_diff,
159                                        cs_real_t  mu_a,
160                                        cs_real_t  mu_b,
161                                        cs_real_t  lambda_a,
162                                        cs_real_t  lambda_b,
163                                        cs_real_t  mu_ref,
164                                        cs_real_t  lambda_ref,
165                                        cs_real_t  tref_mu,
166                                        cs_real_t  tref_lambda,
167                                        cs_real_t  s_mu,
168                                        cs_real_t  s_lambda);
169 
170 /*----------------------------------------------------------------------------*/
171 /*!
172  * \brief Add property fields specific to a gas mix.
173  */
174 /*----------------------------------------------------------------------------*/
175 
176 void
177 cs_gas_mix_add_property_fields(void);
178 
179 /*----------------------------------------------------------------------------*/
180 /*!
181  * \brief Free array mapping gas mix species ids to field ids.
182  */
183 /*----------------------------------------------------------------------------*/
184 
185 void
186 cs_gas_mix_finalize(void);
187 
188 /*----------------------------------------------------------------------------*/
189 
190 END_C_DECLS
191 
192 #endif /* __CS_GAS_MIX_H__ */
193