programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_prototypes.h
Go to the documentation of this file.
1 #ifndef __CS_PROTOTYPES_H__
2 #define __CS_PROTOTYPES_H__
3 
4 /*============================================================================
5  * Prototypes for Fortran functions and subroutines callable from C
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  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_mesh.h"
36 #include "cs_mesh_quantities.h"
37 #include "cs_mesh_bad_cells.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*============================================================================
44  * Macro definitions
45  *============================================================================*/
46 
47 /*=============================================================================
48  * Fortran function/subroutine prototypes
49  *============================================================================*/
50 
51 /*----------------------------------------------------------------------------
52  * Main Fortran subroutine
53  *----------------------------------------------------------------------------*/
54 
55 extern void CS_PROCF (caltri, CALTRI)
56 (
57  void
58 );
59 
60 /*----------------------------------------------------------------------------
61  * Initialize Fortran base common block values
62  *----------------------------------------------------------------------------*/
63 
64 extern void CS_PROCF (csinit, CSINIT)
65 (
66  const cs_int_t *irgpar, /* <-- MPI Rank in parallel, -1 otherwise */
67  const cs_int_t *nrgpar /* <-- Number of MPI processes, or 1 */
68 );
69 
70 /*----------------------------------------------------------------------------
71  * Developer function for output of variables on a post-processing mesh
72  *----------------------------------------------------------------------------*/
73 
74 extern void CS_PROCF (dvvpst, DVVPST)
75 (
76  const cs_int_t *nummai, /* <-- number or post-processing mesh */
77  const cs_int_t *numtyp, /* <-- number or post-processing type
78  * (-1 as volume, -2 as boundary, or nummai) */
79  const cs_int_t *nvar, /* <-- number of variables */
80  const cs_int_t *nscal, /* <-- number of scalars */
81  const cs_int_t *nvlsta, /* <-- number of statistical variables (lagr) */
82  const cs_int_t *nvisbr, /* <-- number of boundary stat. variables (lagr) */
83  const cs_int_t *ncelps, /* <-- number of post-processed cells */
84  const cs_int_t *nfbrps, /* <-- number of post processed boundary faces */
85  const cs_int_t lstcel[], /* <-- list of post-processed cells */
86  const cs_int_t lstfbr[], /* <-- list of post-processed boundary faces */
87  const cs_real_t rtp[], /* <-- cell variables */
88  const cs_real_t propce[], /* <-- cell physical properties */
89  cs_real_t tracel[], /* --- work array for output cells */
90  cs_real_t trafbr[] /* --- work array for output boundary faces */
91 );
92 
93 /*----------------------------------------------------------------------------
94  * Find the nearest cell's center from a node
95  *----------------------------------------------------------------------------*/
96 
97 extern void CS_PROCF (findpt, FINDPT)
98 (
99  const cs_int_t *ncelet, /* <-- number of extended (real + ghost) cells */
100  const cs_int_t *ncel, /* <-- number of cells */
101  const cs_real_t *xyzcen, /* <-- cell centers */
102  const cs_real_t *xx, /* <-- node coordinate X */
103  const cs_real_t *yy, /* <-- node coordinate Y */
104  const cs_real_t *zz, /* <-- node coordinate Z */
105  cs_int_t *node, /* --> node we are looking for, zero if error */
106  cs_int_t *ndrang /* --> rank of associated process */
107 );
108 
109 /*----------------------------------------------------------------------------
110  * Generator for distribution function of p's
111  *----------------------------------------------------------------------------*/
112 
113 extern void CS_PROCF (fische, FISCHE)
114 (
115  const cs_int_t *n,
116  const cs_real_t *mu,
117  cs_int_t p[]);
118 
119 /*----------------------------------------------------------------------------
120  * Check necessity of extended mesh from FORTRAN options.
121  *
122  * Interface Fortran :
123  *
124  * SUBROUTINE HALTYP (IVOSET)
125  * *****************
126  *
127  * INTEGER IVOSET : <-- : Indicator of necessity of extended mesh
128  *----------------------------------------------------------------------------*/
129 
130 extern void
131 CS_PROCF (haltyp, HALTYP)(const cs_int_t *ivoset);
132 
133 /*----------------------------------------------------------------------------
134  * Main Fortran options initialization
135  *----------------------------------------------------------------------------*/
136 
137 extern void CS_PROCF (initi1, INITI1)
138 (
139  void
140 );
141 
142 /*----------------------------------------------------------------------------
143  * Free Fortran allocated memory
144  *----------------------------------------------------------------------------*/
145 
146 extern void CS_PROCF (memfin, MEMFIN) (void);
147 
148 /*----------------------------------------------------------------------------
149  * Mesh renumbering for vector processors
150  *----------------------------------------------------------------------------*/
151 
152 extern void CS_PROCF (numvec, NUMVEC)
153 (
154  const cs_int_t *ncelet, /* <-- number of extended (real + ghost) cells */
155  const cs_int_t *ncel, /* <-- number of local cells */
156  const cs_int_t *nfac, /* <-- number of interior faces */
157  const cs_int_t *nfabor, /* <-- number of boundary faces */
158  const cs_int_t *lregis, /* <-- vector registor length */
159  cs_int_t *irveci, /* <-> interior face vectorization indic. */
160  cs_int_t *irvecb, /* <-> boundary face vectorization indic. */
161  cs_int_t ifacel[], /* <-- interior face->cell connectivity */
162  cs_int_t ifabor[], /* <-- boundary face->cell connectivity */
163  cs_int_t inumfi[], /* <-> interior faces renumbering (size: nfac) */
164  cs_int_t inumfb[], /* <-> boundary faces renumbering (size: nfabor) */
165  cs_int_t iworkf[], /* --- work array, size: max(nfac, nfabor) */
166  cs_int_t ismbs[] /* --- work array, size: ncelet */
167 );
168 
169 /*----------------------------------------------------------------------------
170  * Test renumbering for vector processors
171  *----------------------------------------------------------------------------*/
172 
173 extern void CS_PROCF (tstvec, TSTVEC)
174 (
175  const cs_int_t *ncelet, /* <-- number of extended (real + ghost) cells */
176  const cs_int_t *ncel, /* <-- number of local cells */
177  const cs_int_t *nfac, /* <-- number of interior faces */
178  const cs_int_t *nfabor, /* <-- number of boundary faces */
179  const cs_int_t ifacel[], /* <-- interior face->cell connectivity */
180  const cs_int_t ifabor[], /* <-- boundary face->cell connectivity */
181  cs_int_t iworkf[], /* --- work array, size: max(nfac, nfabor) */
182  cs_int_t ismbs[], /* --- work array, size: ncelet */
183  cs_int_t ismbv[], /* --- work array, size: ncelet */
184  cs_real_t rworkf[], /* --- work array, size: max(nfac, nfabor) */
185  cs_real_t rsmbs[], /* --- work array, size: ncelet */
186  cs_real_t rsmbv[] /* --- work array, size: ncelet */
187 );
188 
189 /*----------------------------------------------------------------------------
190  * User function for output of variables on a post-processing mesh
191  *----------------------------------------------------------------------------*/
192 
193 void CS_PROCF (usvpst, USVPST)
194 (
195  const cs_int_t *nummai, /* <-- number or post-processing mesh */
196  const cs_int_t *nvar, /* <-- number of variables */
197  const cs_int_t *nscal, /* <-- number of scalars */
198  const cs_int_t *nvlsta, /* <-- number of statistical variables (lagr) */
199  const cs_int_t *ncelps, /* <-- number of post-processed cells */
200  const cs_int_t *nfacps, /* <-- number of post processed interior faces */
201  const cs_int_t *nfbrps, /* <-- number of post processed boundary faces */
202  const cs_int_t itypps[3], /* <-- flag (0 or 1) for presence of cells, */
203  /* interior faces, and boundary faces */
204  const cs_int_t lstcel[], /* <-- list of post-processed cells */
205  const cs_int_t lstfac[], /* <-- list of post-processed interior faces */
206  const cs_int_t lstfbr[], /* <-- list of post-processed boundary faces */
207  const cs_real_t dt[], /* <-- local time step */
208  const cs_real_t rtpa[], /* <-- cell variables at previous time step */
209  const cs_real_t rtp[], /* <-- cell variables */
210  const cs_real_t propce[] /* <-- cell physical properties */
211 );
212 
213 /*----------------------------------------------------------------------------
214  * Uniform random number generator
215  *----------------------------------------------------------------------------*/
216 
217 void CS_PROCF (zufall, zufall)
218 (
219  const cs_int_t *n, /* --> size of the vector */
220  const cs_real_t *a /* <-- generated random number vector */
221 );
222 
223 /*----------------------------------------------------------------------------
224  * Gaussian random number generator
225  *----------------------------------------------------------------------------*/
226 
227 void CS_PROCF (normalen, normalen)
228 (
229  const cs_int_t *n, /* --> size of the vector */
230  const cs_real_t *x /* <-- generated random number vector */
231 );
232 
233 /*----------------------------------------------------------------------------
234  * Initialize Lagrangian module parameters for a given zone and class
235  *
236  * parameters:
237  * i_cz_params <-- integer parameters for this class and zone
238  * r_cz_params <-- real parameters for this class and zone
239  *----------------------------------------------------------------------------*/
240 
241 void
242 cs_lagr_init_zone_class_param(const cs_int_t i_cs_params[],
243  const cs_real_t r_cs_params[]);
244 
245 /*----------------------------------------------------------------------------
246  * Define Lagrangian module parameters for a given zone and class
247  *
248  * parameters:
249  * class_id <-- id of given particle class
250  * zone_id <-- id of given boundary zone
251  * i_cz_params <-- integer parameters for this class and zone
252  * r_cz_params <-- real parameters for this class and zone
253  *----------------------------------------------------------------------------*/
254 
255 void
257  cs_int_t zone_id,
258  const cs_int_t i_cs_params[],
259  const cs_real_t r_cs_params[]);
260 
261 /*----------------------------------------------------------------------------
262  * Return Lagrangian model status.
263  *
264  * parameters:
265  * model_flag --> 0 without Lagrangian, 1 or 2 with Lagrangian
266  * restart_flag --> 1 for Lagrangian restart, 0 otherwise
267  * frozen_flag --> 1 for frozen Eulerian flow, 0 otherwise
268  *----------------------------------------------------------------------------*/
269 
270 void
271 cs_lagr_status(int *model_flag,
272  int *restart_flag,
273  int *frozen_flag);
274 
275 /*============================================================================
276  * User function prototypes
277  *============================================================================*/
278 
279 /*----------------------------------------------------------------------------
280  * Define global options for couplings.
281  *
282  * These options allow defining the time step synchronization policy,
283  * as well as a time step multiplier.
284  *----------------------------------------------------------------------------*/
285 
286 void
287 cs_user_coupling(void);
288 
289 /*----------------------------------------------------------------------------
290  * Define mesh joinings.
291  *----------------------------------------------------------------------------*/
292 
293 void
294 cs_user_join(void);
295 
296 /*----------------------------------------------------------------------------
297  * Tag bad cells within the mesh based on geometric criteria.
298  *----------------------------------------------------------------------------*/
299 
300 void
302  cs_mesh_quantities_t *mesh_quantities);
303 
304 /*----------------------------------------------------------------------------
305  * Define mesh files to read and optional associated transformations.
306  *----------------------------------------------------------------------------*/
307 
308 void
309 cs_user_mesh_input(void);
310 
311 /*----------------------------------------------------------------------------
312  * Modifiy geometry and mesh.
313  *----------------------------------------------------------------------------*/
314 
315 void
317 
318 /*----------------------------------------------------------------------------
319  * Insert thin wall into a mesh.
320  *----------------------------------------------------------------------------*/
321 
322 void
324 
325 /*----------------------------------------------------------------------------
326  * Mesh smoothing.
327  *
328  * parameters:
329  * mesh <-> pointer to mesh structure to smoothe
330  *----------------------------------------------------------------------------*/
331 
332 void
334 
335 /*----------------------------------------------------------------------------
336  * Enable or disable mesh saving.
337  *
338  * By default, mesh is saved when modified.
339  *
340  * parameters:
341  * mesh <-> pointer to mesh structure
342  *----------------------------------------------------------------------------*/
343 
344 void
346 
347 /*----------------------------------------------------------------------------
348  * Set options for cutting of warped faces
349  *
350  * parameters:
351  * mesh <-> pointer to mesh structure to smoothe
352  *----------------------------------------------------------------------------*/
353 
354 void
356 
357 /*----------------------------------------------------------------------------
358  * Define advanced mesh numbering options.
359  *----------------------------------------------------------------------------*/
360 
361 void
362 cs_user_numbering(void);
363 
364 /*----------------------------------------------------------------------------
365  * Define parallel IO settings.
366  *----------------------------------------------------------------------------*/
367 
368 void
369 cs_user_parallel_io(void);
370 
371 /*----------------------------------------------------------------------------
372  * Define advanced partitioning options.
373  *----------------------------------------------------------------------------*/
374 
375 void
376 cs_user_partition(void);
377 
378 /*----------------------------------------------------------------------------
379  * Define periodic faces.
380  *----------------------------------------------------------------------------*/
381 
382 void
383 cs_user_periodicity(void);
384 
385 /*----------------------------------------------------------------------------
386  * Define post-processing writers.
387  *
388  * The default output format and frequency may be configured, and additional
389  * post-processing writers allowing outputs in different formats or with
390  * different format options and output frequency than the main writer may
391  * be defined.
392  *----------------------------------------------------------------------------*/
393 
394 void
396 
397 /*----------------------------------------------------------------------------
398  * Define post-processing meshes.
399  *
400  * The main post-processing meshes may be configured, and additional
401  * post-processing meshes may be defined as a subset of the main mesh's
402  * cells or faces (both interior and boundary).
403  *----------------------------------------------------------------------------*/
404 
405 void
407 
408 /*----------------------------------------------------------------------------
409  * Override default frequency or calculation end based output.
410  *
411  * This allows fine-grained control of activation or deactivation,
412  *
413  * parameters:
414  * nt_max_abs <-- maximum time step number
415  * nt_cur_abs <-- current time step number
416  * t_cur_abs <-- absolute time at the current time step
417  *----------------------------------------------------------------------------*/
418 
419 void
420 cs_user_postprocess_activate(int nt_max_abs,
421  int nt_cur_abs,
422  double t_cur_abs);
423 
424 /*----------------------------------------------------------------------------
425  * Define couplings with other instances of Code_Saturne.
426  *----------------------------------------------------------------------------*/
427 
428 void
430 
431 /*----------------------------------------------------------------------------
432  * Set user solver.
433  *----------------------------------------------------------------------------*/
434 
435 int
436 cs_user_solver_set(void);
437 
438 /*----------------------------------------------------------------------------
439  * Main call to user solver.
440  *----------------------------------------------------------------------------*/
441 
442 void
444  const cs_mesh_quantities_t *mesh_quantities);
445 
446 /*----------------------------------------------------------------------------
447  * Define couplings with SYRTHES code.
448  *----------------------------------------------------------------------------*/
449 
450 void
452 
453 /*----------------------------------------------------------------------------
454  * Define rotor/stator model.
455  *----------------------------------------------------------------------------*/
456 
457 void
459 
460 /*----------------------------------------------------------------------------
461  * Define rotor axes, associated cells, and rotor/stator faces.
462  *----------------------------------------------------------------------------*/
463 
464 void
466 
467 /*----------------------------------------------------------------------------*/
468 
470 
471 #endif /* __CS_PROTOTYPES_H__ */