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 /*============================================================================
2  *
3  * This file is part of the Code_Saturne Kernel, element of the
4  * Code_Saturne CFD tool.
5  *
6  * Copyright (C) 1998-2008 EDF S.A., France
7  *
8  * contact: saturne-support@edf.fr
9  *
10  * The Code_Saturne Kernel is free software; you can redistribute it
11  * and/or modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2 of
13  * the License, or (at your option) any later version.
14  *
15  * The Code_Saturne Kernel is distributed in the hope that it will be
16  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with the Code_Saturne Kernel; if not, write to the
22  * Free Software Foundation, Inc.,
23  * 51 Franklin St, Fifth Floor,
24  * Boston, MA 02110-1301 USA
25  *
26  *============================================================================*/
27 
28 #ifndef __CS_LAGR_TRACKING_H__
29 #define __CS_LAGR_TRACKING_H__
30 
31 /*============================================================================
32  * Functions and types for the Lagrangian module
33  *============================================================================*/
34 
35 /*----------------------------------------------------------------------------
36  * Local headers
37  *----------------------------------------------------------------------------*/
38 
39 #include "cs_defs.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*=============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 #define CS_LAGR_N_LAYERS 5
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
55 typedef enum {
56 
57  CS_LAGR_CUR_CELL_NUM, /* current local cell number */
59 
61  CS_LAGR_STATE, /* < 0 : - number of the boundary face where
62  the particle is kept
63  0 : particle has to be destroyed
64  1 : particle has to be synchronized
65  2 : particle treated. End of displacement */
66 
67  CS_LAGR_PREV_ID, /* id in particle set of the previous particle */
68  CS_LAGR_NEXT_ID, /* id in particle set of the next particle */
69 
70  CS_LAGR_RANDOM_VALUE, /* random value associated with the particle */
71 
80 
81  /* Deposition submodel additional parameters */
82 
88 
89  /* Resuspension model additional parameters */
90 
96 
97  /* Thermal model additional parameters */
98 
102 
103  /* Coal combustion additional parameters */
104 
108 
111 
114 
115  /* Radiative model additional parameters */
116 
118 
119  /* End of attributes */
120 
122 
124 
125 /* Base particle description */
126 /* ------------------------- */
127 
128 typedef struct {
129 
130  cs_lnum_t cur_cell_num; /* current local cell number */
132 
134  cs_lnum_t state; /* < 0 : - number of the boundary face where
135  the particle is kept
136  0 : particle has to be destroyed
137  1 : particle has to be synchronized
138  2 : particle treated. End of displacement */
139 
140  cs_lnum_t prev_id; /* id in particle set of the previous particle */
141  cs_lnum_t next_id; /* id in particle set of the next particle */
142 
143  cs_real_t random_value; /* random value associated with the particle */
144 
150  cs_real_t coord[3];
151  cs_real_t velocity[3];
152  cs_real_t velocity_seen[3];
153 
154  /* Deposition submodel additional parameters */
155 
160  cs_lnum_t depo; /* jdepo */
161 
162  /* Resuspension model additional parameters */
163 
169 
170  /* Thermal model additional parameters */
171 
172  cs_real_t temp[CS_LAGR_N_LAYERS]; /* jhp */
174  cs_real_t cp; /* jcp */
175 
176  /* Coal combustion additional parameters */
177 
178  cs_real_t water_mass; /* jmwat */
179  cs_real_t coal_mass[CS_LAGR_N_LAYERS]; /* jmch */
180  cs_real_t coke_mass[CS_LAGR_N_LAYERS]; /* jmck */
181 
183  cs_real_t initial_diam; /* jrd0p */
184 
185  cs_lnum_t coal_number; /* jinch */
186  cs_real_t coal_density[CS_LAGR_N_LAYERS]; /* jrhock */
187 
188  /* Radiative model additional parameters */
189 
190  cs_real_t emissivity; /* jreps */
191 
193 
194 /* Particle description for user-defined variables */
195 /* ----------------------------------------------- */
196 
197 typedef struct { /* User-defined variables. Max. 10 */
198 
199  cs_lnum_t stat_class; /* Only if NBCLST > 0 */
200  cs_real_t aux[10];
201 
203 
204 /* Particle set */
205 /* ------------ */
206 
207 typedef struct {
208 
214 
220 
222 
225 
226  cs_lagr_particle_t *particles; /* Main particle description */
227 
228  cs_lagr_aux_particle_t *aux_desc; /* Additional description for study
229  with user-defined variables */
231 
232 /*=============================================================================
233  * Global variables
234  *============================================================================*/
235 
236 extern const char *cs_lagr_attribute_name[];
237 
238 /*============================================================================
239  * Public function prototypes for Fortran API
240  *============================================================================*/
241 
242 /*----------------------------------------------------------------------------
243  * Allocate cs_lagr_particle_set_t structure and initialize useful buffers
244  * and indexes
245  *
246  * parameters:
247  * n_particles_max <-- local max. number of particles
248  * iphyla <-- kind of physics used for the lagrangian approach
249  * nvls <-- number of user-defined variables
250  * nbclst <-- number of stat. class to study sub-set of particles
251  * ...
252  *----------------------------------------------------------------------------*/
253 
254 void
255 CS_PROCF (lagbeg, LAGBEG)(const cs_int_t *n_particles_max,
256  const cs_int_t *nlayer,
257  const cs_int_t *iphyla,
258  const cs_int_t *idepst,
259  const cs_int_t *ireent,
260  const cs_int_t *iclogst,
261  const cs_int_t *nvls,
262  const cs_int_t *nbclst,
263  cs_lnum_t icocel[],
264  cs_lnum_t itycel[],
265  const cs_lnum_t *jisor,
266  const cs_lnum_t *jrval,
267  const cs_lnum_t *jrpoi,
268  const cs_lnum_t *jrtsp,
269  const cs_lnum_t *jdp,
270  const cs_lnum_t *jmp,
271  const cs_lnum_t *jxp,
272  const cs_lnum_t *jyp,
273  const cs_lnum_t *jzp,
274  const cs_lnum_t *jup,
275  const cs_lnum_t *jvp,
276  const cs_lnum_t *jwp,
277  const cs_lnum_t *juf,
278  const cs_lnum_t *jvf,
279  const cs_lnum_t *jwf,
280  const cs_lnum_t *jtaux,
281  const cs_lnum_t *jryplu,
282  const cs_lnum_t *jrinpf,
283  const cs_lnum_t *jdfac,
284  const cs_lnum_t *jimark,
285  const cs_lnum_t *jtp,
286  const cs_lnum_t jhp[],
287  const cs_lnum_t *jtf,
288  const cs_lnum_t *jmwat,
289  const cs_lnum_t jmch[],
290  const cs_lnum_t jmck[],
291  const cs_lnum_t *jcp,
292  const cs_lnum_t *jrdck,
293  const cs_lnum_t *jrd0p,
294  const cs_lnum_t *jinch,
295  const cs_lnum_t jrhock[],
296  const cs_lnum_t *jreps,
297  const cs_lnum_t *jdepo,
298  const cs_lnum_t *jnbasg,
299  const cs_lnum_t *jnbasp,
300  const cs_lnum_t *jfadh,
301  const cs_lnum_t *jmfadh,
302  const cs_lnum_t *jndisp);
303 
304 /*----------------------------------------------------------------------------
305  * Get variables and parameters associated to each particles and keep it in
306  * a new structure
307  *
308  * parameters:
309  * nbpmax <-- n_particles max.
310  * nbpart --> number of current particles
311  * ...
312  *----------------------------------------------------------------------------*/
313 
314 void
315 CS_PROCF (prtget, PRTGET)(const cs_int_t *nbpmax,
316  const cs_int_t *nbpart,
317  const cs_real_t ettp[],
318  const cs_real_t ettpa[],
319  const cs_int_t itepa[],
320  const cs_real_t tepa[],
321  const cs_int_t ibord[],
322  const cs_int_t indep[]);
323 
324 /*----------------------------------------------------------------------------
325  * Put variables and parameters associated to each particles into FORTRAN
326  * arrays.
327  *
328  * parameters:
329  * nbpmax <-- n_particles max.
330  * nbpart --> number of current particles
331  * dnbpar --> particle total weight
332  * nbpout --> number of outgoing particles
333  * dnbpou --> outgoing particle total weight
334  * nbperr --> number of failed particles
335  * dnbper --> failed particles total weight
336  * nbpdep --> number of depositing particles
337  * dnbdep --> depositing particles total weight
338  * npencr --> number of fouled particles (coal)
339  * dnpenc --> fouled particles (coal) total weight
340  * ...
341  *----------------------------------------------------------------------------*/
342 
343 void
344 CS_PROCF (prtput, PRTPUT)(const cs_int_t *nbpmax,
345  cs_int_t *nbpart,
346  cs_real_t *dnbpar,
347  cs_int_t *nbpout,
348  cs_real_t *dnbpou,
349  cs_int_t *nbperr,
350  cs_real_t *dnbper,
351  cs_int_t *nbpdep,
352  cs_real_t *dnbdep,
353  cs_int_t *npencr,
354  cs_real_t *dnpenc,
355  cs_real_t ettp[],
356  cs_real_t ettpa[],
357  cs_int_t itepa[],
358  cs_real_t tepa[],
359  cs_int_t ibord[]);
360 
361 /*----------------------------------------------------------------------------
362  * Get variables and parameters associated to each particles and keep it in
363  * a new structure
364  *
365  * parameters:
366  * ...
367  *----------------------------------------------------------------------------*/
368 
369 void
370 CS_PROCF (getbdy, GETBDY)(const cs_int_t *nflagm,
371  const cs_int_t *nfrlag,
372  const cs_int_t *injcon,
373  const cs_int_t ilflag[],
374  const cs_int_t iusncl[],
375  const cs_int_t iusclb[],
376  const cs_int_t iusmoy[],
377  const cs_real_t deblag[],
378  const cs_int_t ifrlag[]);
379 
380 /*----------------------------------------------------------------------------
381  * Displacement of particles.
382  *
383  * parameters:
384  * p_n_particles <-> pointer to the number of particles
385  * scheme_order <-- current order of the scheme used for Lagragian
386  *----------------------------------------------------------------------------*/
387 
388 void
389 CS_PROCF (dplprt, DPLPRT)(cs_int_t *p_n_particles,
390  cs_real_t *p_parts_weight,
391  cs_int_t *p_scheme_order,
392  cs_real_t boundary_stat[],
393  const cs_int_t *iensi3,
394  const cs_int_t *inbr,
395  const cs_int_t *inbrbd,
396  const cs_int_t *iflm,
397  const cs_int_t *iflmbd,
398  const cs_int_t *iang,
399  const cs_int_t *iangbd,
400  const cs_int_t *ivit,
401  const cs_int_t *ivitbd,
402  const cs_int_t *iencnd,
403  const cs_int_t *iencma,
404  const cs_int_t *iencdi,
405  const cs_int_t *iencck,
406  const cs_int_t *iencnbbd,
407  const cs_int_t *iencmabd,
408  const cs_int_t *iencdibd,
409  const cs_int_t *iencckbd,
410  const cs_int_t *inclg,
411  const cs_int_t *iscovc,
412  const cs_int_t *nusbor,
413  cs_int_t iusb[],
414  cs_real_t visc_length[],
415  cs_real_t dlgeo[],
416  cs_real_t rtp[],
417  const cs_int_t *iu,
418  const cs_int_t *iv,
419  const cs_int_t *iw,
420  cs_real_t energt[],
421  const cs_real_t tprenc[],
422  const cs_real_t visref[],
423  const cs_real_t enc1[],
424  const cs_real_t enc2[],
425  const cs_real_t *tkelvi);
426 
427 /*----------------------------------------------------------------------------
428  * Update C structures metadata after particle computations.
429  *
430  * This metadata is overwritten and rebuilt at each time step, so
431  * it is useful only for a possible postprocessing step.
432  *
433  * The matching data is copied separately, as it may not need to be
434  * updated at each time step.
435  *
436  * parameters:
437  * nbpmax <-- n_particles max.
438  * nbpart <-- number of current particles
439  * dnbpar <-- particle total weight
440  * nbpout <-- number of outgoing particles
441  * dnbpou <-- outgoing particle total weight
442  * nbperr <-- number of failed particles
443  * dnbper <-- failed particles total weight
444  * nbpdep <-- number of depositing particles
445  * dnbdep <-- depositing particles total weight
446  * npencr <-- number of fouled particles (coal)
447  * dnpenc <-- fouled particles (coal) total weight
448  * ...
449  *----------------------------------------------------------------------------*/
450 
451 void
452 CS_PROCF (ucdprt, UCDPRT)(const cs_lnum_t *nbpmax,
453  const cs_lnum_t *nbpart,
454  const cs_real_t *dnbpar,
455  const cs_int_t *nbpout,
456  const cs_real_t *dnbpou,
457  const cs_int_t *nbperr,
458  const cs_real_t *dnbper,
459  const cs_int_t *nbpdep,
460  const cs_real_t *dnbdep,
461  const cs_int_t *npencr,
462  const cs_real_t *dnpenc,
463  const cs_real_t ettp[],
464  const cs_real_t ettpa[],
465  const cs_lnum_t itepa[],
466  const cs_real_t tepa[],
467  const cs_lnum_t ibord[],
468  const cs_lnum_t indep[]);
469 
470 /*============================================================================
471  * Public function prototypes
472  *============================================================================*/
473 
474 /*----------------------------------------------------------------------------
475  * Get data access information for a given particle attribute.
476  *
477  * For attributes not currently present, the displacement and data
478  * size should be -1 and 0 respectively.
479  *
480  * parameters:
481  * attr <-- particle attribute
482  * extents --> size (in bytes) of particle structure, or NULL
483  * size --> size (in bytes) of attribute in particle structure, or NULL
484  * displ --> displacement (in bytes) in particle structure, or NULL
485  * datatype --> associated datatype, or NULL
486  * count --> associated elements count, or NULL
487  *----------------------------------------------------------------------------*/
488 
489 void
491  size_t *extents,
492  size_t *size,
493  ptrdiff_t *displ,
494  cs_datatype_t *datatype,
495  int *count);
496 
497 /*----------------------------------------------------------------------------
498  * Return pointers to the main cs_lagr_particle_set_t structures.
499  *
500  * parameters:
501  * current_set --> pointer to current particle set, or NULL
502  * previous_set --> pointer to previous particle set, or NULL
503  *----------------------------------------------------------------------------*/
504 
505 void
507  cs_lagr_particle_set_t **previous_set);
508 
509 /*----------------------------------------------------------------------------
510  * Delete cs_lagr_particle_set_t structure and delete other useful buffers.
511  *----------------------------------------------------------------------------*/
512 
513 void
514 cs_lagr_destroy(void);
515 
516 /*----------------------------------------------------------------------------*/
517 
519 
520 #endif /* __CS_LAGR_TRACKING_H__ */