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-2015 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 #include "cs_cdo_connect.h"
40 #include "cs_cdo_quantities.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*=============================================================================
51  * Fortran function/subroutine prototypes
52  *============================================================================*/
53 
54 /*----------------------------------------------------------------------------
55  * Main Fortran subroutine
56  *----------------------------------------------------------------------------*/
57 
58 extern void CS_PROCF (caltri, CALTRI)
59 (
60  void
61 );
62 
63 /*----------------------------------------------------------------------------
64  * Initialize Fortran base common block values
65  *----------------------------------------------------------------------------*/
66 
67 extern void CS_PROCF (csinit, CSINIT)
68 (
69  const cs_int_t *irgpar, /* <-- MPI Rank in parallel, -1 otherwise */
70  const cs_int_t *nrgpar /* <-- Number of MPI processes, or 1 */
71 );
72 
73 /*----------------------------------------------------------------------------
74  * Developer function for output of variables on a post-processing mesh
75  *----------------------------------------------------------------------------*/
76 
77 extern void CS_PROCF (dvvpst, DVVPST)
78 (
79  const cs_int_t *nummai, /* <-- number or post-processing mesh */
80  const cs_int_t *numtyp, /* <-- number or post-processing type
81  * (-1 as volume, -2 as boundary, or nummai) */
82  const cs_int_t *nvar, /* <-- number of variables */
83  const cs_int_t *nscal, /* <-- number of scalars */
84  const cs_int_t *nvlsta, /* <-- number of statistical variables (lagr) */
85  const cs_int_t *nvisbr, /* <-- number of boundary stat. variables (lagr) */
86  const cs_int_t *ncelps, /* <-- number of post-processed cells */
87  const cs_int_t *nfbrps, /* <-- number of post processed boundary faces */
88  const cs_int_t lstcel[], /* <-- list of post-processed cells */
89  const cs_int_t lstfbr[], /* <-- list of post-processed boundary faces */
90  cs_real_t tracel[], /* --- work array for output cells */
91  cs_real_t trafbr[] /* --- work array for output boundary faces */
92 );
93 
94 /*----------------------------------------------------------------------------
95  * Find the nearest cell's center from a node
96  *----------------------------------------------------------------------------*/
97 
98 extern void CS_PROCF (findpt, FINDPT)
99 (
100  const cs_int_t *ncelet, /* <-- number of extended (real + ghost) cells */
101  const cs_int_t *ncel, /* <-- number of cells */
102  const cs_real_t *xyzcen, /* <-- cell centers */
103  const cs_real_t *xx, /* <-- node coordinate X */
104  const cs_real_t *yy, /* <-- node coordinate Y */
105  const cs_real_t *zz, /* <-- node coordinate Z */
106  cs_int_t *node, /* --> node we are looking for, zero if error */
107  cs_int_t *ndrang /* --> rank of associated process */
108 );
109 
110 /*----------------------------------------------------------------------------
111  * Generator for distribution function of p's
112  *----------------------------------------------------------------------------*/
113 
114 extern void CS_PROCF (fische, FISCHE)
115 (
116  const cs_int_t *n,
117  const cs_real_t *mu,
118  cs_int_t p[]);
119 
120 /*----------------------------------------------------------------------------
121  * Check necessity of extended mesh from FORTRAN options.
122  *
123  * Interface Fortran :
124  *
125  * SUBROUTINE HALTYP (IVOSET)
126  * *****************
127  *
128  * INTEGER IVOSET : <-- : Indicator of necessity of extended mesh
129  *----------------------------------------------------------------------------*/
130 
131 extern void
132 CS_PROCF (haltyp, HALTYP)(const cs_int_t *ivoset);
133 
134 /*----------------------------------------------------------------------------
135  * Main Fortran options initialization
136  *----------------------------------------------------------------------------*/
137 
138 extern void CS_PROCF (initi1, INITI1)
139 (
140  void
141 );
142 
143 /*----------------------------------------------------------------------------
144  * Free Fortran allocated memory
145  *----------------------------------------------------------------------------*/
146 
147 extern void CS_PROCF (memfin, MEMFIN) (void);
148 
149 /*----------------------------------------------------------------------------
150  * User function for enthalpy <-> temperature conversion
151  *----------------------------------------------------------------------------*/
152 
153 void CS_PROCF (usthht, USTHHT)
154 (
155  const cs_int_t *mode, /* <-- -1 : t -> h ; 1 : h -> t */
156  cs_real_t *enthal, /* <-- enthalpy */
157  cs_real_t *temper /* <-- temperature */
158 );
159 
160 /*----------------------------------------------------------------------------
161  * User function for output of variables on a post-processing mesh
162  *----------------------------------------------------------------------------*/
163 
164 void CS_PROCF (usvpst, USVPST)
165 (
166  const cs_int_t *nummai, /* <-- number or post-processing mesh */
167  const cs_int_t *nvar, /* <-- number of variables */
168  const cs_int_t *nscal, /* <-- number of scalars */
169  const cs_int_t *nvlsta, /* <-- number of statistical variables (lagr) */
170  const cs_int_t *ncelps, /* <-- number of post-processed cells */
171  const cs_int_t *nfacps, /* <-- number of post processed interior faces */
172  const cs_int_t *nfbrps, /* <-- number of post processed boundary faces */
173  const cs_int_t itypps[3], /* <-- flag (0 or 1) for presence of cells, */
174  /* interior faces, and boundary faces */
175  const cs_int_t lstcel[], /* <-- list of post-processed cells */
176  const cs_int_t lstfac[], /* <-- list of post-processed interior faces */
177  const cs_int_t lstfbr[] /* <-- list of post-processed boundary faces */
178 );
179 
180 /*----------------------------------------------------------------------------
181  * Uniform random number generator
182  *----------------------------------------------------------------------------*/
183 
184 void CS_PROCF (zufall, zufall)
185 (
186  const cs_int_t *n, /* --> size of the vector */
187  const cs_real_t *a /* <-- generated random number vector */
188 );
189 
190 /*----------------------------------------------------------------------------
191  * Gaussian random number generator
192  *----------------------------------------------------------------------------*/
193 
194 void CS_PROCF (normalen, normalen)
195 (
196  const cs_int_t *n, /* --> size of the vector */
197  const cs_real_t *x /* <-- generated random number vector */
198 );
199 
200 /*----------------------------------------------------------------------------
201  * Initialize Lagrangian module parameters for a given zone and class
202  *
203  * parameters:
204  * i_cz_params <-- integer parameters for this class and zone
205  * r_cz_params <-- real parameters for this class and zone
206  *----------------------------------------------------------------------------*/
207 
208 void
209 cs_lagr_init_zone_class_param(const cs_int_t i_cs_params[],
210  const cs_real_t r_cs_params[]);
211 
212 /*----------------------------------------------------------------------------
213  * Define Lagrangian module parameters for a given zone and class
214  *
215  * parameters:
216  * class_id <-- id of given particle class
217  * zone_id <-- id of given boundary zone
218  * i_cz_params <-- integer parameters for this class and zone
219  * r_cz_params <-- real parameters for this class and zone
220  *----------------------------------------------------------------------------*/
221 
222 void
224  cs_int_t zone_id,
225  const cs_int_t i_cs_params[],
226  const cs_real_t r_cs_params[]);
227 
228 /*----------------------------------------------------------------------------
229  * Return Lagrangian model status.
230  *
231  * parameters:
232  * model_flag --> 0 without Lagrangian, 1 or 2 with Lagrangian
233  * restart_flag --> 1 for Lagrangian restart, 0 otherwise
234  * frozen_flag --> 1 for frozen Eulerian flow, 0 otherwise
235  *----------------------------------------------------------------------------*/
236 
237 void
238 cs_lagr_status(int *model_flag,
239  int *restart_flag,
240  int *frozen_flag);
241 
242 /*============================================================================
243  * User function prototypes
244  *============================================================================*/
245 
246 /*----------------------------------------------------------------------------
247  * Define global options for couplings.
248  *
249  * These options allow defining the time step synchronization policy,
250  * as well as a time step multiplier.
251  *----------------------------------------------------------------------------*/
252 
253 void
254 cs_user_coupling(void);
255 
256 /*----------------------------------------------------------------------------
257  * This function is called at the end of each time step.
258  *
259  * It has a very general purpose, although it is recommended to handle
260  * mainly postprocessing or data-extraction type operations.
261  *----------------------------------------------------------------------------*/
262 
263 void
265 
266 /*----------------------------------------------------------------------------
267  * Define mesh joinings.
268  *----------------------------------------------------------------------------*/
269 
270 void
271 cs_user_join(void);
272 
273 /*----------------------------------------------------------------------------
274  * Define linear solver options.
275  *
276  * This function is called at the setup stage, once user and most model-based
277  * fields are defined.
278  *----------------------------------------------------------------------------*/
279 
280 void
282 
283 /*----------------------------------------------------------------------------
284  * Tag bad cells within the mesh based on geometric criteria.
285  *----------------------------------------------------------------------------*/
286 
287 void
289  cs_mesh_quantities_t *mesh_quantities);
290 
291 /*----------------------------------------------------------------------------
292  * Define mesh files to read and optional associated transformations.
293  *----------------------------------------------------------------------------*/
294 
295 void
296 cs_user_mesh_input(void);
297 
298 /*----------------------------------------------------------------------------
299  * Modifiy geometry and mesh.
300  *----------------------------------------------------------------------------*/
301 
302 void
304 
305 /*----------------------------------------------------------------------------
306  * Insert thin wall into a mesh.
307  *----------------------------------------------------------------------------*/
308 
309 void
311 
312 /*----------------------------------------------------------------------------
313  * Mesh smoothing.
314  *
315  * parameters:
316  * mesh <-> pointer to mesh structure to smoothe
317  *----------------------------------------------------------------------------*/
318 
319 void
321 
322 /*----------------------------------------------------------------------------
323  * Enable or disable mesh saving.
324  *
325  * By default, mesh is saved when modified.
326  *
327  * parameters:
328  * mesh <-> pointer to mesh structure
329  *----------------------------------------------------------------------------*/
330 
331 void
333 
334 /*----------------------------------------------------------------------------
335  * Set options for cutting of warped faces
336  *
337  * parameters:
338  * mesh <-> pointer to mesh structure to smoothe
339  *----------------------------------------------------------------------------*/
340 
341 void
343 
344 /*----------------------------------------------------------------------------
345  * Select physical model options, including user fields.
346  *
347  * This function is called at the earliest stages of the data setup.
348  *----------------------------------------------------------------------------*/
349 
350 void
351 cs_user_model(void);
352 
353 /*----------------------------------------------------------------------------
354  * Define advanced mesh numbering options.
355  *----------------------------------------------------------------------------*/
356 
357 void
358 cs_user_numbering(void);
359 
360 /*----------------------------------------------------------------------------
361  * Define parallel IO settings.
362  *----------------------------------------------------------------------------*/
363 
364 void
365 cs_user_parallel_io(void);
366 
367 /*----------------------------------------------------------------------------
368  * Define advanced partitioning options.
369  *----------------------------------------------------------------------------*/
370 
371 void
372 cs_user_partition(void);
373 
374 /*----------------------------------------------------------------------------
375  * Define sparse matrix tuning options.
376  *----------------------------------------------------------------------------*/
377 
378 void
380 
381 /*----------------------------------------------------------------------------
382  * Define or modify general numerical and physical user parameters.
383  *
384  * At the calling point of this function, most model-related most varibles
385  * and other fields have been defined, so speciic settings related to those
386  * fields may be set here.
387  *----------------------------------------------------------------------------*/
388 
389 void
390 cs_user_parameters(void);
391 
392 /*----------------------------------------------------------------------------
393  * Define periodic faces.
394  *----------------------------------------------------------------------------*/
395 
396 void
397 cs_user_periodicity(void);
398 
399 /*----------------------------------------------------------------------------
400  * Define post-processing writers.
401  *
402  * The default output format and frequency may be configured, and additional
403  * post-processing writers allowing outputs in different formats or with
404  * different format options and output frequency than the main writer may
405  * be defined.
406  *----------------------------------------------------------------------------*/
407 
408 void
410 
411 /*----------------------------------------------------------------------------
412  * Define post-processing meshes.
413  *
414  * The main post-processing meshes may be configured, and additional
415  * post-processing meshes may be defined as a subset of the main mesh's
416  * cells or faces (both interior and boundary).
417  *----------------------------------------------------------------------------*/
418 
419 void
421 
422 /*----------------------------------------------------------------------------
423  * Override default frequency or calculation end based output.
424  *
425  * This allows fine-grained control of activation or deactivation,
426  *
427  * parameters:
428  * nt_max_abs <-- maximum time step number
429  * nt_cur_abs <-- current time step number
430  * t_cur_abs <-- absolute time at the current time step
431  *----------------------------------------------------------------------------*/
432 
433 void
434 cs_user_postprocess_activate(int nt_max_abs,
435  int nt_cur_abs,
436  double t_cur_abs);
437 
438 /*----------------------------------------------------------------------------
439  * Define couplings with other instances of Code_Saturne.
440  *----------------------------------------------------------------------------*/
441 
442 void
444 
445 /*----------------------------------------------------------------------------
446  * Set user solver.
447  *----------------------------------------------------------------------------*/
448 
449 int
450 cs_user_solver_set(void);
451 
452 /*----------------------------------------------------------------------------
453  * Main call to user solver.
454  *----------------------------------------------------------------------------*/
455 
456 void
458  const cs_mesh_quantities_t *mesh_quantities);
459 
460 /*----------------------------------------------------------------------------
461  * Define couplings with SYRTHES code.
462  *----------------------------------------------------------------------------*/
463 
464 void
466 
467 /*----------------------------------------------------------------------------
468  * Define time moments.
469  *----------------------------------------------------------------------------*/
470 
471 void
473 
474 /*----------------------------------------------------------------------------
475  * Define rotor/stator model.
476  *----------------------------------------------------------------------------*/
477 
478 void
480 
481 /*----------------------------------------------------------------------------
482  * Define rotor axes, associated cells, and rotor/stator faces.
483  *----------------------------------------------------------------------------*/
484 
485 void
487 
488 
489 /*============================================================================
490  * CDO User function prototypes
491  *============================================================================*/
492 
493 /*----------------------------------------------------------------------------*/
497 /*----------------------------------------------------------------------------*/
498 
499 void
500 cs_user_cdo_setup(void);
501 
502 /*----------------------------------------------------------------------------*/
509 /*----------------------------------------------------------------------------*/
510 
513 
514 /*----------------------------------------------------------------------------*/
518 /*----------------------------------------------------------------------------*/
519 
520 void
522 
523 /*----------------------------------------------------------------------------*/
527 /*----------------------------------------------------------------------------*/
528 
529 void
531 
532 /*----------------------------------------------------------------------------*/
537 /*----------------------------------------------------------------------------*/
538 
539 void
541 
542 /*----------------------------------------------------------------------------*/
553 /*----------------------------------------------------------------------------*/
554 
555 void
557  const cs_mesh_quantities_t *mq,
558  const cs_cdo_connect_t *connect,
559  const cs_cdo_quantities_t *quant,
560  double tcur);
561 
562 /*----------------------------------------------------------------------------*/
563 
565 
566 #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 cs_user_cdo_itsol_settings(void)
Setup advanced features concerning the resolution of linear systems within the CDO framework...
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:625
cs_cdo_cc_algo_t
Definition: cs_cdo_quantities.h:53
void cs_user_postprocess_meshes(void)
Definition: cs_user_postprocess.c:385
void cs_user_model(void)
Select physical model options, including user fields.
Definition: cs_user_parameters.c:110
void cs_user_coupling(void)
Definition: cs_user_coupling.c:75
void cs_user_cdo_setup(void)
Initialize the specifications for the current simulation.
Definition: cs_user_cdo.c:95
void cs_user_mesh_modify(cs_mesh_t *mesh)
Definition: cs_user_mesh.c:546
Definition: cs_cdo_connect.h:86
Definition: cs_field_pointer.h:66
void cs_user_join(void)
Definition: cs_user_mesh.c:145
void cs_user_cdo_extra_op(const cs_mesh_t *m, const cs_mesh_quantities_t *mq, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, double tcur)
Additional operations on results produced by CDO schemes. Define advanced post-processing and/or anal...
Definition: cs_user_cdo_extra_op.c:108
void cs_user_numbering(void)
Definition: cs_user_performance_tuning.c:78
Definition: cs_cdo_quantities.h:94
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
void cs_user_parameters(void)
Define or modify general numerical and physical user parameters.
Definition: cs_user_parameters.c:186
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:207
integer, save nvisbr
Definition: lagdim.f90:54
Definition: cs_mesh_quantities.h:51
void cs_user_cdo_numeric_settings(void)
Setup advanced features concerning the numerical parameters.
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:223
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:259
cs_cdo_cc_algo_t cs_user_cdo_geometric_settings(void)
Setup advanced features concerning the way geometric quantities are built.
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)
void cs_user_cdo_hodge_settings(void)
Setup advanced features concerning the discrete Hodge operators.
#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:443
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