1 /*============================================================================
2 * Lagrangian module logging
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 #include "cs_defs.h"
28
29 /*----------------------------------------------------------------------------
30 * Standard C library headers
31 *----------------------------------------------------------------------------*/
32
33 #include <limits.h>
34 #include <stdio.h>
35 #include <stddef.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #include <math.h>
39 #include <ctype.h>
40 #include <float.h>
41 #include <assert.h>
42
43 /*----------------------------------------------------------------------------
44 * Local headers
45 *----------------------------------------------------------------------------*/
46
47 #include "bft_printf.h"
48 #include "bft_mem.h"
49
50 #include "cs_log.h"
51
52 #include "cs_math.h"
53
54 #include "cs_mesh.h"
55 #include "cs_parall.h"
56
57 #include "cs_field.h"
58
59 #include "cs_lagr.h"
60 #include "cs_lagr_particle.h"
61 #include "cs_lagr_tracking.h"
62 #include "cs_lagr_post.h"
63 #include "cs_lagr_stat.h"
64
65 #include "cs_lagr_prototypes.h"
66
67 #include "cs_time_step.h"
68
69 /*----------------------------------------------------------------------------
70 * Header for the current file
71 *----------------------------------------------------------------------------*/
72
73 #include "cs_lagr_log.h"
74
75 /*----------------------------------------------------------------------------*/
76
77 BEGIN_C_DECLS
78
79 /*=============================================================================
80 * Additional doxygen documentation
81 *============================================================================*/
82
83 /*!
84 \file cs_lagr_log.c
85 */
86
87 /*! \cond DOXYGEN_SHOULD_SKIP_THIS */
88
89 /*============================================================================
90 * Static global variables
91 *============================================================================*/
92
93 const char *_astat[2] = {N_("off"), N_("on")};
94
95 /*! (DOXYGEN_SHOULD_SKIP_THIS) \endcond */
96
97 /*============================================================================
98 * Private function definitions
99 *============================================================================*/
100
101 /*----------------------------------------------------------------------------*/
102 /*!
103 * \brief Return string indicating on/off depending on integer value
104 *
105 * \param i input integer
106 *
107 * \return status string, possibly translated
108 */
109 /*----------------------------------------------------------------------------*/
110
111 static const char *
_status(int i)112 _status(int i)
113 {
114 return (i > 0) ? _(_astat[1]) : _(_astat[0]);
115 }
116
117 /*----------------------------------------------------------------*/
118 /*!
119 *\brief Computes min/max for boundary statistics.
120 *
121 * Parameters:
122 * \param[in] s_id stat id
123 * \param[out] nbrfac number of particles used for the statistics
124 * \param[out] gmin min value
125 * \param[out] gmax max value
126 */
127 /*----------------------------------------------------------------*/
128
129 static void
_lagr_min_max_boundary_stats(int s_id,cs_lnum_t * nbrfac,cs_real_t * gmin,cs_real_t * gmax)130 _lagr_min_max_boundary_stats(int s_id,
131 cs_lnum_t *nbrfac,
132 cs_real_t *gmin,
133 cs_real_t *gmax)
134 {
135 cs_lagr_boundary_interactions_t *lagr_bd_i
136 = cs_glob_lagr_boundary_interactions;
137 cs_lnum_t n_b_faces = cs_glob_mesh->n_b_faces;
138
139 /* Initializations */
140 *nbrfac = 0;
141 *gmax = -cs_math_big_r;
142 *gmin = cs_math_big_r;
143
144 cs_real_t threshold = cs_glob_lagr_stat_options->threshold;
145
146 for (cs_lnum_t ifac = 0; ifac < n_b_faces; ifac++) {
147 if (bound_stat[ifac + n_b_faces * lagr_bd_i->inbr] > threshold) {
148 *nbrfac = *nbrfac + 1;
149 *gmax = CS_MAX(*gmax, bound_stat[ifac + n_b_faces * s_id]);
150 *gmin = CS_MIN(*gmin, bound_stat[ifac + n_b_faces * s_id]);
151 }
152 }
153 }
154
155 /*----------------------------------------------------------------------------*/
156 /*!
157 * \brief Log Lagrangian module injection info.
158 *
159 * \param[in] log associated log file
160 */
161 /*----------------------------------------------------------------------------*/
162
163 static void
_log_setup_injection(cs_log_t log)164 _log_setup_injection(cs_log_t log)
165 {
166 /* Check if this call is needed */
167
168 if (cs_glob_lagr_time_scheme == NULL)
169 return;
170
171 if (cs_glob_lagr_time_scheme->iilagr == CS_LAGR_OFF)
172 return;
173
174 cs_lagr_extra_module_t *extra = cs_get_lagr_extra_module();
175
176 cs_log_printf(log,
177 _("\n"
178 " Lagrangian particle injection\n"
179 " -----------------------------\n\n"));
180
181 for (int i_loc = 0; i_loc < 2; i_loc++) {
182
183 cs_lagr_zone_data_t *zd = NULL;
184
185 int n_zones = 0;
186
187 if (i_loc == 0) {
188 zd = cs_lagr_get_boundary_conditions();
189 n_zones = cs_boundary_zone_n_zones();
190 }
191 else {
192 zd = cs_lagr_get_volume_conditions();
193 n_zones = cs_volume_zone_n_zones();
194 }
195
196 for (int z_id = 0; z_id < n_zones; z_id++) {
197
198 const cs_zone_t *z;
199 if (i_loc == 0)
200 z = cs_boundary_zone_by_id(z_id);
201 else
202 z = cs_volume_zone_by_id(z_id);
203
204 for (int set_id = 0;
205 set_id < zd->n_injection_sets[z_id];
206 set_id++) {
207
208 const cs_lagr_injection_set_t
209 *zis = cs_lagr_get_injection_set(zd, z_id, set_id);
210
211 cs_log_printf(log,
212 _(" zone: %d (%s), set: %d\n"),
213 z->id, z->name, set_id);
214
215 if (zis->n_inject > 0)
216 cs_log_printf(log,
217 _(" n particles to inject: %llu\n"),
218 (unsigned long long)(zis->n_inject));
219
220 if (zis->velocity_profile == -1)
221 cs_log_printf(log,
222 _(" velocity from fluid\n"));
223 else if (zis->velocity_profile == 0)
224 cs_log_printf(log,
225 _(" velocity magnitude: %g (normal to boundary)\n"),
226 zis->velocity_magnitude);
227 else if (zis->velocity_profile == 1)
228 cs_log_printf(log,
229 _(" velocity: [%g, %g, %g]"),
230 zis->velocity[0], zis->velocity[1], zis->velocity[2]);
231
232 cs_log_printf(log,
233 _(" diameter: %g; (variance: %g)\n"
234 " density: %g\n"),
235 zis->diameter, zis->diameter_variance, zis->density);
236
237
238 if (cs_glob_lagr_model->shape == CS_LAGR_SHAPE_SPHEROID_STOC_MODEL) {
239 cs_log_printf(log,
240 _(" shape parameter: %g\n"),
241 zis->shape);
242 }
243
244 if (cs_glob_lagr_model->shape == CS_LAGR_SHAPE_SPHEROID_JEFFERY_MODEL) {
245 cs_log_printf(log,
246 _(" ellipsoid radii: [%g, %g, %g]\n"),
247 zis->radii[0], zis->radii[1], zis->radii[2]);
248 }
249
250 if (zis->flow_rate > 0)
251 cs_log_printf(log,
252 _(" flow rate: %g\n"),
253 zis->flow_rate);
254
255 cs_log_printf(log,
256 _(" statistical cluster id: %d\n"
257 " statistical weight: %g\n"),
258 zis->cluster,
259 zis->stat_weight);
260
261 if (cs_glob_lagr_model->deposition > 0)
262 cs_log_printf(log,
263 _(" fouling index: %g\n"),
264 zis->fouling_index);
265
266 if ( cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_HEAT
267 && cs_glob_lagr_specific_physics->itpvar == 1) {
268 if (zis->temperature_profile == 0)
269 cs_log_printf(log,
270 _(" temperature from fluid\n"));
271 else if (zis->temperature_profile == 1)
272 cs_log_printf(log,
273 _(" temperature: %g\n"),
274 zis->temperature);
275 cs_log_printf(log,
276 _(" Cp: %g\n"),
277 zis->cp);
278 if (extra->radiative_model > 0)
279 cs_log_printf(log,
280 _(" emissivity: %g\n"),
281 zis->emissivity);
282 }
283 else if (cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_COAL) {
284 cs_log_printf(log,
285 _(" coal number: %d\n"),
286 zis->coal_number);
287 }
288
289 cs_log_printf(log, "\n");
290 }
291
292 }
293
294 }
295 }
296
297 /*============================================================================
298 * Public function definitions
299 *============================================================================*/
300
301 /*----------------------------------------------------------------------------*/
302 /*!
303 * \brief Log Lagrangian module output in the setup file.
304 */
305 /*----------------------------------------------------------------------------*/
306
307 void
cs_lagr_log_setup(void)308 cs_lagr_log_setup(void)
309 {
310 /* Check if this call is needed */
311
312 if (cs_glob_lagr_time_scheme == NULL)
313 return;
314
315 if (cs_glob_lagr_time_scheme->iilagr == CS_LAGR_OFF)
316 return;
317
318 /* Now add Lagrangian setup info */
319
320 cs_log_printf(CS_LOG_SETUP,
321 _("\n"
322 "Lagrangian model options\n"
323 "------------------------\n"));
324 cs_log_printf(CS_LOG_SETUP,
325 (" Continuous phase:\n"));
326
327 const char *iilagr_value_str[]
328 = {N_(" CS_LAGR_OFF (no Lagrangian model)"),
329 N_(" CS_LAGR_ONEWAY_COUPLING (one way coupling)"),
330 N_(" CS_LAGR_TOWAY_COUPLING (two way coupling)"),
331 N_(" CS_LAGR_FROZEN_CONTINUOUS_PHASE (on frozen fields)")};
332
333 const char *isuila_value_str[] = {N_(" off (restart not activated)"),
334 N_(" on (restart activated)")};
335
336 const char *isuist_value_str[] = {N_(" off (reinitialized)"),
337 N_(" on (read from restart file)")};
338
339 const char *physical_model_value_str[]
340 = {N_(" 0 (no additional equations)"),
341 N_(" 1 (equations on Dp Tp Mp)"),
342 N_(" 2 (coal particles)")};
343 cs_log_printf(CS_LOG_SETUP,
344 _(" iilagr: %s\n"),
345 _(iilagr_value_str[cs_glob_lagr_time_scheme->iilagr]));
346
347 cs_log_printf(CS_LOG_SETUP,
348 _(" Restart options\n"));
349 cs_log_printf(CS_LOG_SETUP,
350 _(" isuila: %s\n"),
351 _(isuila_value_str[cs_glob_lagr_time_scheme->isuila]));
352
353 cs_log_printf(CS_LOG_SETUP,
354 _(" Statistics/return source terms restart\n"));
355 cs_log_printf(CS_LOG_SETUP,
356 _(" isuist: %s\n"),
357 _(isuist_value_str[cs_glob_lagr_stat_options->isuist]));
358
359 cs_log_printf(CS_LOG_SETUP,
360 (" Additional models associated with particles\n"));
361
362 cs_log_printf(CS_LOG_SETUP,
363 _(" physical_model: %s\n"),
364 _(physical_model_value_str[cs_glob_lagr_model->physical_model]));
365
366 if (cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_HEAT) {
367 const char *idpvar_value_str[]
368 = {N_(" 0 (no evolution equation on particle diameter)"),
369 N_(" 1 (solve the particle diameter evolution)")};
370
371 const char *itpvar_value_str[]
372 = {N_(" 0 (equation on the particle temperature)"),
373 N_(" 1 (solve the particle temperature)")};
374
375 const char *impvar_value_str[]
376 = {N_(" 0 (no evolution equation on particle mass)"),
377 N_(" 1 (solve the particle mass)")};
378
379 cs_log_printf(CS_LOG_SETUP,
380 _(" idpvar: %s\n"),
381 _(idpvar_value_str[cs_glob_lagr_specific_physics->idpvar]));
382
383 cs_log_printf(CS_LOG_SETUP,
384 _(" itpvar: %s\n"),
385 _(itpvar_value_str[cs_glob_lagr_specific_physics->itpvar]));
386
387 cs_log_printf(CS_LOG_SETUP,
388 _(" impvar: %s\n"),
389 _(impvar_value_str[cs_glob_lagr_specific_physics->impvar]));
390 }
391
392 const char *isttio_value_str[]
393 = {N_(" 0 (unsteady the continuous phase flow)"),
394 N_(" 1 (steady continuous phase flow)")};
395
396 cs_log_printf(CS_LOG_SETUP,
397 ("\n Global parameters:\n"));
398
399 cs_log_printf(CS_LOG_SETUP,
400 _(" user particle variables: %22d\n"),
401 cs_glob_lagr_model->n_user_variables);
402
403 cs_log_printf(CS_LOG_SETUP,
404 _(" isttio: %s\n"),
405 _(isttio_value_str[cs_glob_lagr_time_scheme->isttio]));
406
407 if (cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_COAL) {
408
409 cs_log_printf
410 (CS_LOG_SETUP,
411 _("\n Coal options:\n"
412 " fouling: %s\n"),
413 _status(cs_glob_lagr_model->fouling));
414
415 const cs_lagr_extra_module_t *extra = cs_get_lagr_extra_module();
416
417 for (int i = 0; i < extra->ncharb; i++)
418 cs_log_printf
419 (CS_LOG_SETUP,
420 _(" tprenc[%3d]: %11.5e (threshold T for coal fouling %d)\n"),
421 i, cs_glob_lagr_encrustation->tprenc[i], i);
422
423 for (int i = 0; i < extra->ncharb; i++)
424 cs_log_printf
425 (CS_LOG_SETUP,
426 _(" visref[%3d]: %11.5e (critical coal viscosity %d)\n"),
427 i, cs_glob_lagr_encrustation->visref[i], i);
428
429 for (int i = 0; i < extra->ncharb; i++)
430 cs_log_printf
431 (CS_LOG_SETUP,
432 _(" enc1[%3d]: %11.5e (fouling coefficient 1 %d)\n"),
433 i, cs_glob_lagr_encrustation->enc1[i], i);
434
435 for (int i = 0; i < extra->ncharb; i++)
436 cs_log_printf
437 (CS_LOG_SETUP,
438 _(" enc2[%3d]: %11.5e (fouling coefficient 2 %d)\n"),
439 i, cs_glob_lagr_encrustation->enc2[i], i);
440
441 }
442
443 if (cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_COAL) {
444
445 cs_log_printf
446 (CS_LOG_SETUP,
447 _("\n Return coupling options:\n"
448 " start iteration for time average: %d\n"
449 " dynamic return coupling: %s\n"
450 " mass return coupling: %s\n"
451 " thermal return coupling: %s\n"),
452 cs_glob_lagr_source_terms->nstits,
453 _status(cs_glob_lagr_source_terms->ltsdyn),
454 _status(cs_glob_lagr_source_terms->ltsmas),
455 _status(cs_glob_lagr_source_terms->ltsthe));
456 }
457
458 cs_log_printf
459 (CS_LOG_SETUP,
460 _("\n"
461 " Statistics options:\n"
462 " starting iteration for statistics: %d\n"
463 " starting iteration for steady statistics: %d\n"
464 " threshold for statistical meaning: %11.3e\n"),
465 cs_glob_lagr_stat_options->idstnt,
466 cs_glob_lagr_stat_options->nstist,
467 cs_glob_lagr_stat_options->threshold);
468
469 cs_log_printf
470 (CS_LOG_SETUP,
471 _("\n Turbulent dispersion options:\n"
472 " Lagrangian turbulent dispersion: %s\n"
473 " identical to fluid turbulent diffusion: %s\n"
474 " apply model from time step: %d\n"),
475 _status(cs_glob_lagr_model->idistu),
476 _status(cs_glob_lagr_model->idiffl),
477 cs_glob_lagr_model->modcpl);
478
479 cs_log_printf
480 (CS_LOG_SETUP,
481 _("\n Numerical options:\n"
482 " trajectory time scheme order: %d\n"
483 " Poisson correction for particle velocity: %s\n"),
484 cs_glob_lagr_time_scheme->t_order,
485 _status(cs_glob_lagr_time_scheme->ilapoi));
486
487 cs_log_printf
488 (CS_LOG_SETUP,
489 _("\n Trajectory/particle postprocessing options:\n"));
490 for (int attr = 0; attr < CS_LAGR_N_ATTRIBUTES; attr++) {
491 if (cs_lagr_post_get_attr(attr))
492 cs_log_printf(CS_LOG_SETUP,
493 " %s\n", cs_lagr_attribute_name[attr]);
494 }
495
496 cs_log_printf
497 (CS_LOG_SETUP,
498 _("\n Statistics for particles/boundary interaction:\n"));
499
500 if (cs_glob_lagr_dim->n_boundary_stats == 0)
501 cs_log_printf(CS_LOG_SETUP, " %s\n", "none");
502 if (cs_glob_lagr_boundary_interactions->has_part_impact_nbr)
503 cs_log_printf(CS_LOG_SETUP, " %s\n", "particle impact number");
504
505 /* Volume statistics */
506
507 cs_log_printf(CS_LOG_SETUP,
508 _("\n"
509 "Lagrangian statistics\n"
510 "---------------------\n\n"));
511
512 cs_log_printf
513 (CS_LOG_SETUP,
514 _(" Start of calculation from absolute iteration number: %10d\n"),
515 cs_glob_lagr_stat_options->idstnt);
516
517 if (cs_glob_time_step->nt_cur >= cs_glob_lagr_stat_options->idstnt) {
518
519 if (cs_glob_lagr_time_scheme->isttio == 1) {
520 cs_log_printf
521 (CS_LOG_SETUP,
522 _(" Start of steady-state statistics from Lagrangian "
523 "iteration number: %10d\n"),
524 cs_glob_lagr_stat_options->nstist);
525
526 }
527 cs_log_printf(CS_LOG_SETUP, "\n");
528
529 }
530
531 cs_lagr_stat_log_setup();
532 }
533
534 /*----------------------------------------------------------------------------*/
535 /*!
536 * \brief Log Lagrangian module output in the main log file.
537 */
538 /*----------------------------------------------------------------------------*/
539
540 void
cs_lagr_log_iteration(void)541 cs_lagr_log_iteration(void)
542 {
543 /* Check if this call is needed */
544
545 if (cs_glob_lagr_time_scheme == NULL)
546 return;
547
548 if (cs_glob_lagr_time_scheme->iilagr == CS_LAGR_OFF)
549 return;
550
551 /* Return silently if called before Lagrangian start */
552 if (cs_glob_lagr_particle_set == NULL)
553 return;
554
555 cs_log_printf(CS_LOG_DEFAULT,
556 _(" ** INFORMATION ON THE LAGRANGIAN CALCULATION\n"));
557 cs_log_separator(CS_LOG_DEFAULT);
558
559 /* Log injection setup info on the first iteration.
560 TODO this should be in the setup definition, but would require defining
561 injections earlier in the setup phase, including with user functions */
562
563 if (cs_glob_time_step->nt_cur == cs_glob_time_step->nt_prev + 1)
564 _log_setup_injection(CS_LOG_DEFAULT);
565
566 /* Make sure counters are up-to-date */
567
568 const cs_lagr_particle_counter_t *pc = cs_lagr_update_particle_counter();
569
570 /* Number of particles */
571 cs_log_printf(CS_LOG_DEFAULT, "\n");
572 cs_log_printf(CS_LOG_DEFAULT,
573 _(" Current number of particles "
574 "(with and without statistical weight) :\n"));
575 cs_log_printf(CS_LOG_DEFAULT, "\n");
576 cs_log_printf
577 (CS_LOG_DEFAULT,
578 _("ln newly injected %8llu %14.5E\n"),
579 (unsigned long long)(pc->n_g_new),
580 pc->w_new);
581
582 if (cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_COAL && cs_glob_lagr_model->fouling == 1)
583 cs_log_printf
584 (CS_LOG_DEFAULT,
585 _("ln coal particles fouled %8llu %14.5E\n"),
586 (unsigned long long)(pc->n_g_fouling), pc->w_fouling);
587
588 cs_log_printf
589 (CS_LOG_DEFAULT,
590 _("ln out, or deposited and eliminated %8llu %14.5E\n"),
591 (unsigned long long)(pc->n_g_exit), pc->w_exit);
592 cs_log_printf
593 (CS_LOG_DEFAULT,
594 _("ln deposited %8llu %14.5E\n"),
595 (unsigned long long)(pc->n_g_deposited), pc->w_deposited);
596
597 if (cs_glob_lagr_model->resuspension > 0)
598 cs_log_printf
599 (CS_LOG_DEFAULT,
600 _("ln resuspended %8llu %14.5E\n"),
601 (unsigned long long)(pc->n_g_resuspended),
602 pc->w_resuspended);
603
604 cs_log_printf
605 (CS_LOG_DEFAULT,
606 _("ln lost in the location stage %8llu\n"),
607 (unsigned long long)(pc->n_g_failed));
608 cs_log_printf
609 (CS_LOG_DEFAULT,
610 _("ln total number at the end of the time step %8llu %14.5E\n"),
611 (unsigned long long)pc->n_g_total, pc->w_total);
612
613 if (pc->n_g_cumulative_total > 0)
614 cs_log_printf(CS_LOG_DEFAULT,
615 _("%% of lost particles (restart(s) included): %13.4E\n"),
616 pc->n_g_cumulative_failed * 100. / pc->n_g_cumulative_total);
617 cs_log_separator(CS_LOG_DEFAULT);
618
619 /* Flow rate for each zone */
620 cs_log_printf(CS_LOG_DEFAULT,
621 _(" Zone Class Mass flow rate(kg/s) Name (type)\n"));
622
623 cs_lagr_zone_data_t *bdy_cond = cs_lagr_get_boundary_conditions();
624
625 /* TODO log for volume conditions and internal zone */
626 #if 0
627 cs_lagr_internal_condition_t *internal_cond = cs_lagr_get_internal_conditions();
628 #endif
629
630 int n_stats = cs_glob_lagr_model->n_stat_classes + 1;
631
632 cs_real_t *flow_rate;
633 int flow_rate_size = bdy_cond->n_zones*n_stats;
634 BFT_MALLOC(flow_rate, flow_rate_size, cs_real_t);
635
636 for (int i = 0; i < flow_rate_size; i++)
637 flow_rate[i] = bdy_cond->particle_flow_rate[i];
638
639 cs_parall_sum(flow_rate_size, CS_REAL_TYPE, flow_rate);
640
641 for (int z_id = 0; z_id < bdy_cond->n_zones; z_id++) {
642
643 if (CS_ABS(flow_rate[z_id*n_stats]) > 0.) {
644
645 const cs_zone_t *z = cs_boundary_zone_by_id(z_id);
646 const char *chcond;
647
648 if (bdy_cond->zone_type[z_id] == CS_LAGR_INLET)
649 chcond = _("inlet");
650
651 else if (bdy_cond->zone_type[z_id] == CS_LAGR_REBOUND)
652 chcond = _("rebound");
653
654 else if (bdy_cond->zone_type[z_id] == CS_LAGR_OUTLET)
655 chcond = _("outlet");
656
657 else if (bdy_cond->zone_type[z_id] == CS_LAGR_DEPO1)
658 chcond = _("deposition and elimination");
659
660 else if (bdy_cond->zone_type[z_id] == CS_LAGR_DEPO2)
661 chcond = _("deposition");
662
663 else if (bdy_cond->zone_type[z_id] == CS_LAGR_FOULING)
664 chcond = _("fouling");
665
666 else if (bdy_cond->zone_type[z_id] == CS_LAGR_DEPO_DLVO)
667 chcond = _("DLVO conditions");
668
669 else if (bdy_cond->zone_type[z_id] == CS_LAGR_SYM)
670 chcond = _("symmetry");
671
672 else
673 chcond = _("user");
674
675 cs_log_printf(CS_LOG_DEFAULT,
676 " %3d %12.5e %s (%s)\n",
677 z_id,
678 flow_rate[z_id*n_stats]/cs_glob_lagr_time_step->dtp,
679 z->name, chcond);
680
681 for (int j = 1; j < n_stats; j++) {
682 if (CS_ABS(flow_rate[z_id*n_stats + j]) > 0)
683 cs_log_printf(CS_LOG_DEFAULT,
684 " %3d %12.5e\n",
685 j,
686 flow_rate[z_id*n_stats + j]/cs_glob_lagr_time_step->dtp);
687 }
688
689 }
690
691 }
692
693 cs_log_separator(CS_LOG_DEFAULT);
694
695 BFT_FREE(flow_rate);
696
697 /* Boundary statistics */
698
699 if (cs_glob_lagr_dim->n_boundary_stats > 0) {
700
701 cs_log_printf(CS_LOG_DEFAULT,
702 _(" Boundary statistics :\n"));
703 cs_log_printf(CS_LOG_DEFAULT,
704 "\n");
705
706 if (cs_glob_lagr_time_scheme->isttio == 1) {
707
708 if (cs_glob_time_step->nt_cur >= cs_glob_lagr_stat_options->nstist)
709 cs_log_printf(CS_LOG_DEFAULT,
710 _("Number of iterations in steady-state statistics: %10d\n"),
711 cs_glob_lagr_boundary_interactions->npstf);
712
713 else
714 cs_log_printf(CS_LOG_DEFAULT,
715 _("Start of steady-state statistics from time step n°: %8d\n"),
716 cs_glob_lagr_stat_options->nstist);
717
718 }
719
720 cs_log_printf(CS_LOG_DEFAULT,
721 _("Total number of iterations in the statistics:%10d\n"),
722 cs_glob_lagr_boundary_interactions->npstft);
723 cs_log_printf(CS_LOG_DEFAULT,
724 "\n");
725
726 cs_log_printf(CS_LOG_DEFAULT,
727 _(" Min value Max value \n"));
728
729 for (int s_id = 0; s_id < cs_glob_lagr_dim->n_boundary_stats; s_id++) {
730
731 cs_real_t gmin;
732 cs_real_t gmax;
733 cs_lnum_t nbrfac;
734
735 _lagr_min_max_boundary_stats(s_id, &nbrfac, &gmin, &gmax);
736
737 cs_parall_max(1, CS_INT_TYPE, &nbrfac);
738 cs_parall_min(1, CS_REAL_TYPE, &gmin);
739 cs_parall_max(1, CS_REAL_TYPE, &gmax);
740
741 /* If there is no particles, no statistics */
742 if (nbrfac > 0)
743 cs_log_printf(CS_LOG_DEFAULT,
744 "lp %20s %12.5E %12.5E\n",
745 cs_glob_lagr_boundary_interactions->nombrd[s_id],
746 gmin,
747 gmax);
748 else
749 cs_log_printf(CS_LOG_DEFAULT,
750 "lp %20s\n",
751 cs_glob_lagr_boundary_interactions->nombrd[s_id]);
752
753 }
754
755 cs_log_separator(CS_LOG_DEFAULT);
756
757 }
758
759 /* Information about two-way coupling */
760
761 if (cs_glob_lagr_time_scheme->iilagr == CS_LAGR_TWOWAY_COUPLING) {
762
763 if (cs_glob_lagr_time_scheme->isttio == 0) {
764
765 cs_log_printf(CS_LOG_DEFAULT,
766 _(" Unsteady two-way coupling source terms:\n"));
767 cs_log_separator(CS_LOG_DEFAULT);
768
769 }
770 else if (cs_glob_lagr_time_scheme->isttio == 1) {
771
772 cs_log_printf(CS_LOG_DEFAULT,
773 _(" Two-way coupling source terms:\n"));
774 cs_log_separator(CS_LOG_DEFAULT);
775
776 if (cs_glob_time_step->nt_cur < cs_glob_lagr_source_terms->nstits)
777 cs_log_printf(CS_LOG_DEFAULT,
778 _("Reset of the source terms (Start of steady-state at:): %10d\n"),
779 cs_glob_lagr_source_terms->nstits);
780
781 else if (cs_glob_time_step->nt_cur >= cs_glob_lagr_stat_options->nstist)
782 cs_log_printf(CS_LOG_DEFAULT,
783 _("Number of iterations for the steady-state source terms:%10d\n"),
784 cs_glob_lagr_source_terms->npts);
785
786 }
787
788 cs_real_t vmax[2] = {cs_glob_lagr_source_terms->vmax,
789 cs_glob_lagr_source_terms->tmamax};
790 cs_gnum_t cpt = cs_glob_lagr_source_terms->ntxerr;
791
792 cs_parall_max(2, CS_REAL_TYPE, vmax);
793 cs_parall_counter(&cpt, 1);
794
795 cs_log_printf(CS_LOG_DEFAULT,
796 _("Maximum particle volume fraction: %14.5e\n"), vmax[0]);
797 cs_log_printf(CS_LOG_DEFAULT,
798 _("Maximum particle mass fraction: %14.5e\n"), vmax[1]);
799 cs_log_printf(CS_LOG_DEFAULT,
800 _("Number of cells with a particle volume fraction "
801 "greater than 0.8: %10llu\n"), (unsigned long long)cpt);
802 cs_log_separator(CS_LOG_DEFAULT);
803
804 }
805 }
806
807 /*----------------------------------------------------------------------------*/
808
809 END_C_DECLS
810