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-2021 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_domain.h" 36 #include "cs_field.h" 37 #include "cs_mesh.h" 38 #include "cs_mesh_quantities.h" 39 #include "cs_mesh_bad_cells.h" 40 #include "cs_probe.h" 41 #include "cs_volume_zone.h" 42 43 /*----------------------------------------------------------------------------*/ 44 45 BEGIN_C_DECLS 46 47 /*============================================================================ 48 * Macro definitions 49 *============================================================================*/ 50 51 /*============================================================================= 52 * Fortran function/subroutine prototypes 53 *============================================================================*/ 54 55 /*---------------------------------------------------------------------------- 56 * Main Fortran subroutine 57 *----------------------------------------------------------------------------*/ 58 59 extern void CS_PROCF (caltri, CALTRI) 60 ( 61 void 62 ); 63 64 /*---------------------------------------------------------------------------- 65 * Poisson equation resolution for hydrostatic pressure. 66 *----------------------------------------------------------------------------*/ 67 68 extern void cs_hydrostatic_pressure_compute(int *indhyd, 69 int iterns, 70 cs_real_t fext[][3], 71 cs_real_t dfext[][3], 72 cs_real_t phydr[], 73 cs_real_t flumas[], 74 cs_real_t flumab[], 75 cs_real_t viscf[], 76 cs_real_t viscb[], 77 cs_real_t dam[], 78 cs_real_t xam[], 79 cs_real_t dpvar[], 80 cs_real_t rhs[]); 81 82 /*---------------------------------------------------------------------------- 83 * Convert gas temperature to and from enthalpy based on concentrations 84 *----------------------------------------------------------------------------*/ 85 86 extern void CS_PROCF (cpthp1, CPTHP1) 87 ( 88 const int *mode, /* <-- 1: h to t, 2: t to h */ 89 cs_real_t *eh, /* <-> enthalpy of gas mix */ 90 cs_real_t *xesp, /* <-- mas fraction of species */ 91 cs_real_t *f1mc, /* <-- mean f1 */ 92 cs_real_t *f2mc, /* <-- mean f2 */ 93 cs_real_t *tp /* <-- gas temperature (K) */ 94 ); 95 96 /*---------------------------------------------------------------------------- 97 * Initialize Fortran base common block values 98 *----------------------------------------------------------------------------*/ 99 100 extern void CS_PROCF (csinit, CSINIT) 101 ( 102 const int *irgpar, /* <-- MPI Rank in parallel, -1 otherwise */ 103 const int *nrgpar /* <-- Number of MPI processes, or 1 */ 104 ); 105 106 /*---------------------------------------------------------------------------- 107 * Compute distance to wall by solving a 3d diffusion equation. 108 *----------------------------------------------------------------------------*/ 109 110 extern void CS_PROCF (distpr, DISTPR) 111 ( 112 const int *itypfb, /* <-- boudnary face types */ 113 cs_real_t *distpa /* <-- wall distance */ 114 ); 115 116 /*---------------------------------------------------------------------------- 117 * Developer function for output of variables on a post-processing mesh 118 *----------------------------------------------------------------------------*/ 119 120 extern void CS_PROCF (dvvpst, DVVPST) 121 ( 122 const int *nummai, /* <-- number or post-processing mesh */ 123 const int *numtyp, /* <-- number or post-processing type 124 * (-1 as volume, -2 as boundary, or nummai) */ 125 const int *nvar, /* <-- number of variables */ 126 const cs_lnum_t *ncelps, /* <-- number of post-processed cells */ 127 const cs_lnum_t *nfbrps, /* <-- number of post processed boundary faces */ 128 const cs_lnum_t lstcel[], /* <-- list of post-processed cells */ 129 const cs_lnum_t lstfbr[], /* <-- list of post-processed boundary faces */ 130 cs_real_t tracel[], /* --- work array for output cells */ 131 cs_real_t trafbr[] /* --- work array for output boundary faces */ 132 ); 133 134 /*---------------------------------------------------------------------------- 135 * Find the nearest cell's center from a node 136 *----------------------------------------------------------------------------*/ 137 138 extern void CS_PROCF (findpt, FINDPT) 139 ( 140 const cs_lnum_t *ncelet, /* <-- number of extended (real + ghost) cells */ 141 const cs_lnum_t *ncel, /* <-- number of cells */ 142 const cs_real_t *xyzcen, /* <-- cell centers */ 143 const cs_real_t *xx, /* <-- node coordinate X */ 144 const cs_real_t *yy, /* <-- node coordinate Y */ 145 const cs_real_t *zz, /* <-- node coordinate Z */ 146 cs_lnum_t *node, /* --> node we are looking for, zero if error */ 147 int *ndrang /* --> rank of associated process */ 148 ); 149 150 /*---------------------------------------------------------------------------- 151 * Check necessity of extended mesh from FORTRAN options. 152 * 153 * Interface Fortran : 154 * 155 * SUBROUTINE HALTYP (IVOSET) 156 * ***************** 157 * 158 * INTEGER IVOSET : <-- : Indicator of necessity of extended mesh 159 *----------------------------------------------------------------------------*/ 160 161 extern void 162 CS_PROCF (haltyp, HALTYP)(const int *ivoset); 163 164 /*---------------------------------------------------------------------------- 165 * Main Fortran options initialization 166 *----------------------------------------------------------------------------*/ 167 168 extern void CS_PROCF (initi1, INITI1) 169 ( 170 void 171 ); 172 173 /*----------------------------------------------------------------------------*/ 174 /*! 175 * \brief Return pointer to automatic face bc flag array. 176 * 177 * \return auto_flag pointer to automatic boundary condition array 178 */ 179 /*----------------------------------------------------------------------------*/ 180 181 int * 182 cs_atmo_get_auto_flag(void); 183 184 /*---------------------------------------------------------------------------- 185 * Add field indexes associated with a new non-user solved variable, 186 * with default options 187 * 188 * parameters: 189 * f_id <-- field id 190 * 191 * returns: 192 * scalar number for defined field 193 *----------------------------------------------------------------------------*/ 194 195 int 196 cs_add_model_field_indexes(int f_id); 197 198 /*----------------------------------------------------------------------------*/ 199 /*! 200 * \brief Convert temperature to enthalpy at boundary for coal combustion. 201 * 202 * \param[in] n_faces number of faces in list 203 * \param[in] face_ids list of boundary faces at which conversion 204 * is requested (0-based numbering) 205 * \param[in] t_b temperature at boundary 206 * \param[out] h_b enthalpy at boundary 207 */ 208 /*----------------------------------------------------------------------------*/ 209 210 void 211 cs_coal_bt2h(cs_lnum_t n_faces, 212 const cs_lnum_t face_ids[], 213 const cs_real_t t[], 214 cs_real_t h[]); 215 216 /*----------------------------------------------------------------------------*/ 217 /*! 218 * \brief Calculation of the gas temperature 219 * Function with the gas enthalpy and concentrations 220 * 221 * \param[in] location_id mesh location id (cells or boundary faces) 222 * \param[in] eh gas enthalpy 223 * (\f$ j . kg \f$ of gaseous mixture) 224 * \param[in, out] tp gas temperature (in kelvin) 225 */ 226 /*----------------------------------------------------------------------------*/ 227 228 void 229 cs_coal_thfieldconv1(int location_id, 230 const cs_real_t eh[], 231 cs_real_t tp[]); 232 233 /*----------------------------------------------------------------------------*/ 234 /*! 235 * \brief Return pointer to boundary head losses array. 236 * 237 * \return b_head_loss pointer to boundary head losses array 238 */ 239 /*----------------------------------------------------------------------------*/ 240 241 cs_real_t * 242 cs_get_b_head_loss(void); 243 244 /*----------------------------------------------------------------------------*/ 245 /*! 246 * \brief Return pointer to cavitation "dgdpca" array. 247 * 248 * \return pointer to "dgdpca" array. 249 */ 250 /*----------------------------------------------------------------------------*/ 251 252 cs_real_t * 253 cs_get_cavitation_dgdp_st(void); 254 255 /*----------------------------------------------------------------------------*/ 256 /*! 257 * \brief Return pointer to cavitation "gamcav" array. 258 * 259 * \return pointer to "gamcav" array. 260 */ 261 /*----------------------------------------------------------------------------*/ 262 263 cs_real_t * 264 cs_get_cavitation_gam(void); 265 266 /*----------------------------------------------------------------------------*/ 267 /*! 268 * \brief Convert temperature to enthalpy at boundary for fuel combustion. 269 * 270 * \param[in] n_faces number of faces in list 271 * \param[in] face_ids list of boundary faces at which conversion 272 * is requested (0-based numbering) 273 * \param[in] t_b temperature at boundary 274 * \param[out] h_b enthalpy at boundary 275 */ 276 /*----------------------------------------------------------------------------*/ 277 278 void 279 cs_fuel_bt2h(cs_lnum_t n_faces, 280 const cs_lnum_t face_ids[], 281 const cs_real_t t[], 282 cs_real_t h[]); 283 284 /*----------------------------------------------------------------------------*/ 285 /*! 286 * \brief Calculation of the gas temperature 287 * Function with the gas enthalpy and concentrations 288 * 289 * \param[in] location_id mesh location id (cells or boundary faces) 290 * \param[in] eh gas enthalpy 291 * (\f$ j . kg \f$ of gaseous mixture) 292 * \param[in, out] tp gas temperature (in kelvin) 293 */ 294 /*----------------------------------------------------------------------------*/ 295 296 void 297 cs_fuel_thfieldconv1(int location_id, 298 const cs_real_t eh[], 299 cs_real_t tp[]); 300 301 /*---------------------------------------------------------------------------- 302 * Return Lagrangian model status. 303 * 304 * parameters: 305 * model_flag --> 0 without Lagrangian, 1 or 2 with Lagrangian 306 * restart_flag --> 1 for Lagrangian restart, 0 otherwise 307 * frozen_flag --> 1 for frozen Eulerian flow, 0 otherwise 308 *----------------------------------------------------------------------------*/ 309 310 void 311 cs_lagr_status(int *model_flag, 312 int *restart_flag, 313 int *frozen_flag); 314 315 /*---------------------------------------------------------------------------- 316 * Return condensation model metal structures metal surface. 317 * 318 * return: 319 * metal structures surface 320 *----------------------------------------------------------------------------*/ 321 322 double 323 cs_tagms_s_metal(void); 324 325 /*============================================================================ 326 * User function prototypes 327 *============================================================================*/ 328 329 /*---------------------------------------------------------------------------- 330 * Data Entry of the 1D wall thermal module. 331 *----------------------------------------------------------------------------*/ 332 333 void 334 cs_user_1d_wall_thermal(int iappel, 335 int isuit1); 336 337 /*---------------------------------------------------------------------------- 338 * Setup boundary conditions to be applied. 339 *----------------------------------------------------------------------------*/ 340 341 void 342 cs_user_boundary_conditions_setup(cs_domain_t *domain); 343 344 /*---------------------------------------------------------------------------- 345 * This function is called at each time step for boundary conditions. 346 *----------------------------------------------------------------------------*/ 347 348 void 349 cs_user_boundary_conditions(int nvar, 350 int icodcl[], 351 int bc_type[], 352 cs_real_t rcodcl[]); 353 354 /*----------------------------------------------------------------------------*/ 355 /*! 356 * \brief Initialize variables. 357 * 358 * This function is called at beginning of the computation 359 * (restart or not) before the time step loop. 360 * 361 * This is intended to initialize or modify (when restarted) 362 * variable and time step values. 363 364 * \param[in, out] domain pointer to a cs_domain_t structure 365 */ 366 /*----------------------------------------------------------------------------*/ 367 368 void 369 cs_user_extra_operations_initialize(cs_domain_t *domain); 370 371 /*----------------------------------------------------------------------------*/ 372 /*! 373 * \brief This function is called at the end of each time step. 374 * 375 * It has a very general purpose, although it is recommended to handle 376 * mainly postprocessing or data-extraction type operations. 377 * 378 * \param[in, out] domain pointer to a cs_domain_t structure 379 */ 380 /*----------------------------------------------------------------------------*/ 381 382 void 383 cs_user_extra_operations(cs_domain_t *domain); 384 385 /*----------------------------------------------------------------------------*/ 386 /*! 387 * \brief This function is called at the end of the calculation. 388 * 389 * It has a very general purpose, although it is recommended to handle 390 * mainly postprocessing or data-extraction type operations. 391 392 * \param[in, out] domain pointer to a cs_domain_t structure 393 */ 394 /*----------------------------------------------------------------------------*/ 395 396 void 397 cs_user_extra_operations_finalize(cs_domain_t *domain); 398 399 /*----------------------------------------------------------------------------*/ 400 /*! 401 * \brief Compute GUI-defined head losses for a given volume zone. 402 * 403 * Head loss tensor coefficients for each cell are organized as follows: 404 * cku11, cku22, cku33, cku12, cku13, cku23. 405 * 406 * \param[in] zone pointer to zone structure 407 * \param[in, out] cku head loss coefficients 408 */ 409 /*----------------------------------------------------------------------------*/ 410 411 void 412 cs_user_head_losses(const cs_zone_t *zone, 413 cs_real_t cku[][6]); 414 415 /*----------------------------------------------------------------------------*/ 416 /*! 417 * \brief This function is called one time step to initialize problem. 418 * 419 * \param[in, out] domain pointer to a cs_domain_t structure 420 */ 421 /*----------------------------------------------------------------------------*/ 422 423 void 424 cs_user_initialization(cs_domain_t *domain); 425 426 /*----------------------------------------------------------------------------*/ 427 /*! 428 * \brief Define internal coupling options. 429 * 430 * Options are usually defined using cs_internal_coupling_add_entity. 431 */ 432 /*----------------------------------------------------------------------------*/ 433 434 void 435 cs_user_internal_coupling(void); 436 437 /*----------------------------------------------------------------------------*/ 438 /*! 439 * \brief Define volumes as internal coupling zones. 440 * 441 * These zones will be separated from the rest of the domain using automatically 442 * defined thin walls. 443 * 444 * \param[in, out] mesh pointer to a cs_mesh_t structure 445 */ 446 /*----------------------------------------------------------------------------*/ 447 448 void 449 cs_user_internal_coupling_add_volumes(cs_mesh_t *mesh); 450 451 /*----------------------------------------------------------------------------*/ 452 /*! 453 * \brief Define volumesi from separated meshes as internal coupling zones. 454 * 455 * These zones must be disjoint and the face selection criteria must be 456 * specified. 457 * 458 * \param[in, out] mesh pointer to a cs_mesh_t structure 459 */ 460 /*----------------------------------------------------------------------------*/ 461 462 void 463 cs_user_internal_coupling_from_disjoint_meshes(cs_mesh_t *mesh); 464 465 /*----------------------------------------------------------------------------*/ 466 /*! 467 * \brief This function is called each time step to define physical properties. 468 * 469 * \param[in, out] domain pointer to a cs_domain_t structure 470 */ 471 /*----------------------------------------------------------------------------*/ 472 473 void 474 cs_user_physical_properties(cs_domain_t *domain); 475 476 /*----------------------------------------------------------------------------*/ 477 /*! 478 * \brief User definition of enthalpy to temperature conversion. 479 * 480 * This allows overwriting the solver defaults if necessary. 481 * 482 * This function may be called on a per-zone basis, so as to allow different 483 * conversion relations in zones representing solids or different fluids. 484 * 485 * \param[in, out] domain pointer to a cs_domain_t structure 486 * \param[in] z zone (volume or boundary) applying to current call 487 * \param[in] z_local if true, h and t arrays are defined in a compact 488 * (contiguous) manner for this zone only; 489 * if false, h and t are defined on the zone's parent 490 * location (usually all cells or boundary faces) 491 * \param[in] h enthalpy values 492 * \param[in, out] t temperature values 493 */ 494 /*----------------------------------------------------------------------------*/ 495 496 void 497 cs_user_physical_properties_h_to_t(cs_domain_t *domain, 498 const cs_zone_t *z, 499 bool z_local, 500 const cs_real_t h[restrict], 501 cs_real_t t[restrict]); 502 503 /*----------------------------------------------------------------------------*/ 504 /*! 505 * \brief User definition of temperature to enthalpy conversion. 506 * 507 * This allows overwriting the solver defaults if necessary. 508 * 509 * This function may be called on a per-zone basis, so as to allow different 510 * conversion relations in zones representing solids or different fluids. 511 * 512 * \param[in, out] domain pointer to a cs_domain_t structure 513 * \param[in] z zone (volume or boundary) applying to current call 514 * \param[in] z_local if true, h and t arrays are defined in a compact 515 * (contiguous) manner for this zone only; 516 * if false, h and t are defined on the zone's parent 517 * location (usually all cells or boundary faces) 518 * \param[in] h temperature values 519 * \param[in, out] t enthalpy values 520 */ 521 /*----------------------------------------------------------------------------*/ 522 523 void 524 cs_user_physical_properties_t_to_h(cs_domain_t *domain, 525 const cs_zone_t *z, 526 bool z_local, 527 const cs_real_t t[restrict], 528 cs_real_t h[restrict]); 529 530 /*----------------------------------------------------------------------------*/ 531 /*! 532 * \brief Additional user-defined source terms for variable equations 533 * (momentum, scalars, turbulence...). 534 * 535 * \param[in, out] domain pointer to a cs_domain_t structure 536 * \param[in] f_id field id of the variable 537 * \param[out] st_exp explicit source term 538 * \param[out] st_imp implicit part of the source term 539 */ 540 /*----------------------------------------------------------------------------*/ 541 542 void 543 cs_user_source_terms(cs_domain_t *domain, 544 int f_id, 545 cs_real_t *st_exp, 546 cs_real_t *st_imp); 547 548 /*----------------------------------------------------------------------------*/ 549 /*! 550 * \brief Compute the porosity (volume factor \f$ \epsilon \f$ 551 * when the porosity model is activated. 552 * (\ref cs_glob_porous_model > 0). 553 * 554 * This function is called at the begin of the simulation only. 555 * 556 * \param[in, out] domain pointer to a cs_domain_t structure 557 */ 558 /*----------------------------------------------------------------------------*/ 559 560 void 561 cs_user_porosity(cs_domain_t *domain); 562 563 /*---------------------------------------------------------------------------- 564 * Define mesh joinings. 565 *----------------------------------------------------------------------------*/ 566 567 void 568 cs_user_join(void); 569 570 /*---------------------------------------------------------------------------- 571 * Define linear solver options. 572 * 573 * This function is called at the setup stage, once user and most model-based 574 * fields are defined. 575 *----------------------------------------------------------------------------*/ 576 577 void 578 cs_user_linear_solvers(void); 579 580 /*----------------------------------------------------------------------------*/ 581 /*! 582 * \brief Define or modify output user parameters. 583 * For CDO schemes, specify the elements such as properties, advection fields, 584 * user-defined equations and modules which have been previously added. 585 */ 586 /*----------------------------------------------------------------------------*/ 587 588 void 589 cs_user_finalize_setup(cs_domain_t *domain); 590 591 /*---------------------------------------------------------------------------- 592 * Tag bad cells within the mesh based on geometric criteria. 593 *----------------------------------------------------------------------------*/ 594 595 void 596 cs_user_mesh_bad_cells_tag(cs_mesh_t *mesh, 597 cs_mesh_quantities_t *mesh_quantities); 598 599 /*---------------------------------------------------------------------------- 600 * Define mesh files to read and optional associated transformations. 601 *----------------------------------------------------------------------------*/ 602 603 void 604 cs_user_mesh_input(void); 605 606 /*---------------------------------------------------------------------------- 607 * Modifiy geometry and mesh. 608 *----------------------------------------------------------------------------*/ 609 610 void 611 cs_user_mesh_modify(cs_mesh_t *mesh); 612 613 /*---------------------------------------------------------------------------- 614 * Insert boundary wall into a mesh. 615 *----------------------------------------------------------------------------*/ 616 617 void 618 cs_user_mesh_boundary(cs_mesh_t *mesh); 619 620 /*---------------------------------------------------------------------------- 621 * Mesh smoothing. 622 * 623 * parameters: 624 * mesh <-> pointer to mesh structure to smoothe 625 *----------------------------------------------------------------------------*/ 626 627 void 628 cs_user_mesh_smoothe(cs_mesh_t *mesh); 629 630 /*---------------------------------------------------------------------------- 631 * Enable or disable mesh saving. 632 * 633 * By default, mesh is saved when modified. 634 * 635 * parameters: 636 * mesh <-> pointer to mesh structure 637 *----------------------------------------------------------------------------*/ 638 639 void 640 cs_user_mesh_save(cs_mesh_t *mesh); 641 642 /*---------------------------------------------------------------------------- 643 * Set options for cutting of warped faces 644 * 645 * parameters: 646 * mesh <-> pointer to mesh structure to smoothe 647 *----------------------------------------------------------------------------*/ 648 649 void 650 cs_user_mesh_warping(void); 651 652 /*----------------------------------------------------------------------------*/ 653 /*! 654 * \brief Apply partial modifications to the mesh after the preprocessing 655 * and initial postprocessing mesh building stage. 656 * 657 * \param[in,out] mesh pointer to a cs_mesh_t structure 658 * \param[in,out] mesh_quantities pointer to a cs_mesh_quantities_t structure 659 */ 660 /*----------------------------------------------------------------------------*/ 661 662 void 663 cs_user_mesh_modify_partial(cs_mesh_t *mesh, 664 cs_mesh_quantities_t *mesh_quantities); 665 666 /*----------------------------------------------------------------------------*/ 667 /*! 668 * \brief Define a cartesian mesh. 669 */ 670 /*----------------------------------------------------------------------------*/ 671 672 void 673 cs_user_mesh_cartesian_define(void); 674 675 /*---------------------------------------------------------------------------- 676 * Select physical model options, including user fields. 677 * 678 * This function is called at the earliest stages of the data setup. 679 *----------------------------------------------------------------------------*/ 680 681 void 682 cs_user_model(void); 683 684 /*---------------------------------------------------------------------------- 685 * Define advanced mesh numbering options. 686 *----------------------------------------------------------------------------*/ 687 688 void 689 cs_user_numbering(void); 690 691 /*---------------------------------------------------------------------------- 692 * Define parallel IO settings. 693 *----------------------------------------------------------------------------*/ 694 695 void 696 cs_user_parallel_io(void); 697 698 /*---------------------------------------------------------------------------- 699 * Define advanced partitioning options. 700 *----------------------------------------------------------------------------*/ 701 702 void 703 cs_user_partition(void); 704 705 /*---------------------------------------------------------------------------- 706 * Define sparse matrix tuning options. 707 *----------------------------------------------------------------------------*/ 708 709 void 710 cs_user_matrix_tuning(void); 711 712 /*---------------------------------------------------------------------------- 713 * Define or modify general numerical and physical user parameters. 714 * 715 * At the calling point of this function, most model-related most variables 716 * and other fields have been defined, so specific settings related to those 717 * fields may be set here. 718 *----------------------------------------------------------------------------*/ 719 720 void 721 cs_user_parameters(cs_domain_t *domain); 722 723 /*---------------------------------------------------------------------------- 724 * User function for input of radiative transfer module options. 725 *----------------------------------------------------------------------------*/ 726 727 void 728 cs_user_radiative_transfer_parameters(void); 729 730 /*----------------------------------------------------------------------------- 731 * User subroutine for input of radiative transfer boundary conditions 732 *----------------------------------------------------------------------------*/ 733 734 void 735 cs_user_radiative_transfer_bcs(int nvar, 736 const int bc_type[], 737 int icodcl[], 738 int isothp[], 739 cs_real_t *tmin, 740 cs_real_t *tmax, 741 cs_real_t *tx, 742 const cs_real_t dt[], 743 cs_real_t rcodcl[], 744 const cs_real_t thwall[], 745 const cs_real_t qincid[], 746 cs_real_t hfcnvp[], 747 cs_real_t flcnvp[], 748 cs_real_t xlamp[], 749 cs_real_t epap[], 750 cs_real_t epsp[], 751 cs_real_t textp[]); 752 753 /*---------------------------------------------------------------------------- 754 * Define periodic faces. 755 *----------------------------------------------------------------------------*/ 756 757 void 758 cs_user_periodicity(void); 759 760 /*---------------------------------------------------------------------------- 761 * Define post-processing writers. 762 * 763 * The default output format and frequency may be configured, and additional 764 * post-processing writers allowing outputs in different formats or with 765 * different format options and output frequency than the main writer may 766 * be defined. 767 *----------------------------------------------------------------------------*/ 768 769 void 770 cs_user_postprocess_writers(void); 771 772 /*----------------------------------------------------------------------------- 773 * Define monitoring probes and profiles. A profile is seen as a set of probes. 774 *----------------------------------------------------------------------------*/ 775 776 void 777 cs_user_postprocess_probes(void); 778 779 /*---------------------------------------------------------------------------- 780 * Define post-processing meshes. 781 * 782 * The main post-processing meshes may be configured, and additional 783 * post-processing meshes may be defined as a subset of the main mesh's 784 * cells or faces (both interior and boundary). 785 *----------------------------------------------------------------------------*/ 786 787 void 788 cs_user_postprocess_meshes(void); 789 790 /*---------------------------------------------------------------------------- 791 * User function for output of values on a post-processing mesh. 792 *----------------------------------------------------------------------------*/ 793 794 void 795 cs_user_postprocess_values(const char *mesh_name, 796 int mesh_id, 797 int cat_id, 798 cs_probe_set_t *probes, 799 cs_lnum_t n_cells, 800 cs_lnum_t n_i_faces, 801 cs_lnum_t n_b_faces, 802 cs_lnum_t n_vertices, 803 const cs_lnum_t cell_list[], 804 const cs_lnum_t i_face_list[], 805 const cs_lnum_t b_face_list[], 806 const cs_lnum_t vertex_list[], 807 const cs_time_step_t *ts); 808 809 /*---------------------------------------------------------------------------- 810 * Override default frequency or calculation end based output. 811 * 812 * This allows fine-grained control of activation or deactivation, 813 * 814 * parameters: 815 * nt_max_abs <-- maximum time step number 816 * nt_cur_abs <-- current time step number 817 * t_cur_abs <-- absolute time at the current time step 818 *----------------------------------------------------------------------------*/ 819 820 void 821 cs_user_postprocess_activate(int nt_max_abs, 822 int nt_cur_abs, 823 double t_cur_abs); 824 825 /*---------------------------------------------------------------------------- 826 * Absorption coefficient for radiative module 827 *----------------------------------------------------------------------------*/ 828 829 void 830 cs_user_rad_transfer_absorption(const int bc_type[], 831 cs_real_t ck[]); 832 833 /*---------------------------------------------------------------------------- 834 * Compute the net radiation flux 835 *----------------------------------------------------------------------------*/ 836 837 void 838 cs_user_rad_transfer_net_flux(const int itypfb[], 839 const cs_real_t coefap[], 840 const cs_real_t coefbp[], 841 const cs_real_t cofafp[], 842 const cs_real_t cofbfp[], 843 const cs_real_t twall[], 844 const cs_real_t qincid[], 845 const cs_real_t xlam[], 846 const cs_real_t epa[], 847 const cs_real_t eps[], 848 const cs_real_t ck[], 849 cs_real_t net_flux[]); 850 851 /*---------------------------------------------------------------------------- 852 * Set user solver. 853 *----------------------------------------------------------------------------*/ 854 855 int 856 cs_user_solver_set(void); 857 858 /*---------------------------------------------------------------------------- 859 * Main call to user solver. 860 *----------------------------------------------------------------------------*/ 861 862 void 863 cs_user_solver(const cs_mesh_t *mesh, 864 const cs_mesh_quantities_t *mesh_quantities); 865 866 /*---------------------------------------------------------------------------- 867 * Define couplings with other instances of Code_Saturne. 868 *----------------------------------------------------------------------------*/ 869 870 void 871 cs_user_saturne_coupling(void); 872 873 /*---------------------------------------------------------------------------- 874 * Define couplings with SYRTHES code. 875 *----------------------------------------------------------------------------*/ 876 877 void 878 cs_user_syrthes_coupling(void); 879 880 /*----------------------------------------------------------------------------*/ 881 /*! 882 * \brief Compute a volume exchange coefficient for SYRTHES couplings. 883 * 884 * \param[in] coupling_id Syrthes coupling id 885 * \param[in] syrthes_name name of associated Syrthes instance 886 * \param[in] n_elts number of associated cells 887 * \param[in] elt_ids associated cell ids 888 * \param[out] h_vol associated exchange coefficient (size: n_elts) 889 */ 890 /*----------------------------------------------------------------------------*/ 891 892 void 893 cs_user_syrthes_coupling_volume_h(int coupling_id, 894 const char *syrthes_name, 895 cs_lnum_t n_elts, 896 const cs_lnum_t elt_ids[], 897 cs_real_t h_vol[]); 898 899 /*---------------------------------------------------------------------------- 900 * Define time moments. 901 *----------------------------------------------------------------------------*/ 902 903 void 904 cs_user_time_moments(void); 905 906 /*---------------------------------------------------------------------------- 907 * Define rotor/stator model. 908 *----------------------------------------------------------------------------*/ 909 910 void 911 cs_user_turbomachinery(void); 912 913 /*---------------------------------------------------------------------------- 914 * Define rotor axes, associated cells, and rotor/stator faces. 915 *----------------------------------------------------------------------------*/ 916 917 void 918 cs_user_turbomachinery_rotor(void); 919 920 /*---------------------------------------------------------------------------- 921 * Define rotation velocity of rotor. 922 *----------------------------------------------------------------------------*/ 923 924 void 925 cs_user_turbomachinery_set_rotation_velocity(void); 926 927 /*----------------------------------------------------------------------------*/ 928 /*! 929 * \brief Define volume and surface zones. 930 */ 931 /*----------------------------------------------------------------------------*/ 932 933 void 934 cs_user_zones(void); 935 936 /*----------------------------------------------------------------------------*/ 937 /*! 938 * \brief Define scaling parameter for electric model 939 */ 940 /*----------------------------------------------------------------------------*/ 941 942 void 943 cs_user_scaling_elec(const cs_mesh_t *mesh, 944 const cs_mesh_quantities_t *mesh_quantities, 945 cs_real_t *dt); 946 947 /*---------------------------------------------------------------------------- 948 * Computation of the relaxation time-scale to equilibrium in the frame of 949 * the homogeneous two-phase model. 950 *----------------------------------------------------------------------------*/ 951 952 void 953 cs_user_hgn_thermo_relax_time(const cs_mesh_t *mesh, 954 const cs_real_t *alpha_eq, 955 const cs_real_t *y_eq, 956 const cs_real_t *z_eq, 957 const cs_real_t *ei, 958 const cs_real_t *v, 959 cs_real_t *relax_tau); 960 961 /*============================================================================ 962 * MEG function prototypes 963 *============================================================================*/ 964 965 /*----------------------------------------------------------------------------*/ 966 /*! 967 * \file cs_meg_boundary_function.c 968 * 969 * \brief This function is used to compute user defined values for fields over a 970 * given boundary zone 971 * 972 * \param[in] zone pointer to cs_zone_t structure related to boundary 973 * \param[in] field_name name of the field (const char *) 974 * \param[in] condition condition type (const char *) 975 * 976 * \return a pointer to an array of cs_real_t values 977 */ 978 /*----------------------------------------------------------------------------*/ 979 980 cs_real_t * 981 cs_meg_boundary_function(const cs_zone_t *zone, 982 const char *field_name, 983 const char *condition); 984 985 /*----------------------------------------------------------------------------*/ 986 /*! 987 * \brief This function is used to compute user defined values for fields over a 988 * given volume zone 989 * 990 * \param[in] zone pointer to cs_zone_t structure related to a volume 991 * \param[in, out] f[] array of pointers to cs_field_t 992 */ 993 /*----------------------------------------------------------------------------*/ 994 995 void 996 cs_meg_volume_function(const cs_zone_t *zone, 997 cs_field_t *f[]); 998 999 /*----------------------------------------------------------------------------*/ 1000 /*! 1001 * \brief Evaluate GUI defined mathematical expressions over volume zones for 1002 * initialization. 1003 * 1004 * \param[in] zone pointer to a cs_volume_zone_t structure 1005 * \param[in] field_name variable name 1006 */ 1007 /*----------------------------------------------------------------------------*/ 1008 1009 cs_real_t * 1010 cs_meg_initialization(const cs_zone_t *zone, 1011 const char *field_name); 1012 1013 /*----------------------------------------------------------------------------*/ 1014 /*! 1015 * \file cs_meg_source_terms.c 1016 * 1017 * \brief This function is used to compute source terms over a volume zone 1018 * 1019 * \param[in] zone pointer to cs_volume_zone_t 1020 * \param[in] name variable name 1021 * \param[in] source_type source term type 1022 * 1023 * \returns new_vals: a cs_real_t pointer containing the values 1024 */ 1025 /*----------------------------------------------------------------------------*/ 1026 1027 cs_real_t * 1028 cs_meg_source_terms(const cs_zone_t *zone, 1029 const char *name, 1030 const char *source_type); 1031 1032 /*----------------------------------------------------------------------------*/ 1033 /*! 1034 * \file cs_meg_immersed_boundaries_inout.c 1035 * 1036 * \brief This function is used to indicate whether a given point is within or 1037 * outside a given solid 1038 * 1039 * \param[in, out] ipenal indicator for cut cells algorithm 1040 * \param[in] object_name name of the solid object 1041 * \param[in] xyz point coordinates 1042 * \param[in] t time value 1043 */ 1044 /*----------------------------------------------------------------------------*/ 1045 1046 void 1047 cs_meg_immersed_boundaries_inout(int *ipenal, 1048 const char *object_name, 1049 cs_real_t xyz[3], 1050 cs_real_t t); 1051 1052 /*----------------------------------------------------------------------------*/ 1053 /*! 1054 * \brief This function is used to query FSI internal coupling structure values 1055 * for a given boundary and structure. 1056 * 1057 * \param[in] object_type name of object type 1058 * \param[in] name name of matching boundary 1059 * \param[in] fluid_f array of fluid forces on the object 1060 * \param[in, out] val[] matrix or vector coefficients 1061 */ 1062 /*----------------------------------------------------------------------------*/ 1063 1064 void 1065 cs_meg_fsi_struct(const char *object_type, 1066 const char *name, 1067 const cs_real_t fluid_f[], 1068 cs_real_t val[]); 1069 1070 /*----------------------------------------------------------------------------*/ 1071 /*! 1072 * \brief This function is used to activate postprocessing writers. 1073 */ 1074 /*----------------------------------------------------------------------------*/ 1075 1076 void 1077 cs_meg_post_activate(void); 1078 1079 /*----------------------------------------------------------------------------*/ 1080 /*! 1081 * \brief This function is used to define profile coordinates. 1082 * 1083 * \param[in] name name of matching profile 1084 * \param[in] n_coords number of point coordinates 1085 * \param[in, out] coords point coordinates 1086 */ 1087 /*----------------------------------------------------------------------------*/ 1088 1089 void 1090 cs_meg_post_profiles(const char *name, 1091 int n_coords, 1092 cs_real_t coords[][3]); 1093 1094 /*----------------------------------------------------------------------------*/ 1095 /*! 1096 * \brief Define ParaMEDMEM coupling(s) 1097 */ 1098 /*----------------------------------------------------------------------------*/ 1099 1100 void 1101 cs_user_paramedmem_define_couplings(void); 1102 1103 /*----------------------------------------------------------------------------*/ 1104 /*! 1105 * \brief Define coupled meshes 1106 */ 1107 /*----------------------------------------------------------------------------*/ 1108 1109 void 1110 cs_user_paramedmem_define_meshes(void); 1111 1112 /*----------------------------------------------------------------------------*/ 1113 /*! 1114 * \brief Define fields to couple with ParaMEDMEM 1115 */ 1116 /*----------------------------------------------------------------------------*/ 1117 1118 void 1119 cs_user_paramedmem_define_fields(void); 1120 1121 /*----------------------------------------------------------------------------*/ 1122 1123 END_C_DECLS 1124 1125 #endif /* __CS_PROTOTYPES_H__ */ 1126