1 #ifndef __CS_LAGR_H__ 2 #define __CS_LAGR_H__ 3 4 /*============================================================================ 5 * Functions and types for the Lagrangian module 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 #include "cs_defs.h" 31 32 /*---------------------------------------------------------------------------- 33 * Standard C library headers 34 *----------------------------------------------------------------------------*/ 35 36 #include "assert.h" 37 38 /*---------------------------------------------------------------------------- 39 * Local headers 40 *----------------------------------------------------------------------------*/ 41 42 #include "cs_base.h" 43 #include "cs_field.h" 44 45 #include "cs_lagr_injection.h" 46 47 /*----------------------------------------------------------------------------*/ 48 49 BEGIN_C_DECLS 50 51 /*============================================================================ 52 * Type definitions 53 *============================================================================*/ 54 55 /*----------------------------------------------------------------------------*/ 56 /*! 57 * \brief Function pointer for computation of particle injection profile. 58 * 59 * Note: if the input pointer is non-NULL, it must point to valid data 60 * when the selection function is called, so that value or structure should 61 * not be temporary (i.e. local); 62 * 63 * \param[in] zone_id id of associated mesh zone 64 * \param[in] location_id id of associated mesh location 65 * \param[in] input pointer to optional (untyped) value or structure. 66 * \param[in] n_elts number of zone elements 67 * \param[in] elt_ids ids of zone elements 68 * \param[out] profile weight of a given zone element (size: n_elts) 69 */ 70 /*----------------------------------------------------------------------------*/ 71 72 typedef void 73 (cs_lagr_injection_profile_compute_t) (int zone_id, 74 int location_id, 75 const void *input, 76 cs_lnum_t n_elts, 77 const cs_lnum_t elt_ids[], 78 cs_real_t profile[]); 79 80 /*! Lagrangian boundary condition types */ 81 /*--------------------------------------*/ 82 83 typedef enum { 84 85 CS_LAGR_BC_UNDEFINED, /*!< undefined conditions */ 86 CS_LAGR_SYM, /*!< symmetry */ 87 CS_LAGR_INLET, /*!< inlet */ 88 CS_LAGR_OUTLET, /*!< outlet */ 89 CS_LAGR_REBOUND, /*!< elastic rebound */ 90 CS_LAGR_DEPO1, /*!< immediate deposition and elimination */ 91 CS_LAGR_DEPO2, /*!< deposition */ 92 CS_LAGR_DEPO_DLVO, /*!< deposition based on DLVO theory */ 93 CS_LAGR_FOULING, /*!< fouling (combustion) */ 94 CS_LAGR_BC_USER /*!< user-defined */ 95 96 } cs_lagr_bc_type; 97 98 /*! Lagrangian injection condition types */ 99 /*---------------------------------------*/ 100 101 enum { 102 CS_LAGR_IN_IMPOSED_FLUID_VALUE = -1, /*!< impose fluid value 103 for the injected particles */ 104 CS_LAGR_IN_IMPOSED_NORM = 0, /*!< impose norm */ 105 CS_LAGR_IN_IMPOSED_COMPONENTS = 1 /*!< impose components (for vectors) */ 106 }; 107 108 /*! Lagrangian module status. 109 the different values correspond to the following coupling: 110 - CS_LAGR_OFF: Lagrangian module off 111 - CS_LAGR_ONEWAY_COUPLING: Lagrangian two-phase flow in one-way coupling 112 (no influence of the particles on the continuous phase) 113 - CS_LAGR_TWOWAY_COUPLING: Lagrangian two-phase flow with two-way coupling 114 (influence of the particles on the dynamics of the continuous phase). 115 Dynamics, temperature and mass may be coupled independently. 116 - CS_LAGR_FROZEN_CONTINUOUS_PHASE: Lagrangian two-phase flow on frozen i 117 continuous phase. This option 118 only only be used in case of a calculation restart. All the 119 Eulerian fields are frozen (including the scalar fields). 120 This option automatically implies \ref iccvfg = 1 */ 121 122 typedef enum { 123 CS_LAGR_OFF = 0, 124 CS_LAGR_ONEWAY_COUPLING = 1, 125 CS_LAGR_TWOWAY_COUPLING = 2, 126 CS_LAGR_FROZEN_CONTINUOUS_PHASE = 3 127 } cs_lagr_module_status_t; 128 129 /*! Particle shape condition types */ 130 /*---------------------------------*/ 131 132 typedef enum { 133 134 /*! Impose spherical particles */ 135 CS_LAGR_SHAPE_SPHERE_MODEL = 0, 136 137 /*! Impose spheroids (stochastic model for transport) */ 138 CS_LAGR_SHAPE_SPHEROID_STOC_MODEL = 1, 139 140 /*< Impose spheroids (Jeffery equations for transport) */ 141 CS_LAGR_SHAPE_SPHEROID_JEFFERY_MODEL = 2, 142 143 } cs_lagr_module_shape_t; 144 145 /*! Lagrangian additional physical model */ 146 /*---------------------------------------*/ 147 148 enum { 149 CS_LAGR_PHYS_OFF = 0, 150 CS_LAGR_PHYS_HEAT = 1, 151 CS_LAGR_PHYS_COAL = 2 152 }; 153 154 /*! Fixed maximum sizes */ 155 /*----------------------*/ 156 157 typedef struct { 158 159 int nusbrd; /*!< maximum number of additional user 160 particle/boundary interactions */ 161 162 int ndlaim; /*!< maximum number of particle integer data */ 163 164 int ncharm2; /*!< maximum number of coal classes */ 165 int nlayer; /*!< maximum number of coal layers */ 166 167 } cs_lagr_const_dim_t; 168 169 /*! General dimensions */ 170 /*---------------------*/ 171 172 typedef struct { 173 174 int ntersl; /*!< number of source terms for return coupling */ 175 int n_boundary_stats; /*!< number of boundary statistics */ 176 177 } cs_lagr_dim_t; 178 179 /*! Time and coupling scheme for the Lagrangian module */ 180 /*-----------------------------------------------------*/ 181 182 typedef struct { 183 184 /*! Lagrangian module status. 185 - CS_LAGR_OFF: Lagrangian module off 186 - CS_LAGR_ONEWAY_COUPLING: Lagrangian two-phase flow in one-way coupling 187 (no influence of the particles on the continuous phase) 188 - CS_LAGR_TWOWAY_COUPLING: Lagrangian two-phase flow with two-way coupling 189 (influence of the particles on the dynamics of the continuous phase). 190 Dynamics, temperature and mass may be coupled independently. 191 - CS_LAGR_FROZEN_CONTINUOUS_PHASE: Lagrangian two-phase flow on frozen i 192 continuous phase. This option may 193 only be used in the case of a calculation restart. All the 194 Eulerian fields are frozen (including the scalar fields). 195 This option automatically implies \ref iccvfg = 1 */ 196 int iilagr; 197 198 /* indicates the steady (=1) or unsteady (=0) state of the 199 continuous phase flow 200 in particular, \ref isttio = 1 is needed in order to: 201 calculate steady statistics in the volume or at the boundaries 202 (starting respectively from the iterations 203 \ref cs_lagr_stat_options_t::nstist "nstist") 204 and calculate time-averaged two-way coupling source terms (from the 205 time step \ref nstits). 206 Useful if \ref iilagr = CS_LAGR_ONEWAY_COUPLING 207 or \ref iilagr = CS_LAGR_TWOWAY_COUPLING 208 (if \ref iilagr = CS_LAGR_FROZEN_CONTINUOUS_PHASE, 209 then \ref isttio=1 automatically) */ 210 int isttio; 211 212 /*! activation (=1) or not (=0) of a Lagrangian calculation restart. 213 The calculation restart file read when this option is activated 214 only contains the data related to the particles; 215 the global calculation must also be a restart calculation 216 */ 217 int isuila; 218 219 /*! trajectory algorithm order in time */ 220 int t_order; 221 222 /*! activation (=1) or not (=0) of the solution of a Poisson's equation for 223 the correction of the particle instantaneous velocities 224 (in order to obtain a null divergence). 225 this option is not validated and reserved to the development team. 226 Do not change the default value */ 227 int ilapoi; 228 229 /*! activation (=1) or not (=0) of the added-mass term. 230 \f[ \DP{u_p} = - \dfrac{1}{\rho_p} \grad P + \dfrac{u_s-u_p}{\tau_p} 231 + g 232 +1/2 C_A \dfrac{\rho_f}{\rho_p} \left( \dfrac{Du}{Dt}-\DP{u_p} \right) 233 \f] 234 and 235 \f[ \rho_f \dfrac{Du}{Dt} \simeq - \grad P + \rho_f g \f] 236 with \f$ C_A = 1\f$. Then 237 \f[ \DP{u_p} = - \dfrac{1}{\rho_p} \dfrac{1+C_A/2} 238 {1+C_A/2\dfrac{\rho_f}{\rho_p}} \grad P 239 + \dfrac{u_s-u_p}{\widetilde{\tau}_p} 240 + g 241 \f] 242 with 243 \f[ \widetilde{\tau_p} = (1 + C_A /2 \dfrac{\rho_f}{\rho_p}) \tau_p \f] */ 244 int iadded_mass; 245 246 /*! Added-mass constant (\f$ C_A = 1\f$) */ 247 cs_real_t added_mass_const; 248 249 } cs_lagr_time_scheme_t; 250 251 /*! Main physical model parameters for the Lagrangian module */ 252 /*-----------------------------------------------------------*/ 253 254 typedef struct { 255 256 /*! activates (>0) or deactivates (=0) the physical models associated to the 257 particles: 258 - CS_LAGR_PHYS_HEAT: allows to associate with the particles evolution 259 equations on their temperature (in degrees Celsius), their diameter and 260 their mass 261 - CS_LAGR_PHYS_COAL: the particles are pulverised coal particles. 262 Evolution equations on temperature (in degree Celsius), mass of 263 reactive coal, mass of char and diameter of the shrinking core are 264 associated with the particles. This option is available only if the 265 continuous phase represents a pulverised coal flame. */ 266 int physical_model; 267 int n_temperature_layers; 268 269 /*! Activates (1) or not (0) the assumption that we have regular particles. 270 When set to, 0 then the particles are assumed to be fluid particles 271 (and the turbulence dispersion model is disabled by default). 272 Since this model uses volume statistics, is use forces their 273 activation even if not otherwise requested 274 (see \ref cs_lagr_stat_options_t::idstnt "idstnt"). */ 275 int modcpl; 276 277 /*! Activation of the turbulent dispersion (on: 1; off). 278 Default is on if \ref modcpl = 1, off if \ref modcpl = 0); 279 This is compatible only with the RANS turbulent models 280 (\f$k-\varepsilon\f$, \f$R_{ij}-\varepsilon\f$, v2f or \f$k-\omega\f$). */ 281 int idistu; 282 283 /*! Suppress the crossing trajectory effect (if set to 1), making 284 turbulent dispersion for the particles identical to the turbulent 285 diffusion of fluid particles. 286 Default is off if \ref modcpl = 1, on if \ref modcpl = 0). */ 287 int idiffl; 288 289 /*!- 0: no deposition model 290 - 1: depositionion model */ 291 int deposition; 292 293 int dlvo; 294 295 /*! - 0: no DLVO conditions with roughness surface 296 - 1: DLVO conditions with roughness surface */ 297 int roughness; 298 299 /*!- 0: no resuspension model 300 - 1: resuspension model */ 301 int resuspension; 302 303 /*!- 0: no clogging model 304 - 1: clogging model */ 305 int clogging; 306 307 /*!- 0: spherical particles (default) 308 - 1: spheroid particles 309 - 2: ellipsoids */ 310 int shape; 311 312 /*! - 0: no consolidation model 313 - 1: consolidation model */ 314 int consolidation; 315 316 int precipitation; 317 int fouling; 318 319 /*! - 0: no agglomeration model 320 - 1: agglomeration model used */ 321 int agglomeration; 322 323 /*! - 0: no fragmentation model 324 - 1: fragmentation model used */ 325 int fragmentation; 326 327 int n_stat_classes; 328 329 int n_user_variables; 330 331 } cs_lagr_model_t; 332 333 /*! Particle counters for the Lagrangian module */ 334 /*----------------------------------------------*/ 335 336 typedef struct { 337 338 /*! total number of injected particles, since the beginning, 339 including calculation restarts */ 340 cs_gnum_t n_g_cumulative_total; 341 342 /*! total number of failed particles, since the beginning, 343 including calculation restarts */ 344 cs_gnum_t n_g_cumulative_failed; 345 346 /*! total number of particles */ 347 cs_gnum_t n_g_total; 348 349 /*! total number of particles*/ 350 cs_gnum_t n_g_new; 351 352 /*! number of exited particles*/ 353 cs_gnum_t n_g_exit; 354 355 /*! number of merged particles*/ 356 cs_gnum_t n_g_merged; 357 358 /*! number of deposited particles */ 359 cs_gnum_t n_g_deposited; 360 361 /*! number of fouling particles */ 362 cs_gnum_t n_g_fouling; 363 364 /*! number of re-entrained particles*/ 365 cs_gnum_t n_g_resuspended; 366 367 /*! total number of failed particles */ 368 cs_gnum_t n_g_failed; 369 370 /*! total weight of particles*/ 371 cs_real_t w_total; 372 373 /*! weight of new particles*/ 374 cs_real_t w_new; 375 376 /*! weight of exited particles*/ 377 cs_real_t w_exit; 378 379 /*! weight of merged particles*/ 380 cs_real_t w_merged; 381 382 /*! weight of deposited particles */ 383 cs_real_t w_deposited; 384 385 /*! number of fouling particles */ 386 cs_real_t w_fouling; 387 388 /*! weight of resuspended particles */ 389 cs_real_t w_resuspended; 390 391 } cs_lagr_particle_counter_t; 392 393 /*! Specific physical model options for the Lagrangian module */ 394 /* ---------------------------------------------------------- */ 395 396 typedef struct { 397 398 /* activation (=1) or not (=0) of an evolution equation on the particle 399 temperature (in degrees Celsius). 400 Useful if \ref physical_model=1 and if there is a thermal scalar 401 associated with the continuous phase. 402 */ 403 int itpvar; 404 405 /* activation (=1) or not (=0) of an evolution equation on the particle 406 diameter. Useful if \ref physical_model = 1. 407 */ 408 int idpvar; 409 410 /* activation (=1) or not (=0) of an evolution equation on the particle mass 411 Useful if \ref physical_model = 1 412 */ 413 int impvar; 414 415 /* initialization temperature (in degree Celsius) for the particles already 416 present in the calculation domain when an evolution equation on 417 the particle temperature is activated during a calculation 418 (\ref physical_model = 1 and \ref itpvar = 1). 419 Useful if \ref isuila = 1 and \ref itpvar = 0 in the previous calculation. 420 */ 421 cs_real_t tpart; 422 423 /* initialization value for the specific heat (\f$ J.kg^{-1}.K^{-1} \f$) 424 of the particles already present 425 in the calculation domain when an evolution equation 426 on the particle temperature is activated during a calculation 427 (\ref physical_model = 1 and \ref itpvar = 1). 428 Useful if \ref isuila = 1 and \ref itpvar = 0 in the previous calculation 429 */ 430 cs_real_t cppart; 431 432 } cs_lagr_specific_physics_t; 433 434 /*! Parameters of the reentrainment model */ 435 /* -------------------------------------- */ 436 437 typedef struct { 438 439 /* - 0: no resuspension model 440 - 1: resuspension model */ 441 int ireent; 442 443 /* - 0: no head losses calculation for influence of the deposit on the flow 444 - 1: head losses calculation for influence of the deposit on the flow */ 445 int iflow; 446 447 /* Parameters of the particle resuspension model*/ 448 cs_real_t espasg; 449 cs_real_t denasp; 450 cs_real_t modyeq; 451 cs_real_t rayasp; 452 cs_real_t rayasg; 453 454 } cs_lagr_reentrained_model_t; 455 456 /*! Parameters of the precipitation model */ 457 /* -------------------------------------- */ 458 459 typedef struct { 460 461 /* number of particle classes*/ 462 int nbrclas; 463 /* diameter of particles formed by precipitation*/ 464 cs_real_t diameter; 465 /* density of particles formed by precipitation*/ 466 cs_real_t rho; 467 /* number of precipitated particles */ 468 int *nbprec; 469 /* */ 470 cs_real_t *solub; 471 /* number of precipitated particles */ 472 cs_real_t *mp_diss; 473 474 } cs_lagr_precipitation_model_t; 475 476 /*! Parameters of the particle clogging model */ 477 /* ------------------------------------------ */ 478 479 typedef struct { 480 481 cs_real_t jamlim; 482 cs_real_t mporos; 483 cs_real_t csthpp; 484 cs_real_t diam_mean; 485 486 } cs_lagr_clogging_model_t; 487 488 /*! Parameters of model for non-spherical particles */ 489 /* ------------------------------------------------ */ 490 491 typedef struct { 492 493 cs_real_t param_chmb; 494 495 } cs_lagr_shape_model_t; 496 497 /*! Parameters of the particle agglomeration model */ 498 /* ------------------------------------------ */ 499 500 typedef struct { 501 502 cs_lnum_t n_max_classes; 503 cs_real_t min_stat_weight; 504 cs_real_t max_stat_weight; 505 cs_real_t scalar_kernel; 506 cs_real_t base_diameter; 507 508 } cs_lagr_agglomeration_model_t; 509 510 /*! Parameters of the particle fragmentation model */ 511 /* ------------------------------------------ */ 512 513 typedef struct { 514 515 cs_real_t scalar_kernel; 516 cs_real_t base_diameter; 517 cs_real_t (*function_kernel)(cs_lnum_t); 518 519 } cs_lagr_fragmentation_model_t; 520 521 /*! Parameters of the particle consolidation model */ 522 /* ----------------------------------------------- */ 523 524 typedef struct { 525 526 cs_lnum_t iconsol; 527 cs_real_t rate_consol; 528 cs_real_t slope_consol; 529 cs_real_t force_consol; 530 531 } cs_lagr_consolidation_model_t; 532 533 /*! Lagrangian time stepping status */ 534 /*----------------------------------*/ 535 536 typedef struct { 537 538 /* current step id (for 2nd order scheme) */ 539 int nor; 540 541 /* duration of a Lagrangian iteration */ 542 cs_real_t dtp; 543 544 /* physical time of the Lagrangian simulation */ 545 cs_real_t ttclag; 546 547 } cs_lagr_time_step_t; 548 549 /*! Particle injection parameters for a given zone and particle set */ 550 /*------------------------------------------------------------------*/ 551 552 typedef struct { 553 554 int zone_id; /*!< associated zone id */ 555 int set_id; /*!< associated set id */ 556 int location_id; /*!< associated mesh location id */ 557 558 cs_gnum_t n_inject; /*!< number of particles injected 559 at a time for this class and zone */ 560 561 int injection_frequency; /*!< injection frequency 562 (if =< 0, only at first iteration) */ 563 564 /*! optional injection profile computation function, or NULL */ 565 cs_lagr_injection_profile_compute_t *injection_profile_func; 566 567 /*! optional injection profile input data, or NULL */ 568 void *injection_profile_input; 569 570 /*! velocity condition type: 571 - -1 imposed fluid velocity (from cell velocity) 572 - 0 imposed velocity along the normal of the boundary face 573 - 1 imposed velocity: \ref velocity must be set. */ 574 int velocity_profile; 575 576 /*! temperature condition type: 577 - 0 fluid temperature 578 - 1 imposed temperature */ 579 int temperature_profile; 580 581 int coal_number; /*!< particle coal number (if 582 \ref cs_lagr_model_t::physical_model "physical_model" 583 =2) */ 584 585 int cluster; /*!< statistical cluster id */ 586 587 int aggregat_class_id; /*!< aggregate class id */ 588 cs_real_t aggregat_fractal_dim; /*!< aggregate fractal dimension */ 589 590 cs_real_t velocity_magnitude; /*!< particle velocity magnitude */ 591 cs_real_t velocity[3]; /*!< particle velocity components */ 592 593 cs_real_t temperature; /*!< particle temperature */ 594 595 cs_real_t diameter; /*!< particle diameter */ 596 cs_real_t diameter_variance; /*!< particle diameter variance */ 597 598 cs_real_t shape; /*!< particle shape for spheroids 599 (if shape model is activated */ 600 cs_real_t orientation[3]; /*!< particle orintation for spheroids */ 601 cs_real_t radii[3]; /*!< particle radii for ellispoids */ 602 cs_real_t angular_vel[3]; /*!< particle angular velocity 603 (if shape model is activated */ 604 605 cs_real_t euler[4]; /*!< particle four Euler parameters 606 (if shape model is activated */ 607 cs_real_t shape_param[4]; /*!< particle shape parameters 608 for ellispoids 609 (alpha_0, beta_0, gamma_0, chi _0) 610 in Brenner 1964 611 (if shape model is activated */ 612 cs_real_t density; /*!< particle density */ 613 614 cs_real_t fouling_index; /*!< fouling index */ 615 616 cs_real_t cp; /*!< particle specific heat */ 617 618 cs_real_t stat_weight; /*!< particle statitistical weight */ 619 620 cs_real_t flow_rate; /*!< flow rate */ 621 622 cs_real_t emissivity; /*!< particle emissivity */ 623 624 } cs_lagr_injection_set_t; 625 626 /*! 2-way coupling and source term information. */ 627 /*----------------------------------------------*/ 628 629 typedef struct { 630 631 /*! activation (=1) or not (=0) of the two-way coupling on the dynamics 632 of the continuous phase. 633 Useful if \ref iilagr = CS_LAGR_TWOWAY_COUPLING and \ref iccvfg = 0 */ 634 int ltsdyn; 635 636 /*! activation (=1) or not (=0) of the two-way coupling on the mass. 637 Useful if \ref iilagr = CS_LAGR_TWOWAY_COUPLING, 638 \ref cs_lagr_model_t::physical_model "physical_model" = 1 and 639 \ref cs_lagr_specific_physics_t::impvar "impvar" = 1 */ 640 int ltsmas; 641 642 /* if \ref physical_model = 1 and \ref itpvar = 1, \ref ltsthe 643 activates (=1) or not (=0) the two-way coupling on temperature. 644 if \ref physical_model = 2, \ref ltsthe activates (=1) or not (=0) the 645 two-way coupling on the eulerian variables related to pulverised 646 coal combustion. 647 Useful if \ref iilagr = CS_LAGR_TWOWAY_COUPLING */ 648 int ltsthe; 649 650 /*! implicit source term for the continuous phase velocity and 651 for the turbulent energy if the \f$k-\varepsilon\f$ model is used */ 652 int itsli; 653 654 /* explicit source term for the turbulent dissipation and the 655 turbulent energy if the \f$k-\varepsilon\f$ turbulence model is used 656 for the continuous phase */ 657 int itske; 658 659 /*! explicit thermal source term for the thermal scalar of 660 the continuous phase */ 661 int itste; 662 663 /*! implicit thermal source term for the thermal scalar of 664 the continuous phase */ 665 int itsti; 666 667 /*! mass source term */ 668 int itsmas; 669 670 /* source term for the light volatile matters */ 671 int *itsmv1; //ncharm2 672 673 /* source term for the heavy volatile matters */ 674 int *itsmv2; //ncharm2 675 676 /*! source term for the carbon released during heterogeneous combustion */ 677 int itsco; 678 679 /*! variance of the air scalar */ 680 int itsfp4; 681 682 /*! number of absolute time steps (including the restarts) 683 after which a time-average of the two-way coupling source terms is 684 calculated. 685 Indeed, if the flow is steady (\ref cs_lagr_time_scheme_t::isttio "isttio"=1), 686 the average quantities that appear in the two-way coupling source terms can 687 be calculated over different time steps, in order to get a better precision. 688 if the number of absolute time steps is strictly inferior to 689 \ref nstits, the code considers that the flow has not yet reached its 690 steady state (transition period) and the averages appearing in the source 691 terms are reinitialized at each time step, as it is the case for unsteady 692 flows (\ref cs_lagr_time_scheme_t::isttio "isttio"=0). 693 Useful if \ref iilagr = CS_LAGR_TWOWAY_COUPLING and 694 \ref cs_lagr_time_scheme_t::isttio "isttio"=1 */ 695 int nstits; 696 697 /*! number of time steps for source terms accumulations */ 698 int npts; 699 700 /*! number of cells, whose vulumetric rate DODO 701 (concentration ?)is greather than 0.8 */ 702 int ntxerr; 703 704 /*! maximum volumetric concentration reached */ 705 cs_real_t vmax; 706 707 /*! maximum massic concentration reached */ 708 cs_real_t tmamax; 709 710 /*! source term values */ 711 cs_real_t *st_val; 712 713 } cs_lagr_source_terms_t; 714 715 /*! Boundary or volume condition definitions and data */ 716 /*----------------------------------------------------*/ 717 718 typedef struct { 719 720 int location_id; /*!< mesh location id */ 721 722 int n_zones; /*!< number of zones */ 723 int *zone_type; /*!< zone type */ 724 725 int *n_injection_sets; /*!< number of injection 726 sets per zone */ 727 cs_lagr_injection_set_t **injection_set; /*!< injection data per 728 set per zone */ 729 730 char *elt_type; /*! zone type per 731 element, or NULL */ 732 733 cs_real_t *particle_flow_rate; /*!< particle flow rate 734 per zone per 735 statistical class */ 736 737 } cs_lagr_zone_data_t; 738 739 /*! Internal face condition definitions */ 740 /*---------------------------------------*/ 741 742 typedef struct { 743 744 int *i_face_zone_id; 745 746 } cs_lagr_internal_condition_t; 747 748 /*! Encrustation model parameters */ 749 /*--------------------------------*/ 750 751 typedef struct { 752 753 /* Activates (=1) or not (=0) the option of coal particle fouling. 754 It then is necessary to specify the domain boundaries 755 on which fouling may take place. Useful if \ref physical_model = 2*/ 756 int iencra; 757 758 /* encrustation data*/ 759 int npencr; 760 // TODO cf particles->n_part_fou in cs_lagr_tracking.c 761 762 /* encrustation data*/ 763 cs_real_t *enc1; // size: ncharm2 764 /* encrustation data*/ 765 cs_real_t *enc2; // size: ncharm2 766 767 /* Limit temperature (in degree Celsius) below which the coal particles do 768 not cause any fouling (if the fouling model is activated). 769 Useful if \ref physical_model = 2 and \ref iencra = 1*/ 770 cs_real_t *tprenc; // size: ncharm2 771 772 /* Ash critical viscosity in \f$ kg.m^{-1}.s^{-1} \f$, in the fouling model 773 cf J.D. Watt et T. Fereday (J.Inst.Fuel, Vol.42-p99). 774 Useful if \ref physical_model = 2 and \ref iencra = 1*/ 775 cs_real_t *visref; // size: ncharm2 776 777 /* encrustation data */ 778 cs_real_t dnpenc; 779 780 } cs_lagr_encrustation_t; 781 782 /*! Physical and chemical model parameters */ 783 /*-----------------------------------------*/ 784 785 typedef struct { 786 787 /*! Hamaker constant for the particle/fluid/substrate system */ 788 cs_real_t cstham; 789 790 /*! Retardation wavelength for VDW forces 791 for the particle/fluid/substrate system */ 792 cs_real_t lambda_vdw; 793 794 /*! Dielectric constant of the fluid */ 795 cs_real_t epseau; 796 797 /*! Electrokinetic potential of the first solid - particle */ 798 cs_real_t phi_p; 799 800 /*! Electrokinetic potential of the second solid - surface */ 801 cs_real_t phi_s; 802 803 /*! Valence of ions in the solution (used for EDL forces) */ 804 cs_real_t valen; 805 806 /*! Ionic force */ 807 cs_real_t fion; 808 809 } cs_lagr_physico_chemical_t; 810 811 /*! Brownian movement parameters */ 812 /*-------------------------------*/ 813 814 typedef struct { 815 816 int lamvbr; /*!< brownian motion activation */ 817 818 } cs_lagr_brownian_t; 819 820 /*! Boundary interactions statistics parameters */ 821 /*----------------------------------------------*/ 822 823 typedef struct { 824 825 /*! Number of iterations during which steady boundary statistics have 826 been accumulated. 827 Useful if \ref cs_lagr_time_scheme_t::isttio "isttio"=1 and 828 \ref cs_lagr_stat_options_t::nstist "nstist" inferior 829 or equal to the current time step. 830 \ref npstf is initialized and updated automatically by the code, 831 its value is not to be modified by the user */ 832 int npstf; 833 834 /*! number of iterations during which boundary statistics have 835 been calculated 836 (the potential iterations during which unsteady 837 statistics have been calculated are counted in \ref npstft). 838 \ref npstft is initialized and updated automatically by the code, 839 its value is not to be modified by the user */ 840 int npstft; 841 842 /*! activation (=1) or not (=0) of the recording of the number of 843 particle/boundary interactions, and of the calculation of the associated 844 boundary statistics. */ 845 int has_part_impact_nbr; 846 847 /*! activation (=1) or not (=0) of the recording of clogging parameters 848 involved in a particle/boundary interaction, and of the calculation of 849 the associated boundary statistics. */ 850 int iclgst; 851 852 /*! id for number of particle/boundary interactions */ 853 int inbr; 854 855 /*! id for number of deposited particles */ 856 int inclg; 857 858 /*! id for particle deposition part */ 859 int inclgt; 860 861 /*! id for particle deposition time */ 862 int iclogt; 863 864 /*! id for particle consolidation height */ 865 int iclogh; 866 867 /*! id for particle surface coverage */ 868 int iscovc; 869 870 /* id for mean of particle deposition height */ 871 int ihdepm; 872 873 /* id for variance of particle deposition height */ 874 int ihdepv; 875 876 /* id for mean diameter of deposited particles */ 877 int ihdiam; 878 879 /* id for sum of deposited particle diameters */ 880 int ihsum; 881 882 /*! If the recording of the boundary statistics is steady, \ref tstatp 883 contains the cumulated physical duration of the recording of the boundary 884 statistics. 885 If the recording of the boundary statistics is unsteady, then 886 \ref tstatp = dtp (it is the Lagrangian time step, because the 887 statistics are reset to zero at every time step). */ 888 cs_real_t tstatp; 889 890 /*! name of the boundary statistics, displayed in the log 891 and the post-processing files. 892 Warning: this name is also used to reference information in the restart 893 file. If the name of a variable is changed between two 894 calculations, it will not be possible to read its value from the restart 895 file */ 896 char **nombrd; 897 898 } cs_lagr_boundary_interactions_t; 899 900 /*! Pointers to external (Eulerian solver) data. */ 901 /*-----------------------------------------------*/ 902 903 typedef struct { 904 905 /* Turbulence model */ 906 int iturb; 907 int itytur; 908 909 /* cpincl */ 910 int ncharb; 911 912 /* ppppar */ 913 int ncharm; 914 915 /* radiation */ 916 int radiative_model; 917 918 /* icp */ 919 int icp; 920 921 /* diftl0 */ 922 cs_real_t diftl0; 923 924 /* cmu */ 925 cs_real_t cmu; 926 927 /* visls0 */ 928 cs_real_t visls0; 929 930 /* Referenced fields 931 ----------------- */ 932 933 /* wall ustar */ 934 cs_field_t *ustar; 935 936 /* Fluid density */ 937 cs_field_t *cromf; 938 939 /* Fluid pressure */ 940 cs_field_t *pressure; 941 942 /* Fluid temparature */ 943 cs_field_t *scal_t; 944 cs_field_t *temperature; 945 946 /* Fluid velocity */ 947 cs_field_t *vel; 948 949 /* Fluid viscosity */ 950 cs_field_t *viscl; 951 952 /* Fluid viscosity */ 953 cs_field_t *cpro_viscls; 954 955 /* Fluid specific heat capacity */ 956 cs_field_t *cpro_cp; 957 958 /* Radiat. */ 959 cs_field_t *luminance; 960 961 /* Combustion */ 962 cs_field_t *x_oxyd; 963 cs_field_t *x_eau; 964 cs_field_t *x_m; 965 966 /* Turbulence */ 967 /* Turbulent intensity */ 968 cs_field_t *cvar_k; 969 970 /* Turbulent dissipation */ 971 cs_field_t *cvar_ep; 972 973 /* Omega from k-omega SST model*/ 974 cs_field_t *cvar_omg; 975 976 /* Reynolds Stress Tensor */ 977 cs_field_t *cvar_rij; 978 979 /* Total pressure gradient */ 980 cs_real_3_t *grad_pr; 981 982 /* velocity gradient */ 983 cs_real_33_t *grad_vel; 984 985 } cs_lagr_extra_module_t; 986 987 /*! External data relative to coal combustion */ 988 /*--------------------------------------------*/ 989 990 typedef struct { 991 992 int ih2o; // cpincl 993 int io2; // cpincl 994 int ico; // cpincl 995 996 int iatc; // ppthch 997 cs_real_t prefth; // ppthch 998 cs_real_t trefth; // ppthch 999 1000 int natom; // = 5; 1001 cs_real_t *wmolat; // dim = natom 1002 1003 int ngazem; // = 20; 1004 cs_real_t *wmole; // ngazem 1005 int *iym1; 1006 1007 int ncharm; // cpincl 1008 cs_real_t *a1ch; // ncharm 1009 cs_real_t *h02ch; 1010 cs_real_t *e1ch; // 1011 cs_real_t *a2ch; // 1012 cs_real_t *e2ch; // 1013 cs_real_t *y1ch; // 1014 cs_real_t *y2ch; // 1015 cs_real_t *cp2ch; // 1016 cs_real_t *ahetch; // 1017 cs_real_t *ehetch; // 1018 cs_real_t *rho0ch; // 1019 cs_real_t *xwatch; // 1020 cs_real_t *xashch; // 1021 cs_real_t *thcdch; // 1022 1023 } cs_lagr_coal_comb_t; 1024 1025 /*============================================================================ 1026 * Global variables 1027 *============================================================================*/ 1028 1029 /*! Fixed constants */ 1030 1031 extern const cs_lagr_const_dim_t *cs_glob_lagr_const_dim; 1032 1033 /*! General dimensions */ 1034 1035 extern cs_lagr_dim_t *cs_glob_lagr_dim; 1036 1037 /*! Time and Lagrangian-Eulerian coupling scheme */ 1038 extern cs_lagr_time_scheme_t *cs_glob_lagr_time_scheme; 1039 1040 /*! Main Lagragian physical model parameters */ 1041 extern cs_lagr_model_t *cs_glob_lagr_model; 1042 1043 /*! Read-only pointer to global particle counter */ 1044 extern const cs_lagr_particle_counter_t *cs_glob_lagr_particle_counter; 1045 1046 /* Lagrangian log output every frequency_n time steps */ 1047 1048 extern int cs_glob_lagr_log_frequency_n; 1049 1050 /* Statisics on boundaries */ 1051 1052 extern cs_real_t *bound_stat; 1053 1054 extern cs_lagr_specific_physics_t *cs_glob_lagr_specific_physics; 1055 extern cs_lagr_reentrained_model_t *cs_glob_lagr_reentrained_model; 1056 extern cs_lagr_precipitation_model_t *cs_glob_lagr_precipitation_model; 1057 extern cs_lagr_clogging_model_t *cs_glob_lagr_clogging_model; 1058 extern cs_lagr_shape_model_t *cs_glob_lagr_shape_model; 1059 1060 extern cs_lagr_agglomeration_model_t *cs_glob_lagr_agglomeration_model; 1061 extern cs_lagr_fragmentation_model_t *cs_glob_lagr_fragmentation_model; 1062 1063 extern cs_lagr_consolidation_model_t *cs_glob_lagr_consolidation_model; 1064 extern cs_lagr_time_step_t *cs_glob_lagr_time_step; 1065 extern cs_lagr_source_terms_t *cs_glob_lagr_source_terms; 1066 extern cs_lagr_encrustation_t *cs_glob_lagr_encrustation; 1067 extern cs_lagr_physico_chemical_t *cs_glob_lagr_physico_chemical; 1068 extern cs_lagr_brownian_t *cs_glob_lagr_brownian; 1069 extern cs_lagr_boundary_interactions_t *cs_glob_lagr_boundary_interactions; 1070 1071 extern cs_lagr_extra_module_t *cs_glob_lagr_extra_module; 1072 extern cs_lagr_coal_comb_t *cs_glob_lagr_coal_comb; 1073 1074 extern const cs_lagr_zone_data_t *cs_glob_lagr_boundary_conditions; 1075 extern const cs_lagr_zone_data_t *cs_glob_lagr_volume_conditions; 1076 extern cs_lagr_internal_condition_t *cs_glob_lagr_internal_conditions; 1077 1078 /* Projection matrices for global to local coordinates on boundary faces */ 1079 extern cs_real_33_t *cs_glob_lagr_b_face_proj; 1080 1081 /*============================================================================ 1082 * Public function prototypes 1083 *============================================================================*/ 1084 1085 /*----------------------------------------------------------------------------*/ 1086 /*! 1087 * \brief Provide access to injection set structure. 1088 * 1089 * This access method ensures the strucure is initialized for the given 1090 * zone and injection set. 1091 * 1092 * \param[in] zone_data pointer to boundary or volume conditions structure 1093 * \param[in] zone_id zone id 1094 * \param[in] set_id injection set id 1095 * 1096 * \return pointer to injection set data structure 1097 */ 1098 /*----------------------------------------------------------------------------*/ 1099 1100 cs_lagr_injection_set_t * 1101 cs_lagr_get_injection_set(cs_lagr_zone_data_t *zone_data, 1102 int zone_id, 1103 int set_id); 1104 1105 /*----------------------------------------------------------------------------*/ 1106 /*! 1107 * \brief Initialize injection set data structure fields to defaults. 1108 * 1109 * \param[in, out] zis pointer to structure to initialize 1110 */ 1111 /*----------------------------------------------------------------------------*/ 1112 1113 void 1114 cs_lagr_injection_set_default(cs_lagr_injection_set_t *zis); 1115 1116 /*----------------------------------------------------------------------------*/ 1117 /*! 1118 * \brief Get read/write pointer to global particle counter 1119 * 1120 * \return pointer to lagrangian particle counter structure 1121 */ 1122 /*----------------------------------------------------------------------------*/ 1123 1124 cs_lagr_particle_counter_t * 1125 cs_lagr_get_particle_counter(void); 1126 1127 /*----------------------------------------------------------------------------*/ 1128 /*! 1129 \brief Update global particle counter 1130 * 1131 * All fields handled in the local particle set are updated relative 1132 * to that data (using global sums). 1133 * 1134 * \return pointer to lagrangian particle counter structure 1135 */ 1136 /*----------------------------------------------------------------------------*/ 1137 1138 cs_lagr_particle_counter_t * 1139 cs_lagr_update_particle_counter(void); 1140 1141 /*---------------------------------------------------------------------------- 1142 * Provide access to cs_lagr_particle_counter_t 1143 * 1144 * needed to initialize structure with GUI 1145 *----------------------------------------------------------------------------*/ 1146 1147 cs_lagr_specific_physics_t * 1148 cs_get_lagr_specific_physics(void); 1149 1150 /*---------------------------------------------------------------------------- 1151 * Provide access to cs_lagr_reentrained_model_t 1152 * 1153 * needed to initialize structure with GUI 1154 *----------------------------------------------------------------------------*/ 1155 1156 cs_lagr_reentrained_model_t * 1157 cs_get_lagr_reentrained_model(void); 1158 1159 /*---------------------------------------------------------------------------- 1160 * Provide access to cs_lagr_precipitation_model_t 1161 * 1162 * needed to initialize structure with GUI 1163 *----------------------------------------------------------------------------*/ 1164 1165 cs_lagr_precipitation_model_t * 1166 cs_get_lagr_precipitation_model(void); 1167 1168 /*---------------------------------------------------------------------------- 1169 * Provide access to cs_lagr_clogging_model_t 1170 * 1171 * needed to initialize structure with GUI 1172 *----------------------------------------------------------------------------*/ 1173 1174 cs_lagr_clogging_model_t * 1175 cs_get_lagr_clogging_model(void); 1176 1177 /*---------------------------------------------------------------------------- 1178 * Provide access to cs_lagr_shape_model_t 1179 * 1180 * needed to initialize structure with GUI 1181 *----------------------------------------------------------------------------*/ 1182 1183 cs_lagr_shape_model_t * 1184 cs_get_lagr_shape_model(void); 1185 1186 /*---------------------------------------------------------------------------- 1187 * Provide access to cs_lagr_agglomeration_model_t 1188 * 1189 * needed to initialize structure with GUI 1190 *----------------------------------------------------------------------------*/ 1191 1192 cs_lagr_agglomeration_model_t * 1193 cs_get_lagr_agglomeration_model(void); 1194 1195 /*---------------------------------------------------------------------------- 1196 * Provide access to cs_lagr_consolidation_model_t 1197 * 1198 * needed to initialize structure with GUI 1199 *----------------------------------------------------------------------------*/ 1200 1201 cs_lagr_consolidation_model_t * 1202 cs_get_lagr_consolidation_model(void); 1203 1204 /*---------------------------------------------------------------------------- 1205 * Provide access to cs_lagr_time_step_t 1206 * 1207 * needed to initialize structure with GUI 1208 *----------------------------------------------------------------------------*/ 1209 1210 cs_lagr_time_step_t * 1211 cs_get_lagr_time_step(void); 1212 1213 /*---------------------------------------------------------------------------- 1214 * Provide access to cs_lagr_source_terms_t 1215 * 1216 * needed to initialize structure with GUI 1217 *----------------------------------------------------------------------------*/ 1218 1219 cs_lagr_source_terms_t * 1220 cs_get_lagr_source_terms(void); 1221 1222 /*---------------------------------------------------------------------------- 1223 * Provide access to cs_lagr_encrustation_t 1224 * 1225 * needed to initialize structure with GUI 1226 *----------------------------------------------------------------------------*/ 1227 1228 cs_lagr_encrustation_t * 1229 cs_get_lagr_encrustation(void); 1230 1231 /*---------------------------------------------------------------------------- 1232 * Provide access to cs_lagr_physico_chemical_t 1233 * 1234 * needed to initialize structure with GUI 1235 *----------------------------------------------------------------------------*/ 1236 1237 cs_lagr_physico_chemical_t * 1238 cs_get_lagr_physico_chemical(void); 1239 1240 /*---------------------------------------------------------------------------- 1241 * Provide access to cs_lagr_brownian_t 1242 * 1243 * needed to initialize structure with GUI 1244 *----------------------------------------------------------------------------*/ 1245 1246 cs_lagr_brownian_t * 1247 cs_get_lagr_brownian(void); 1248 1249 /*----------------------------------------------------------------------------*/ 1250 /*! 1251 * \brief Return pointer to the main boundary conditions structure. 1252 * 1253 * \return pointer to current boundary zone data structure 1254 */ 1255 /*----------------------------------------------------------------------------*/ 1256 1257 cs_lagr_zone_data_t * 1258 cs_lagr_get_boundary_conditions(void); 1259 1260 /*----------------------------------------------------------------------------*/ 1261 /*! 1262 * \brief Return pointer to the main volume conditions structure. 1263 * 1264 * \return pointer to current volume zone data structure 1265 */ 1266 /*----------------------------------------------------------------------------*/ 1267 1268 cs_lagr_zone_data_t * 1269 cs_lagr_get_volume_conditions(void); 1270 1271 /*----------------------------------------------------------------------------*/ 1272 /*! 1273 * \brief Return pointer to the main internal conditions structure. 1274 * 1275 * \return pointer to current internal conditions structure 1276 */ 1277 /*----------------------------------------------------------------------------*/ 1278 1279 cs_lagr_internal_condition_t * 1280 cs_lagr_get_internal_conditions(void); 1281 1282 /*----------------------------------------------------------------------------*/ 1283 /*! 1284 * \brief Finalize the global boundary and volume condition structures. 1285 */ 1286 /*----------------------------------------------------------------------------*/ 1287 1288 void 1289 cs_lagr_finalize_zone_conditions(void); 1290 1291 /*---------------------------------------------------------------------------- 1292 * Destroy finalize the global cs_lagr_internal_condition_t structure. 1293 *----------------------------------------------------------------------------*/ 1294 1295 void 1296 cs_lagr_finalize_internal_cond(void); 1297 1298 /*---------------------------------------------------------------------------- 1299 * Provide access to cs_lagr_boundary_interactions_t 1300 * 1301 * needed to initialize structure with GUI 1302 *----------------------------------------------------------------------------*/ 1303 1304 cs_lagr_boundary_interactions_t * 1305 cs_get_lagr_boundary_interactions(void); 1306 1307 /*---------------------------------------------------------------------------- 1308 * Provide access to cs_lagr_extra_module_t 1309 *----------------------------------------------------------------------------*/ 1310 1311 cs_lagr_extra_module_t * 1312 cs_get_lagr_extra_module(void); 1313 1314 /*---------------------------------------------------------------------------- 1315 * Prepare for execution of the Lagrangian model. 1316 * 1317 * This should be called before the fist call to cs_lagr_solve_time_step. 1318 * 1319 * parameters: 1320 * dt <-- time step (per cell) 1321 *----------------------------------------------------------------------------*/ 1322 1323 void 1324 cs_lagr_solve_initialize(const cs_real_t *dt); 1325 1326 /*-------------------------------------------------------------------- 1327 * Execute one time step of the Lagrangian model. 1328 * 1329 * This is the main function for that model. 1330 * 1331 * parameters: 1332 * itypfb <-- boundary face types 1333 * dt <-- time step (per cell) 1334 *-------------------------------------------------------------------- */ 1335 1336 void 1337 cs_lagr_solve_time_step(const int itypfb[], 1338 const cs_real_t *dt); 1339 1340 /*---------------------------------------------------------------------------- 1341 * Return pointers to lagrangian arrays 1342 * 1343 * This function is intended for use by Fortran wrappers. 1344 * 1345 * parameters: 1346 * dim_bound_stat --> dimensions for bound_stat pointer 1347 * p_bound_stat --> bound_stat pointer 1348 *----------------------------------------------------------------------------*/ 1349 1350 void 1351 cs_lagr_init_c_arrays(int dim_cs_glob_lagr_source_terms[2], 1352 cs_real_t **p_cs_glob_lagr_source_terms); 1353 1354 /*---------------------------------------------------------------------------- 1355 * Free lagrangian arrays 1356 * 1357 * This function is intended for use by Fortran wrappers. 1358 *----------------------------------------------------------------------------*/ 1359 1360 void 1361 cs_lagr_finalize(void); 1362 1363 /*----------------------------------------------------------------------------*/ 1364 1365 END_C_DECLS 1366 1367 #endif /* __CS_LAGR_H__ */ 1368