8.0
general documentation
Loading...
Searching...
No Matches
cs_lagr_particle.h
Go to the documentation of this file.
1#ifndef __CS_LAGR_PARTICLE_H__
2#define __CS_LAGR_PARTICLE_H__
3
4/*============================================================================
5 * Lagrangian module particle model
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2023 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#include "assert.h"
33
34/*----------------------------------------------------------------------------*/
35
37
38/*=============================================================================
39 * Macro definitions
40 *============================================================================*/
41
42/*=============================================================================
43 * Macro definitions
44 *============================================================================*/
45
49
51#define CS_LAGR_PART_TO_DELETE (1 << 0)
52
54#define CS_LAGR_PART_FIXED (1 << 1)
55
57#define CS_LAGR_PART_DEPOSITED (1 << 2)
58
60#define CS_LAGR_PART_ROLLING (1 << 3)
61
63#define CS_LAGR_PART_IMPOSED_MOTION (1 << 4)
64
66
68#define CS_LAGR_PART_DEPOSITION_FLAGS \
69 ( CS_LAGR_PART_TO_DELETE | CS_LAGR_PART_FIXED | CS_LAGR_PART_DEPOSITED \
70 | CS_LAGR_PART_ROLLING | CS_LAGR_PART_IMPOSED_MOTION)
71
72/*============================================================================
73 * Type definitions
74 *============================================================================*/
75
77/* ------------------------------- */
78
79typedef enum {
80
82
85
87
89
98
103
104 /* Arrays for 2nd order scheme */
105
106 CS_LAGR_TURB_STATE_1, /* turbulence characteristics of first pass */
107 CS_LAGR_PRED_VELOCITY, /* 1st step prediction for particle velocity */
108 CS_LAGR_PRED_VELOCITY_SEEN, /* 1st step prediction for relative velocity */
109 CS_LAGR_V_GAUSS, /* 1st step Gaussian variable */
110 CS_LAGR_BR_GAUSS, /* 1st step Brownian motion Gaussian variable */
111
112 /* Non-spherical particles submodel additoinal parameters */
113
121
122 /* Deposition submodel additional parameters */
123
129
130 /* Resuspension model additional parameters */
131
137
138 /* Clogging model additional parameters */
139
144
145 /* Thermal model additional parameters */
146
150
151 /* Coal combustion additional parameters */
152
156
159
162
163 /* Radiative model additional parameters */
164
166
167 /* Statistical class */
168
170
171 /* Agglomeration/fragmentation model parameters */
174
175 /* User attributes */
176
178
179 /* End of attributes */
180
182
184
186/* ------------------------------------- */
187
188typedef struct {
189
190 size_t extents; /* size (in bytes) of particle
191 structure */
192 size_t lb; /* size (in bytes) of lower
193 bounds of particle data
194 (work area before) */
195
196 int n_time_vals; /* number of time values
197 handled */
198
199 size_t size[CS_LAGR_N_ATTRIBUTES]; /* size (in bytes) of
200 attributes in particle
201 structure for a given
202 time value */
203 cs_datatype_t datatype[CS_LAGR_N_ATTRIBUTES]; /* datatype of associated
204 attributes */
205 int (*count)[CS_LAGR_N_ATTRIBUTES]; /* number of values for each
206 attribute, per associated
207 time_id */
208 ptrdiff_t (*displ)[CS_LAGR_N_ATTRIBUTES]; /* displacement (in bytes) of
209 attributes in particle data,
210 per associated time_id*/
211
212 ptrdiff_t *source_term_displ; /* displacement (in bytes) of
213 source term values
214 for second-order scheme,
215 or NULL */
216
218
219/* Particle set */
220/* ------------ */
221
249
250/*=============================================================================
251 * Global variables
252 *============================================================================*/
253
255
256extern const char *cs_lagr_attribute_name[];
257
259
261
262/*============================================================================
263 * Public function prototypes for Fortran API
264 *============================================================================*/
265
266/*============================================================================
267 * Public function prototypes
268 *============================================================================*/
269
270/*----------------------------------------------------------------------------*/
274/*----------------------------------------------------------------------------*/
275
276void
278
279/*----------------------------------------------------------------------------*/
285/*----------------------------------------------------------------------------*/
286
289
290/*----------------------------------------------------------------------------*/
294/*----------------------------------------------------------------------------*/
295
296void
298
299/*----------------------------------------------------------------------------*/
303/*----------------------------------------------------------------------------*/
304
305void
307
308/*----------------------------------------------------------------------------*/
317/*----------------------------------------------------------------------------*/
318
319void
321 cs_lnum_t src);
322
323/*----------------------------------------------------------------------------*/
342/*----------------------------------------------------------------------------*/
343
344void
346 int time_id,
348 size_t *extents,
349 size_t *size,
350 ptrdiff_t *displ,
351 cs_datatype_t *datatype,
352 int *count);
353
354/*----------------------------------------------------------------------------*/
367/*----------------------------------------------------------------------------*/
368
369int
372 cs_datatype_t datatype,
373 int stride,
374 int component_id);
375
376/*----------------------------------------------------------------------------*/
384/*----------------------------------------------------------------------------*/
385
386void
388
389/*----------------------------------------------------------------------------
390 * Return pointer to the main cs_lagr_particle_set_t structure.
391 *
392 * returns:
393 * pointer to current particle set, or NULL
394 *----------------------------------------------------------------------------*/
395
398
399/*----------------------------------------------------------------------------*/
409/*----------------------------------------------------------------------------*/
410
411inline static void *
413 cs_lnum_t particle_id,
415{
416 assert(particle_set->p_am->count[0][attr] > 0);
417
418 return (unsigned char *)particle_set->p_buffer
419 + particle_set->p_am->extents*particle_id
420 + particle_set->p_am->displ[0][attr];
421}
422
423/*----------------------------------------------------------------------------*/
434/*----------------------------------------------------------------------------*/
435
436inline static const void *
438 cs_lnum_t particle_id,
440{
441 assert(particle_set->p_am->count[0][attr] > 0);
442
443 return particle_set->p_buffer
444 + particle_set->p_am->extents*particle_id
445 + particle_set->p_am->displ[0][attr];
446}
447
448/*----------------------------------------------------------------------------*/
460/*----------------------------------------------------------------------------*/
461
462inline static void *
464 cs_lnum_t particle_id,
465 int time_id,
467{
468 assert(particle_set->p_am->count[time_id][attr] > 0);
469
470 return particle_set->p_buffer
471 + particle_set->p_am->extents*particle_id
472 + particle_set->p_am->displ[time_id][attr];
473}
474
475/*----------------------------------------------------------------------------*/
487/*----------------------------------------------------------------------------*/
488
489inline static const void *
491 cs_lnum_t particle_id,
492 int time_id,
494{
495 assert(particle_set->p_am->count[time_id][attr] > 0);
496
497 return particle_set->p_buffer
498 + particle_set->p_am->extents*particle_id
499 + particle_set->p_am->displ[time_id][attr];
500}
501
502/*----------------------------------------------------------------------------*/
512/*----------------------------------------------------------------------------*/
513
514inline static int
516 cs_lnum_t particle_id,
517 int mask)
518{
519 int flag
520 = *((const cs_lnum_t *)( particle_set->p_buffer
521 + particle_set->p_am->extents*particle_id
522 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG]));
523
524 return (flag & mask);
525}
526
527/*----------------------------------------------------------------------------*/
535/*----------------------------------------------------------------------------*/
536
537inline static void
539 cs_lnum_t particle_id,
540 int mask)
541{
542 int flag
543 = *((const cs_lnum_t *)( particle_set->p_buffer
544 + particle_set->p_am->extents*particle_id
545 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG]));
546
547 flag = flag | mask;
548
549 *((cs_lnum_t *)( particle_set->p_buffer
550 + particle_set->p_am->extents*particle_id
551 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG])) = flag;
552}
553
554/*----------------------------------------------------------------------------*/
562/*----------------------------------------------------------------------------*/
563
564inline static void
566 cs_lnum_t particle_id,
567 int mask)
568{
569 int flag
570 = *((const cs_lnum_t *)( particle_set->p_buffer
571 + particle_set->p_am->extents*particle_id
572 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG]));
573
574 flag = (flag | mask) - mask;
575
576 *((cs_lnum_t *)( particle_set->p_buffer
577 + particle_set->p_am->extents*particle_id
578 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG])) = flag;
579}
580
581/*----------------------------------------------------------------------------*/
591/*----------------------------------------------------------------------------*/
592
593inline static cs_lnum_t
595 cs_lnum_t particle_id,
597{
598 assert(particle_set->p_am->count[0][attr] > 0);
599
600 return *((const cs_lnum_t *)( particle_set->p_buffer
601 + particle_set->p_am->extents*particle_id
602 + particle_set->p_am->displ[0][attr]));
603}
604
605/*----------------------------------------------------------------------------*/
617/*----------------------------------------------------------------------------*/
618
619inline static cs_lnum_t
621 cs_lnum_t particle_id,
622 int time_id,
624{
625 assert(particle_set->p_am->count[time_id][attr] > 0);
626
627 return *((const cs_lnum_t *)( particle_set->p_buffer
628 + particle_set->p_am->extents*particle_id
629 + particle_set->p_am->displ[time_id][attr]));
630}
631
632/*----------------------------------------------------------------------------*/
641/*----------------------------------------------------------------------------*/
642
643inline static void
645 cs_lnum_t particle_id,
647 cs_lnum_t value)
648{
649 assert(particle_set->p_am->count[0][attr] > 0);
650
651 *((cs_lnum_t *)( particle_set->p_buffer
652 + particle_set->p_am->extents*particle_id
653 + particle_set->p_am->displ[0][attr])) = value;
654}
655
656/*----------------------------------------------------------------------------*/
667/*----------------------------------------------------------------------------*/
668
669inline static void
671 cs_lnum_t particle_id,
672 int time_id,
674 cs_lnum_t value)
675{
676 assert(particle_set->p_am->count[time_id][attr] > 0);
677
678 *((cs_lnum_t *)( particle_set->p_buffer
679 + particle_set->p_am->extents*particle_id
680 + particle_set->p_am->displ[time_id][attr])) = value;
681}
682
683/*----------------------------------------------------------------------------*/
693/*----------------------------------------------------------------------------*/
694
695inline static cs_gnum_t
697 cs_lnum_t particle_id,
699{
700 assert(particle_set->p_am->count[0][attr] > 0);
701
702 return *((const cs_gnum_t *)( particle_set->p_buffer
703 + particle_set->p_am->extents*particle_id
704 + particle_set->p_am->displ[0][attr]));
705}
706
707/*----------------------------------------------------------------------------*/
719/*----------------------------------------------------------------------------*/
720
721inline static cs_gnum_t
723 cs_lnum_t particle_id,
724 int time_id,
726{
727 assert(particle_set->p_am->count[time_id][attr] > 0);
728
729 return *((const cs_gnum_t *)( particle_set->p_buffer
730 + particle_set->p_am->extents*particle_id
731 + particle_set->p_am->displ[time_id][attr]));
732}
733
734/*----------------------------------------------------------------------------*/
743/*----------------------------------------------------------------------------*/
744
745inline static void
747 cs_lnum_t particle_id,
749 cs_gnum_t value)
750{
751 assert(particle_set->p_am->count[0][attr] > 0);
752
753 *((cs_gnum_t *)( particle_set->p_buffer
754 + particle_set->p_am->extents*particle_id
755 + particle_set->p_am->displ[0][attr])) = value;
756}
757
758/*----------------------------------------------------------------------------*/
769/*----------------------------------------------------------------------------*/
770
771inline static void
773 cs_lnum_t particle_id,
774 int time_id,
776 cs_gnum_t value)
777{
778 assert(particle_set->p_am->count[time_id][attr] > 0);
779
780 *((cs_gnum_t *)( particle_set->p_buffer
781 + particle_set->p_am->extents*particle_id
782 + particle_set->p_am->displ[time_id][attr])) = value;
783}
784
785/*----------------------------------------------------------------------------*/
795/*----------------------------------------------------------------------------*/
796
797inline static cs_real_t
799 cs_lnum_t particle_id,
801{
802 assert(particle_set->p_am->count[0][attr] > 0);
803
804 return *((const cs_real_t *)( particle_set->p_buffer
805 + particle_set->p_am->extents*particle_id
806 + particle_set->p_am->displ[0][attr]));
807}
808
809/*----------------------------------------------------------------------------*/
821/*----------------------------------------------------------------------------*/
822
823inline static cs_real_t
825 cs_lnum_t particle_id,
826 int time_id,
828{
829 assert(particle_set->p_am->count[time_id][attr] > 0);
830
831 return *((const cs_real_t *)( particle_set->p_buffer
832 + particle_set->p_am->extents*particle_id
833 + particle_set->p_am->displ[time_id][attr]));
834}
835
836/*----------------------------------------------------------------------------*/
845/*----------------------------------------------------------------------------*/
846
847inline static void
849 cs_lnum_t particle_id,
851 cs_real_t value)
852{
853 assert(particle_set->p_am->count[0][attr] > 0);
854
855 *((cs_real_t *)( particle_set->p_buffer
856 + particle_set->p_am->extents*particle_id
857 + particle_set->p_am->displ[0][attr])) = value;
858}
859
860/*----------------------------------------------------------------------------*/
871/*----------------------------------------------------------------------------*/
872
873inline static void
875 cs_lnum_t particle_id,
876 int time_id,
878 cs_real_t value)
879{
880 assert(particle_set->p_am->count[time_id][attr] > 0);
881
882 *((cs_real_t *)( particle_set->p_buffer
883 + particle_set->p_am->extents*particle_id
884 + particle_set->p_am->displ[time_id][attr])) = value;
885}
886
887/*----------------------------------------------------------------------------*/
898/*----------------------------------------------------------------------------*/
899
900inline static cs_real_t *
902 cs_lnum_t particle_id,
904{
905 assert(particle_set->p_am->source_term_displ != NULL);
906 assert(particle_set->p_am->source_term_displ[attr] >= 0);
907
908 return (cs_real_t *)( (unsigned char *)particle_set->p_buffer
909 + particle_set->p_am->extents*particle_id
910 + particle_set->p_am->source_term_displ[attr]);
911}
912
913/*----------------------------------------------------------------------------*/
924/*----------------------------------------------------------------------------*/
925
926inline static const cs_real_t *
928 cs_lnum_t particle_id,
930{
931 assert(particle_set->p_am->source_term_displ != NULL);
932 assert(particle_set->p_am->source_term_displ[attr] >= 0);
933
934 return (const cs_real_t *)( (unsigned char *)particle_set->p_buffer
935 + particle_set->p_am->extents*particle_id
936 + particle_set->p_am->source_term_displ[attr]);
937}
938
939/*----------------------------------------------------------------------------*/
949/*----------------------------------------------------------------------------*/
950
951inline static void *
953 const cs_lagr_attribute_map_t *attr_map,
955{
956 assert(attr_map->count[0][attr] > 0);
957
958 return (unsigned char *)particle + attr_map->displ[0][attr];
959}
960
961/*----------------------------------------------------------------------------*/
971/*----------------------------------------------------------------------------*/
972
973inline static const void *
974cs_lagr_particle_attr_const(const void *particle,
975 const cs_lagr_attribute_map_t *attr_map,
977{
978 assert(attr_map->count[0][attr] > 0);
979
980 return (const unsigned char *)particle + attr_map->displ[0][attr];
981}
982
983/*----------------------------------------------------------------------------*/
994/*----------------------------------------------------------------------------*/
995
996inline static void *
998 const cs_lagr_attribute_map_t *attr_map,
999 int time_id,
1001{
1002 assert(attr_map->count[time_id][attr] > 0);
1003
1004 return (unsigned char *)particle + attr_map->displ[time_id][attr];
1005}
1006
1007/*----------------------------------------------------------------------------*/
1018/*----------------------------------------------------------------------------*/
1019
1020inline static const void *
1022 const cs_lagr_attribute_map_t *attr_map,
1023 int time_id,
1025{
1026 assert(attr_map->count[time_id][attr] > 0);
1027
1028 return (const unsigned char *)particle
1029 + attr_map->displ[time_id][attr];
1030}
1031
1032/*----------------------------------------------------------------------------*/
1042/*----------------------------------------------------------------------------*/
1043
1044inline static cs_lnum_t
1045cs_lagr_particle_get_lnum(const void *particle,
1046 const cs_lagr_attribute_map_t *attr_map,
1048{
1049 assert(attr_map->count[0][attr] > 0);
1050
1051 return *((const cs_lnum_t *)( (const unsigned char *)particle
1052 + attr_map->displ[0][attr]));
1053}
1054
1055/*----------------------------------------------------------------------------*/
1067/*----------------------------------------------------------------------------*/
1068
1069inline static cs_lnum_t
1070cs_lagr_particle_get_lnum_n(const void *particle,
1071 const cs_lagr_attribute_map_t *attr_map,
1072 int time_id,
1074{
1075 assert(attr_map->count[time_id][attr] > 0);
1076
1077 return *((const cs_lnum_t *)( (const unsigned char *)particle
1078 + attr_map->displ[time_id][attr]));
1079}
1080
1081/*----------------------------------------------------------------------------*/
1090 /*----------------------------------------------------------------------------*/
1091
1092inline static void
1094 const cs_lagr_attribute_map_t *attr_map,
1096 cs_lnum_t value)
1097{
1098 assert(attr_map->count[0][attr] > 0);
1099
1100 *((cs_lnum_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1101 = value;
1102}
1103
1104/*----------------------------------------------------------------------------*/
1115 /*----------------------------------------------------------------------------*/
1116
1117inline static void
1119 const cs_lagr_attribute_map_t *attr_map,
1120 int time_id,
1122 cs_lnum_t value)
1123{
1124 assert(attr_map->count[time_id][attr] > 0);
1125
1126 *((cs_lnum_t *)( (unsigned char *)particle
1127 + attr_map->displ[time_id][attr])) = value;
1128}
1129
1130/*----------------------------------------------------------------------------*/
1140/*----------------------------------------------------------------------------*/
1141
1142inline static cs_gnum_t
1143cs_lagr_particle_get_gnum(const void *particle,
1144 const cs_lagr_attribute_map_t *attr_map,
1146{
1147 assert(attr_map->count[0][attr] > 0);
1148
1149 return *((const cs_gnum_t *)( (const unsigned char *)particle
1150 + attr_map->displ[0][attr]));
1151}
1152
1153/*----------------------------------------------------------------------------*/
1165/*----------------------------------------------------------------------------*/
1166
1167inline static cs_gnum_t
1168cs_lagr_particle_get_gnum_n(const void *particle,
1169 const cs_lagr_attribute_map_t *attr_map,
1170 int time_id,
1172{
1173 assert(attr_map->count[time_id][attr] > 0);
1174
1175 return *((const cs_gnum_t *)( (const unsigned char *)particle
1176 + attr_map->displ[time_id][attr]));
1177}
1178
1179/*----------------------------------------------------------------------------*/
1188 /*----------------------------------------------------------------------------*/
1189
1190inline static void
1192 const cs_lagr_attribute_map_t *attr_map,
1194 cs_gnum_t value)
1195{
1196 assert(attr_map->count[0][attr] > 0);
1197
1198 *((cs_gnum_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1199 = value;
1200}
1201
1202/*----------------------------------------------------------------------------*/
1213 /*----------------------------------------------------------------------------*/
1214
1215inline static void
1217 const cs_lagr_attribute_map_t *attr_map,
1218 int time_id,
1220 cs_gnum_t value)
1221{
1222 assert(attr_map->count[time_id][attr] > 0);
1223
1224 *((cs_gnum_t *)( (unsigned char *)particle
1225 + attr_map->displ[time_id][attr])) = value;
1226}
1227
1228/*----------------------------------------------------------------------------*/
1238/*----------------------------------------------------------------------------*/
1239
1240inline static cs_real_t
1241cs_lagr_particle_get_real(const void *particle,
1242 const cs_lagr_attribute_map_t *attr_map,
1244{
1245 assert(attr_map->count[0][attr] > 0);
1246
1247 return *((const cs_real_t *)( (const unsigned char *)particle
1248 + attr_map->displ[0][attr]));
1249}
1250
1251/*----------------------------------------------------------------------------*/
1263/*----------------------------------------------------------------------------*/
1264
1265inline static cs_real_t
1266cs_lagr_particle_get_real_n(const void *particle,
1267 const cs_lagr_attribute_map_t *attr_map,
1268 int time_id,
1270{
1271 assert(attr_map->count[time_id][attr] > 0);
1272
1273 return *((const cs_real_t *)( (const unsigned char *)particle
1274 + attr_map->displ[time_id][attr]));
1275}
1276
1277/*----------------------------------------------------------------------------*/
1286 /*----------------------------------------------------------------------------*/
1287
1288inline static void
1290 const cs_lagr_attribute_map_t *attr_map,
1292 cs_real_t value)
1293{
1294 assert(attr_map->count[0][attr] > 0);
1295
1296 *((cs_real_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1297 = value;
1298}
1299
1300/*----------------------------------------------------------------------------*/
1311 /*----------------------------------------------------------------------------*/
1312
1313inline static void
1315 const cs_lagr_attribute_map_t *attr_map,
1316 int time_id,
1318 cs_real_t value)
1319{
1320 assert(attr_map->count[time_id][attr] > 0);
1321
1322 *((cs_real_t *)( (unsigned char *)particle
1323 + attr_map->displ[time_id][attr])) = value;
1324}
1325
1326/*----------------------------------------------------------------------------*/
1336/*----------------------------------------------------------------------------*/
1337
1338inline static cs_real_t *
1340 const cs_lagr_attribute_map_t *attr_map,
1342{
1343 assert(attr_map->source_term_displ != NULL);
1344 assert(attr_map->source_term_displ[attr] >= 0);
1345
1346 return (cs_real_t *)( (unsigned char *)particle
1347 + attr_map->source_term_displ[attr]);
1348}
1349
1350/*----------------------------------------------------------------------------*/
1360/*----------------------------------------------------------------------------*/
1361
1362inline static const cs_real_t *
1364 const cs_lagr_attribute_map_t *attr_map,
1366{
1367 assert(attr_map->source_term_displ != NULL);
1368 assert(attr_map->source_term_displ[attr] >= 0);
1369
1370 return (const cs_real_t *)( (unsigned char *)particle
1371 + attr_map->source_term_displ[attr]);
1372}
1373
1374/*----------------------------------------------------------------------------
1375 * Resize particle set buffers if needed.
1376 *
1377 * parameters:
1378 * n_particles <-- minumum number of particles required
1379 *
1380 *
1381 * returns:
1382 * 1 if resizing was required, 0 otherwise
1383 *----------------------------------------------------------------------------*/
1384
1385int
1386cs_lagr_particle_set_resize(cs_lnum_t n_min_particles);
1387
1388/*----------------------------------------------------------------------------
1389 * Set reallocation factor for particle sets.
1390 *
1391 * This factor determines the multiplier used for reallocations when
1392 * the particle set's buffers are too small to handle the new number of
1393 * particles.
1394 *
1395 * parameters:
1396 * f <-- reallocation size multiplier
1397 *----------------------------------------------------------------------------*/
1398
1399void
1401
1402/*----------------------------------------------------------------------------*/
1411/*----------------------------------------------------------------------------*/
1412
1413unsigned long long
1415
1416/*----------------------------------------------------------------------------*/
1425/*----------------------------------------------------------------------------*/
1426
1427void
1428cs_lagr_set_n_g_particles_max(unsigned long long n_g_particles_max);
1429
1430/*----------------------------------------------------------------------------*/
1437/*----------------------------------------------------------------------------*/
1438
1439void
1441 cs_lnum_t particle_id);
1442
1443/*----------------------------------------------------------------------------*/
1449/*----------------------------------------------------------------------------*/
1450
1451void
1453
1454/*----------------------------------------------------------------------------*/
1460/*----------------------------------------------------------------------------*/
1461
1462void
1463cs_lagr_set_n_user_variables(int n_user_variables);
1464
1465/*----------------------------------------------------------------------------*/
1466
1468
1469#endif /* __CS_LAGR_PARTICLE_H__ */
cs_datatype_t
Definition cs_defs.h:272
#define BEGIN_C_DECLS
Definition cs_defs.h:509
double cs_real_t
Floating-point value.
Definition cs_defs.h:319
#define END_C_DECLS
Definition cs_defs.h:510
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:313
void cs_lagr_particle_attr_in_range(int attr)
Check if a particle attribute is in a valid range.
Definition cs_lagr_particle.c:1136
unsigned long long cs_lagr_get_n_g_particles_max(void)
Get global maximum number of particles.
Definition cs_lagr_particle.c:1222
cs_lagr_attribute_t
Definition cs_lagr_particle.h:79
@ CS_LAGR_DEPO_TIME
Definition cs_lagr_particle.h:142
@ CS_LAGR_QUATERNION
Definition cs_lagr_particle.h:116
@ CS_LAGR_FLUID_TEMPERATURE
Definition cs_lagr_particle.h:148
@ CS_LAGR_HEIGHT
Definition cs_lagr_particle.h:140
@ CS_LAGR_FOULING_INDEX
Definition cs_lagr_particle.h:128
@ CS_LAGR_COAL_DENSITY
Definition cs_lagr_particle.h:161
@ CS_LAGR_MASS
Definition cs_lagr_particle.h:92
@ CS_LAGR_PRED_VELOCITY
Definition cs_lagr_particle.h:107
@ CS_LAGR_EMISSIVITY
Definition cs_lagr_particle.h:165
@ CS_LAGR_AGGLO_CLASS_ID
Definition cs_lagr_particle.h:172
@ CS_LAGR_NEIGHBOR_FACE_ID
Definition cs_lagr_particle.h:126
@ CS_LAGR_PRED_VELOCITY_SEEN
Definition cs_lagr_particle.h:108
@ CS_LAGR_CLUSTER_NB_PART
Definition cs_lagr_particle.h:141
@ CS_LAGR_RADII
Definition cs_lagr_particle.h:117
@ CS_LAGR_ORIENTATION
Definition cs_lagr_particle.h:115
@ CS_LAGR_TR_TRUNCATE
Definition cs_lagr_particle.h:99
@ CS_LAGR_USER
Definition cs_lagr_particle.h:177
@ CS_LAGR_DISPLACEMENT_NORM
Definition cs_lagr_particle.h:136
@ CS_LAGR_COAL_MASS
Definition cs_lagr_particle.h:154
@ CS_LAGR_VELOCITY
Definition cs_lagr_particle.h:96
@ CS_LAGR_BR_GAUSS
Definition cs_lagr_particle.h:110
@ CS_LAGR_INTERF
Definition cs_lagr_particle.h:125
@ CS_LAGR_MARKO_VALUE
Definition cs_lagr_particle.h:127
@ CS_LAGR_COKE_MASS
Definition cs_lagr_particle.h:155
@ CS_LAGR_CELL_ID
Definition cs_lagr_particle.h:83
@ CS_LAGR_REBOUND_ID
Definition cs_lagr_particle.h:86
@ CS_LAGR_TAUP_AUX
Definition cs_lagr_particle.h:94
@ CS_LAGR_RESIDENCE_TIME
Definition cs_lagr_particle.h:91
@ CS_LAGR_TURB_STATE_1
Definition cs_lagr_particle.h:106
@ CS_LAGR_TEMPERATURE
Definition cs_lagr_particle.h:147
@ CS_LAGR_TR_REPOSITION
Definition cs_lagr_particle.h:100
@ CS_LAGR_CP
Definition cs_lagr_particle.h:149
@ CS_LAGR_RANDOM_VALUE
Definition cs_lagr_particle.h:88
@ CS_LAGR_SHAPE_PARAM
Definition cs_lagr_particle.h:120
@ CS_LAGR_RANK_ID
Definition cs_lagr_particle.h:84
@ CS_LAGR_COAL_ID
Definition cs_lagr_particle.h:160
@ CS_LAGR_INITIAL_DIAMETER
Definition cs_lagr_particle.h:158
@ CS_LAGR_ADHESION_FORCE
Definition cs_lagr_particle.h:134
@ CS_LAGR_STAT_WEIGHT
Definition cs_lagr_particle.h:90
@ CS_LAGR_N_SMALL_ASPERITIES
Definition cs_lagr_particle.h:133
@ CS_LAGR_N_ATTRIBUTES
Definition cs_lagr_particle.h:181
@ CS_LAGR_ADHESION_TORQUE
Definition cs_lagr_particle.h:135
@ CS_LAGR_ANGULAR_VEL
Definition cs_lagr_particle.h:118
@ CS_LAGR_VELOCITY_SEEN
Definition cs_lagr_particle.h:97
@ CS_LAGR_STAT_CLASS
Definition cs_lagr_particle.h:169
@ CS_LAGR_N_LARGE_ASPERITIES
Definition cs_lagr_particle.h:132
@ CS_LAGR_P_FLAG
Definition cs_lagr_particle.h:81
@ CS_LAGR_SHRINKING_DIAMETER
Definition cs_lagr_particle.h:157
@ CS_LAGR_V_GAUSS
Definition cs_lagr_particle.h:109
@ CS_LAGR_SHAPE
Definition cs_lagr_particle.h:114
@ CS_LAGR_AGGLO_FRACTAL_DIM
Definition cs_lagr_particle.h:173
@ CS_LAGR_YPLUS
Definition cs_lagr_particle.h:124
@ CS_LAGR_WATER_MASS
Definition cs_lagr_particle.h:153
@ CS_LAGR_CONSOL_HEIGHT
Definition cs_lagr_particle.h:143
@ CS_LAGR_DIAMETER
Definition cs_lagr_particle.h:93
@ CS_LAGR_COORDS
Definition cs_lagr_particle.h:95
@ CS_LAGR_EULER
Definition cs_lagr_particle.h:119
static cs_gnum_t cs_lagr_particle_get_gnum_n(const void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_gnum_t of a given particle at a given time.
Definition cs_lagr_particle.h:1168
static void cs_lagr_particles_set_flag(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int mask)
Set flag value with a selected mask for a given particle in a set.
Definition cs_lagr_particle.h:538
static void * cs_lagr_particle_attr(void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr)
Get pointer to current attribute data of a particle.
Definition cs_lagr_particle.h:952
static void cs_lagr_particles_set_real(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr, cs_real_t value)
Set attribute value of type cs_real_t of a given particle in a set.
Definition cs_lagr_particle.h:848
static void cs_lagr_particles_unset_flag(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int mask)
Unset flag value with a selected mask for a given particle in a set.
Definition cs_lagr_particle.h:565
static void cs_lagr_particle_set_lnum(void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr, cs_lnum_t value)
Set attribute value of type cs_lnum_t of a given particle.
Definition cs_lagr_particle.h:1093
void cs_lagr_particle_set_dump(const cs_lagr_particle_set_t *particles)
Dump a cs_lagr_particle_set_t structure.
Definition cs_lagr_particle.c:1281
static int cs_lagr_particles_get_flag(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int mask)
Get flag value with a selected mask for a given particle in a set.
Definition cs_lagr_particle.h:515
void cs_lagr_particle_attr_initialize(void)
Define particle map based on defined options.
Definition cs_lagr_particle.c:661
static void cs_lagr_particles_set_lnum_n(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr, cs_lnum_t value)
Set attribute value of type cs_lnum_t of a given particle in a set at a given time.
Definition cs_lagr_particle.h:670
void cs_lagr_particles_current_to_previous(cs_lagr_particle_set_t *particles, cs_lnum_t particle_id)
Copy current attributes to previous attributes.
Definition cs_lagr_particle.c:1254
static cs_gnum_t cs_lagr_particle_get_gnum(const void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr)
Get attribute value of type cs_gnum_t of a given particle in a set.
Definition cs_lagr_particle.h:1143
static const void * cs_lagr_particles_attr_const(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr)
Get const pointer to current attribute data of a given particle in a set.
Definition cs_lagr_particle.h:437
static void cs_lagr_particles_set_gnum(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr, cs_gnum_t value)
Set attribute value of type cs_gnum_t of a given particle in a set.
Definition cs_lagr_particle.h:746
static const void * cs_lagr_particle_attr_const(const void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr)
Get const pointer to current attribute data of a particle.
Definition cs_lagr_particle.h:974
cs_lagr_particle_set_t * cs_glob_lagr_particle_set
static const cs_real_t * cs_lagr_particle_source_term_const(void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr)
Get pointer to 2nd order scheme attribute source terms of a particle.
Definition cs_lagr_particle.h:1363
static cs_lnum_t cs_lagr_particles_get_lnum_n(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_lnum_t of a given particle in a set at a given time.
Definition cs_lagr_particle.h:620
static cs_real_t cs_lagr_particles_get_real_n(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_real_t of a given particle in a set at a given time.
Definition cs_lagr_particle.h:824
static void * cs_lagr_particles_attr(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr)
Get pointer to a current attribute of a given particle in a set.
Definition cs_lagr_particle.h:412
static void * cs_lagr_particle_attr_n(void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr)
Get pointer to attribute data of a particle at a given time.
Definition cs_lagr_particle.h:997
void cs_lagr_set_reallocation_factor(double f)
Set reallocation factor for particle sets.
Definition cs_lagr_particle.c:1204
static cs_real_t cs_lagr_particle_get_real(const void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr)
Get attribute value of type cs_real_t of a given particle in a set.
Definition cs_lagr_particle.h:1241
static cs_real_t * cs_lagr_particle_source_term(void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr)
Get pointer to 2nd order scheme attribute source terms of a particle.
Definition cs_lagr_particle.h:1339
static const void * cs_lagr_particle_attr_n_const(const void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr)
Get const pointer to attribute data of a particle at a given time.
Definition cs_lagr_particle.h:1021
static void cs_lagr_particle_set_real(void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr, cs_real_t value)
Set attribute value of type cs_real_t of a given particle.
Definition cs_lagr_particle.h:1289
static cs_gnum_t cs_lagr_particles_get_gnum_n(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_gnum_t of a given particle in a set at a given time.
Definition cs_lagr_particle.h:722
static void cs_lagr_particles_set_real_n(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr, cs_real_t value)
Set attribute value of type cs_real_t of a given particle in a set at a given time.
Definition cs_lagr_particle.h:874
static cs_gnum_t cs_lagr_particles_get_gnum(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_gnum_t of a given particle in a set.
Definition cs_lagr_particle.h:696
cs_lagr_particle_set_t * cs_lagr_get_particle_set(void)
Return pointer to the main cs_lagr_particle_set_t structure.
Definition cs_lagr_particle.c:1153
static cs_lnum_t cs_lagr_particle_get_lnum_n(const void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_lnum_t of a given particle at a given time.
Definition cs_lagr_particle.h:1070
static void cs_lagr_particle_set_real_n(void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr, cs_real_t value)
Set attribute value of type cs_real_t of a given particle at a given time.
Definition cs_lagr_particle.h:1314
static void * cs_lagr_particles_attr_n(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr)
Get pointer to attribute data of a given particle in a set at a given time.
Definition cs_lagr_particle.h:463
static void cs_lagr_particles_set_gnum_n(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr, cs_gnum_t value)
Set attribute value of type cs_gnum_t of a given particle in a set at a given time.
Definition cs_lagr_particle.h:772
static void cs_lagr_particles_set_lnum(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr, cs_lnum_t value)
Set attribute value of type cs_lnum_t of a given particle in a set.
Definition cs_lagr_particle.h:644
static cs_real_t * cs_lagr_particles_source_terms(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr)
Get pointer to 2nd order scheme source terms for an attribute of a given particle in a set.
Definition cs_lagr_particle.h:901
void cs_lagr_set_n_user_variables(int n_user_variables)
Set number of user particle variables.
Definition cs_lagr_particle.c:1309
static const cs_real_t * cs_lagr_particles_source_terms_const(cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr)
Get const pointer to 2nd order scheme source terms an attribute of a given particle in a set.
Definition cs_lagr_particle.h:927
void cs_lagr_particle_finalize(void)
Destroy main particle set and map if they exist.
Definition cs_lagr_particle.c:980
static const void * cs_lagr_particles_attr_n_const(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, int time_id, cs_lagr_attribute_t attr)
Get const pointer to attribute data of a given particle in a set at a given time.
Definition cs_lagr_particle.h:490
void cs_lagr_set_n_g_particles_max(unsigned long long n_g_particles_max)
Set global maximum number of particles.
Definition cs_lagr_particle.c:1239
void cs_lagr_part_copy(cs_lnum_t dest, cs_lnum_t src)
Copy attributes from one particle to another.
Definition cs_lagr_particle.c:999
int cs_lagr_particle_set_resize(cs_lnum_t n_min_particles)
Resize particle set buffers if needed.
Definition cs_lagr_particle.c:1173
void cs_lagr_particle_set_create(void)
Definition cs_lagr_particle.c:963
static void cs_lagr_particle_set_gnum_n(void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr, cs_gnum_t value)
Set attribute value of type cs_gnum_t of a given particle at a given time.
Definition cs_lagr_particle.h:1216
int cs_lagr_check_attr_query(const cs_lagr_particle_set_t *particles, cs_lagr_attribute_t attr, cs_datatype_t datatype, int stride, int component_id)
Check that query for a given particle attribute is valid.
Definition cs_lagr_particle.c:1071
static void cs_lagr_particle_set_lnum_n(void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr, cs_lnum_t value)
Set attribute value of type cs_lnum_t of a given particle at a given time.
Definition cs_lagr_particle.h:1118
static cs_real_t cs_lagr_particle_get_real_n(const void *particle, const cs_lagr_attribute_map_t *attr_map, int time_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_real_t of a given particle at a given time.
Definition cs_lagr_particle.h:1266
static cs_lnum_t cs_lagr_particle_get_lnum(const void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr)
Get attribute value of type cs_lnum_t of a given particle in a set.
Definition cs_lagr_particle.h:1045
void cs_lagr_get_attr_info(const cs_lagr_particle_set_t *particles, int time_id, cs_lagr_attribute_t attr, size_t *extents, size_t *size, ptrdiff_t *displ, cs_datatype_t *datatype, int *count)
Get data extents for a given particle attribute.
Definition cs_lagr_particle.c:1034
static void cs_lagr_particle_set_gnum(void *particle, const cs_lagr_attribute_map_t *attr_map, cs_lagr_attribute_t attr, cs_gnum_t value)
Set attribute value of type cs_gnum_t of a given particle.
Definition cs_lagr_particle.h:1191
const char * cs_lagr_attribute_name[]
const cs_lagr_attribute_map_t * cs_lagr_particle_get_attr_map(void)
Return const pointer to the main particle attribute map structure.
Definition cs_lagr_particle.c:950
static cs_real_t cs_lagr_particles_get_real(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_real_t of a given particle in a set.
Definition cs_lagr_particle.h:798
static cs_lnum_t cs_lagr_particles_get_lnum(const cs_lagr_particle_set_t *particle_set, cs_lnum_t particle_id, cs_lagr_attribute_t attr)
Get attribute value of type cs_lnum_t of a given particle in a set.
Definition cs_lagr_particle.h:594
Definition cs_lagr_particle.h:188
cs_datatype_t datatype[CS_LAGR_N_ATTRIBUTES]
Definition cs_lagr_particle.h:203
ptrdiff_t(* displ)[CS_LAGR_N_ATTRIBUTES]
Definition cs_lagr_particle.h:208
size_t size[CS_LAGR_N_ATTRIBUTES]
Definition cs_lagr_particle.h:199
int(* count)[CS_LAGR_N_ATTRIBUTES]
Definition cs_lagr_particle.h:205
size_t lb
Definition cs_lagr_particle.h:192
ptrdiff_t * source_term_displ
Definition cs_lagr_particle.h:212
int n_time_vals
Definition cs_lagr_particle.h:196
size_t extents
Definition cs_lagr_particle.h:190
Definition cs_lagr_particle.h:222
cs_real_t weight_merged
Definition cs_lagr_particle.h:236
cs_lnum_t n_part_merged
Definition cs_lagr_particle.h:227
cs_real_t weight
Definition cs_lagr_particle.h:233
cs_lnum_t n_particles
Definition cs_lagr_particle.h:224
cs_lnum_t n_part_new
Definition cs_lagr_particle.h:225
cs_real_t weight_out
Definition cs_lagr_particle.h:235
cs_real_t weight_failed
Definition cs_lagr_particle.h:240
cs_real_t weight_dep
Definition cs_lagr_particle.h:237
unsigned char * p_buffer
Definition cs_lagr_particle.h:246
cs_lnum_t n_failed_part
Definition cs_lagr_particle.h:231
cs_real_t weight_fou
Definition cs_lagr_particle.h:238
cs_lnum_t n_part_resusp
Definition cs_lagr_particle.h:230
cs_real_t weight_new
Definition cs_lagr_particle.h:234
cs_lnum_t n_part_out
Definition cs_lagr_particle.h:226
const cs_lagr_attribute_map_t * p_am
Definition cs_lagr_particle.h:244
cs_lnum_t n_part_fou
Definition cs_lagr_particle.h:229
cs_lnum_t n_part_dep
Definition cs_lagr_particle.h:228
cs_lnum_t n_particles_max
Definition cs_lagr_particle.h:242
cs_real_t weight_resusp
Definition cs_lagr_particle.h:239