1!------------------------------------------------------------------------------- 2 3! This file is part of Code_Saturne, a general-purpose CFD tool. 4! 5! Copyright (C) 1998-2021 EDF S.A. 6! 7! This program is free software; you can redistribute it and/or modify it under 8! the terms of the GNU General Public License as published by the Free Software 9! Foundation; either version 2 of the License, or (at your option) any later 10! version. 11! 12! This program is distributed in the hope that it will be useful, but WITHOUT 13! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15! details. 16! 17! You should have received a copy of the GNU General Public License along with 18! this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 19! Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 21!------------------------------------------------------------------------------- 22 23subroutine covarp 24!================ 25 26 27!=============================================================================== 28! FONCTION : 29! --------- 30 31! INIT DES POSITIONS DES VARIABLES SELON 32! POUR LA COMBUSTION 33! FLAMME DE DIFFUSION ET DE PREMELANGE 34! REMPLISSAGE DES PARAMETRES (DEJA DEFINIS) POUR LES SCALAIRES PP 35 36!------------------------------------------------------------------------------- 37! Arguments 38!__________________.____._____.________________________________________________. 39! name !type!mode ! role ! 40!__________________!____!_____!________________________________________________! 41!__________________!____!_____!________________________________________________! 42 43! Type: i (integer), r (real), s (string), a (array), l (logical), 44! and composite types (ex: ra real array) 45! mode: <-- input, --> output, <-> modifies data, --- work array 46!=============================================================================== 47 48!=============================================================================== 49! Module files 50!=============================================================================== 51 52use paramx 53use dimens 54use numvar 55use optcal 56use cstphy 57use entsor 58use cstnum 59use ppppar 60use ppthch 61use coincl 62use cpincl 63use ppincl 64use field 65use cs_c_bindings 66 67!=============================================================================== 68 69implicit none 70 71! Local variables 72 73integer f_id, isc, ii, jj 74integer kscmin, kscmax, kscavr 75 76type(var_cal_opt) :: vcopt 77 78!=============================================================================== 79 80!=============================================================================== 81! Interfaces 82!=============================================================================== 83 84interface 85 86 subroutine cs_field_pointer_map_gas_combustion() & 87 bind(C, name='cs_field_pointer_map_gas_combustion') 88 use, intrinsic :: iso_c_binding 89 implicit none 90 end subroutine cs_field_pointer_map_gas_combustion 91 92end interface 93 94!=============================================================================== 95! 0. Definitions for fields 96!=============================================================================== 97 98! Key ids for clipping 99call field_get_key_id("min_scalar_clipping", kscmin) 100call field_get_key_id("max_scalar_clipping", kscmax) 101call field_get_key_id("first_moment_id", kscavr) 102 103!=============================================================================== 104! 1. Define variable fields 105!=============================================================================== 106 107! 1.1 Flamme de diffusion : chimie 3 points 108! ========================================= 109 110if (ippmod(icod3p).ge.0) then 111 112 ! Mixture fraction and its variance 113 114 call add_model_scalar_field('mixture_fraction', 'Fra_MEL', ifm) 115 f_id = ivarfl(isca(ifm)) 116 call field_set_key_double(f_id, kscmin, 0.d0) 117 call field_set_key_double(f_id, kscmax, 1.d0) 118 119 call add_model_scalar_field('mixture_fraction_variance', 'Var_FrMe', ifp2m) 120 f_id = ivarfl(isca(ifp2m)) 121 call field_set_key_int(f_id, kscavr, ivarfl(isca(ifm))) 122 123 ! Enthalpy 124 125 if (ippmod(icod3p).eq.1) then 126 itherm = 2 127 call add_model_scalar_field('enthalpy', 'Enthalpy', ihm) 128 iscalt = ihm 129 ! Set min and max clipping 130 f_id = ivarfl(isca(iscalt)) 131 call field_set_key_double(f_id, kscmin, -grand) 132 call field_set_key_double(f_id, kscmax, grand) 133 endif 134 135 ! Soot mass fraction and precursor number 136 if (isoot.ge.1) then 137 138 call add_model_scalar_field('soot_mass_fraction', 'Fra_Soot', ifsm) 139 f_id = ivarfl(isca(ifsm)) 140 call field_set_key_double(f_id, kscmin, 0.d0) 141 call field_set_key_double(f_id, kscmax, 1.d0) 142 143 call add_model_scalar_field('soot_precursor_number', 'NPr_Soot', inpm) 144 f_id = ivarfl(isca(inpm)) 145 call field_set_key_double(f_id, kscmin, 0.d0) 146 call field_set_key_double(f_id, kscmax, 1.d0) 147 148 endif 149 150endif 151 152! 1.2 Flamme de premelange : modele EBU 153! ===================================== 154 155if (ippmod(icoebu).ge.0) then 156 157 ! Fraction massique des gaz frais 158 call add_model_scalar_field('fresh_gas_fraction', 'Fra_GF', iygfm) 159 160 f_id = ivarfl(isca(iygfm)) 161 call field_set_key_double(f_id, kscmin, 0.d0) 162 call field_set_key_double(f_id, kscmax, 1.d0) 163 164 if (ippmod(icoebu).eq.2 .or.ippmod(icoebu).eq.3) then 165 ! Taux de melange 166 call add_model_scalar_field('mixture_fraction', 'Fra_MEL', ifm) 167 f_id = ivarfl(isca(ifm)) 168 call field_set_key_double(f_id, kscmin, 0.d0) 169 call field_set_key_double(f_id, kscmax, 1.d0) 170 endif 171 if (ippmod(icoebu).eq.1 .or. ippmod(icoebu).eq.3) then 172 itherm = 2 173 call add_model_scalar_field('enthalpy', 'Enthalpy', ihm) 174 iscalt = ihm 175 f_id = ivarfl(isca(iscalt)) 176 call field_set_key_double(f_id, kscmin, -grand) 177 call field_set_key_double(f_id, kscmax, grand) 178 endif 179endif 180 181! 1.3 Flamme de premelange : modele BML A DEVELOPER 182! ================================================= 183 184! 1.4 Flamme de premelange : modele LWC 185! ===================================== 186 187if (ippmod(icolwc).ge.0 ) then 188 189 call add_model_scalar_field('mixture_fraction', 'Fra_MEL', ifm) 190 f_id = ivarfl(isca(ifm)) 191 call field_set_key_double(f_id, kscmin, 0.d0) 192 call field_set_key_double(f_id, kscmax, 1.d0) 193 194 call add_model_scalar_field('mixture_fraction_variance', 'Var_FrMe', ifp2m) 195 f_id = ivarfl(isca(ifp2m)) 196 call field_set_key_int(f_id, kscavr, ivarfl(isca(ifm))) 197 198 199 call add_model_scalar_field('mass_fraction', 'Fra_Mas', iyfm) 200 f_id = ivarfl(isca(iyfm)) 201 call field_set_key_double(f_id, kscmin, 0.d0) 202 call field_set_key_double(f_id, kscmax, 1.d0) 203 204 call add_model_scalar_field('mass_fraction_variance', 'Var_FMa', iyfp2m) 205 f_id = ivarfl(isca(iyfp2m)) 206 call field_set_key_int(f_id, kscavr, ivarfl(isca(iyfm))) 207 208 if (ippmod(icolwc).ge.2 ) then 209 call add_model_scalar_field('mass_fraction_covariance', 'COYF_PP4', icoyfp) 210 f_id = ivarfl(isca(icoyfp)) 211 call field_set_key_double(f_id, kscmin, -0.25d0) 212 call field_set_key_double(f_id, kscmax, 0.25d0) 213 endif 214 215 if (ippmod(icolwc).eq.1 .or. & 216 ippmod(icolwc).eq.3 .or. & 217 ippmod(icolwc).eq.5) then 218 itherm = 2 219 call add_model_scalar_field('enthalpy', 'Enthalpy', ihm) 220 iscalt = ihm 221 endif 222 223endif 224 225! MAP to C API 226call cs_field_pointer_map_gas_combustion 227 228!=============================================================================== 229! 2. PROPRIETES PHYSIQUES 230! A RENSEIGNER OBLIGATOIREMENT (sinon pb dans varpos) 231! ICP 232!=============================================================================== 233 234if (ippmod(icod3p).eq.1 .or. & 235 ippmod(icoebu).eq.1 .or. & 236 ippmod(icoebu).eq.3 .or. & 237 ippmod(icolwc).eq.1 .or. & 238 ippmod(icolwc).eq.3 .or. & 239 ippmod(icolwc).eq.5) then 240 241 ! Although we are in enthalpy formulation, we keep Cp constant 242 243 icp = -1 244 245endif 246 247!=============================================================================== 248! Default numerical options 249!=============================================================================== 250 251do isc = 1, nscapp 252 253 jj = iscapp(isc) 254 255 ii = isca(iscapp(isc)) 256 257 call field_get_key_struct_var_cal_opt(ivarfl(ii), vcopt) 258 259 ! Second order convective scheme 260 vcopt%blencv = 1.d0 261 262 ! Centered convective scheme 263 vcopt%ischcv = 1 264 265 ! Automatic slope test 266 vcopt%isstpc = 0 267 268 ! Reconstruct convection and diffusion fluxes at faces 269 vcopt%ircflu = 1 270 271 call field_set_key_struct_var_cal_opt(ivarfl(ii), vcopt) 272 273enddo 274 275!=============================================================================== 276 277return 278end subroutine 279