programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_lagr_tracking.h
Go to the documentation of this file.
1 #ifndef __CS_LAGR_TRACKING_H__
2 #define __CS_LAGR_TRACKING_H__
3 
4 /*============================================================================
5  * Functions and types for the Lagrangian module
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2014 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 #include "cs_defs.h"
31 
32 /*----------------------------------------------------------------------------*/
33 
35 
36 /*=============================================================================
37  * Macro definitions
38  *============================================================================*/
39 
40 /*============================================================================
41  * Type definitions
42  *============================================================================*/
43 
44 typedef enum {
45 
46  CS_LAGR_CELL_NUM, /* local cell number */
47  CS_LAGR_RANK_ID, /* local parallel rank id */
48 
50 
51  CS_LAGR_RANDOM_VALUE, /* random value associated with the particle */
52 
61 
62  /* Deposition submodel additional parameters */
63 
69 
70  /* Resuspension model additional parameters */
71 
77 
78  /* Thermal model additional parameters */
79 
83 
84  /* Coal combustion additional parameters */
85 
89 
92 
95 
96  /* Radiative model additional parameters */
97 
99 
100  /* Statistical class */
101 
103 
104  /* User variables */
105 
107 
108  /* End of attributes */
109 
111 
113 
114 /* Particle structure mapping */
115 /* -------------------------- */
116 
117 typedef struct {
118 
119  size_t extents; /* size (in bytes) of particle
120  structure */
121 
122  int n_time_vals; /* number of time values
123  handled */
124 
125  size_t size[CS_LAGR_N_ATTRIBUTES]; /* size (in bytes) of attributes
126  in particle structure for
127  a given time value */
128  cs_datatype_t datatype[CS_LAGR_N_ATTRIBUTES]; /* datatype of associated
129  attributes */
130  ptrdiff_t (*displ)[CS_LAGR_N_ATTRIBUTES]; /* displacement (in bytes) of
131  attributes in particle data,
132  per associated time_id*/
133  int (*count)[CS_LAGR_N_ATTRIBUTES]; /* number of values for each
134  attribute, per associated
135  time_id */
136 
138 
139 /* Linked list */
140 /* ----------- */
141 
142 typedef struct _cs_lagr_tracking_list_t cs_lagr_tracking_list_t;
143 
144 /* Particle set */
145 /* ------------ */
146 
147 typedef struct {
148 
149  int time_id; /* 0 for current time,
150  -1 for previous */
156 
162 
164 
167 
168  const cs_lagr_attribute_map_t *p_am; /* particle attributes maps
169  (p_am + i for time n-i) */
170  unsigned char *p_buffer; /* Particles data buffer */
171 
172  cs_lagr_tracking_list_t *used_id; /* active particles list,
173  or NULL for secondary sets */
174 
176 
177 /* Global parameters for Lagrangian module */
178 
179 typedef struct {
180 
181  int physical_model; /* FIXME: => enum: CS_LAGR_PHYS_STD,
182  CS_LAGR_PHYS_COAL,
183  CS_LAGR_PHYS_HEAT... */
185 
189  int clogging;
190 
193 
195 
196 /*=============================================================================
197  * Global variables
198  *============================================================================*/
199 
200 extern const char *cs_lagr_attribute_name[];
201 
202 /* Pointer to global Lagragian module parameters */
203 
205 
206 /*============================================================================
207  * Public function prototypes for Fortran API
208  *============================================================================*/
209 
210 /*----------------------------------------------------------------------------
211  * Allocate cs_lagr_particle_set_t structure and initialize useful buffers
212  * and indexes
213  *
214  * parameters:
215  * n_particles_max <-- local max. number of particles
216  * iphyla <-- kind of physics used for the lagrangian approach
217  * nvls <-- number of user-defined variables
218  * nbclst <-- number of stat. class to study sub-set of particles
219  * ...
220  *----------------------------------------------------------------------------*/
221 
222 void
223 CS_PROCF (lagbeg, LAGBEG)(const cs_int_t *n_particles_max,
224  const cs_int_t *nlayer,
225  const cs_int_t *iphyla,
226  const cs_int_t *idepst,
227  const cs_int_t *irough,
228  const cs_int_t *ireent,
229  const cs_int_t *iclogst,
230  const cs_int_t *nvls,
231  const cs_int_t *nbclst,
232  cs_lnum_t icocel[],
233  cs_lnum_t itycel[],
234  const cs_int_t *jisor,
235  const cs_int_t *jisora,
236  const cs_int_t *jirka,
237  const cs_int_t *jord1,
238  const cs_int_t *jrval,
239  const cs_int_t *jrpoi,
240  const cs_int_t *jrtsp,
241  const cs_int_t *jdp,
242  const cs_int_t *jmp,
243  const cs_int_t *jxp,
244  const cs_int_t *jyp,
245  const cs_int_t *jzp,
246  const cs_int_t *jup,
247  const cs_int_t *jvp,
248  const cs_int_t *jwp,
249  const cs_int_t *juf,
250  const cs_int_t *jvf,
251  const cs_int_t *jwf,
252  const cs_int_t *jtaux,
253  const cs_int_t *jryplu,
254  const cs_int_t *jrinpf,
255  const cs_int_t *jdfac,
256  const cs_int_t *jimark,
257  const cs_int_t *jtp,
258  const cs_int_t jhp[],
259  const cs_int_t *jtf,
260  const cs_int_t *jmwat,
261  const cs_int_t jmch[],
262  const cs_int_t jmck[],
263  const cs_int_t *jcp,
264  const cs_int_t *jrdck,
265  const cs_int_t *jrd0p,
266  const cs_int_t *jinch,
267  const cs_int_t jrhock[],
268  const cs_int_t *jreps,
269  const cs_int_t *jdepo,
270  const cs_int_t *jnbasg,
271  const cs_int_t *jnbasp,
272  const cs_int_t *jfadh,
273  const cs_int_t *jmfadh,
274  const cs_int_t *jndisp,
275  const cs_int_t *jclst,
276  const cs_int_t *jvls);
277 
278 /*----------------------------------------------------------------------------
279  * Get variables and parameters associated to each particles and keep it in
280  * a new structure
281  *
282  * parameters:
283  * nbpmax <-- n_particles max.
284  * nbpart --> number of current particles
285  * ...
286  *----------------------------------------------------------------------------*/
287 
288 void
289 CS_PROCF (prtget, PRTGET)(const cs_int_t *nbpmax,
290  const cs_int_t *nbpart,
291  const cs_real_t ettp[],
292  const cs_real_t ettpa[],
293  const cs_int_t itepa[],
294  const cs_real_t tepa[]);
295 
296 /*----------------------------------------------------------------------------
297  * Put variables and parameters associated to each particles into FORTRAN
298  * arrays.
299  *
300  * parameters:
301  * nbpmax <-- n_particles max.
302  * nbpart --> number of current particles
303  * dnbpar --> particle total weight
304  * nbpout --> number of outgoing particles
305  * dnbpou --> outgoing particle total weight
306  * nbperr --> number of failed particles
307  * dnbper --> failed particles total weight
308  * nbpdep --> number of depositing particles
309  * dnbdep --> depositing particles total weight
310  * npencr --> number of fouled particles (coal)
311  * dnpenc --> fouled particles (coal) total weight
312  * ...
313  *----------------------------------------------------------------------------*/
314 
315 void
316 CS_PROCF (prtput, PRTPUT)(const cs_int_t *nbpmax,
317  cs_int_t *nbpart,
318  cs_real_t *dnbpar,
319  cs_int_t *nbpout,
320  cs_real_t *dnbpou,
321  cs_int_t *nbperr,
322  cs_real_t *dnbper,
323  cs_int_t *nbpdep,
324  cs_real_t *dnbdep,
325  cs_int_t *npencr,
326  cs_real_t *dnpenc,
327  cs_real_t ettp[],
328  cs_real_t ettpa[],
329  cs_int_t itepa[],
330  cs_real_t tepa[]);
331 
332 /*----------------------------------------------------------------------------
333  * Get variables and parameters associated to each particles and keep it in
334  * a new structure
335  *
336  * parameters:
337  * ...
338  *----------------------------------------------------------------------------*/
339 
340 void
341 CS_PROCF (getbdy, GETBDY)(const cs_int_t *nflagm,
342  const cs_int_t *nfrlag,
343  const cs_int_t *injcon,
344  const cs_int_t ilflag[],
345  const cs_int_t iusncl[],
346  const cs_int_t iusclb[],
347  const cs_real_t deblag[],
348  const cs_int_t ifrlag[]);
349 
350 /*----------------------------------------------------------------------------
351  * Displacement of particles.
352  *
353  * parameters:
354  * p_n_particles <-> pointer to the number of particles
355  * scheme_order <-- current order of the scheme used for Lagragian
356  *----------------------------------------------------------------------------*/
357 
358 void
359 CS_PROCF (dplprt, DPLPRT)(cs_int_t *p_n_particles,
360  cs_int_t *p_scheme_order,
361  cs_real_t boundary_stat[],
362  const cs_int_t *iensi3,
363  const cs_int_t *inbr,
364  const cs_int_t *inbrbd,
365  const cs_int_t *iflm,
366  const cs_int_t *iflmbd,
367  const cs_int_t *iang,
368  const cs_int_t *iangbd,
369  const cs_int_t *ivit,
370  const cs_int_t *ivitbd,
371  const cs_int_t *iencnd,
372  const cs_int_t *iencma,
373  const cs_int_t *iencdi,
374  const cs_int_t *iencck,
375  const cs_int_t *iencnbbd,
376  const cs_int_t *iencmabd,
377  const cs_int_t *iencdibd,
378  const cs_int_t *iencckbd,
379  const cs_int_t *inclg,
380  const cs_int_t *iscovc,
381  const cs_int_t *nusbor,
382  cs_int_t iusb[],
383  cs_real_t visc_length[],
384  cs_real_t dlgeo[],
385  cs_real_t energt[],
386  const cs_real_t tprenc[],
387  const cs_real_t visref[],
388  const cs_real_t enc1[],
389  const cs_real_t enc2[],
390  const cs_real_t *tkelvi);
391 
392 /*----------------------------------------------------------------------------
393  * Update C structures metadata after particle computations.
394  *
395  * This metadata is overwritten and rebuilt at each time step, so
396  * it is useful only for a possible postprocessing step.
397  *
398  * The matching data is copied separately, as it may not need to be
399  * updated at each time step.
400  *
401  * parameters:
402  * nbpmax <-- n_particles max.
403  * nbpart <-- number of current particles
404  * dnbpar <-- particle total weight
405  * nbpout <-- number of outgoing particles
406  * dnbpou <-- outgoing particle total weight
407  * nbperr <-- number of failed particles
408  * dnbper <-- failed particles total weight
409  * nbpdep <-- number of depositing particles
410  * dnbdep <-- depositing particles total weight
411  * npencr <-- number of fouled particles (coal)
412  * dnpenc <-- fouled particles (coal) total weight
413  * ...
414  *----------------------------------------------------------------------------*/
415 
416 void
417 CS_PROCF (ucdprt, UCDPRT)(const cs_lnum_t *nbpmax,
418  const cs_lnum_t *nbpart,
419  const cs_real_t *dnbpar,
420  const cs_int_t *nbpout,
421  const cs_real_t *dnbpou,
422  const cs_int_t *nbperr,
423  const cs_real_t *dnbper,
424  const cs_int_t *nbpdep,
425  const cs_real_t *dnbdep,
426  const cs_int_t *npencr,
427  const cs_real_t *dnpenc,
428  const cs_real_t ettp[],
429  const cs_real_t ettpa[],
430  const cs_lnum_t itepa[],
431  const cs_real_t tepa[]);
432 
433 /*============================================================================
434  * Public function prototypes
435  *============================================================================*/
436 
437 /*----------------------------------------------------------------------------
438  * Get data access information for a given particle attribute.
439  *
440  * For attributes not currently present, the displacement and data
441  * size should be -1 and 0 respectively.
442  *
443  * parameters:
444  * particles <-- associated particle set
445  * time_id <-- associated time id (0: current, 1: previous)
446  * attr <-- particle attribute
447  * extents --> size (in bytes) of particle structure, or NULL
448  * size --> size (in bytes) of attribute in particle structure, or NULL
449  * displ --> displacement (in bytes) in particle structure, or NULL
450  * datatype --> associated datatype, or NULL
451  * count --> associated elements count, or NULL
452  *----------------------------------------------------------------------------*/
453 
454 void
456  int time_id,
457  cs_lagr_attribute_t attr,
458  size_t *extents,
459  size_t *size,
460  ptrdiff_t *displ,
461  cs_datatype_t *datatype,
462  int *count);
463 
464 /*----------------------------------------------------------------------------
465  * Return pointer to the main cs_lagr_particle_set_t structure.
466  *
467  * returns:
468  * pointer to current particle set, or NULL
469  *----------------------------------------------------------------------------*/
470 
473 
474 /*----------------------------------------------------------------------------
475  * Delete particle set structure and other useful buffers.
476  *----------------------------------------------------------------------------*/
477 
478 void
479 cs_lagr_destroy(void);
480 
481 /*----------------------------------------------------------------------------*/
491 /*----------------------------------------------------------------------------*/
492 
493 inline static void *
494 cs_lagr_particles_attr(cs_lagr_particle_set_t *particle_set,
495  cs_lnum_t particle_id,
496  cs_lagr_attribute_t attr)
497 {
498  assert(particle_set->p_am->count[0][attr] > 0);
499 
500  return (unsigned char *)particle_set->p_buffer
501  + particle_set->p_am->extents*particle_id
502  + particle_set->p_am->displ[0][attr];
503 }
504 
505 /*----------------------------------------------------------------------------*/
516 /*----------------------------------------------------------------------------*/
517 
518 inline static const void *
519 cs_lagr_particles_attr_const(const cs_lagr_particle_set_t *particle_set,
520  cs_lnum_t particle_id,
521  cs_lagr_attribute_t attr)
522 {
523  assert(particle_set->p_am->count[0][attr] > 0);
524 
525  return particle_set->p_buffer
526  + particle_set->p_am->extents*particle_id
527  + particle_set->p_am->displ[0][attr];
528 }
529 
530 /*----------------------------------------------------------------------------*/
542 /*----------------------------------------------------------------------------*/
543 
544 inline static void *
545 cs_lagr_particles_attr_n(cs_lagr_particle_set_t *particle_set,
546  cs_lnum_t particle_id,
547  int time_id,
548  cs_lagr_attribute_t attr)
549 {
550  assert(particle_set->p_am->count[time_id][attr] > 0);
551 
552  return particle_set->p_buffer
553  + particle_set->p_am->extents*particle_id
554  + particle_set->p_am->displ[time_id][attr];
555 }
556 
557 /*----------------------------------------------------------------------------*/
569 /*----------------------------------------------------------------------------*/
570 
571 inline static const void *
572 cs_lagr_particles_attr_n_const(const cs_lagr_particle_set_t *particle_set,
573  cs_lnum_t particle_id,
574  int time_id,
575  cs_lagr_attribute_t attr)
576 {
577  assert(particle_set->p_am->count[time_id][attr] > 0);
578 
579  return particle_set->p_buffer
580  + particle_set->p_am->extents*particle_id
581  + particle_set->p_am->displ[time_id][attr];
582 }
583 
584 /*----------------------------------------------------------------------------*/
594 /*----------------------------------------------------------------------------*/
595 
596 inline static cs_lnum_t
597 cs_lagr_particles_get_lnum(const cs_lagr_particle_set_t *particle_set,
598  cs_lnum_t particle_id,
599  cs_lagr_attribute_t attr)
600 {
601  assert(particle_set->p_am->count[0][attr] > 0);
602 
603  return *((const cs_lnum_t *)( particle_set->p_buffer
604  + particle_set->p_am->extents*particle_id
605  + particle_set->p_am->displ[0][attr]));
606 }
607 
608 /*----------------------------------------------------------------------------*/
620 /*----------------------------------------------------------------------------*/
621 
622 inline static cs_lnum_t
623 cs_lagr_particles_get_lnum_n(const cs_lagr_particle_set_t *particle_set,
624  cs_lnum_t particle_id,
625  int time_id,
626  cs_lagr_attribute_t attr)
627 {
628  assert(particle_set->p_am->count[time_id][attr] > 0);
629 
630  return *((const cs_lnum_t *)( particle_set->p_buffer
631  + particle_set->p_am->extents*particle_id
632  + particle_set->p_am->displ[time_id][attr]));
633 }
634 
635 /*----------------------------------------------------------------------------*/
644 /*----------------------------------------------------------------------------*/
645 
646 inline static void
647 cs_lagr_particles_set_lnum(cs_lagr_particle_set_t *particle_set,
648  cs_lnum_t particle_id,
649  cs_lagr_attribute_t attr,
650  cs_lnum_t value)
651 {
652  assert(particle_set->p_am->count[0][attr] > 0);
653 
654  *((cs_lnum_t *)( particle_set->p_buffer
655  + particle_set->p_am->extents*particle_id
656  + particle_set->p_am->displ[0][attr])) = value;
657 }
658 
659 /*----------------------------------------------------------------------------*/
670 /*----------------------------------------------------------------------------*/
671 
672 inline static void
673 cs_lagr_particles_set_lnum_n(cs_lagr_particle_set_t *particle_set,
674  cs_lnum_t particle_id,
675  int time_id,
676  cs_lagr_attribute_t attr,
677  cs_lnum_t value)
678 {
679  assert(particle_set->p_am->count[time_id][attr] > 0);
680 
681  *((cs_lnum_t *)( particle_set->p_buffer
682  + particle_set->p_am->extents*particle_id
683  + particle_set->p_am->displ[time_id][attr])) = value;
684 }
685 
686 /*----------------------------------------------------------------------------*/
696 /*----------------------------------------------------------------------------*/
697 
698 inline static cs_gnum_t
699 cs_lagr_particles_get_gnum(const cs_lagr_particle_set_t *particle_set,
700  cs_lnum_t particle_id,
701  cs_lagr_attribute_t attr)
702 {
703  assert(particle_set->p_am->count[0][attr] > 0);
704 
705  return *((const cs_gnum_t *)( particle_set->p_buffer
706  + particle_set->p_am->extents*particle_id
707  + particle_set->p_am->displ[0][attr]));
708 }
709 
710 /*----------------------------------------------------------------------------*/
722 /*----------------------------------------------------------------------------*/
723 
724 inline static cs_gnum_t
725 cs_lagr_particles_get_gnum_n(const cs_lagr_particle_set_t *particle_set,
726  cs_lnum_t particle_id,
727  int time_id,
728  cs_lagr_attribute_t attr)
729 {
730  assert(particle_set->p_am->count[time_id][attr] > 0);
731 
732  return *((const cs_gnum_t *)( particle_set->p_buffer
733  + particle_set->p_am->extents*particle_id
734  + particle_set->p_am->displ[time_id][attr]));
735 }
736 
737 /*----------------------------------------------------------------------------*/
746 /*----------------------------------------------------------------------------*/
747 
748 inline static void
749 cs_lagr_particles_set_gnum(cs_lagr_particle_set_t *particle_set,
750  cs_lnum_t particle_id,
751  cs_lagr_attribute_t attr,
752  cs_gnum_t value)
753 {
754  assert(particle_set->p_am->count[0][attr] > 0);
755 
756  *((cs_gnum_t *)( particle_set->p_buffer
757  + particle_set->p_am->extents*particle_id
758  + particle_set->p_am->displ[0][attr])) = value;
759 }
760 
761 /*----------------------------------------------------------------------------*/
772 /*----------------------------------------------------------------------------*/
773 
774 inline static void
775 cs_lagr_particles_set_gnum_n(cs_lagr_particle_set_t *particle_set,
776  cs_lnum_t particle_id,
777  int time_id,
778  cs_lagr_attribute_t attr,
779  cs_gnum_t value)
780 {
781  assert(particle_set->p_am->count[time_id][attr] > 0);
782 
783  *((cs_gnum_t *)( particle_set->p_buffer
784  + particle_set->p_am->extents*particle_id
785  + particle_set->p_am->displ[time_id][attr])) = value;
786 }
787 
788 /*----------------------------------------------------------------------------*/
798 /*----------------------------------------------------------------------------*/
799 
800 inline static cs_real_t
801 cs_lagr_particles_get_real(const cs_lagr_particle_set_t *particle_set,
802  cs_lnum_t particle_id,
803  cs_lagr_attribute_t attr)
804 {
805  assert(particle_set->p_am->count[0][attr] > 0);
806 
807  return *((const cs_real_t *)( particle_set->p_buffer
808  + particle_set->p_am->extents*particle_id
809  + particle_set->p_am->displ[0][attr]));
810 }
811 
812 /*----------------------------------------------------------------------------*/
824 /*----------------------------------------------------------------------------*/
825 
826 inline static cs_real_t
827 cs_lagr_particles_get_real_n(const cs_lagr_particle_set_t *particle_set,
828  cs_lnum_t particle_id,
829  int time_id,
830  cs_lagr_attribute_t attr)
831 {
832  assert(particle_set->p_am->count[time_id][attr] > 0);
833 
834  return *((const cs_real_t *)( particle_set->p_buffer
835  + particle_set->p_am->extents*particle_id
836  + particle_set->p_am->displ[time_id][attr]));
837 }
838 
839 /*----------------------------------------------------------------------------*/
848 /*----------------------------------------------------------------------------*/
849 
850 inline static void
851 cs_lagr_particles_set_real(cs_lagr_particle_set_t *particle_set,
852  cs_lnum_t particle_id,
853  cs_lagr_attribute_t attr,
854  cs_real_t value)
855 {
856  assert(particle_set->p_am->count[0][attr] > 0);
857 
858  *((cs_real_t *)( particle_set->p_buffer
859  + particle_set->p_am->extents*particle_id
860  + particle_set->p_am->displ[0][attr])) = value;
861 }
862 
863 /*----------------------------------------------------------------------------*/
874 /*----------------------------------------------------------------------------*/
875 
876 inline static void
877 cs_lagr_particles_set_real_n(cs_lagr_particle_set_t *particle_set,
878  cs_lnum_t particle_id,
879  int time_id,
880  cs_lagr_attribute_t attr,
881  cs_real_t value)
882 {
883  assert(particle_set->p_am->count[time_id][attr] > 0);
884 
885  *((cs_real_t *)( particle_set->p_buffer
886  + particle_set->p_am->extents*particle_id
887  + particle_set->p_am->displ[time_id][attr])) = value;
888 }
889 
890 /*----------------------------------------------------------------------------*/
900 /*----------------------------------------------------------------------------*/
901 
902 inline static void *
903 cs_lagr_particle_attr(void *particle,
904  const cs_lagr_attribute_map_t *attr_map,
905  cs_lagr_attribute_t attr)
906 {
907  assert(attr_map->count[0][attr] > 0);
908 
909  return (unsigned char *)particle + attr_map->displ[0][attr];
910 }
911 
912 /*----------------------------------------------------------------------------*/
922 /*----------------------------------------------------------------------------*/
923 
924 inline static const void *
925 cs_lagr_particle_attr_const(const void *particle,
926  const cs_lagr_attribute_map_t *attr_map,
927  cs_lagr_attribute_t attr)
928 {
929  assert(attr_map->count[0][attr] > 0);
930 
931  return (const unsigned char *)particle + attr_map->displ[0][attr];
932 }
933 
934 /*----------------------------------------------------------------------------*/
945 /*----------------------------------------------------------------------------*/
946 
947 inline static void *
948 cs_lagr_particle_attr_n(void *particle,
949  const cs_lagr_attribute_map_t *attr_map,
950  int time_id,
951  cs_lagr_attribute_t attr)
952 {
953  assert(attr_map->count[time_id][attr] > 0);
954 
955  return (unsigned char *)particle + attr_map->displ[time_id][attr];
956 }
957 
958 /*----------------------------------------------------------------------------*/
969 /*----------------------------------------------------------------------------*/
970 
971 inline static const void *
972 cs_lagr_particle_attr_n_const(const void *particle,
973  const cs_lagr_attribute_map_t *attr_map,
974  int time_id,
975  cs_lagr_attribute_t attr)
976 {
977  assert(attr_map->count[time_id][attr] > 0);
978 
979  return (const unsigned char *)particle
980  + attr_map->displ[time_id][attr];
981 }
982 
983 /*----------------------------------------------------------------------------*/
993 /*----------------------------------------------------------------------------*/
994 
995 inline static cs_lnum_t
996 cs_lagr_particle_get_lnum(const void *particle,
997  const cs_lagr_attribute_map_t *attr_map,
998  cs_lagr_attribute_t attr)
999 {
1000  assert(attr_map->count[0][attr] > 0);
1001 
1002  return *((const cs_lnum_t *)( (const unsigned char *)particle
1003  + attr_map->displ[0][attr]));
1004 }
1005 
1006 /*----------------------------------------------------------------------------*/
1018 /*----------------------------------------------------------------------------*/
1019 
1020 inline static cs_lnum_t
1021 cs_lagr_particle_get_lnum_n(const void *particle,
1022  const cs_lagr_attribute_map_t *attr_map,
1023  int time_id,
1024  cs_lagr_attribute_t attr)
1025 {
1026  assert(attr_map->count[time_id][attr] > 0);
1027 
1028  return *((const cs_lnum_t *)( (const unsigned char *)particle
1029  + attr_map->displ[time_id][attr]));
1030 }
1031 
1032 /*----------------------------------------------------------------------------*/
1041  /*----------------------------------------------------------------------------*/
1042 
1043 inline static void
1044 cs_lagr_particle_set_lnum(void *particle,
1045  const cs_lagr_attribute_map_t *attr_map,
1046  cs_lagr_attribute_t attr,
1047  cs_lnum_t value)
1048 {
1049  assert(attr_map->count[0][attr] > 0);
1050 
1051  *((cs_lnum_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1052  = value;
1053 }
1054 
1055 /*----------------------------------------------------------------------------*/
1066  /*----------------------------------------------------------------------------*/
1067 
1068 inline static void
1069 cs_lagr_particle_set_lnum_n(void *particle,
1070  const cs_lagr_attribute_map_t *attr_map,
1071  int time_id,
1072  cs_lagr_attribute_t attr,
1073  cs_lnum_t value)
1074 {
1075  assert(attr_map->count[time_id][attr] > 0);
1076 
1077  *((cs_lnum_t *)( (unsigned char *)particle
1078  + attr_map->displ[time_id][attr])) = value;
1079 }
1080 
1081 /*----------------------------------------------------------------------------*/
1091 /*----------------------------------------------------------------------------*/
1092 
1093 inline static cs_gnum_t
1094 cs_lagr_particle_get_gnum(const void *particle,
1095  const cs_lagr_attribute_map_t *attr_map,
1096  cs_lagr_attribute_t attr)
1097 {
1098  assert(attr_map->count[0][attr] > 0);
1099 
1100  return *((const cs_gnum_t *)( (const unsigned char *)particle
1101  + attr_map->displ[0][attr]));
1102 }
1103 
1104 /*----------------------------------------------------------------------------*/
1116 /*----------------------------------------------------------------------------*/
1117 
1118 inline static cs_gnum_t
1119 cs_lagr_particle_get_gnum_n(const void *particle,
1120  const cs_lagr_attribute_map_t *attr_map,
1121  int time_id,
1122  cs_lagr_attribute_t attr)
1123 {
1124  assert(attr_map->count[time_id][attr] > 0);
1125 
1126  return *((const cs_gnum_t *)( (const unsigned char *)particle
1127  + attr_map->displ[time_id][attr]));
1128 }
1129 
1130 /*----------------------------------------------------------------------------*/
1139  /*----------------------------------------------------------------------------*/
1140 
1141 inline static void
1142 cs_lagr_particle_set_gnum(void *particle,
1143  const cs_lagr_attribute_map_t *attr_map,
1144  cs_lagr_attribute_t attr,
1145  cs_gnum_t value)
1146 {
1147  assert(attr_map->count[0][attr] > 0);
1148 
1149  *((cs_gnum_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1150  = value;
1151 }
1152 
1153 /*----------------------------------------------------------------------------*/
1164  /*----------------------------------------------------------------------------*/
1165 
1166 inline static void
1167 cs_lagr_particle_set_gnum_n(void *particle,
1168  const cs_lagr_attribute_map_t *attr_map,
1169  int time_id,
1170  cs_lagr_attribute_t attr,
1171  cs_gnum_t value)
1172 {
1173  assert(attr_map->count[time_id][attr] > 0);
1174 
1175  *((cs_gnum_t *)( (unsigned char *)particle
1176  + attr_map->displ[time_id][attr])) = value;
1177 }
1178 
1179 /*----------------------------------------------------------------------------*/
1189 /*----------------------------------------------------------------------------*/
1190 
1191 inline static cs_real_t
1192 cs_lagr_particle_get_real(const void *particle,
1193  const cs_lagr_attribute_map_t *attr_map,
1194  cs_lagr_attribute_t attr)
1195 {
1196  assert(attr_map->count[0][attr] > 0);
1197 
1198  return *((const cs_real_t *)( (const unsigned char *)particle
1199  + attr_map->displ[0][attr]));
1200 }
1201 
1202 /*----------------------------------------------------------------------------*/
1214 /*----------------------------------------------------------------------------*/
1215 
1216 inline static cs_real_t
1217 cs_lagr_particle_get_real_n(const void *particle,
1218  const cs_lagr_attribute_map_t *attr_map,
1219  int time_id,
1220  cs_lagr_attribute_t attr)
1221 {
1222  assert(attr_map->count[time_id][attr] > 0);
1223 
1224  return *((const cs_real_t *)( (const unsigned char *)particle
1225  + attr_map->displ[time_id][attr]));
1226 }
1227 
1228 /*----------------------------------------------------------------------------*/
1237  /*----------------------------------------------------------------------------*/
1238 
1239 inline static void
1240 cs_lagr_particle_set_real(void *particle,
1241  const cs_lagr_attribute_map_t *attr_map,
1242  cs_lagr_attribute_t attr,
1243  cs_real_t value)
1244 {
1245  assert(attr_map->count[0][attr] > 0);
1246 
1247  *((cs_real_t *)((unsigned char *)particle + attr_map->displ[0][attr]))
1248  = value;
1249 }
1250 
1251 /*----------------------------------------------------------------------------*/
1262  /*----------------------------------------------------------------------------*/
1263 
1264 inline static void
1265 cs_lagr_particle_set_real_n(void *particle,
1266  const cs_lagr_attribute_map_t *attr_map,
1267  int time_id,
1268  cs_lagr_attribute_t attr,
1269  cs_real_t value)
1270 {
1271  assert(attr_map->count[time_id][attr] > 0);
1272 
1273  *((cs_real_t *)( (unsigned char *)particle
1274  + attr_map->displ[time_id][attr])) = value;
1275 }
1276 
1277 /*----------------------------------------------------------------------------
1278  * Dump a cs_lagr_particle_t structure
1279  *
1280  * parameter
1281  * particles <-- cs_lagr_particle_t structure to dump
1282  *----------------------------------------------------------------------------*/
1283 
1284 void
1286 
1287 /*----------------------------------------------------------------------------*/
1288 
1290 
1291 #endif /* __CS_LAGR_TRACKING_H__ */
cs_lnum_t n_part_out
Definition: cs_lagr_tracking.h:152
cs_datatype_t
Definition: cs_defs.h:255
Definition: cs_lagr_tracking.h:74
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_tracking.c:5760
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:280
Definition: cs_lagr_tracking.h:67
cs_lnum_t n_part_fou
Definition: cs_lagr_tracking.h:154
Definition: cs_lagr_tracking.h:75
Definition: cs_lagr_tracking.h:81
Definition: cs_lagr_tracking.h:94
void lagbeg(const cs_int_t *n_particles_max, const cs_int_t *nlayer, const cs_int_t *iphyla, const cs_int_t *idepst, const cs_int_t *irough, const cs_int_t *ireent, const cs_int_t *iclogst, const cs_int_t *nvls, const cs_int_t *nbclst, cs_lnum_t icocel[], cs_lnum_t itycel[], const cs_int_t *jisor, const cs_int_t *jisora, const cs_int_t *jirka, const cs_int_t *jord1, const cs_int_t *jrval, const cs_int_t *jrpoi, const cs_int_t *jrtsp, const cs_int_t *jdp, const cs_int_t *jmp, const cs_int_t *jxp, const cs_int_t *jyp, const cs_int_t *jzp, const cs_int_t *jup, const cs_int_t *jvp, const cs_int_t *jwp, const cs_int_t *juf, const cs_int_t *jvf, const cs_int_t *jwf, const cs_int_t *jtaux, const cs_int_t *jryplu, const cs_int_t *jrinpf, const cs_int_t *jdfac, const cs_int_t *jimark, const cs_int_t *jtp, const cs_int_t jhp[], const cs_int_t *jtf, const cs_int_t *jmwat, const cs_int_t jmch[], const cs_int_t jmck[], const cs_int_t *jcp, const cs_int_t *jrdck, const cs_int_t *jrd0p, const cs_int_t *jinch, const cs_int_t jrhock[], const cs_int_t *jreps, const cs_int_t *jdepo, const cs_int_t *jnbasg, const cs_int_t *jnbasp, const cs_int_t *jfadh, const cs_int_t *jmfadh, const cs_int_t *jndisp, const cs_int_t *jclst, const cs_int_t *jvls)
Definition: cs_lagr_tracking.h:66
Definition: cs_lagr_tracking.h:106
Definition: cs_lagr_tracking.h:55
int physical_model
Definition: cs_lagr_tracking.h:181
Definition: cs_lagr_tracking.h:73
Definition: cs_lagr_tracking.h:98
Definition: cs_lagr_tracking.h:110
Definition: cs_lagr_tracking.h:49
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
Definition: cs_lagr_tracking.h:76
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
Definition: cs_lagr_tracking.h:147
Definition: cs_lagr_tracking.h:90
Definition: cs_lagr_tracking.h:72
int n_temperature_layers
Definition: cs_lagr_tracking.h:184
const cs_lagr_param_t * cs_glob_lagr_params
Definition: cs_lagr_tracking.c:385
void prtget(const cs_int_t *nbpmax, const cs_int_t *nbpart, const cs_real_t ettp[], const cs_real_t ettpa[], const cs_int_t itepa[], const cs_real_t tepa[])
cs_real_t weight_fou
Definition: cs_lagr_tracking.h:160
void dplprt(cs_int_t *p_n_particles, cs_int_t *p_scheme_order, cs_real_t boundary_stat[], const cs_int_t *iensi3, const cs_int_t *inbr, const cs_int_t *inbrbd, const cs_int_t *iflm, const cs_int_t *iflmbd, const cs_int_t *iang, const cs_int_t *iangbd, const cs_int_t *ivit, const cs_int_t *ivitbd, const cs_int_t *iencnd, const cs_int_t *iencma, const cs_int_t *iencdi, const cs_int_t *iencck, const cs_int_t *iencnbbd, const cs_int_t *iencmabd, const cs_int_t *iencdibd, const cs_int_t *iencckbd, const cs_int_t *inclg, const cs_int_t *iscovc, const cs_int_t *nusbor, cs_int_t iusb[], cs_real_t visc_length[], cs_real_t dlgeo[], cs_real_t energt[], const cs_real_t tprenc[], const cs_real_t visref[], const cs_real_t enc1[], const cs_real_t enc2[], const cs_real_t *tkelvi)
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_tracking.c:5729
const cs_lagr_attribute_map_t * p_am
Definition: cs_lagr_tracking.h:168
void getbdy(const cs_int_t *nflagm, const cs_int_t *nfrlag, const cs_int_t *injcon, const cs_int_t ilflag[], const cs_int_t iusncl[], const cs_int_t iusclb[], const cs_real_t deblag[], const cs_int_t ifrlag[])
Definition: cs_lagr_tracking.h:57
cs_real_t weight_failed
Definition: cs_lagr_tracking.h:161
Definition: cs_lagr_tracking.h:87
cs_real_t weight_dep
Definition: cs_lagr_tracking.h:159
unsigned char * p_buffer
Definition: cs_lagr_tracking.h:170
Definition: cs_lagr_tracking.h:102
int resuspension
Definition: cs_lagr_tracking.h:188
Definition: cs_lagr_tracking.h:53
Definition: cs_lagr_tracking.h:47
ptrdiff_t(* displ)[CS_LAGR_N_ATTRIBUTES]
Definition: cs_lagr_tracking.h:130
cs_real_t weight_out
Definition: cs_lagr_tracking.h:158
int deposition
Definition: cs_lagr_tracking.h:186
Definition: cs_lagr_tracking.h:51
void cs_lagr_particle_set_dump(const cs_lagr_particle_set_t *particles)
Dump a cs_lagr_particle_t structure.
Definition: cs_lagr_tracking.c:5816
int time_id
Definition: cs_lagr_tracking.h:149
cs_lnum_t n_part_dep
Definition: cs_lagr_tracking.h:153
cs_lnum_t n_particles_max
Definition: cs_lagr_tracking.h:163
Definition: cs_lagr_tracking.h:58
const char * cs_lagr_attribute_name[]
Definition: cs_lagr_tracking.c:312
cs_lagr_attribute_t
Definition: cs_lagr_tracking.h:44
void cs_lagr_destroy(void)
Delete particle set structure and other useful buffers.
Definition: cs_lagr_tracking.c:5772
Definition: cs_lagr_tracking.h:46
Definition: cs_lagr_tracking.h:86
cs_lnum_t n_particles
Definition: cs_lagr_tracking.h:151
cs_lnum_t n_failed_part
Definition: cs_lagr_tracking.h:155
Definition: cs_lagr_tracking.h:82
void prtput(const cs_int_t *nbpmax, cs_int_t *nbpart, cs_real_t *dnbpar, cs_int_t *nbpout, cs_real_t *dnbpou, cs_int_t *nbperr, cs_real_t *dnbper, cs_int_t *nbpdep, cs_real_t *dnbdep, cs_int_t *npencr, cs_real_t *dnpenc, cs_real_t ettp[], cs_real_t ettpa[], cs_int_t itepa[], cs_real_t tepa[])
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
int n_time_vals
Definition: cs_lagr_tracking.h:122
Definition: cs_lagr_tracking.h:80
Definition: cs_lagr_tracking.h:91
#define END_C_DECLS
Definition: cs_defs.h:406
double cs_real_t
Definition: cs_defs.h:296
Definition: cs_lagr_tracking.h:68
Definition: cs_lagr_tracking.h:56
size_t extents
Definition: cs_lagr_tracking.h:119
#define CS_PROCF(x, y)
Definition: cs_defs.h:419
int roughness
Definition: cs_lagr_tracking.h:187
Definition: cs_lagr_tracking.h:59
void ucdprt(const cs_lnum_t *nbpmax, const cs_lnum_t *nbpart, const cs_real_t *dnbpar, const cs_int_t *nbpout, const cs_real_t *dnbpou, const cs_int_t *nbperr, const cs_real_t *dnbper, const cs_int_t *nbpdep, const cs_real_t *dnbdep, const cs_int_t *npencr, const cs_real_t *dnpenc, const cs_real_t ettp[], const cs_real_t ettpa[], const cs_lnum_t itepa[], const cs_real_t tepa[])
cs_real_t weight
Definition: cs_lagr_tracking.h:157
int n_user_variables
Definition: cs_lagr_tracking.h:192
Definition: cs_lagr_tracking.h:65
int n_stat_classes
Definition: cs_lagr_tracking.h:191
Definition: cs_lagr_tracking.h:54
Definition: cs_lagr_tracking.h:88
Definition: cs_lagr_tracking.h:117
Definition: cs_lagr_tracking.h:60
cs_lnum_t first_free_id
Definition: cs_lagr_tracking.h:166
cs_lagr_tracking_list_t * used_id
Definition: cs_lagr_tracking.h:172
Definition: cs_lagr_tracking.h:93
cs_lnum_t first_used_id
Definition: cs_lagr_tracking.h:165
Definition: cs_lagr_tracking.h:64
int clogging
Definition: cs_lagr_tracking.h:189
int(* count)[CS_LAGR_N_ATTRIBUTES]
Definition: cs_lagr_tracking.h:133
Definition: cs_lagr_tracking.h:179