1/*============================================================================ 2 * Code_Saturne documentation page 3 *============================================================================*/ 4 5/* 6 This file is part of Code_Saturne, a general-purpose CFD tool. 7 8 Copyright (C) 1998-2021 EDF S.A. 9 10 This program is free software; you can redistribute it and/or modify it under 11 the terms of the GNU General Public License as published by the Free Software 12 Foundation; either version 2 of the License, or (at your option) any later 13 version. 14 15 This program is distributed in the hope that it will be useful, but WITHOUT 16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 details. 19 20 You should have received a copy of the GNU General Public License along with 21 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 22 Street, Fifth Floor, Boston, MA 02110-1301, USA. 23*/ 24 25/*----------------------------------------------------------------------------*/ 26 27/*! 28 \page cs_var_dico Variables and structures reference (C and Fortran) 29 30 \section cs_var_dico_intro Introduction 31 32 This page is meant to help users find their way through when implementing 33 user C functions or Fortran subroutines or even developing inside the code 34 kernel. It provides cross-reference tables containing the names of Fortran 35 variables and their C counterparts as well as guidelines about 36 how to manage the mesh entities and the fields (variables, properties, ...). 37 In addition, some naming conventions are described. 38 39 Note: variables with the same name in Fortran and in C are most of the time not listed. 40 41 \section cs_var_dico_namingcontent Contents 42 43 Cross-reference tables and guidelines are organized as follows: 44 45 - \subpage mesh 46 - \subpage field 47 - \subpage local 48 - \subpage field_kw 49 50*/ 51// _____________________________________________________________________________ 52/*! 53 54 \page mesh How to access and manage the main mesh entities and mesh quantities ? 55 56 \section cs_var_dico_mesh_vars Mesh variables 57 58 These variables are defined in the files \ref mesh.f90 and \ref cs_mesh.h. 59 60 - The Fortran variables are global in the code, accessible directly by their 61 name. 62 - Members of the global C structure \c cs_glob_mesh are accessed as: \n 63 <tt>cs_glob_mesh->name</tt>, \n 64 \e i.e. adding <tt> cs_glob_mesh-> </tt> in front of the name of the 65 variable. 66 - For a more concise syntax, defining a local \c m or \c mesh variable is recommended: 67 \code{.c} 68 const cs_mesh_t *m = cs_glob_mesh; 69 \endcode 70 so that the shorter name of the local variable may be used. 71 - In functions which have a <tt> domain </tt> argument, 72 using <tt> domain->mesh </tt> is recommended, and may be combined 73 with the use of a local argument (as above) for conciseness. 74 - Note that the number of elements given here are *local* to a given 75 rank when running in parallel. Global sizes should only be used in specific 76 instances, though they are available in \ref cs_mesh_t structures. 77 78 Fortran code | C code | Description 79 ------------- | ------------------------------------- | ------------ 80 <tt> ndim | cs_glob_mesh->dim </tt> | Space dimension (always 3) 81 <tt> ncelet | cs_glob_mesh->n_cells_with_ghosts </tt> | Total number of cells on the local rank \n (n_cells + n_ghost_cells) 82 <tt> ncel | cs_glob_mesh->n_cells </tt> | Number of cells 83 <tt> nfac | cs_glob_mesh->n_i_faces </tt> | Number of interior faces 84 <tt> nfabor | cs_glob_mesh->n_b_faces </tt> | Number of boundary faces 85 <tt> nnod | cs_glob_mesh->n_vertices </tt> | Number of vertices 86 - | <tt> cs_glob_mesh->n_b_cells </tt> | Number of boundary cells 87 <tt> lndfac | cs_glob_mesh->i_face_vtx_connect_size </tt> | Size of the connectivity \n interior faces -> vertices 88 <tt> lndfbr | cs_glob_mesh->b_face_vtx_connect_size </tt>| Size of the connectivity \n boundary faces -> vertices 89 <tt> ifacel | cs_glob_mesh->i_face_cells </tt> | Interior faces -> cells connectivity 90 <tt> ifabor | cs_glob_mesh->b_face_cells </tt> | Boundary faces -> cells connectivity 91 <tt> ipnfac | cs_glob_mesh->i_face_vtx_idx </tt> | Interior faces -> vertices index 92 <tt> nodfac | cs_glob_mesh->i_face_vtx_lst </tt> | Interior faces -> vertices connectivity 93 <tt> ipnfbr | cs_glob_mesh->b_face_vtx_idx </tt> | Boundary faces -> vertices index 94 <tt> nodfbr | cs_glob_mesh->b_face_vtx_lst </tt> | Boundary faces -> vertices connectivity 95 - | <tt> cs_glob_mesh->b_cells </tt> | Boundary cell list 96 <tt> xyznod | cs_glob_mesh->vtx_coord </tt> | Vertex coordinates 97 98 \section cs_var_dico_mesh_q_vars Mesh quantity variables 99 100 These variables are defined in the files \ref mesh.f90 and 101 \ref cs_mesh_quantities.h. 102 103 - The Fortran variables are global in the code, accessible directly by their 104 name. 105 - Members of the global C structure \c cs_glob_mesh_quantities are accessed 106 as: \n 107 <tt>cs_glob_mesh_quantities->name</tt>, \n 108 \e i.e. adding <tt> cs_glob_mesh_quantities-> </tt> in front of the name of 109 the variable. 110 - For a more concise syntax, defining a local \c mq variable is recommended: 111 \code{.c} 112 const cs_mesh_quantities_t *mq = cs_glob_mesh_quantities; 113 \endcode 114 so that the shorter name of the local variable may be used. 115 - In functions which have a <tt> domain </tt> argument, 116 using <tt> domain->mesh_quantities </tt> is recommended, and may be combined 117 with the use of a local argument (as above) for conciseness. 118 119 Fortran code | C code | Description 120 ------------- | --------------------------------------------- |------------- 121 <tt> isympa | cs_glob_mesh_quantities->b_sym_flag </tt> | Symmetry flag for boundary faces 122 <tt> xyzcen | cs_glob_mesh_quantities->cell_cen </tt> | Cell center coordinates 123 <tt> surfac | cs_glob_mesh_quantities->i_face_normal </tt> | Surface normal of interior faces 124 <tt> surfbo | cs_glob_mesh_quantities->b_face_normal </tt> | Surface normal of border faces 125 <tt> cdgfac | cs_glob_mesh_quantities->i_face_cog </tt> | Center of gravity of interior faces 126 <tt> cdgfbo | cs_glob_mesh_quantities->b_face_cog </tt> | Center of gravity of border faces 127 <tt> volume | cs_glob_mesh_quantities->cell_vol </tt> | Cell volume 128 <tt> surfan | cs_glob_mesh_quantities->i_face_surf </tt> | Surface of interior faces 129 <tt> surfbn | cs_glob_mesh_quantities->b_face_surf </tt> | Surface of boundary faces 130 <tt> dist | cs_glob_mesh_quantities->i_dist </tt> | Distance between the cell center and \n the center of gravity of interior faces 131 <tt> distb | cs_glob_mesh_quantities->b_dist </tt> | Distance between the cell center and \n the center of gravity of border faces 132 <tt> pond | cs_glob_mesh_quantities->weight </tt> | Interior faces weighting factor 133 134*/ 135// _____________________________________________________________________________ 136/*! 137 138 \page field How to access and manage variables and properties using the cs_field API? 139 140 \ref cs_var_dico_vars "Variables" and \ref cs_var_dico_props "properties" can be accessed both in Fortran and in C using the \ref cs_field.h "cs_field" API. 141 142 First, let us specify a few conventions used in code_saturne: 143 144 - The *dynamic variables* designation includes velocity, pressure, and 145 variables related to the turbulence model (<em>k</em>, <em>ε</em>, 146 <em>R<sub>ij</sub></em>, <em>ω</em>, <em>ϕ</em>, \f$ \overline{f} \f$, 147 <em>α</em>, <em>ν<sub>t</sub></em>). \n 148 149 - The designation “scalar” refers to (usually scalar) variables which are 150 solution of an advection equation, apart from the *dynamic* variables listed 151 above; for instance the temperature, scalars which may be passive or not, 152 user-defined or model-defined. 153 154 The mean value of the square of the fluctuations of a “scalar” is a 155 “scalar”, too. 156 157 Scalars may be divided into two groups: **user-defined** scalars 158 and **model-defined** (sometimes referred to as “specific physics”) scalars. 159 In Fortran, there are \c nscaus user-defined scalars and \c nscapp 160 “specific physics” (i.e. model-defined) scalars, with 161 <tt>nscal = nscaus + nscapp</tt>. 162 163 - Depending on the thermal model used; the solved thermal scalar variable may be 164 the temperature, the enthalpy, or in the case of the compressible module, 165 the total energy. When the temperature is not the solved thermal variable, 166 it is usually available as a property. 167 168 - When a user scalar represents the mean of the 169 square of the fluctuations of another scalar (<em>i.e.</em> the average 170 \f$ \overline{\varphi^\prime\varphi^\prime} \f$ for a fluctuating scalar 171 <em>ϕ</em>). This can be made either {\em via} the 172 interface or by declaring that scalar using 173 \texttt{cs\_parameters\_add\_variable\_variance} in 174 \texttt{cs\_user\_parameters.f90} (if the scalar in question is not a ``user'' 175 scalar, the selection is made automatically). For instance, if \texttt{j} 176 and \texttt{k} are ``user'' scalars, the variable $\varphi$ corresponding 177 to \texttt{k} is the variable number 178 \texttt{isca(k)=isca(iscavr(j))}. 179\end{list} 180 181 182 \par Accessing variables and properties in Fortran: 183 184 - The most general way of accessing a field is to use its name: \n\n 185 186 <tt>call \ref field::field_get_val_s_by_name "field_get_val_s_by_name"("pressure", cvar_pr) 187 \n pres = cvar_pr(iel)</tt> \n\n 188 189 - Both \ref cs_var_dico_vars "variables" and \ref cs_var_dico_props "properties" can be accessed via the 190 \ref field.f90 "cs_field" API, using the global field indices and indirections arrays, as in the following examples: 191 192 - For one-dimensional arrays:\n\n 193 <tt>call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref numvar::ipr "ipr"), cvar_pr) 194 \n pres = cvar_pr(iel)</tt>, \n\n 195 <tt>call \ref field::field_get_val_s "field_get_val_s"(\ref cstphy::icp "icp", cpro_cp) \n 196 cp = cpro_cp(iel)</tt> \n\n 197 The values of scalar variable can be accessed as follows:\n\n 198 <tt>call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref isca "isca"(iscalt)), cvar_scalt) \n 199 temp = cvar_scalt(iel)</tt> \n\n 200 201 - For interleaved multidimensional arrays:\n\n 202 <tt>call \ref field::field_get_val_v "field_get_val_v"(ivarfl(\ref numvar::iu "iu"), cvar_vel) 203 \n ux = cvar_vel(1,iel)</tt> \n\n 204 205 \ref numvar::ipr "ipr", \ref numvar::iu "iu" are here variable indices and the array ivarfl allows to get the corresponding field indices.\n 206 \ref isca "isca"(iscalt) is also a variable index (\ref optcal::iscalt "iscalt" is the scalar index of the thermal scalar).\n 207 \ref cstphy::icp "icp" is directly a field index (there is no equivalent to the array ivarfl for field of type properties).\n\n 208 209 - the solved variable number for scalar <tt>j</tt>, where 210 <tt>1 <= j <= nscal</tt>, is given by the <tt>iscal</tt> array. 211 So to access the associated field, use:\n 212 <tt>ivarfl(iscal(j))</tt>). \n\n 213 214 - For model-defined scalars, the total scalar number for model scalar <tt>j</tt>, where 215 <tt>1 <= j <= nscapp</tt>, is given by the <tt>iscapp</tt> array. 216 So to access the associated field, use:\n 217 <tt>ivarfl(iscal(iscapp(j)))</tt>). \n\n 218 219 - The thermal scalar can be accessed using the <tt>iscalt</tt> index in the list of the 220 scalars. It's variable number is thus <tt> isca(iscalt) </tt>.\n 221 if there is no thermal scalar, <tt>iscalt</tt> is equal to -1. \n\n 222 223 \par Accessing variables and properties in C: 224 225 - The most general way of accessing a field is to use its name: \n\n 226 227 <tt>cs_real_t *cvar_pr = cs_field_by_name "field_get_val_s_by_name"("pressure")->val; </tt>\n 228 then: \n 229 <tt> cvar_pr(cell_id) </tt> \n\n 230 231 - The main \ref cs_var_dico_vars "variables" and \ref cs_var_dico_props "properties" can be accessed using the \ref CS_F_ macro:\n\n 232 233 - For one-dimensional arrays:\n 234 <tt>press = CS_F_(p)->val[cell_id]</tt>, \n 235 <tt>cp = CS_F_(cp)->val[cell_id]</tt> \n 236 <tt>temp = CS_F_(t)->val[cell_id]</tt> \n\n 237 238 - For multidimensional arrays:\n 239 <tt>uz = CS_F_(vel)->val[3*cell_id + 2]</tt>\n\n 240 These arrays can also be cast as follows (for a 3-D array):\n 241 <tt>\ref cs_real_3_t *cvar_vel = (\ref cs_real_3_t *)CS_F_(vel)->val</tt> \n\n 242 The cell value can then be accessed as \n 243 <tt>ux = cvar_vel[cell_id][0]</tt>\n\n 244 245 <b>\c vel, \c p, or \c cp </b> are defined in \ref cs_field_pointer.h. \n\n 246 247 - Indexed variables (such as user scalars) and indexed properties 248 are accessed as: \n 249 <tt>\ref CS_FI_(name,ii-1)->val[cell_id]</tt>. \n\n 250 251 - The thermal scalar can be accessed using the \ref cs_thermal_model_field 252 function: \n 253 <tt>field_t *tf = cs_thermal_model_field();</tt>\n 254 then: \n 255 <tt>tf->val[cell_id]</tt>. \n 256 if there is no thermal scalar, cs_thermal_model_field returns NULL. \n\n 257 258 - In any case, all variables can be accessed using the function \ref cs_field_by_name:\n 259 <tt>\ref cs_real_t *cvar_pr = \ref cs_field_by_name("pressure")->val</tt> \n\n 260 261 - A field's \ref scalar_id key-word should be ≥ 0 if it is a scalar. \n\n 262 263 - When a field is user-defined (rather than model-defined), 264 its \ref cs_field_t::type "type" flag 265 should also match the \ref CS_FIELD_USER mask: \n 266 <tt> if (f->type & CS_FIELD_USER) ... </tt> 267 268 \remark Note that indexes in C begin at 0, while indexes in Fortran begin at 1. 269 Thus, Fortran and C loop counters are related in the following as:\n 270 <tt>cell_id = iel-1</tt>. 271 272 Cross-reference tables are available for the variables and properties of the 273 standard solver and the specific physics features: 274 - \ref cs_var_dico_vars 275 - \ref cs_var_dico_props 276 - \ref cs_var_dico_part 277 - \ref cs_var_dico_atmo 278 - \ref cs_var_dico_comb 279 - \ref cs_var_dico_cfbl 280 - \ref cs_var_dico_elec 281 - \ref cs_var_dico_cogz 282 - \ref cs_var_dico_rayt 283 284 \section cs_var_dico_vars Variables 285 286 The Fortran variables indexes are defined in the files \ref numvar.f90 (with 287 the exception of \c ihm and \c iscal, which are respectively defined in \ref 288 ppincl.f90 and \ref optcal.f90) and the C variables names are defined in 289 \ref cs_field_pointer.h. \n Note that \c dt is accessible by its name 290 (using the \ref cs_field_by_name family of functions), but not through 291 a permanent index.. 292 293 Fortran code | C code | Description 294 ------------------------------------------------ | ---------------------------- | ------------ 295 <tt> call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ipr), cvar_pr) | CS_F_(p)->val | Pressure 296 call \ref field::field_get_val_v "field_get_val_v"(ivarfl(\ref iu), cvar_vel) | CS_F_(vel)->val | Velocity 297 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ivolf2), cvar_voidf) | CS_F_(void_f)->val | Void fraction for Volume of Fluid model 298 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ik ), cvar_k ) | CS_F_(k)->val | Turbulent kinetic energy \f$ k \f$ 299 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref iep ), cvar_eps) | CS_F_(eps)->val | Turbulent dissipation \f$ \varepsilon \f$ 300 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ir11), cvar_r11) | CS_F_(r11)->val | Reynolds stress component \f$ R_{xx} \f$ 301 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ir22), cvar_r22) | CS_F_(r22)->val | Reynolds stress component \f$ R_{yy} \f$ 302 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ir33), cvar_r33) | CS_F_(r33)->val | Reynolds stress component \f$ R_{zz} \f$ 303 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ir12), cvar_r12) | CS_F_(r12)->val | Reynolds stress component \f$ R_{xy} \f$ 304 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ir23), cvar_r23) | CS_F_(r23)->val | Reynolds stress component \f$ R_{yz} \f$ 305 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ir13), cvar_r13) | CS_F_(r13)->val | Reynolds stress component \f$ R_{xz} \f$ 306 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref iphi), cvar_phi) | CS_F_(phi)->val | \f$ \phi \f$ for \f$ \phi-f_b \f$ model 307 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ifb ), cvar_fb ) | CS_F_(f_bar)->val | \f$ f_b \f$ for \f$ \phi-f_b \f$ model 308 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref ial ), cvar_al ) | CS_F_(alp_bl)->val | \f$ \alpha \f$ for \f$ Bl-v^2-k \f$ \n or EBRSM model 309 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref iomg), cvar_omg) | CS_F_(omg)->val | \f$ \omega \f$ for \f$ k-\omega \f$ SST model 310 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref inusa), cvar_nusa) | CS_F_(nusa)->val | \f$ \widetilde{\nu}_T \f$ for Spalart-Allmaras 311 call \ref field::field_get_val_v "field_get_val_v"(ivarfl(\ref iuma), cvar_mesh_v) | CS_F_(mesh_u)->val | Mesh velocity 312 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(isca(\ref ppincl::ihm "ihm")), cvar_hm) | CS_F_(h)->val | Enthalpy 313 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(isca(\ref optcal::iscalt "iscalt")), cvar_scalt) | CS_F_(t)->val | Temperature </tt> 314 315 316 \section cs_var_dico_props Properties 317 318 These properties are defined in the files \ref numvar.f90 and 319 \ref cs_field_pointer.h. 320 321 Fortran code |C code | Description 322 ------------------------------------------------------------------------------------------------|---------------------------------- | ------------ 323 <tt> dt |CS_F_(dt)->val | Local time step 324 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::iviscl "iviscl", cpro_viscl) |CS_F_(mu)->val | Molecular viscosity 325 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::ivisct "ivisct", cpro_visct) |CS_F_(mu_t)->val | Turbulent dynamic viscosity 326 call \ref field::field_get_val_s "field_get_val_s"(\ref cstphy::icp "icp", cpro_cp) |CS_F_(cp)->val | Specific heat 327 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::icrom "icrom", cpro_crom) |CS_F_(rho)->val | Density (at cells) 328 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::ibrom "ibrom", bpro_rho) |CS_F_(rho_b)->val[face_id] | Density (at boundary faces) 329 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::ismago "ismago", cpro_smago) |\ref cs_real_t *cpro_smago = \ref cs_field_by_name("smagorinsky_constant^2")->val| Field id of the anisotropic turbulent viscosity 330 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::icour "icour", cpro_cour) |\ref cs_real_t *cpro_cour = \ref cs_field_by_name("courant_number")->val | Courant number 331 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::ifour "ifour", cpro_four) |\ref cs_real_t *cpro_four = \ref cs_field_by_name("fourier_number")->val | Fourier number 332 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::iprtot "iprtot", cpro_prtot) |\ref cs_real_t *cpro_prtot = \ref cs_field_by_name("total_pressure")->val | Total pressure at cell centers 333 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::ivisma "ivisma", cpro_visma_s) |\ref cs_real_t *cpro_visma_s = \ref cs_field_by_name("mesh_viscosity")->val | Mesh velocity viscosity (scalar) for the ALE module 334 call \ref field::field_get_val_v "field_get_val_v"(\ref numvar::ivisma "ivisma", cpro_visma_s) |\ref cs_real_t *cpro_visma_v = \ref cs_field_by_name("mesh_viscosity")->val | Mesh velocity viscosity (vector) for the ALE module 335 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::itsrho "itsrho"), cpro_tsrho ) |\ref cs_real_t *cpro_tsrho = \ref cs_field_by_name("dila_st")->val | Global dilatation source terms 336 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::ibeta "ibeta"), cpro_beta ) |\ref cs_real_t *cpro_beta = \ref cs_field_by_name("thermal_expansion")->val | Thermal expansion coefficient 337 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::ipori "ipori", cpro_ipori) |CS_F_(poro)->val | Porosity 338 call \ref field::field_get_val_v "field_get_val_v"(\ref numvar::iporf "iporf", cpro_iporf) |CS_F_(t_poro)->val | Tensorial porosity 339 call \ref field::field_get_val_v "field_get_val_v"(\ref numvar::iforbr "iforbr", bpro_forbr) |\ref cs_real_t *bpro_forbr = \ref cs_field_by_name("boundary_forces")->val| Field id of the stresses at boundary 340 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::iyplbr "iyplbr", bpro_yplus) |\ref cs_real_t *bpro_yplus = \ref cs_field_by_name("yplus")->val | Field id of \f$y^+\f$ at boundary 341 call \ref field::field_get_val_v "field_get_val_v"(\ref numvar::idtten "idtten", dttens) |\ref cs_real_t *dttens = \ref cs_field_by_name("dttens")->val | Field id for the dttens tensor 342 call \ref field::field_get_val_s "field_get_val_s"(\ref numvar::itempb "itempb", t_b) |CS_F_(t_b)->val | Boundary temperature </tt> 343 344Some physical properties such as specific heat or diffusivity are often 345constant (depending on the model or user parameters). 346In that case, these properties are stored as a simple real numbers 347rather than in a field over all mesh cells. 348 349- This is the case for the specific heat <em>C<sub>p</sub></em>. 350 351 - If <em>C<sub>p</sub></em> is constant, it is based on the reference 352 value \ref cs_glob_fluid_properties->cp0 (<tt>cp0</tt> in Fortran).\n 353 When this is the case, \ref cs_glob_fluid_properties->icp (mapped as <tt>icp</tt> in 354 Fortran) should remain set to 0.\n 355 When <tt>icp</tt> is initialized to 1 (by the GUI, or in 356 \ref cs_user_parameters.c, it is automatically reset to the id of 357 the cell-based property field referenced in the above table. 358 359- This is the same for the diffusivity <em>K</em> of each scalar. 360 361 - When <em>K</em> is constant, its value is based on the field's reference 362 diffusivity, accessible through the scalar field's \ref diffusivity_ref 363 keyword. 364 365 When it is variable, the matching field can be specified and accessed using 366 the base scalar field's \ref diffusivity_id key (accessible using 367 \ref cs_field_key_id("diffusivity_id") in C, or <tt>kivisl</tt> in Fortran).\n 368 For example, for a scalar field <tt>f</tt>:\n 369 <tt> int k_f_id = \ref cs_field_get_key_int(f, \ref cs_field_key_id("diffusivity_id")); \n 370 cs_field_t *kf = \ref cs_field_by_id(k_f_id); </tt> 371 372 373 \section cs_var_dico_part Specific physical models 374 375 \subsection cs_var_dico_atmo Atmospheric 376 377 Defined in \ref optcal.f90, \ref atincl.f90, \ref atvarp.f90 and 378 \ref cs_field_pointer.h. 379 380 Fortran code | C code | Description 381 ------------ | ------ | ------------ 382 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(isca(iscalt)), cvar_scalt) | <tt> CS_F_(pot_t)->val </tt> | Potential temperature 383 - | <tt> CS_F_(totwt)->val </tt> | Total water content 384 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref isca(\ref atincl::intdrp "intdrp")), cvar_intdrp) | <tt> CS_F_(ntdrp)->val </tt> | Total number of droplets 385 call \ref field::field_get_val_s "field_get_val_s"(ivarfl(\ref isca(\ref atchem::isca_chem "isca_chem"(iesp))), cvar_sc) | <tt> CS_FI_(chemistry,iesp-1)->val </tt>| Chemistry species (indexed) 386 387 \subsection cs_var_dico_comb Coal combustion 388 389 Defined in \ref ppincl.f90, \ref ppcpfu.f90 and \ref cs_field_pointer.h. 390 391 Fortran code | C code | Description 392 ------------------------------------------------------------------------------- | -------------------------------- | ------------ 393 <tt> call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::inp "inp"(iesp)), cvar_inpcl) | \ref CS_FI_(np,iesp-1)->val | Particles per kg for coal class 394 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ixch "ixch"(iesp)), cvar_xchcl) | \ref CS_FI_(xch,iesp-1)->val | Reactive coal mass fraction for coal class 395 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ixck "ixck"(iesp)), cvar_xckcl) | \ref CS_FI_(xck,iesp-1)->val | Coke mass fraction for coal class 396 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ixwt "ixwt"(iesp)), cvar_xwtcl) | \ref CS_FI_(xwt,iesp-1)->val | Water mass fraction for coal class 397 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ih2 "ih2"(iesp)), cvar_h2cl) | \ref CS_FI_(h2,iesp-1)->val | Mass enthalpy for coal class (permeatic case) 398 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if1m "if1m"(iesp)), cvar_f1mcl) | \ref CS_FI_(f1m,iesp-1)->val | Mean value light volatiles for coal class 399 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if2m "if2m"(iesp)), cvar_f2mcl) | \ref CS_FI_(f2m,iesp-1)->val | Mean value heavy volatiles for coal class 400 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if4m "if4m"), cvar_f4m) | CS_F_(f4m)->val | Oxydant 2 mass fraction 401 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if5m "if5m"), cvar_f5m)) | CS_F_(f5m)->val | Oxydant 3 mass fraction 402 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if6m "if6m"), cvar_f6m)) | CS_F_(f6m)->val | Water from coal drying mass fraction 403 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if7m "if7m"), cvar_f7m)) | CS_F_(f7m)->val | Carbon from coal oxidyzed by O2 mass fraction 404 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if8m "if8m"), cvar_f8m)) | CS_F_(f8m)->val | Carbon from coal gasified by CO2 mass fraction 405 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::if9m "if9m"), cvar_f9m)) | CS_F_(f9m)->val | Carbon from coal gasified by H2O mass fraction 406 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ifvp2m "ifvp2m"), cvar_fvp2m) | CS_F_(fvp2m)->val | f1f2 variance 407 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppcpfu::iyco2 "iyco2"), cvar_yco2) | CS_F_(yco2)->val | CO2 fraction 408 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppcpfu::iyhcn "iyhcn"), cvar_yhnc) | CS_F_(yhcn)->val | HCN fraction 409 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppcpfu::iyno "iyno"), cvar, yno) | CS_F_(yno)->val | NO fraction 410 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppcpfu::iynh3 "iynh3"), cvar_ynh3) | CS_F_(ynh3)->val | NH3 enthalpy 411 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppcpfu::ihox "ihox"), cvar_hox) | CS_F_(hox)->val | Ox enthalpy </tt> 412 413 414 \subsection cs_var_dico_cfbl Compressible 415 416 Defined in \ref ppincl.f90 and \ref cs_field_pointer.h. 417 418 Fortran code | C code | Description 419 ------------------------------------------------------------------------------ | ----------------------------- | ------------ 420 <tt> call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ienerg "ienerg"), cvar_energ) | CS_F_(e_tot)->val | Total energy 421 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::itempk "itempk"), cvar_tempk) | CS_F_(t_kelvin)->val | Temperature, in Kelvin </tt> 422 423 424 \subsection cs_var_dico_elec Electric arcs 425 426 Defined in \ref ppincl.f90 and \ref cs_field_pointer.h. 427 428 Fortran code | C code | Description 429 ----------------------------------------------------------------------------- | ---------------------------------- | ------------ 430 <tt> call \ref field::field_get_val_s_by_name "field_get_val_s_by_name"("elec_pot_r", cvar_potr) | CS_F_(potr)->val | Electric potential, real part 431 call \ref field::field_get_val_s_by_name "field_get_val_s_by_name"("elec_pot_i", cvar_poti) | CS_F_(poti)->val | Electric potential, imaginary part 432 call \ref field::field_get_val_v_by_name "field_get_val_v_by_name"("vec_potential", cvar_potva) | CS_F_(potva)->val | Vector potential 433 call \ref field::field_get_val_s_by_name "field_get_val_s_by_name"("esl_fraction_01", cvar_ycoel_01) | \ref CS_FI_(ycoel,iesp-1)->val | Constituent mass fraction </tt> 434 435 436 \subsection cs_var_dico_cogz Gas combustion 437 438 Defined in \ref ppincl.f90 and \ref cs_field_pointer.h. 439 440 Fortran code | C code | Description 441 ------------------------------------------------------------------------- | -------------------------- | ------------ 442 <tt> call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ifm "ifm"), cvar_fm) | CS_F_(fm)->val | Mixture fraction 443 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ifp2m "ifp2m"), cvar_fp2m) | CS_F_(fp2m)->val | Mixture fraction variance 444 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::ifsm "ifsm"), cvar_fsm) | CS_F_(fsm)->val | Soot mass fraction 445 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::inpm "inpm"), cvar_npm) | CS_F_(npm)->val | Soot precursor number 446 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::iygfm "iygfm"), cvar_ygfm) | CS_F_(ygfm)->val | Fresh gas fraction 447 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::iyfm "iyfm"), cvar_yfm) | CS_F_(yfm)->val | Mass fraction 448 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::iyfp2m "iyfp2m"), cvar_yfp2m) | CS_F_(yfp2m)->val | Mass fraction variance 449 call \ref field::field_get_val_s "field_get_val_s"(\ref isca(\ref ppincl::icoyfp "icoyfp"), cvar_coyfp) | CS_F_(coyfp)->val | Mass fraction covariance </tt> 450 451 452 \subsection cs_var_dico_rayt Radiative transfer 453 454 Defined in \ref cs_field_pointer.h. 455 456 C code | Description 457 --------------------------------------- | ------------ 458 <tt> CS_F_(rad_lumin)->val </tt> | Radiative luminance 459 <tt> CS_F_(rad_q)->val </tt> | Radiative flux 460 <tt> CS_FI_(rad_ets,iesp-1)->val </tt> | Radiative flux explicit source term 461 <tt> CS_FI_(rad_its,iesp-1)->val </tt> | Radiative flux implicit source term 462 <tt> CS_FI_(rad_abs,iesp-1)->val </tt> | Radiative absorption 463 <tt> CS_FI_(rad_emi,iesp-1)->val </tt> | Radiative emission 464 <tt> CS_FI_(rad_cak,iesp-1)->val </tt> | Radiative absorption coefficient 465 <tt> CS_F_(qinci)->val </tt> | Radiative incident radiative flux density 466 <tt> CS_F_(xlam)->val </tt> | Wall thermal conductivity 467 <tt> CS_F_(epa)->val </tt> | Wall thickness 468 <tt> CS_F_(emissivity)->val </tt> | Wall emissivity 469 <tt> CS_F_(fnet)->val </tt> | Boundary radiative flux 470 <tt> CS_F_(fconv)->val </tt> | Boundary radiative convective flux 471 <tt> CS_F_(hconv)->val </tt> | Radiative exchange coefficient 472 473 474 \subsection cs_var_dico_multiphase Eulerian-Eulerian multiphase flows 475 476 Defined in \ref cs_field_pointer.h. 477 478 C code | Description 479 --------------------------------------- | ------------ 480 <tt> CS_FI_(yf_ncond,inc)->val </tt> | Non-condensable gas mass fractions 481 <tt> CS_FI_(qp,ip)->val </tt> | Particles turbulent kinetic energy Q2 482 <tt> CS_FI_(qfp,ip)->val </tt> | Covariance of the turbulent Q12 483 <tt> CS_FI_(qfpxx,ip)->val </tt> | XX component of qfp 484 <tt> CS_FI_(qfpxy,ip)->val </tt> | XY component of qfp 485 <tt> CS_FI_(qfpxz,ip)->val </tt> | XZ component of qfp 486 <tt> CS_FI_(qfpyx,ip)->val </tt> | YX component of qfp 487 <tt> CS_FI_(qfpyy,ip)->val </tt> | YY component of qfp 488 <tt> CS_FI_(qfpyz,ip)->val </tt> | YZ component of qfp 489 <tt> CS_FI_(qfpzx,ip)->val </tt> | ZX component of qfp 490 <tt> CS_FI_(qfpzy,ip)->val </tt> | ZY component of qfp 491 <tt> CS_FI_(qfpzz,ip)->val </tt> | ZZ component of qfp 492 <tt> CS_FI_(gamma,ip)->val </tt> | Interfacial mass transfer 493 <tt> CS_FI_(ia,ip)->val </tt> | Interfacial area 494 <tt> CS_FI_(x2,ip)->val </tt> | Droplets x2 495 <tt> CS_FI_(d32,ip)->val </tt> | Droplets Sauter mean diameter 496 <tt> CS_FI_(drag,ipcpl)->val </tt> | Drag between phases 497 <tt> CS_FI_(ad_mass,ip)->val </tt> | Added mass 498 <tt> CS_FI_(th_diff,ip)->val </tt> | Thermal diffusivity 499 <tt> CS_FI_(th_diff_t,ip)->val </tt> | Turbulent thermal diffusivity 500 <tt> CS_FI_(drho_dp,ip)->val </tt> | dRho over dP 501 <tt> CS_FI_(drho_dh,ip)->val </tt> | dRho over dH 502 <tt> CS_FI_(tau12_t,ip)->val </tt> | Turbulent tau12 for particles 503 <tt> CS_FI_(lift,ip)->val </tt> | Particles lift 504 <tt> CS_FI_(disp_t,ip)->val </tt> | Particles turbulent dispersion 505 <tt> CS_FI_(drift_vel,ip)->val </tt> | Particles drift velocity 506 507*/ 508// _____________________________________________________________________________ 509/*! 510 511 \page local How to name common local variables ? 512 513 The following table provides a non-exhaustive list of local variables which 514 are used in the code in a recurring manner. 515 516 Fortran code | C code | Description 517 ------------------ | ---------- | ------------ 518 <tt> iel | cell_id </tt> | Cell index 519 <tt> ifac | face_id </tt> | Face index 520 <tt> ig | g_id </tt> | Interior face number of associated groups (OpenMP) 521 <tt> it | t_id </tt> | Interior face number of threads (OpenMP) 522 <tt> idimtr | tr_dim </tt> | Indicator for tensor perodicity of rotation 523 <tt> flumas | i_massflux </tt> | Mass flux at interior faces 524 <tt> flumab | b_massflux </tt> | Mass flux at boundary faces 525 <tt> viscf | i_visc </tt> | \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$ \n at interior faces for the r.h.s. 526 <tt> viscb | b_visc </tt> | \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$ \n at border faces for the r.h.s. 527 <tt> smbrp | rhs </tt> | Right hand side \f$ \vect{Rhs} \f$ 528 529 \section cs_var_dico_conv Local naming convention for fields (Fortran and C) 530 531 Rules have been stablished for local names denoting fields, depending on their nature. The convention, applying both in Fortran and in C, is as follows: 532 533 - The first letter of the name indicates the location at which the field values are defined: 534 - \b c for values at the cell centers. 535 - \b i for values at the interior faces. 536 - \b b for values at the boundary faces. 537 - The next three letters indicate if the field is a variable (at the current time step or the previous time step) or a property: 538 - \b var for variables at the current time step. 539 - \b vara for variables at the previous time step. 540 - \b pro for properties. 541 - An underscore \b _ follows. 542 - Finally, the <b> short name </b> of the variable/property is specified. This short name is built from the variable/property Fortran index, removing the \c i at the beginning of the word. 543 544 The following examples ilustrate this convention: 545 546 \c cvar_pr: Values of the variable pressure field defined at the cell centers, at the current time step. \n 547 \c cvara_pr: Values of the variable pressure field defined at the cell centers, at the previous time step. \n 548 \c cpro_cp: Values of the property specific heat defined field at the cell centers. \n 549 550*/ 551// _____________________________________________________________________________ 552/*! 553 554 \page field_kw List of main field keys 555 556 A non-exhaustive \ref field_keywords "list of field keys" which are used in the code is provided. 557 558*/ 559