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_domain.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*=============================================================================
50  * Fortran function/subroutine prototypes
51  *============================================================================*/
52 
53 /*----------------------------------------------------------------------------
54  * Main Fortran subroutine
55  *----------------------------------------------------------------------------*/
56 
57 extern void CS_PROCF (caltri, CALTRI)
58 (
59  void
60 );
61 
62 /*----------------------------------------------------------------------------
63  * Initialize Fortran base common block values
64  *----------------------------------------------------------------------------*/
65 
66 extern void CS_PROCF (csinit, CSINIT)
67 (
68  const cs_int_t *irgpar, /* <-- MPI Rank in parallel, -1 otherwise */
69  const cs_int_t *nrgpar /* <-- Number of MPI processes, or 1 */
70 );
71 
72 /*----------------------------------------------------------------------------
73  * Developer function for output of variables on a post-processing mesh
74  *----------------------------------------------------------------------------*/
75 
76 extern void CS_PROCF (dvvpst, DVVPST)
77 (
78  const cs_int_t *nummai, /* <-- number or post-processing mesh */
79  const cs_int_t *numtyp, /* <-- number or post-processing type
80  * (-1 as volume, -2 as boundary, or nummai) */
81  const cs_int_t *nvar, /* <-- number of variables */
82  const cs_int_t *nscal, /* <-- number of scalars */
83  const cs_int_t *nvlsta, /* <-- number of statistical variables (lagr) */
84  const cs_int_t *nvisbr, /* <-- number of boundary stat. variables (lagr) */
85  const cs_int_t *ncelps, /* <-- number of post-processed cells */
86  const cs_int_t *nfbrps, /* <-- number of post processed boundary faces */
87  const cs_int_t lstcel[], /* <-- list of post-processed cells */
88  const cs_int_t lstfbr[], /* <-- list of post-processed boundary faces */
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  * User function for enthalpy <-> temperature conversion
150  *----------------------------------------------------------------------------*/
151 
152 void CS_PROCF (usthht, USTHHT)
153 (
154  const cs_int_t *mode, /* <-- -1 : t -> h ; 1 : h -> t */
155  cs_real_t *enthal, /* <-- enthalpy */
156  cs_real_t *temper /* <-- temperature */
157 );
158 
159 /*----------------------------------------------------------------------------
160  * User function for output of variables on a post-processing mesh
161  *----------------------------------------------------------------------------*/
162 
163 void CS_PROCF (usvpst, USVPST)
164 (
165  const cs_int_t *nummai, /* <-- number or post-processing mesh */
166  const cs_int_t *nvar, /* <-- number of variables */
167  const cs_int_t *nscal, /* <-- number of scalars */
168  const cs_int_t *nvlsta, /* <-- number of statistical variables (lagr) */
169  const cs_int_t *ncelps, /* <-- number of post-processed cells */
170  const cs_int_t *nfacps, /* <-- number of post processed interior faces */
171  const cs_int_t *nfbrps, /* <-- number of post processed boundary faces */
172  const cs_int_t itypps[3], /* <-- flag (0 or 1) for presence of cells, */
173  /* interior faces, and boundary faces */
174  const cs_int_t lstcel[], /* <-- list of post-processed cells */
175  const cs_int_t lstfac[], /* <-- list of post-processed interior faces */
176  const cs_int_t lstfbr[] /* <-- list of post-processed boundary faces */
177 );
178 
179 /*----------------------------------------------------------------------------
180  * Uniform random number generator
181  *----------------------------------------------------------------------------*/
182 
183 void CS_PROCF (zufall, zufall)
184 (
185  const cs_int_t *n, /* --> size of the vector */
186  const cs_real_t *a /* <-- generated random number vector */
187 );
188 
189 /*----------------------------------------------------------------------------
190  * Gaussian random number generator
191  *----------------------------------------------------------------------------*/
192 
193 void CS_PROCF (normalen, normalen)
194 (
195  const cs_int_t *n, /* --> size of the vector */
196  const cs_real_t *x /* <-- generated random number vector */
197 );
198 
199 /*----------------------------------------------------------------------------
200  * Initialize Lagrangian module parameters for a given zone and class
201  *
202  * parameters:
203  * i_cz_params <-- integer parameters for this class and zone
204  * r_cz_params <-- real parameters for this class and zone
205  *----------------------------------------------------------------------------*/
206 
207 void
208 cs_lagr_init_zone_class_param(const cs_int_t i_cs_params[],
209  const cs_real_t r_cs_params[]);
210 
211 /*----------------------------------------------------------------------------
212  * Define Lagrangian module parameters for a given zone and class
213  *
214  * parameters:
215  * class_id <-- id of given particle class
216  * zone_id <-- id of given boundary zone
217  * i_cz_params <-- integer parameters for this class and zone
218  * r_cz_params <-- real parameters for this class and zone
219  *----------------------------------------------------------------------------*/
220 
221 void
223  cs_int_t zone_id,
224  const cs_int_t i_cs_params[],
225  const cs_real_t r_cs_params[]);
226 
227 /*----------------------------------------------------------------------------
228  * Return Lagrangian model status.
229  *
230  * parameters:
231  * model_flag --> 0 without Lagrangian, 1 or 2 with Lagrangian
232  * restart_flag --> 1 for Lagrangian restart, 0 otherwise
233  * frozen_flag --> 1 for frozen Eulerian flow, 0 otherwise
234  *----------------------------------------------------------------------------*/
235 
236 void
237 cs_lagr_status(int *model_flag,
238  int *restart_flag,
239  int *frozen_flag);
240 
241 /*============================================================================
242  * User function prototypes
243  *============================================================================*/
244 
245 /*----------------------------------------------------------------------------
246  * Define global options for couplings.
247  *
248  * These options allow defining the time step synchronization policy,
249  * as well as a time step multiplier.
250  *----------------------------------------------------------------------------*/
251 
252 void
253 cs_user_coupling(void);
254 
255 /*----------------------------------------------------------------------------
256  * This function is called at the end of each time step.
257  *
258  * It has a very general purpose, although it is recommended to handle
259  * mainly postprocessing or data-extraction type operations.
260  *----------------------------------------------------------------------------*/
261 
262 void
264 
265 /*----------------------------------------------------------------------------
266  * Define mesh joinings.
267  *----------------------------------------------------------------------------*/
268 
269 void
270 cs_user_join(void);
271 
272 /*----------------------------------------------------------------------------
273  * Define linear solver options.
274  *
275  * This function is called at the setup stage, once user and most model-based
276  * fields are defined.
277  *----------------------------------------------------------------------------*/
278 
279 void
281 
282 /*----------------------------------------------------------------------------
283  * Tag bad cells within the mesh based on geometric criteria.
284  *----------------------------------------------------------------------------*/
285 
286 void
288  cs_mesh_quantities_t *mesh_quantities);
289 
290 /*----------------------------------------------------------------------------
291  * Define mesh files to read and optional associated transformations.
292  *----------------------------------------------------------------------------*/
293 
294 void
295 cs_user_mesh_input(void);
296 
297 /*----------------------------------------------------------------------------
298  * Modifiy geometry and mesh.
299  *----------------------------------------------------------------------------*/
300 
301 void
303 
304 /*----------------------------------------------------------------------------
305  * Insert thin wall into a mesh.
306  *----------------------------------------------------------------------------*/
307 
308 void
310 
311 /*----------------------------------------------------------------------------
312  * Mesh smoothing.
313  *
314  * parameters:
315  * mesh <-> pointer to mesh structure to smoothe
316  *----------------------------------------------------------------------------*/
317 
318 void
320 
321 /*----------------------------------------------------------------------------
322  * Enable or disable mesh saving.
323  *
324  * By default, mesh is saved when modified.
325  *
326  * parameters:
327  * mesh <-> pointer to mesh structure
328  *----------------------------------------------------------------------------*/
329 
330 void
332 
333 /*----------------------------------------------------------------------------
334  * Set options for cutting of warped faces
335  *
336  * parameters:
337  * mesh <-> pointer to mesh structure to smoothe
338  *----------------------------------------------------------------------------*/
339 
340 void
342 
343 /*----------------------------------------------------------------------------
344  * Select physical model options, including user fields.
345  *
346  * This function is called at the earliest stages of the data setup.
347  *----------------------------------------------------------------------------*/
348 
349 void
350 cs_user_model(void);
351 
352 /*----------------------------------------------------------------------------
353  * Define advanced mesh numbering options.
354  *----------------------------------------------------------------------------*/
355 
356 void
357 cs_user_numbering(void);
358 
359 /*----------------------------------------------------------------------------
360  * Define parallel IO settings.
361  *----------------------------------------------------------------------------*/
362 
363 void
364 cs_user_parallel_io(void);
365 
366 /*----------------------------------------------------------------------------
367  * Define advanced partitioning options.
368  *----------------------------------------------------------------------------*/
369 
370 void
371 cs_user_partition(void);
372 
373 /*----------------------------------------------------------------------------
374  * Define sparse matrix tuning options.
375  *----------------------------------------------------------------------------*/
376 
377 void
379 
380 /*----------------------------------------------------------------------------
381  * Define or modify general numerical and physical user parameters.
382  *
383  * At the calling point of this function, most model-related most variables
384  * and other fields have been defined, so speciic settings related to those
385  * fields may be set here.
386  *----------------------------------------------------------------------------*/
387 
388 void
389 cs_user_parameters(void);
390 
391 /*----------------------------------------------------------------------------
392  * Define periodic faces.
393  *----------------------------------------------------------------------------*/
394 
395 void
396 cs_user_periodicity(void);
397 
398 /*----------------------------------------------------------------------------
399  * Define post-processing writers.
400  *
401  * The default output format and frequency may be configured, and additional
402  * post-processing writers allowing outputs in different formats or with
403  * different format options and output frequency than the main writer may
404  * be defined.
405  *----------------------------------------------------------------------------*/
406 
407 void
409 
410 /*----------------------------------------------------------------------------
411  * Define post-processing meshes.
412  *
413  * The main post-processing meshes may be configured, and additional
414  * post-processing meshes may be defined as a subset of the main mesh's
415  * cells or faces (both interior and boundary).
416  *----------------------------------------------------------------------------*/
417 
418 void
420 
421 /*----------------------------------------------------------------------------
422  * Override default frequency or calculation end based output.
423  *
424  * This allows fine-grained control of activation or deactivation,
425  *
426  * parameters:
427  * nt_max_abs <-- maximum time step number
428  * nt_cur_abs <-- current time step number
429  * t_cur_abs <-- absolute time at the current time step
430  *----------------------------------------------------------------------------*/
431 
432 void
433 cs_user_postprocess_activate(int nt_max_abs,
434  int nt_cur_abs,
435  double t_cur_abs);
436 
437 /*----------------------------------------------------------------------------
438  * Define couplings with other instances of Code_Saturne.
439  *----------------------------------------------------------------------------*/
440 
441 void
443 
444 /*----------------------------------------------------------------------------
445  * Set user solver.
446  *----------------------------------------------------------------------------*/
447 
448 int
449 cs_user_solver_set(void);
450 
451 /*----------------------------------------------------------------------------
452  * Main call to user solver.
453  *----------------------------------------------------------------------------*/
454 
455 void
457  const cs_mesh_quantities_t *mesh_quantities);
458 
459 /*----------------------------------------------------------------------------
460  * Define couplings with SYRTHES code.
461  *----------------------------------------------------------------------------*/
462 
463 void
465 
466 /*----------------------------------------------------------------------------
467  * Define time moments.
468  *----------------------------------------------------------------------------*/
469 
470 void
472 
473 /*----------------------------------------------------------------------------
474  * Define rotor/stator model.
475  *----------------------------------------------------------------------------*/
476 
477 void
479 
480 /*----------------------------------------------------------------------------
481  * Define rotor axes, associated cells, and rotor/stator faces.
482  *----------------------------------------------------------------------------*/
483 
484 void
486 
487 
488 /*============================================================================
489  * CDO User function prototypes
490  *============================================================================*/
491 
492 /*----------------------------------------------------------------------------*/
496 /*----------------------------------------------------------------------------*/
497 
498 bool
500 
501 /*----------------------------------------------------------------------------*/
505 /*----------------------------------------------------------------------------*/
506 
507 void
509 
510 /*----------------------------------------------------------------------------*/
518 /*----------------------------------------------------------------------------*/
519 
520 void
522 
523 /*----------------------------------------------------------------------------*/
531 /*----------------------------------------------------------------------------*/
532 
533 void
535 
536 /*----------------------------------------------------------------------------*/
543 /*----------------------------------------------------------------------------*/
544 
547 
548 /*----------------------------------------------------------------------------*/
555 /*----------------------------------------------------------------------------*/
556 
557 void
559 
560 /*----------------------------------------------------------------------------*/
567 /*----------------------------------------------------------------------------*/
568 
569 void
570 cs_user_cdo_extra_op(const cs_domain_t *domain);
571 
572 /*----------------------------------------------------------------------------*/
573 
575 
576 #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_cdo_init_domain(cs_domain_t *domain)
Specify for the computational domain: – which type of boundaries closed the computational domain – ...
Definition: cs_user_cdo.c:121
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
bool cs_user_cdo_activated(void)
Activate or not the CDO module.
Definition: cs_user_cdo.c:90
integer, save nvlsta
Definition: lagdim.f90:54
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
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_extra_op(const cs_domain_t *domain)
Additional operations on results provided by CDO schemes. Define advanced post-processing and/or anal...
Definition: cs_user_cdo_extra_op.c:99
void cs_user_mesh_modify(cs_mesh_t *mesh)
Definition: cs_user_mesh.c:549
Definition: cs_field_pointer.h:66
void cs_user_join(void)
Definition: cs_user_mesh.c:145
void cs_user_cdo_numeric_settings(cs_domain_t *domain)
Setup advanced features concerning the numerical parameters of the equation resolved during the compu...
Definition: cs_user_cdo_numerics.c:108
void cs_user_cdo_add_mesh_locations(void)
Specify additional mesh locations.
Definition: cs_user_cdo.c:102
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:626
Definition: cs_mesh.h:62
void cs_user_parameters(void)
Define or modify general numerical and physical user parameters.
Definition: cs_user_parameters.c:131
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:153
integer, save nvisbr
Definition: lagdim.f90:54
Definition: cs_mesh_quantities.h:51
Definition: cs_domain.h:62
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:169
void cs_user_cdo_set_domain(cs_domain_t *domain)
Associate material property and/or convection field to user-defined equations and specify boundary co...
Definition: cs_user_cdo.c:137
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:647
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.
Definition: cs_user_cdo_numerics.c:82
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:430
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:453
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:103
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:590
Definition: mesh.f90:26