src/ctwr/cs_ctwr.h Source File

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_ctwr.h
Go to the documentation of this file.
1 #ifndef __CS_CTWR_H__
2 #define __CS_CTWR_H__
3
4 /*============================================================================
5 * Main for cooling towers related functions
6 *============================================================================*/
7
8 /*
9 This file is part of Code_Saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2013 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 /*----------------------------------------------------------------------------
31 * PLE library headers
32 *----------------------------------------------------------------------------*/
33
34 #include <ple_locator.h>
35
36 /*----------------------------------------------------------------------------
37 * Local headers
38 *----------------------------------------------------------------------------*/
39
40 #include "fvm_nodal.h"
41
42 #include "cs_base.h"
43 #include "cs_halo.h"
44 #include "cs_mesh.h"
45 #include "cs_mesh_quantities.h"
46
47 /*----------------------------------------------------------------------------*/
48
49 BEGIN_C_DECLS
50
51 /*============================================================================
52 * Local Macro definitions
53 *============================================================================*/
54
55 /*============================================================================
56 * Type definitions
57 *============================================================================*/
58
59 typedef struct _cs_ctwr_zone_t cs_ctwr_zone_t;
60
63 /* Cooling tower exchange zone structure definition */
64 /*--------------------------------------------------*/
65
66 struct _cs_ctwr_zone_t {
67
68 int idimct; /* Problem dimension (2 or 3) */
69 int num; /* Exchange zone number */
70 char *ze_name; /* Exchange zone elements name */
71 int imctch; /* 0: None; 1: Poppe's model; 2: Merkel's model */
72 int ntypct; /* 1: Counter currents; 2: Crossed-currents;
73 3: Rain zone */
74 int nelect; /* Number of nodes on each vertical mesh for
75 the water mesh */
76
77 cs_real_t hmin; /* Minimum vertical height of exchange zone */
78 cs_real_t hmax; /* Maximum height of exchange zone */
79 cs_real_t deltat; /* Temperature delta required for exchange zone */
80
81 cs_real_t cl_teau; /* Water entry temperature */
82 cs_real_t cl_fem; /* Water flow */
83
84 cs_real_t xap; /* Exchange law lambda coefficient */
85 cs_real_t xnp; /* Exchange law n exponent */
86
87 cs_real_t surface_in; /* Water inlet surface */
88 cs_real_t surface_out; /* Water outlet surface */
89 cs_real_t surface; /* Total surface */
90
91 cs_int_t nnpsct; /* Number of points on top face */
92
93 cs_int_t nbfac_sct; /* Number of top "interior faces" */
94 cs_int_t nbfac_ict; /* Number of bottom "interior faces" */
95 cs_int_t nbfac_lct; /* Number of lateral "interior faces" */
96 cs_int_t nbfac_ct; /* Number of inside "interior faces" */
97 cs_int_t nbfbr_sct; /* Number of top "boundary faces" */
98 cs_int_t nbfbr_ict; /* Number of bottom "boundary faces" */
99 cs_int_t nbfbr_lct; /* Number of lateral "boundary faces" */
100
101 cs_int_t nbevct; /* Number of air cells belonging to the zone */
102
103 cs_int_t id_amont; /* Number of upstream exchange zone (if any) */
104
105 fvm_nodal_t *face_sup_mesh; /* Nodal Mesh of the zone's top faces */
106 fvm_nodal_t *face_inf_mesh; /* Nodal mesh of the zone's bottom faces */
107 fvm_nodal_t *face_lat_mesh; /* Nodal mesh of the zone's lateral faces */
108 fvm_nodal_t *cell_mesh; /* Nodal mesh of cells in the zone */
109 fvm_nodal_t *fac_mesh; /* Nodal mesh of internal faces in the zone */
110
111 fvm_nodal_t *water_mesh; /* Nodal mesh of water in the exchange area */
112
113 cs_int_t *ze_cell_list; /* List of cells of ct criteria */
114 cs_int_t *voiseau; /* List of water neighbors of air cells */
115 cs_int_t *pvoiseau; /* Positions in the list of water neighbors */
116 cs_int_t *voisair; /* List of air neighbors of water points */
117 cs_int_t *pvoisair; /* Positions in the list of air neighbors */
118 cs_int_t *mark_ze; /* Cell marker for ct */
119
120 cs_int_t *fac_sup_connect_idx; /* Top faces point connectivity index */
121 cs_int_t *fac_sup_connect_lst; /* Top faces point connectivity */
122
123 cs_real_t *surf_fac_sup; /* Top faces surfaces */
124
125 cs_real_t *coefeau; /* Water -> air interpolation coefficients */
126 cs_real_t *coefair; /* Air -> water interpolation coefficients */
127
128 cs_real_t *teau; /* Water temperature field */
129 cs_real_t *fem; /* Water flow field */
130 cs_real_t *vgoutte; /* Water drop velocity field (rain zones) */
131
132 cs_real_t fem_e; /* Water entry flow */
133 cs_real_t fem_s; /* Water exit flow */
134 cs_real_t teau_e; /* Mean water entry temperature */
135 cs_real_t teau_s; /* Mean water exit temperature */
136 cs_real_t heau_e; /* Mean water entry enthalpy */
137 cs_real_t heau_s; /* Mean water exit enthalpy */
138 cs_real_t tair_e; /* Mean air entry temperature */
139 cs_real_t tair_s; /* Mean air exit temperature */
140 cs_real_t xair_e; /* Mean air entry humidity */
141 cs_real_t xair_s; /* Mean air exit humidity */
142 cs_real_t hair_e; /* Mean air entry enthalpy */
143 cs_real_t hair_s; /* Mean air exit enthalpy */
144 cs_real_t debit_e; /* Air entry flow */
145 cs_real_t debit_s; /* Air exit flow */
146
147 cs_real_t dgout; /* Drop diameter for rain zones */
148
149 ple_locator_t *locat_air_water; /* Locator water -> air interpolation */
150 ple_locator_t *locat_water_air; /* Locator for air -> water interpolation */
151 ple_locator_t * *locat_cell_ct_upwind;
152
153 cs_int_t post_mesh_id; /* 0 if post-processing is not active,
154 mesh_id if post-processing is active */
155
156 /* Parallelism and/or periodic features */
157
158 cs_halo_type_t halo_type; /* Halo type */
159
160 cs_int_t *cs_array_rank; /* Array of process ranks which
161 have an exchange area */
162 cs_int_t nnpsct_with_ghosts; /* Total number of water nodes
163 (nnpsct + n_ghost_wcells) */
164
165 cs_halo_t *water_halo; /* Structure used to manage ghost cells */
166
167 };
168
171 /*============================================================================
172 * Static global variables
173 *============================================================================*/
174
175 /* array of exchanges area */
176
177
178 extern cs_int_t cs_glob_ct_nbr_max;
179 extern cs_int_t cs_glob_ct_nbr;
180 extern cs_ctwr_zone_t ** cs_glob_ct_tab;
181
182 /* array containing the stacking of the exchange area*/
183 extern cs_int_t * cs_stack_ct;
184
185 /* array containing the treatment order of the exchanges areas */
186 extern cs_int_t * cs_chain_ct;
187
188 /*============================================================================
189 * Public function prototypes for Fortran API
190 *============================================================================*/
191
192 /*----------------------------------------------------------------------------
193 * Define an exchange zone
194 *
195 * Fortran interface:
196 *
197 * SUBROUTINE DEFCT1
198 * *****************
199 *
200 * INTEGER IDIMCT : --> : problem dimension (2 or 3)
201 * INTEGER IMCTCH : --> : 1: Poppe's Model; 2: Merkel's model
202 * INTEGER NTYPCT : --> : 1: Counter-currents
203 * : : 2: Crossed-currents
204 * : : 3: Rain zones
205 * INTEGER NELECT : --> : number of nodes on each water line
206 * : : (i.e. vertical resolution)
207 * DOUBLE PRECISION DELTAT : --> : imposed water infow/outflow
208 * : --> : temperature delta
209 * DOUBLE PRECISION TEAU : --> : water inlet mean temperature
210 * DOUBLE PRECISION FEM : --> : water inlet flow
211 * DOUBLE PRECISION XAP : --> : exchange law lambda coeffcient
212 * DOUBLE PRECISION XNP : --> : exchange law n exponent
213 * DOUBLE PRECISION DGOUT : --> : drop diameter for rain zones
214 *----------------------------------------------------------------------------*/
215
216 void CS_PROCF (defct1, DEFCT1)
217 (
218 const cs_int_t *idimct,
219 const char *zecrit,
220 cs_int_t *ze_n_len,
221 const cs_int_t *imctch,
222 const cs_int_t *ntypct,
223 const cs_int_t *nelect,
224 const cs_real_t *deltat,
225 const cs_real_t *teau,
226 const cs_real_t *fem,
227 const cs_real_t *xap,
228 const cs_real_t *xnp,
229 const cs_real_t *surface,
230 const cs_real_t *dgout
231 );
232
233 /*----------------------------------------------------------------------------
234 * Get number of cooling tower exchange zones.
235 *
236 * Fortran interface:
237 *
238 * SUBROUTINE NBZECT
239 * *****************
240 *
241 * INTEGER NBRCTZ : --> : number of exchange zones
242 *----------------------------------------------------------------------------*/
243
244 void CS_PROCF (nbzect, NBZECT)
245 (
246 cs_int_t *nbrctz
247 );
248
249 /*----------------------------------------------------------------------------
250 * Indicate if the cooling tower model used is that of Poppe or Merkel.
251 *
252 * Fortran interface:
253 *
254 * SUBROUTINE AEMODE
255 * *****************
256 *
257 * INTEGER IMCTCH : --> : model type (1: Poppe; 2: Merkel)
258 *----------------------------------------------------------------------------*/
259
260 void CS_PROCF (aemode, AEMODE)
261 (
262 cs_int_t *imctch
263 );
264
265 /*----------------------------------------------------------------------------
266 * Add a constant to the temperature vector for all exchange zones.
267 *
268 * Fortran interface:
269 *
270 * SUBROUTINE AEPROT
271 * *****************
272 *
273 * DOUBLE PRECISION DELTA : --> : type de ct (Poppe ou Merkel)
274 *----------------------------------------------------------------------------*/
275
276 void CS_PROCF (aeprot, AEPROT)
277 (
278 cs_real_t *delta
279 );
280
281 /*----------------------------------------------------------------------------
282 * Resolution of water variables
283 *
284 * Fortran interface:
285 *
286 * SUBROUTINE AETEAU ( )
287 *
288 * DOUBLE PRECISION TEMP(*) : --> : air temperature
289 * DOUBLE PRECISION XA(*) : --> : air humidity
290 * DOUBLE PRECISION RHO(*) : --> : air density
291 * DOUBLE PRECISION VITX(*) : --> : air velocity component (x)
292 * DOUBLE PRECISION VITY(*) : --> : air velocity component (y)
293 * DOUBLE PRECISION VITZ(*) : --> : air velocity component (z)
294 * DOUBLE PRECISION GX : --> : gravity component x
295 * DOUBLE PRECISION GY : --> : gravity component y
296 * DOUBLE PRECISION GZ : --> : gravity component z
297 *----------------------------------------------------------------------------*/
298
299 void CS_PROCF (aeteau, AETEAU)
300 (
301 cs_real_t temp[],
302 cs_real_t xa[],
303 cs_real_t rho[],
304 cs_real_t vitx[],
305 cs_real_t vity[],
306 cs_real_t vitz[]
307 );
308
309 /*----------------------------------------------------------------------------
310 * Calculation of source terms for air equations
311 *
312 * Fortran interface:
313 *
314 * SUBROUTINE AETSSC
315 * *****************
316 *
317 * INTEGER ISCAL : : scalar number
318 * DOUBLE PRECISION TEMP : : air temperature
319 * DOUBLE PRECISION XA : : air humidity
320 * DOUBLE PRECISION RHO : : air density
321 * DOUBLE PRECISION UTSIM : : implicite source term
322 * DOUBLE PRECISION UTSEX : : explicite source term
323 * DOUBLE PRECISION VITX : : air velocity along x
324 * DOUBLE PRECISION VITY : : air velocity along y
325 * DOUBLE PRECISION VITZ : : air velocity along z
326 * DOUBLE PRECISION GX : : x component of the gravity vector
327 * DOUBLE PRECISION GY : : y component of the gravity vector
328 * DOUBLE PRECISION GZ : : z component of the gravity vector
329 *----------------------------------------------------------------------------*/
330
331 void CS_PROCF (aetssc, AETSSC)
332 (
333 const cs_int_t *iscal,
334 cs_real_t temp[],
335 cs_real_t xa[],
336 cs_real_t rho[],
337 cs_real_t utsim[],
338 cs_real_t utsex[],
339 cs_real_t vitx[],
340 cs_real_t vity[],
341 cs_real_t vitz[]
342 );
343
344 /*----------------------------------------------------------------------------
345 * Calculation of induced head loss in rain zones
346 *
347 * Fortran interface:
348 *
349 * SUBROUTINE AETSVI
350 * *****************
351 *----------------------------------------------------------------------------*/
352
353 void CS_PROCF (aetsvi, AETSVI)
354 (
355 const cs_int_t *const idim,
356 const cs_real_t rho[], /* masse volumique air */
357 const cs_real_t vitx[], /* vitesse air suivant x */
358 const cs_real_t vity[], /* vitesse air suivant y */
359 const cs_real_t vitz[], /* vitesse air suivant z */
360 const cs_real_t xair[], /* humidite de l'air */
361 cs_real_t utsex[] /* terme source explicite */
362 );
363
364 /*----------------------------------------------------------------------------
365 * Bilan dans les ct
366 *
367 * Fortran interface:
368 *
369 * Interface Fortran :
370 *
371 * SUBROUTINE BILANct ( )
372 *----------------------------------------------------------------------------*/
373
374 void CS_PROCF (bilanct, BILANCT)
375 (
376 const cs_real_t *const time,
377 cs_real_t fem_entree[], /* debit eau entree */
378 cs_real_t fem_sortie[], /* debit eau sortie */
379 cs_real_t teau_entree[], /* temperature eau entree */
380 cs_real_t teau_sortie[], /* temperature eau sortie */
381 cs_real_t heau_entree[], /* enthalpie eau entree */
382 cs_real_t heau_sortie[], /* enthalpie eau sortie */
383 cs_real_t tair_entree[], /* temperature air entree */
384 cs_real_t tair_sortie[], /* temperature air sortie */
385 cs_real_t xair_entree[], /* */
386 cs_real_t xair_sortie[], /* */
387 cs_real_t hair_entree[], /* */
388 cs_real_t hair_sortie[], /* */
389 cs_real_t debit_entree[], /* */
390 cs_real_t debit_sortie[], /* */
391
392 const cs_real_t temp[], /* Temperature air */
393 const cs_real_t xa[], /* humidite air */
394 const cs_real_t flux_masse_fac[], /* vitesse verticale air */
395 const cs_real_t flux_masse_fbr[], /* vitesse horizontale air */
396 const cs_real_t vitx[], /* vitesse air suivant x */
397 const cs_real_t vity[], /* vitesse air suivant y */
398 const cs_real_t vitz[] /* vitesse air suivant z */
399 );
400
401 /*----------------------------------------------------------------------------
402 * Initialize post processing.
403 *
404 * Fortran interface:
405 *
406 * Fortran Interface:
407 *
408 * SUBROUTINE PSTICT
409 * *****************
410 *----------------------------------------------------------------------------*/
411
412 void CS_PROCF(pstict, PSTICT)
413 (
414 void
415 );
416
417 /*----------------------------------------------------------------------------
418 * Write the restart file of the cooling tower module
419 *
420 * Fortran interface:
421 *
422 * SUBROUTINE LECT1D
423 * *****************
424 *
425 * CHARACTER NOMSUI : <-- : Name of the restart file
426 * INTEGER LNGNOM : <-- : Name length
427 *----------------------------------------------------------------------------*/
428
429 void CS_PROCF (ecrctw, ECRCTW)
430 (
431 const char *const nomsui,
432 const cs_int_t *const lngnom
433 );
434
435 /*----------------------------------------------------------------------------
436 * Read the restart file of the cooling tower module
437 *
438 * Fortran interface:
439 *
440 * SUBROUTINE LECT1D
441 * *****************
442 *
443 * CHARACTER NOMSUI : <-- : Name of the restart file
444 * INTEGER LNGNOM : <-- : Name length
445 *----------------------------------------------------------------------------*/
446
447 void CS_PROCF (lecctw, LECCTW)
448 (
449 const char *const nomsui,
450 const cs_int_t *const lngnom
451 );
452
453 /*============================================================================
454 * Public function definitions
455 *============================================================================*/
456
457 /*----------------------------------------------------------------------------
458 * Definition d'une zone d'echange (qui est ajoute a celles deja definies)
459 *----------------------------------------------------------------------------*/
460
461 void cs_ctwr_definit
462 (
463 const cs_int_t idimct, /* Dimemsion du probleme 2:2D 3:3D */
464 const char *ze_crit, /* Critere de selection */
465 const cs_int_t imctch, /* 1: Modele de Poppe
466 2: Merkel
467 0: Rien */
468 const cs_int_t ntypct, /* 1: Contre courant
469 2: Courant croises
470 3: Zone de pluie */
471 const cs_int_t nelect, /* Nombre d'elements sur chaque ligne
472 du maillage eau pour la zone de
473 noeuds par segment eau */
474 const cs_real_t deltat, /* Ecart de temperature impose en entree
475 de la zone d'echange */
476 const cs_real_t teau_cl, /* Teau en entree de la zone d'echange */
477 const cs_real_t fem_cl, /* debit en entree de la zone d'echange */
478 const cs_real_t xap, /* coefficient lambda de la loi d'echange */
479 const cs_real_t xnp, /* exposant n de la loi d'echange */
480
481 const cs_real_t surface, /* Surface arrivee d eau de la ct */
482
483 const cs_real_t dgout /* Diametre de goutte pour les zones
484 de pluie */
485 );
486
487 /*----------------------------------------------------------------------------
488 * Destruction des structures associees aux ventilateurs
489 *----------------------------------------------------------------------------*/
490
491 void
492 cs_ctwr_all_destroy(void);
493
494 /*----------------------------------------------------------------------------
495 * Resolution des variables eau
496 *----------------------------------------------------------------------------*/
497
498 void cs_ctwr_aeteau
499 (
500 cs_real_t temp[], /* Temperature air */
501 cs_real_t xa[], /* humidite air */
502 cs_real_t rho[], /* masse volumique air */
503 cs_real_t vitx[], /* vitesse air suivant x */
504 cs_real_t vity[], /* vitesse air suivant y */
505 cs_real_t vitz[] /* vitesse air suivant z */
506 );
507
508 /*----------------------------------------------------------------------------
509 * Calcul des termes source pour l'air
510 *----------------------------------------------------------------------------*/
511
512 void cs_ctwr_aetssc
513 (
514 const cs_int_t iscal, /* */
515
516 cs_real_t temp[], /* Temperature air */
517 cs_real_t xa[], /* humidite air */
518 cs_real_t rho[], /* masse volumique air */
519 cs_real_t utsim[], /* vitesse verticale air */
520 cs_real_t utsex[], /* vitesse horizontale air */
521 cs_real_t vitx[], /* vitesse air suivant x */
522 cs_real_t vity[], /* vitesse air suivant y */
523 cs_real_t vitz[] /* vitesse air suivant z */
524 );
525
526 /*----------------------------------------------------------------------------
527 * Calcul des PdC induites dans les zones de pluie
528 *----------------------------------------------------------------------------*/
529
530 void cs_ctwr_aetsvi
531 (
532 const cs_int_t idim,
533 const cs_real_t rho[], /* masse volumique air */
534 const cs_real_t vitx[], /* vitesse air suivant x */
535 const cs_real_t vity[], /* vitesse air suivant y */
536 const cs_real_t vitz[], /* vitesse air suivant z */
537 const cs_real_t xair[], /* humidite de l'air */
538 cs_real_t utsex[] /* terme source explicite */
539 );
540
541 /*----------------------------------------------------------------------------
542 * Bilan dans les ct
543 *----------------------------------------------------------------------------*/
544
545 void cs_ctwr_bilanct
546 (
547 const cs_real_t time, /* */
548 cs_real_t fem_entree[], /* debit eau entree */
549 cs_real_t fem_sortie[], /* debit eau sortie */
550 cs_real_t teau_entree[], /* temperature eau entree */
551 cs_real_t teau_sortie[], /* temperature eau sortie */
552 cs_real_t heau_entree[], /* enthalpie eau entree */
553 cs_real_t heau_sortie[], /* enthalpie eau sortie */
554 cs_real_t tair_entree[], /* temperature air entree */
555 cs_real_t tair_sortie[], /* temperature air sortie */
556 cs_real_t xair_entree[], /* */
557 cs_real_t xair_sortie[], /* */
558 cs_real_t hair_entree[], /* */
559 cs_real_t hair_sortie[], /* */
560 cs_real_t debit_entree[], /* */
561 cs_real_t debit_sortie[], /* */
562
563 const cs_real_t temp[], /* Temperature air */
564 const cs_real_t xa[], /* humidite air */
565 const cs_real_t flux_masse_fac[], /* vitesse verticale air */
566 const cs_real_t flux_masse_fbr[], /* vitesse horizontale air */
567 const cs_real_t vitx[], /* vitesse air suivant x */
568 const cs_real_t vity[], /* vitesse air suivant y */
569 const cs_real_t vitz[], /* vitesse air suivant z */
570 const cs_mesh_t *mesh, /* <-- structure maillage associee */
571 const cs_mesh_quantities_t *mesh_quantities /* <-- grandeurs du maillage */
572 );
573
574 /*----------------------------------------------------------------------------
575 * Initialict post-processing
576 *
577 * parameters:
578 * ct_id --> Id of exchange area
579 * writer_id --> Id of associated writer
580 *----------------------------------------------------------------------------*/
581
582 void
583 cs_ctwr_post_init(cs_int_t ct_id,
584 cs_int_t writer_id);
585
586 /*----------------------------------------------------------------------------
587 * Get pointer to exchange area.
588 *
589 * parameters:
590 * ct_id <-- Id (0 to n-1) of exchange area
591 *
592 * returns:
593 * pointer to exchange area structure
594 *----------------------------------------------------------------------------*/
595
596 cs_ctwr_zone_t *
597 cs_ctwr_by_id(cs_int_t ct_id);
598
599 /*----------------------------------------------------------------------------*/
600
601 END_C_DECLS
602
603 #endif /* __CS_CTWR_H__ */