programmer's documentation
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-2016 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  cs_real_t tracel[], /* --- work array for output cells */
88  cs_real_t trafbr[] /* --- work array for output boundary faces */
89 );
90 
91 /*----------------------------------------------------------------------------
92  * Find the nearest cell's center from a node
93  *----------------------------------------------------------------------------*/
94 
95 extern void CS_PROCF (findpt, FINDPT)
96 (
97  const cs_int_t *ncelet, /* <-- number of extended (real + ghost) cells */
98  const cs_int_t *ncel, /* <-- number of cells */
99  const cs_real_t *xyzcen, /* <-- cell centers */
100  const cs_real_t *xx, /* <-- node coordinate X */
101  const cs_real_t *yy, /* <-- node coordinate Y */
102  const cs_real_t *zz, /* <-- node coordinate Z */
103  cs_int_t *node, /* --> node we are looking for, zero if error */
104  cs_int_t *ndrang /* --> rank of associated process */
105 );
106 
107 /*----------------------------------------------------------------------------
108  * Generator for distribution function of p's
109  *----------------------------------------------------------------------------*/
110 
111 extern void CS_PROCF (fische, FISCHE)
112 (
113  const cs_int_t *n,
114  const cs_real_t *mu,
115  cs_int_t p[]);
116 
117 /*----------------------------------------------------------------------------
118  * Check necessity of extended mesh from FORTRAN options.
119  *
120  * Interface Fortran :
121  *
122  * SUBROUTINE HALTYP (IVOSET)
123  * *****************
124  *
125  * INTEGER IVOSET : <-- : Indicator of necessity of extended mesh
126  *----------------------------------------------------------------------------*/
127 
128 extern void
129 CS_PROCF (haltyp, HALTYP)(const cs_int_t *ivoset);
130 
131 /*----------------------------------------------------------------------------
132  * Main Fortran options initialization
133  *----------------------------------------------------------------------------*/
134 
135 extern void CS_PROCF (initi1, INITI1)
136 (
137  void
138 );
139 
140 /*----------------------------------------------------------------------------
141  * Free Fortran allocated memory
142  *----------------------------------------------------------------------------*/
143 
144 extern void CS_PROCF (memfin, MEMFIN) (void);
145 
146 /*----------------------------------------------------------------------------
147  * User function for enthalpy <-> temperature conversion
148  *----------------------------------------------------------------------------*/
149 
150 void CS_PROCF (usthht, USTHHT)
151 (
152  const cs_int_t *mode, /* <-- -1 : t -> h ; 1 : h -> t */
153  cs_real_t *enthal, /* <-- enthalpy */
154  cs_real_t *temper /* <-- temperature */
155 );
156 
157 /*----------------------------------------------------------------------------
158  * User function for output of variables on a post-processing mesh
159  *----------------------------------------------------------------------------*/
160 
161 void CS_PROCF (usvpst, USVPST)
162 (
163  const cs_int_t *nummai, /* <-- number or post-processing mesh */
164  const cs_int_t *nvar, /* <-- number of variables */
165  const cs_int_t *nscal, /* <-- number of scalars */
166  const cs_int_t *nvlsta, /* <-- number of statistical variables (lagr) */
167  const cs_int_t *ncelps, /* <-- number of post-processed cells */
168  const cs_int_t *nfacps, /* <-- number of post processed interior faces */
169  const cs_int_t *nfbrps, /* <-- number of post processed boundary faces */
170  const cs_int_t itypps[3], /* <-- flag (0 or 1) for presence of cells, */
171  /* interior faces, and boundary faces */
172  const cs_int_t lstcel[], /* <-- list of post-processed cells */
173  const cs_int_t lstfac[], /* <-- list of post-processed interior faces */
174  const cs_int_t lstfbr[] /* <-- list of post-processed boundary faces */
175 );
176 
177 /*----------------------------------------------------------------------------
178  * Uniform random number generator
179  *----------------------------------------------------------------------------*/
180 
181 void CS_PROCF (zufall, zufall)
182 (
183  const cs_int_t *n, /* --> size of the vector */
184  const cs_real_t *a /* <-- generated random number vector */
185 );
186 
187 /*----------------------------------------------------------------------------
188  * Gaussian random number generator
189  *----------------------------------------------------------------------------*/
190 
191 void CS_PROCF (normalen, normalen)
192 (
193  const cs_int_t *n, /* --> size of the vector */
194  const cs_real_t *x /* <-- generated random number vector */
195 );
196 
197 /*----------------------------------------------------------------------------
198  * Initialize Lagrangian module parameters for a given zone and class
199  *
200  * parameters:
201  * i_cz_params <-- integer parameters for this class and zone
202  * r_cz_params <-- real parameters for this class and zone
203  *----------------------------------------------------------------------------*/
204 
205 void
206 cs_lagr_init_zone_class_param(const cs_int_t i_cs_params[],
207  const cs_real_t r_cs_params[]);
208 
209 /*----------------------------------------------------------------------------
210  * Define Lagrangian module parameters for a given zone and class
211  *
212  * parameters:
213  * class_id <-- id of given particle class
214  * zone_id <-- id of given boundary zone
215  * i_cz_params <-- integer parameters for this class and zone
216  * r_cz_params <-- real parameters for this class and zone
217  *----------------------------------------------------------------------------*/
218 
219 void
221  cs_int_t zone_id,
222  const cs_int_t i_cs_params[],
223  const cs_real_t r_cs_params[]);
224 
225 /*----------------------------------------------------------------------------
226  * Return Lagrangian model status.
227  *
228  * parameters:
229  * model_flag --> 0 without Lagrangian, 1 or 2 with Lagrangian
230  * restart_flag --> 1 for Lagrangian restart, 0 otherwise
231  * frozen_flag --> 1 for frozen Eulerian flow, 0 otherwise
232  *----------------------------------------------------------------------------*/
233 
234 void
235 cs_lagr_status(int *model_flag,
236  int *restart_flag,
237  int *frozen_flag);
238 
239 /*============================================================================
240  * User function prototypes
241  *============================================================================*/
242 
243 /*----------------------------------------------------------------------------
244  * Define global options for couplings.
245  *
246  * These options allow defining the time step synchronization policy,
247  * as well as a time step multiplier.
248  *----------------------------------------------------------------------------*/
249 
250 void
251 cs_user_coupling(void);
252 
253 /*----------------------------------------------------------------------------
254  * This function is called at the end of each time step.
255  *
256  * It has a very general purpose, although it is recommended to handle
257  * mainly postprocessing or data-extraction type operations.
258  *----------------------------------------------------------------------------*/
259 
260 void
262 
263 /*----------------------------------------------------------------------------
264  * Define mesh joinings.
265  *----------------------------------------------------------------------------*/
266 
267 void
268 cs_user_join(void);
269 
270 /*----------------------------------------------------------------------------
271  * Define linear solver options.
272  *
273  * This function is called at the setup stage, once user and most model-based
274  * fields are defined.
275  *----------------------------------------------------------------------------*/
276 
277 void
279 
280 /*----------------------------------------------------------------------------
281  * Tag bad cells within the mesh based on geometric criteria.
282  *----------------------------------------------------------------------------*/
283 
284 void
286  cs_mesh_quantities_t *mesh_quantities);
287 
288 /*----------------------------------------------------------------------------
289  * Define mesh files to read and optional associated transformations.
290  *----------------------------------------------------------------------------*/
291 
292 void
293 cs_user_mesh_input(void);
294 
295 /*----------------------------------------------------------------------------
296  * Modifiy geometry and mesh.
297  *----------------------------------------------------------------------------*/
298 
299 void
301 
302 /*----------------------------------------------------------------------------
303  * Insert thin wall into a mesh.
304  *----------------------------------------------------------------------------*/
305 
306 void
308 
309 /*----------------------------------------------------------------------------
310  * Mesh smoothing.
311  *
312  * parameters:
313  * mesh <-> pointer to mesh structure to smoothe
314  *----------------------------------------------------------------------------*/
315 
316 void
318 
319 /*----------------------------------------------------------------------------
320  * Enable or disable mesh saving.
321  *
322  * By default, mesh is saved when modified.
323  *
324  * parameters:
325  * mesh <-> pointer to mesh structure
326  *----------------------------------------------------------------------------*/
327 
328 void
330 
331 /*----------------------------------------------------------------------------
332  * Set options for cutting of warped faces
333  *
334  * parameters:
335  * mesh <-> pointer to mesh structure to smoothe
336  *----------------------------------------------------------------------------*/
337 
338 void
340 
341 /*----------------------------------------------------------------------------
342  * Select physical model options, including user fields.
343  *
344  * This function is called at the earliest stages of the data setup.
345  *----------------------------------------------------------------------------*/
346 
347 void
348 cs_user_model(void);
349 
350 /*----------------------------------------------------------------------------
351  * Define advanced mesh numbering options.
352  *----------------------------------------------------------------------------*/
353 
354 void
355 cs_user_numbering(void);
356 
357 /*----------------------------------------------------------------------------
358  * Define parallel IO settings.
359  *----------------------------------------------------------------------------*/
360 
361 void
362 cs_user_parallel_io(void);
363 
364 /*----------------------------------------------------------------------------
365  * Define advanced partitioning options.
366  *----------------------------------------------------------------------------*/
367 
368 void
369 cs_user_partition(void);
370 
371 /*----------------------------------------------------------------------------
372  * Define sparse matrix tuning options.
373  *----------------------------------------------------------------------------*/
374 
375 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 time moments.
455  *----------------------------------------------------------------------------*/
456 
457 void
459 
460 /*----------------------------------------------------------------------------
461  * Define rotor/stator model.
462  *----------------------------------------------------------------------------*/
463 
464 void
466 
467 /*----------------------------------------------------------------------------
468  * Define rotor axes, associated cells, and rotor/stator faces.
469  *----------------------------------------------------------------------------*/
470 
471 void
473 
474 /*----------------------------------------------------------------------------*/
475 
477 
478 #endif /* __CS_PROTOTYPES_H__ */
void cs_user_partition(void)
Definition: cs_user_performance_tuning.c:139
void csinit(const cs_int_t *irgpar, const cs_int_t *nrgpar)
integer, save ncel
Definition: mesh.f90:50
void initi1(void)
Definition: initi1.f90:29
void cs_user_periodicity(void)
Definition: cs_user_mesh.c:285
void cs_user_turbomachinery(void)
Definition: cs_user_turbomachinery.c:77
void zufall(const cs_int_t *n, const cs_real_t *a)
void cs_user_mesh_thinwall(cs_mesh_t *mesh)
Definition: cs_user_mesh.c:492
void caltri(void)
Definition: caltri.f90:24
integer, save nvlsta
Definition: lagdim.f90:54
#define BEGIN_C_DECLS
Definition: cs_defs.h:419
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
void cs_user_postprocess_activate(int nt_max_abs, int nt_cur_abs, double t_cur_abs)
Definition: cs_user_postprocess.c:629
void cs_user_postprocess_meshes(void)
Definition: cs_user_postprocess.c:389
void cs_user_model(void)
Select physical model options, including user fields.
Definition: cs_user_parameters.c:109
void cs_user_coupling(void)
Definition: cs_user_coupling.c:75
void cs_user_mesh_modify(cs_mesh_t *mesh)
Definition: cs_user_mesh.c:546
Definition: cs_field_pointer.h:66
void cs_user_join(void)
Definition: cs_user_mesh.c:145
void cs_user_numbering(void)
Definition: cs_user_performance_tuning.c:78
void usthht(const cs_int_t *mode, cs_real_t *enthal, cs_real_t *temper)
integer, save ncelet
Definition: mesh.f90:46
void cs_user_mesh_save(cs_mesh_t *mesh)
Definition: cs_user_mesh.c:623
Definition: cs_mesh.h:62
double precision, dimension(:,:), pointer xyzcen
Definition: mesh.f90:114
void dvvpst(const cs_int_t *nummai, const cs_int_t *numtyp, const cs_int_t *nvar, const cs_int_t *nscal, const cs_int_t *nvlsta, const cs_int_t *nvisbr, const cs_int_t *ncelps, const cs_int_t *nfbrps, const cs_int_t lstcel[], const cs_int_t lstfbr[], cs_real_t tracel[], cs_real_t trafbr[])
void cs_user_matrix_tuning(void)
Definition: cs_user_performance_tuning.c:280
void cs_user_mesh_warping(void)
Definition: cs_user_mesh.c:471
void cs_user_solver(const cs_mesh_t *mesh, const cs_mesh_quantities_t *mesh_quantities)
Definition: cs_user_solver.c:86
void cs_lagr_status(int *model_flag, int *restart_flag, int *frozen_flag)
int cs_user_solver_set(void)
Definition: cs_user_solver.c:75
double precision, save a
Definition: cs_fuel_incl.f90:146
void memfin(void)
Definition: memfin.f90:24
void cs_user_linear_solvers(void)
Define linear solver options.
Definition: cs_user_parameters.c:191
integer, save nvisbr
Definition: lagdim.f90:54
Definition: cs_mesh_quantities.h:51
void usvpst(const cs_int_t *nummai, const cs_int_t *nvar, const cs_int_t *nscal, const cs_int_t *nvlsta, const cs_int_t *ncelps, const cs_int_t *nfacps, const cs_int_t *nfbrps, const cs_int_t itypps[3], const cs_int_t lstcel[], const cs_int_t lstfac[], const cs_int_t lstfbr[])
integer, save nvar
number of solved variables (must be lower than nvarmx)
Definition: dimens.f90:42
void fische(const cs_int_t *n, const cs_real_t *mu, cs_int_t p[])
void normalen(const cs_int_t *n, const cs_real_t *x)
void cs_user_time_moments(void)
Define time moments.
Definition: cs_user_parameters.c:207
void cs_user_extra_operations(void)
This function is called at the end of each time step.
Definition: cs_user_extra_operations.c:103
void cs_user_mesh_input(void)
Definition: cs_user_mesh.c:94
void cs_user_mesh_bad_cells_tag(cs_mesh_t *mesh, cs_mesh_quantities_t *mesh_quantities)
Definition: cs_user_mesh.c:644
void cs_user_postprocess_writers(void)
Definition: cs_user_postprocess.c:263
void findpt(const cs_int_t *ncelet, const cs_int_t *ncel, const cs_real_t *xyzcen, const cs_real_t *xx, const cs_real_t *yy, const cs_real_t *zz, cs_int_t *node, cs_int_t *ndrang)
void haltyp(const cs_int_t *ivoset)
#define END_C_DECLS
Definition: cs_defs.h:420
double cs_real_t
Definition: cs_defs.h:296
integer, save nscal
number of solved user scalars effective number of scalars solutions of an advection equation...
Definition: dimens.f90:55
#define CS_PROCF(x, y)
Definition: cs_defs.h:433
void cs_user_syrthes_coupling(void)
Definition: cs_user_coupling.c:125
void cs_user_turbomachinery_rotor(void)
Definition: cs_user_turbomachinery.c:96
Definition: cs_field_pointer.h:100
void cs_lagr_define_zone_class_param(cs_int_t class_id, cs_int_t zone_id, const cs_int_t i_cs_params[], const cs_real_t r_cs_params[])
void cs_user_parallel_io(void)
Definition: cs_user_performance_tuning.c:206
void cs_user_saturne_coupling(void)
Definition: cs_user_coupling.c:221
void cs_lagr_init_zone_class_param(const cs_int_t i_cs_params[], const cs_real_t r_cs_params[])
void cs_user_mesh_smoothe(cs_mesh_t *mesh)
Definition: cs_user_mesh.c:587
Definition: mesh.f90:26