My Project
programmer's 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-2019 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
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
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
98
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 /* Deposition submodel additional parameters */
113
119
120 /* Resuspension model additional parameters */
121
127
128 /* Clogging model additional parameters */
129
134
135 /* Thermal model additional parameters */
136
140
141 /* Coal combustion additional parameters */
142
146
149
152
153 /* Radiative model additional parameters */
154
156
157 /* Statistical class */
158
160
162
163 /* User attributes */
164
166
167 /* End of attributes */
168
170
172
174/* ------------------------------------- */
175
176typedef struct {
177
178 size_t extents; /* size (in bytes) of particle
179 structure */
180 size_t lb; /* size (in bytes) of lower
181 bounds of particle data
182 (work area before) */
183
184 int n_time_vals; /* number of time values
185 handled */
186
187 size_t size[CS_LAGR_N_ATTRIBUTES]; /* size (in bytes) of
188 attributes in particle
189 structure for a given
190 time value */
191 cs_datatype_t datatype[CS_LAGR_N_ATTRIBUTES]; /* datatype of associated
192 attributes */
193 int (*count)[CS_LAGR_N_ATTRIBUTES]; /* number of values for each
194 attribute, per associated
195 time_id */
196 ptrdiff_t (*displ)[CS_LAGR_N_ATTRIBUTES]; /* displacement (in bytes) of
197 attributes in particle data,
198 per associated time_id*/
199
200 ptrdiff_t *source_term_displ; /* displacement (in bytes) of
201 source term values
202 for second-order scheme,
203 or NULL */
204
206
207/* Particle set */
208/* ------------ */
209
237
238/*=============================================================================
239 * Global variables
240 *============================================================================*/
241
244extern const char *cs_lagr_attribute_name[];
245
249
250/*============================================================================
251 * Public function prototypes for Fortran API
252 *============================================================================*/
253
254/*============================================================================
255 * Public function prototypes
256 *============================================================================*/
257
258/*----------------------------------------------------------------------------*/
262/*----------------------------------------------------------------------------*/
263
264void
266
267/*----------------------------------------------------------------------------*/
273/*----------------------------------------------------------------------------*/
274
277
278/*----------------------------------------------------------------------------*/
282/*----------------------------------------------------------------------------*/
283
284void
286
287/*----------------------------------------------------------------------------*/
291/*----------------------------------------------------------------------------*/
292
293void
295
296/*----------------------------------------------------------------------------*/
305/*----------------------------------------------------------------------------*/
306
307void
309 cs_lnum_t src);
310
311/*----------------------------------------------------------------------------*/
330/*----------------------------------------------------------------------------*/
331
332void
334 int time_id,
336 size_t *extents,
337 size_t *size,
338 ptrdiff_t *displ,
339 cs_datatype_t *datatype,
340 int *count);
341
342/*----------------------------------------------------------------------------*/
355/*----------------------------------------------------------------------------*/
356
357int
360 cs_datatype_t datatype,
361 int stride,
362 int component_id);
363
364/*----------------------------------------------------------------------------*/
372/*----------------------------------------------------------------------------*/
373
374void
376
377/*----------------------------------------------------------------------------
378 * Return pointer to the main cs_lagr_particle_set_t structure.
379 *
380 * returns:
381 * pointer to current particle set, or NULL
382 *----------------------------------------------------------------------------*/
383
386
387/*----------------------------------------------------------------------------*/
397/*----------------------------------------------------------------------------*/
398
399inline static void *
401 cs_lnum_t particle_id,
403{
404 assert(particle_set->p_am->count[0][attr] > 0);
405
406 return (unsigned char *)particle_set->p_buffer
407 + particle_set->p_am->extents*particle_id
408 + particle_set->p_am->displ[0][attr];
409}
410
411/*----------------------------------------------------------------------------*/
422/*----------------------------------------------------------------------------*/
423
424inline static const void *
426 cs_lnum_t particle_id,
428{
429 assert(particle_set->p_am->count[0][attr] > 0);
430
431 return particle_set->p_buffer
432 + particle_set->p_am->extents*particle_id
433 + particle_set->p_am->displ[0][attr];
434}
435
436/*----------------------------------------------------------------------------*/
448/*----------------------------------------------------------------------------*/
449
450inline static void *
452 cs_lnum_t particle_id,
453 int time_id,
455{
456 assert(particle_set->p_am->count[time_id][attr] > 0);
457
458 return particle_set->p_buffer
459 + particle_set->p_am->extents*particle_id
460 + particle_set->p_am->displ[time_id][attr];
461}
462
463/*----------------------------------------------------------------------------*/
475/*----------------------------------------------------------------------------*/
476
477inline static const void *
479 cs_lnum_t particle_id,
480 int time_id,
482{
483 assert(particle_set->p_am->count[time_id][attr] > 0);
484
485 return particle_set->p_buffer
486 + particle_set->p_am->extents*particle_id
487 + particle_set->p_am->displ[time_id][attr];
488}
489
490/*----------------------------------------------------------------------------*/
500/*----------------------------------------------------------------------------*/
501
502inline static int
504 cs_lnum_t particle_id,
505 int mask)
506{
507 int flag
508 = *((const cs_lnum_t *)( particle_set->p_buffer
509 + particle_set->p_am->extents*particle_id
510 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG]));
511
512 return (flag & mask);
513}
514
515/*----------------------------------------------------------------------------*/
523/*----------------------------------------------------------------------------*/
524
525inline static void
527 cs_lnum_t particle_id,
528 int mask)
529{
530 int flag
531 = *((const cs_lnum_t *)( particle_set->p_buffer
532 + particle_set->p_am->extents*particle_id
533 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG]));
534
535 flag = flag | mask;
536
537 *((cs_lnum_t *)( particle_set->p_buffer
538 + particle_set->p_am->extents*particle_id
539 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG])) = flag;
540}
541
542/*----------------------------------------------------------------------------*/
550/*----------------------------------------------------------------------------*/
551
552inline static void
554 cs_lnum_t particle_id,
555 int mask)
556{
557 int flag
558 = *((const cs_lnum_t *)( particle_set->p_buffer
559 + particle_set->p_am->extents*particle_id
560 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG]));
561
562 flag = (flag | mask) - mask;
563
564 *((cs_lnum_t *)( particle_set->p_buffer
565 + particle_set->p_am->extents*particle_id
566 + particle_set->p_am->displ[0][CS_LAGR_P_FLAG])) = flag;
567}
568
569/*----------------------------------------------------------------------------*/
579/*----------------------------------------------------------------------------*/
580
581inline static cs_lnum_t
583 cs_lnum_t particle_id,
585{
586 assert(particle_set->p_am->count[0][attr] > 0);
587
588 return *((const cs_lnum_t *)( particle_set->p_buffer
589 + particle_set->p_am->extents*particle_id
590 + particle_set->p_am->displ[0][attr]));
591}
592
593/*----------------------------------------------------------------------------*/
605/*----------------------------------------------------------------------------*/
606
607inline static cs_lnum_t
609 cs_lnum_t particle_id,
610 int time_id,
612{
613 assert(particle_set->p_am->count[time_id][attr] > 0);
614
615 return *((const cs_lnum_t *)( particle_set->p_buffer
616 + particle_set->p_am->extents*particle_id
617 + particle_set->p_am->displ[time_id][attr]));
618}
619
620/*----------------------------------------------------------------------------*/
629/*----------------------------------------------------------------------------*/
630
631inline static void
633 cs_lnum_t particle_id,
635 cs_lnum_t value)
636{
637 assert(particle_set->p_am->count[0][attr] > 0);
638
639 *((cs_lnum_t *)( particle_set->p_buffer
640 + particle_set->p_am->extents*particle_id
641 + particle_set->p_am->displ[0][attr])) = value;
642}
643
644/*----------------------------------------------------------------------------*/
655/*----------------------------------------------------------------------------*/
656
657inline static void
659 cs_lnum_t particle_id,
660 int time_id,
662 cs_lnum_t value)
663{
664 assert(particle_set->p_am->count[time_id][attr] > 0);
665
666 *((cs_lnum_t *)( particle_set->p_buffer
667 + particle_set->p_am->extents*particle_id
668 + particle_set->p_am->displ[time_id][attr])) = value;
669}
670
671/*----------------------------------------------------------------------------*/
681/*----------------------------------------------------------------------------*/
682
683inline static cs_gnum_t
685 cs_lnum_t particle_id,
687{
688 assert(particle_set->p_am->count[0][attr] > 0);
689
690 return *((const cs_gnum_t *)( particle_set->p_buffer
691 + particle_set->p_am->extents*particle_id
692 + particle_set->p_am->displ[0][attr]));
693}
694
695/*----------------------------------------------------------------------------*/
707/*----------------------------------------------------------------------------*/
708
709inline static cs_gnum_t
711 cs_lnum_t particle_id,
712 int time_id,
714{
715 assert(particle_set->p_am->count[time_id][attr] > 0);
716
717 return *((const cs_gnum_t *)( particle_set->p_buffer
718 + particle_set->p_am->extents*particle_id
719 + particle_set->p_am->displ[time_id][attr]));
720}
721
722/*----------------------------------------------------------------------------*/
731/*----------------------------------------------------------------------------*/
732
733inline static void
735 cs_lnum_t particle_id,
737 cs_gnum_t value)
738{
739 assert(particle_set->p_am->count[0][attr] > 0);
740
741 *((cs_gnum_t *)( particle_set->p_buffer
742 + particle_set->p_am->extents*particle_id
743 + particle_set->p_am->displ[0][attr])) = value;
744}
745
746/*----------------------------------------------------------------------------*/
757/*----------------------------------------------------------------------------*/
758
759inline static void
761 cs_lnum_t particle_id,
762 int time_id,
764 cs_gnum_t value)
765{
766 assert(particle_set->p_am->count[time_id][attr] > 0);
767
768 *((cs_gnum_t *)( particle_set->p_buffer
769 + particle_set->p_am->extents*particle_id
770 + particle_set->p_am->displ[time_id][attr])) = value;
771}
772
773/*----------------------------------------------------------------------------*/
783/*----------------------------------------------------------------------------*/
784
785inline static cs_real_t
787 cs_lnum_t particle_id,
789{
790 assert(particle_set->p_am->count[0][attr] > 0);
791
792 return *((const cs_real_t *)( particle_set->p_buffer
793 + particle_set->p_am->extents*particle_id
794 + particle_set->p_am->displ[0][attr]));
795}
796
797/*----------------------------------------------------------------------------*/
809/*----------------------------------------------------------------------------*/
810
811inline static cs_real_t
813 cs_lnum_t particle_id,
814 int time_id,
816{
817 assert(particle_set->p_am->count[time_id][attr] > 0);
818
819 return *((const cs_real_t *)( particle_set->p_buffer
820 + particle_set->p_am->extents*particle_id
821 + particle_set->p_am->displ[time_id][attr]));
822}
823
824/*----------------------------------------------------------------------------*/
833/*----------------------------------------------------------------------------*/
834
835inline static void
837 cs_lnum_t particle_id,
839 cs_real_t value)
840{
841 assert(particle_set->p_am->count[0][attr] > 0);
842
843 *((cs_real_t *)( particle_set->p_buffer
844 + particle_set->p_am->extents*particle_id
845 + particle_set->p_am->displ[0][attr])) = value;
846}
847
848/*----------------------------------------------------------------------------*/
859/*----------------------------------------------------------------------------*/
860
861inline static void
863 cs_lnum_t particle_id,
864 int time_id,
866 cs_real_t value)
867{
868 assert(particle_set->p_am->count[time_id][attr] > 0);
869
870 *((cs_real_t *)( particle_set->p_buffer
871 + particle_set->p_am->extents*particle_id
872 + particle_set->p_am->displ[time_id][attr])) = value;
873}
874
875/*----------------------------------------------------------------------------*/
886/*----------------------------------------------------------------------------*/
887
888inline static cs_real_t *
890 cs_lnum_t particle_id,
892{
893 assert(particle_set->p_am->source_term_displ != NULL);
894 assert(particle_set->p_am->source_term_displ[attr] >= 0);
895
896 return (cs_real_t *)( (unsigned char *)particle_set->p_buffer
897 + particle_set->p_am->extents*particle_id
898 + particle_set->p_am->source_term_displ[attr]);
899}
900
901/*----------------------------------------------------------------------------*/
912/*----------------------------------------------------------------------------*/
913
914inline static const cs_real_t *
916 cs_lnum_t particle_id,
918{
919 assert(particle_set->p_am->source_term_displ != NULL);
920 assert(particle_set->p_am->source_term_displ[attr] >= 0);
921
922 return (const cs_real_t *)( (unsigned char *)particle_set->p_buffer
923 + particle_set->p_am->extents*particle_id
924 + particle_set->p_am->source_term_displ[attr]);
925}
926
927/*----------------------------------------------------------------------------*/
937/*----------------------------------------------------------------------------*/
938
939inline static void *
941 const cs_lagr_attribute_map_t *attr_map,
943{
944 assert(attr_map->count[0][attr] > 0);
945
946 return (unsigned char *)particle + attr_map->displ[0][attr];
947}
948
949/*----------------------------------------------------------------------------*/
959/*----------------------------------------------------------------------------*/
960
961inline static const void *
962cs_lagr_particle_attr_const(const void *particle,
963 const cs_lagr_attribute_map_t *attr_map,
965{
966 assert(attr_map->count[0][attr] > 0);
967
968 return (const unsigned char *)particle + attr_map->displ[0][attr];
969}
970
971/*----------------------------------------------------------------------------*/
982/*----------------------------------------------------------------------------*/
983
984inline static void *
986 const cs_lagr_attribute_map_t *attr_map,
987 int time_id,
989{
990 assert(attr_map->count[time_id][attr] > 0);
991
992 return (unsigned char *)particle + attr_map->displ[time_id][attr];
993}
994
995/*----------------------------------------------------------------------------*/
1006/*----------------------------------------------------------------------------*/
1007
1008inline static const void *
1010 const cs_lagr_attribute_map_t *attr_map,
1011 int time_id,
1013{
1014 assert(attr_map->count[time_id][attr] > 0);
1015
1016 return (const unsigned char *)particle
1017 + attr_map->displ[time_id][attr];
1018}
1019
1020/*----------------------------------------------------------------------------*/
1030/*----------------------------------------------------------------------------*/
1031
1032inline static cs_lnum_t
1033cs_lagr_particle_get_lnum(const void *particle,
1034 const cs_lagr_attribute_map_t *attr_map,
1036{
1037 assert(attr_map->count[0][attr] > 0);
1038
1039 return *((const cs_lnum_t *)( (const unsigned char *)particle
1040 + attr_map->displ[0][attr]));
1041}
1042
1043/*----------------------------------------------------------------------------*/
1055/*----------------------------------------------------------------------------*/
1056
1057inline static cs_lnum_t
1058cs_lagr_particle_get_lnum_n(const void *particle,
1059 const cs_lagr_attribute_map_t *attr_map,
1060 int time_id,
1062{
1063 assert(attr_map->count[time_id][attr] > 0);
1064
1065 return *((const cs_lnum_t *)( (const unsigned char *)particle
1066 + attr_map->displ[time_id][attr]));
1067}
1068
1069/*----------------------------------------------------------------------------*/
1078 /*----------------------------------------------------------------------------*/
1079
1080inline static void
1082 const cs_lagr_attribute_map_t *attr_map,
1084 cs_lnum_t value)
1085{
1086 assert(attr_map->count[0][attr] > 0);
1087
1088 *((cs_lnum_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1089 = value;
1090}
1091
1092/*----------------------------------------------------------------------------*/
1103 /*----------------------------------------------------------------------------*/
1104
1105inline static void
1107 const cs_lagr_attribute_map_t *attr_map,
1108 int time_id,
1110 cs_lnum_t value)
1111{
1112 assert(attr_map->count[time_id][attr] > 0);
1113
1114 *((cs_lnum_t *)( (unsigned char *)particle
1115 + attr_map->displ[time_id][attr])) = value;
1116}
1117
1118/*----------------------------------------------------------------------------*/
1128/*----------------------------------------------------------------------------*/
1129
1130inline static cs_gnum_t
1131cs_lagr_particle_get_gnum(const void *particle,
1132 const cs_lagr_attribute_map_t *attr_map,
1134{
1135 assert(attr_map->count[0][attr] > 0);
1136
1137 return *((const cs_gnum_t *)( (const unsigned char *)particle
1138 + attr_map->displ[0][attr]));
1139}
1140
1141/*----------------------------------------------------------------------------*/
1153/*----------------------------------------------------------------------------*/
1154
1155inline static cs_gnum_t
1156cs_lagr_particle_get_gnum_n(const void *particle,
1157 const cs_lagr_attribute_map_t *attr_map,
1158 int time_id,
1160{
1161 assert(attr_map->count[time_id][attr] > 0);
1162
1163 return *((const cs_gnum_t *)( (const unsigned char *)particle
1164 + attr_map->displ[time_id][attr]));
1165}
1166
1167/*----------------------------------------------------------------------------*/
1176 /*----------------------------------------------------------------------------*/
1177
1178inline static void
1180 const cs_lagr_attribute_map_t *attr_map,
1182 cs_gnum_t value)
1183{
1184 assert(attr_map->count[0][attr] > 0);
1185
1186 *((cs_gnum_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1187 = value;
1188}
1189
1190/*----------------------------------------------------------------------------*/
1201 /*----------------------------------------------------------------------------*/
1202
1203inline static void
1205 const cs_lagr_attribute_map_t *attr_map,
1206 int time_id,
1208 cs_gnum_t value)
1209{
1210 assert(attr_map->count[time_id][attr] > 0);
1211
1212 *((cs_gnum_t *)( (unsigned char *)particle
1213 + attr_map->displ[time_id][attr])) = value;
1214}
1215
1216/*----------------------------------------------------------------------------*/
1226/*----------------------------------------------------------------------------*/
1227
1228inline static cs_real_t
1229cs_lagr_particle_get_real(const void *particle,
1230 const cs_lagr_attribute_map_t *attr_map,
1232{
1233 assert(attr_map->count[0][attr] > 0);
1234
1235 return *((const cs_real_t *)( (const unsigned char *)particle
1236 + attr_map->displ[0][attr]));
1237}
1238
1239/*----------------------------------------------------------------------------*/
1251/*----------------------------------------------------------------------------*/
1252
1253inline static cs_real_t
1254cs_lagr_particle_get_real_n(const void *particle,
1255 const cs_lagr_attribute_map_t *attr_map,
1256 int time_id,
1258{
1259 assert(attr_map->count[time_id][attr] > 0);
1260
1261 return *((const cs_real_t *)( (const unsigned char *)particle
1262 + attr_map->displ[time_id][attr]));
1263}
1264
1265/*----------------------------------------------------------------------------*/
1274 /*----------------------------------------------------------------------------*/
1275
1276inline static void
1278 const cs_lagr_attribute_map_t *attr_map,
1280 cs_real_t value)
1281{
1282 assert(attr_map->count[0][attr] > 0);
1283
1284 *((cs_real_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1285 = value;
1286}
1287
1288/*----------------------------------------------------------------------------*/
1299 /*----------------------------------------------------------------------------*/
1300
1301inline static void
1303 const cs_lagr_attribute_map_t *attr_map,
1304 int time_id,
1306 cs_real_t value)
1307{
1308 assert(attr_map->count[time_id][attr] > 0);
1309
1310 *((cs_real_t *)( (unsigned char *)particle
1311 + attr_map->displ[time_id][attr])) = value;
1312}
1313
1314/*----------------------------------------------------------------------------*/
1324/*----------------------------------------------------------------------------*/
1325
1326inline static cs_real_t *
1328 const cs_lagr_attribute_map_t *attr_map,
1330{
1331 assert(attr_map->source_term_displ != NULL);
1332 assert(attr_map->source_term_displ[attr] >= 0);
1333
1334 return (cs_real_t *)( (unsigned char *)particle
1335 + attr_map->source_term_displ[attr]);
1336}
1337
1338/*----------------------------------------------------------------------------*/
1348/*----------------------------------------------------------------------------*/
1349
1350inline static const cs_real_t *
1352 const cs_lagr_attribute_map_t *attr_map,
1354{
1355 assert(attr_map->source_term_displ != NULL);
1356 assert(attr_map->source_term_displ[attr] >= 0);
1357
1358 return (const cs_real_t *)( (unsigned char *)particle
1359 + attr_map->source_term_displ[attr]);
1360}
1361
1362/*----------------------------------------------------------------------------
1363 * Resize particle set buffers if needed.
1364 *
1365 * parameters:
1366 * n_particles <-- minumum number of particles required
1367 *
1368 *
1369 * returns:
1370 * 1 if resizing was required, 0 otherwise
1371 *----------------------------------------------------------------------------*/
1372
1373int
1374cs_lagr_particle_set_resize(cs_lnum_t n_min_particles);
1375
1376/*----------------------------------------------------------------------------
1377 * Set reallocation factor for particle sets.
1378 *
1379 * This factor determines the multiplier used for reallocations when
1380 * the particle set's buffers are too small to handle the new number of
1381 * particles.
1382 *
1383 * parameters:
1384 * f <-- reallocation size multiplier
1385 *----------------------------------------------------------------------------*/
1386
1387void
1389
1390/*----------------------------------------------------------------------------*/
1399/*----------------------------------------------------------------------------*/
1400
1401unsigned long long
1403
1404/*----------------------------------------------------------------------------*/
1413/*----------------------------------------------------------------------------*/
1414
1415void
1416cs_lagr_set_n_g_particles_max(unsigned long long n_g_particles_max);
1417
1418/*----------------------------------------------------------------------------*/
1425/*----------------------------------------------------------------------------*/
1426
1427void
1429 cs_lnum_t particle_id);
1430
1431/*----------------------------------------------------------------------------*/
1437/*----------------------------------------------------------------------------*/
1438
1439void
1441
1442/*----------------------------------------------------------------------------*/
1448/*----------------------------------------------------------------------------*/
1449
1450void
1451cs_lagr_set_n_user_variables(int n_user_variables);
1452
1453/*----------------------------------------------------------------------------*/
1454
1456
1457#endif /* __CS_LAGR_PARTICLE_H__ */
cs_datatype_t
Definition cs_defs.h:260
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
#define END_C_DECLS
Definition cs_defs.h:468
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
void cs_lagr_particle_attr_in_range(int attr)
Check if a particle attribute is in a valid range.
Definition cs_lagr_particle.c:1083
unsigned long long cs_lagr_get_n_g_particles_max(void)
Get global maximum number of particles.
Definition cs_lagr_particle.c:1169
cs_lagr_attribute_t
Definition cs_lagr_particle.h:79
@ CS_LAGR_DEPO_TIME
Definition cs_lagr_particle.h:132
@ CS_LAGR_FLUID_TEMPERATURE
Definition cs_lagr_particle.h:138
@ CS_LAGR_HEIGHT
Definition cs_lagr_particle.h:130
@ CS_LAGR_FOULING_INDEX
Definition cs_lagr_particle.h:118
@ CS_LAGR_COAL_DENSITY
Definition cs_lagr_particle.h:151
@ 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:155
@ CS_LAGR_NEIGHBOR_FACE_ID
Definition cs_lagr_particle.h:116
@ CS_LAGR_PRED_VELOCITY_SEEN
Definition cs_lagr_particle.h:108
@ CS_LAGR_CLUSTER_NB_PART
Definition cs_lagr_particle.h:131
@ CS_LAGR_TR_TRUNCATE
Definition cs_lagr_particle.h:99
@ CS_LAGR_USER
Definition cs_lagr_particle.h:165
@ CS_LAGR_DISPLACEMENT_NORM
Definition cs_lagr_particle.h:126
@ CS_LAGR_COAL_MASS
Definition cs_lagr_particle.h:144
@ 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:115
@ CS_LAGR_MARKO_VALUE
Definition cs_lagr_particle.h:117
@ CS_LAGR_COKE_MASS
Definition cs_lagr_particle.h:145
@ 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:137
@ CS_LAGR_TR_REPOSITION
Definition cs_lagr_particle.h:100
@ CS_LAGR_CP
Definition cs_lagr_particle.h:139
@ CS_LAGR_RANDOM_VALUE
Definition cs_lagr_particle.h:88
@ CS_LAGR_RANK_ID
Definition cs_lagr_particle.h:84
@ CS_LAGR_COAL_ID
Definition cs_lagr_particle.h:150
@ CS_LAGR_INITIAL_DIAMETER
Definition cs_lagr_particle.h:148
@ CS_LAGR_ADHESION_FORCE
Definition cs_lagr_particle.h:124
@ CS_LAGR_STAT_WEIGHT
Definition cs_lagr_particle.h:90
@ CS_LAGR_N_SMALL_ASPERITIES
Definition cs_lagr_particle.h:123
@ CS_LAGR_N_ATTRIBUTES
Definition cs_lagr_particle.h:169
@ CS_LAGR_ADHESION_TORQUE
Definition cs_lagr_particle.h:125
@ CS_LAGR_PARTICLE_AGGREGATE
Definition cs_lagr_particle.h:161
@ CS_LAGR_VELOCITY_SEEN
Definition cs_lagr_particle.h:97
@ CS_LAGR_STAT_CLASS
Definition cs_lagr_particle.h:159
@ CS_LAGR_N_LARGE_ASPERITIES
Definition cs_lagr_particle.h:122
@ CS_LAGR_P_FLAG
Definition cs_lagr_particle.h:81
@ CS_LAGR_SHRINKING_DIAMETER
Definition cs_lagr_particle.h:147
@ CS_LAGR_V_GAUSS
Definition cs_lagr_particle.h:109
@ CS_LAGR_YPLUS
Definition cs_lagr_particle.h:114
@ CS_LAGR_WATER_MASS
Definition cs_lagr_particle.h:143
@ CS_LAGR_CONSOL_HEIGHT
Definition cs_lagr_particle.h:133
@ CS_LAGR_DIAMETER
Definition cs_lagr_particle.h:93
@ CS_LAGR_COORDS
Definition cs_lagr_particle.h:95
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:1156
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:526
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:940
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:836
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:553
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:1081
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:1228
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:503
void cs_lagr_particle_attr_initialize(void)
Define particle map based on defined options.
Definition cs_lagr_particle.c:639
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:658
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:1201
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:1131
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:425
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:734
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:962
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:1351
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:608
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:812
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:400
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:985
void cs_lagr_set_reallocation_factor(double f)
Set reallocation factor for particle sets.
Definition cs_lagr_particle.c:1151
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:1229
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:1327
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:1009
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:1277
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:710
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:862
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:684
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:1100
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:1058
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:1302
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:451
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:760
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:632
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:889
void cs_lagr_set_n_user_variables(int n_user_variables)
Set number of user particle variables.
Definition cs_lagr_particle.c:1256
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:915
void cs_lagr_particle_finalize(void)
Destroy main particle set and map if they exist.
Definition cs_lagr_particle.c:927
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:478
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:1186
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:946
int cs_lagr_particle_set_resize(cs_lnum_t n_min_particles)
Resize particle set buffers if needed.
Definition cs_lagr_particle.c:1120
void cs_lagr_particle_set_create(void)
Definition cs_lagr_particle.c:910
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:1204
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:1018
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:1106
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:1254
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:1033
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:981
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:1179
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:897
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:786
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:582
Definition cs_lagr_particle.h:176
ptrdiff_t(* displ)[CS_LAGR_N_ATTRIBUTES]
Definition cs_lagr_particle.h:196
int(* count)[CS_LAGR_N_ATTRIBUTES]
Definition cs_lagr_particle.h:193
size_t lb
Definition cs_lagr_particle.h:180
ptrdiff_t * source_term_displ
Definition cs_lagr_particle.h:200
int n_time_vals
Definition cs_lagr_particle.h:184
size_t extents
Definition cs_lagr_particle.h:178
Definition cs_lagr_particle.h:210
cs_real_t weight_merged
Definition cs_lagr_particle.h:224
cs_lnum_t n_part_merged
Definition cs_lagr_particle.h:215
cs_real_t weight
Definition cs_lagr_particle.h:221
cs_lnum_t n_particles
Definition cs_lagr_particle.h:212
cs_lnum_t n_part_new
Definition cs_lagr_particle.h:213
cs_real_t weight_out
Definition cs_lagr_particle.h:223
cs_real_t weight_failed
Definition cs_lagr_particle.h:228
cs_real_t weight_dep
Definition cs_lagr_particle.h:225
unsigned char * p_buffer
Definition cs_lagr_particle.h:234
cs_lnum_t n_failed_part
Definition cs_lagr_particle.h:219
cs_real_t weight_fou
Definition cs_lagr_particle.h:226
cs_lnum_t n_part_resusp
Definition cs_lagr_particle.h:218
cs_real_t weight_new
Definition cs_lagr_particle.h:222
cs_lnum_t n_part_out
Definition cs_lagr_particle.h:214
const cs_lagr_attribute_map_t * p_am
Definition cs_lagr_particle.h:232
cs_lnum_t n_part_fou
Definition cs_lagr_particle.h:217
cs_lnum_t n_part_dep
Definition cs_lagr_particle.h:216
cs_lnum_t n_particles_max
Definition cs_lagr_particle.h:230
cs_real_t weight_resusp
Definition cs_lagr_particle.h:227