6.2
general documentation
cs_navsto_param.h
Go to the documentation of this file.
1 #ifndef __CS_NAVSTO_PARAM_H__
2 #define __CS_NAVSTO_PARAM_H__
3 
4 /*============================================================================
5  * Routines to handle cs_navsto_param_t structure
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2020 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  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_boundary.h"
33 #include "cs_equation_param.h"
34 #include "cs_math.h"
35 #include "cs_physical_constants.h"
36 #include "cs_turbulence_model.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*============================================================================
43  * Macro definitions
44  *============================================================================*/
45 
46 /* Manage the naming of properties, variables and equations related to the
47  * Navier-Stokes module */
48 
49 #define CS_NAVSTO_LAMINAR_VISCOSITY "laminar_viscosity"
50 #define CS_NAVSTO_STREAM_EQNAME "streamfunction_eq"
51 
57 /* Value = 1 */
58 #define CS_NAVSTO_FLAG_STEADY (1 << 0)
70 /* Value = 1 */
71 #define CS_NAVSTO_POST_VELOCITY_DIVERGENCE (1 << 0)
73 /* Value = 2 */
74 #define CS_NAVSTO_POST_KINETIC_ENERGY (1 << 1)
76 /* Value = 4 */
77 #define CS_NAVSTO_POST_VORTICITY (1 << 2)
79 /* Value = 8 */
80 #define CS_NAVSTO_POST_VELOCITY_GRADIENT (1 << 3)
81 
82 /* Value = 16 */
83 #define CS_NAVSTO_POST_STREAM_FUNCTION (1 << 4)
85 /* Value = 32 */
86 #define CS_NAVSTO_POST_HELICITY (1 << 5)
88 /* Value = 64 */
89 #define CS_NAVSTO_POST_ENSTROPHY (1 << 6)
95 /*============================================================================
96  * Type definitions
97  *============================================================================*/
98 
100 
141 typedef enum {
142 
143  /* Main modelling for the dynamic
144  ------------------------------ */
145 
146  CS_NAVSTO_MODEL_STOKES = 1<<0, /* = 1 */
147  CS_NAVSTO_MODEL_OSEEN = 1<<1, /* = 2 */
149 
150  /* Additional modelling bits
151  ------------------------- */
152 
155  CS_NAVSTO_MODEL_BOUSSINESQ = 1<<5, /* = 32 */
157 
159 
301 typedef enum {
302 
315 
317 
319 
331 typedef enum {
332 
334 
336 
338 
343 typedef struct {
344 
349 
363 
369 
375 
380 
385 
398 
404 
410 
416 
422 
427 
431 
432 
447 typedef enum {
448 
452 
454 
456 
462 typedef struct {
463 
468 
473 
485 
492 
498 
505 
512 
526 
534 
535 
546 
556 
561 
566 
571 
578 
587 
593 
594 
599 
629 
647 
656  /* \var boundaries
657  * Pointer to a \ref cs_boundary_t structure shared with the domain
658  */
660 
679 
696 
711 
715 
809 typedef enum {
810 
832 
834 
836 
837 /*============================================================================
838  * Inline static public function prototypes
839  *============================================================================*/
840 
841 /*----------------------------------------------------------------------------*/
850 /*----------------------------------------------------------------------------*/
851 
852 static inline bool
853 cs_navsto_param_is_steady(const cs_navsto_param_t *nsp)
854 {
855  if (nsp == NULL)
856  return true;
857 
859  return true;
860  else
861  return false;
862 }
863 
864 /*============================================================================
865  * Public function prototypes
866  *============================================================================*/
867 
868 /*----------------------------------------------------------------------------*/
881 /*----------------------------------------------------------------------------*/
882 
884 cs_navsto_param_create(const cs_boundary_t *boundaries,
886  cs_navsto_param_coupling_t algo_coupling,
887  cs_flag_t option_flag,
888  cs_flag_t post_flag);
889 
890 /*----------------------------------------------------------------------------*/
898 /*----------------------------------------------------------------------------*/
899 
902 
903 /*----------------------------------------------------------------------------*/
912 /*----------------------------------------------------------------------------*/
913 
914 void
916  cs_navsto_key_t key,
917  const char *keyval);
918 
919 /*----------------------------------------------------------------------------*/
927 /*----------------------------------------------------------------------------*/
928 
929 void
931  cs_equation_param_t *eqp);
932 
933 /*----------------------------------------------------------------------------*/
939 /*----------------------------------------------------------------------------*/
940 
941 void
943 
944 /*----------------------------------------------------------------------------*/
953 /*----------------------------------------------------------------------------*/
954 
957 
958 /*----------------------------------------------------------------------------*/
966 /*----------------------------------------------------------------------------*/
967 
968 const char *
970 
971 /*----------------------------------------------------------------------------*/
978 /*----------------------------------------------------------------------------*/
979 
980 void
982  cs_real_t pref);
983 
984 /*----------------------------------------------------------------------------*/
998 /*----------------------------------------------------------------------------*/
999 
1000 cs_xdef_t *
1002  const char *z_name,
1003  cs_real_t *val);
1004 
1005 /*----------------------------------------------------------------------------*/
1020 /*----------------------------------------------------------------------------*/
1021 
1022 cs_xdef_t *
1024  const char *z_name,
1025  cs_analytic_func_t *analytic,
1026  void *input);
1027 
1028 /*----------------------------------------------------------------------------*/
1042 /*----------------------------------------------------------------------------*/
1043 
1044 cs_xdef_t *
1046  const char *z_name,
1047  cs_real_t *val);
1048 
1049 /*----------------------------------------------------------------------------*/
1064 /*----------------------------------------------------------------------------*/
1065 
1066 cs_xdef_t *
1068  const char *z_name,
1069  cs_analytic_func_t *analytic,
1070  void *input);
1071 
1072 /*----------------------------------------------------------------------------*/
1080 /*----------------------------------------------------------------------------*/
1081 
1082 void
1084 
1085 /*----------------------------------------------------------------------------*/
1093 /*----------------------------------------------------------------------------*/
1094 
1095 void
1097 
1098 /*----------------------------------------------------------------------------*/
1106 /*----------------------------------------------------------------------------*/
1107 
1108 void
1110 
1111 /*----------------------------------------------------------------------------*/
1120 /*----------------------------------------------------------------------------*/
1121 
1122 void
1124  const char *z_name,
1125  cs_real_t *values);
1126 
1127 /*----------------------------------------------------------------------------*/
1137 /*----------------------------------------------------------------------------*/
1138 
1139 void
1141  const char *z_name,
1142  cs_real_t *values);
1143 
1144 /*----------------------------------------------------------------------------*/
1154 /*----------------------------------------------------------------------------*/
1155 
1156 void
1158  const char *z_name,
1159  cs_real_t *values);
1160 
1161 /*----------------------------------------------------------------------------*/
1172 /*----------------------------------------------------------------------------*/
1173 
1174 void
1176  const char *z_name,
1177  cs_analytic_func_t *ana,
1178  void *input);
1179 
1180 /*----------------------------------------------------------------------------*/
1192 /*----------------------------------------------------------------------------*/
1193 
1194 cs_xdef_t *
1196  const char *z_name,
1197  cs_analytic_func_t *ana,
1198  void *input);
1199 
1200 /*----------------------------------------------------------------------------*/
1211 /*----------------------------------------------------------------------------*/
1212 
1213 cs_xdef_t *
1215  const char *z_name,
1216  cs_real_t *val);
1217 
1218 /*----------------------------------------------------------------------------*/
1233 /*----------------------------------------------------------------------------*/
1234 
1235 cs_xdef_t *
1237  const char *z_name,
1238  cs_flag_t loc,
1239  cs_real_t *array,
1240  bool is_owner,
1241  cs_lnum_t *index);
1242 
1243 /*----------------------------------------------------------------------------*/
1250 /*----------------------------------------------------------------------------*/
1251 
1252 void
1254  cs_adv_field_t *adv_fld);
1255 
1256 /*----------------------------------------------------------------------------*/
1257 
1259 
1260 #endif /* __CS_NAVSTO_PARAM_H__ */
void cs_navsto_param_transfer(const cs_navsto_param_t *nsp, cs_equation_param_t *eqp)
Apply the numerical settings defined for the Navier-Stokes system to an equation related to this syst...
Definition: cs_navsto_param.c:809
Definition: cs_navsto_param.h:831
void cs_navsto_param_log(const cs_navsto_param_t *nsp)
Summary of the main cs_navsto_param_t structure.
Definition: cs_navsto_param.c:860
void cs_navsto_set_velocity_wall_by_value(cs_navsto_param_t *nsp, const char *z_name, cs_real_t *values)
Define the velocity field for a sliding wall boundary using a uniform value.
Definition: cs_navsto_param.c:1600
Definition: cs_navsto_param.h:833
void cs_navsto_set_outlets(cs_navsto_param_t *nsp)
Add the definition of boundary conditions related to outlets into the set of parameters for the manag...
Definition: cs_navsto_param.c:1466
Definition: cs_navsto_param.h:814
Definition: cs_navsto_param.h:815
cs_navsto_param_sles_t sles_param
Definition: cs_navsto_param.h:598
Definition: cs_navsto_param.h:817
int n_velocity_ic_defs
Definition: cs_navsto_param.h:627
cs_turb_rans_model_t * rans_modelling
Definition: cs_navsto_param.h:533
Definition: cs_navsto_param.h:310
Definition: cs_advection_field.h:149
Definition: cs_navsto_param.h:825
cs_property_t * lami_viscosity
Definition: cs_navsto_param.h:511
void cs_navsto_add_oseen_field(cs_navsto_param_t *nsp, cs_adv_field_t *adv_fld)
Add a advection field for the Oseen problem.
Definition: cs_navsto_param.c:1869
cs_real_t reference_pressure
Definition: cs_navsto_param.h:491
Definition: cs_navsto_param.h:822
cs_navsto_param_coupling_t
Choice of algorithm for solving the system.
Definition: cs_navsto_param.h:447
bool velocity_ic_is_owner
Definition: cs_navsto_param.h:626
Definition: cs_navsto_param.h:453
Definition: cs_navsto_param.h:316
Definition: cs_navsto_param.h:335
Structure storing the parameters for solving the Navier-Stokes system.
Definition: cs_navsto_param.h:343
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:201
Definition: cs_navsto_param.h:312
cs_xdef_t ** pressure_ic_defs
Definition: cs_navsto_param.h:646
cs_real_t nl_algo_verbosity
Definition: cs_navsto_param.h:426
cs_xdef_t * cs_navsto_add_velocity_ic_by_analytic(cs_navsto_param_t *nsp, const char *z_name, cs_analytic_func_t *analytic, void *input)
Define the initial condition for the velocity unknowns. This definition can be done on a specified me...
Definition: cs_navsto_param.c:1197
Definition: cs_navsto_param.h:830
Definition: cs_navsto_param.h:303
cs_flag_t option_flag
Definition: cs_navsto_param.h:545
cs_xdef_t * cs_navsto_add_source_term_by_analytic(cs_navsto_param_t *nsp, const char *z_name, cs_analytic_func_t *ana, void *input)
Define a new source term structure defined by an analytical function.
Definition: cs_navsto_param.c:1779
Definition: cs_navsto_param.h:147
Definition: cs_navsto_param.h:154
cs_real_t il_algo_rtol
Definition: cs_navsto_param.h:362
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
void cs_navsto_set_velocity_inlet_by_analytic(cs_navsto_param_t *nsp, const char *z_name, cs_analytic_func_t *ana, void *input)
Define the velocity field for an inlet boundary using an analytical function.
Definition: cs_navsto_param.c:1714
Definition: cs_navsto_param.h:811
Turbulence model general options descriptor.
Definition: cs_turbulence_model.h:108
Definition: cs_navsto_param.h:153
cs_quadrature_type_t qtype
Definition: cs_navsto_param.h:592
Definition: cs_navsto_param.h:826
cs_real_t il_algo_verbosity
Definition: cs_navsto_param.h:384
cs_xdef_t * cs_navsto_add_source_term_by_array(cs_navsto_param_t *nsp, const char *z_name, cs_flag_t loc, cs_real_t *array, bool is_owner, cs_lnum_t *index)
Define a new source term structure defined by an array.
Definition: cs_navsto_param.c:1843
Definition: cs_navsto_param.h:820
cs_real_t gd_scale_coef
Definition: cs_navsto_param.h:577
Definition: cs_navsto_param.h:314
Definition: cs_navsto_param.h:827
void cs_navsto_set_fixed_walls(cs_navsto_param_t *nsp)
Add the definition of boundary conditions related to a fixed wall into the set of parameters for the ...
Definition: cs_navsto_param.c:1368
cs_property_t * mass_density
Definition: cs_navsto_param.h:504
int n_pressure_ic_defs
Definition: cs_navsto_param.h:645
Definition: cs_navsto_param.h:818
cs_xdef_t * cs_navsto_add_source_term_by_val(cs_navsto_param_t *nsp, const char *z_name, cs_real_t *val)
Define a new source term structure defined by a constant value.
Definition: cs_navsto_param.c:1813
void cs_navsto_param_set(cs_navsto_param_t *nsp, cs_navsto_key_t key, const char *keyval)
Set a parameter attached to a keyname in a cs_navsto_param_t structure.
Definition: cs_navsto_param.c:461
cs_xdef_t * cs_navsto_add_velocity_ic_by_value(cs_navsto_param_t *nsp, const char *z_name, cs_real_t *val)
Define the initial condition for the velocity unknowns. This definition can be done on a specified me...
Definition: cs_navsto_param.c:1134
Definition: cs_navsto_param.h:450
cs_equation_param_t * cs_navsto_param_get_velocity_param(const cs_navsto_param_t *nsp)
Retrieve the cs_equation_param_t structure related to the velocity equation (momentum equation in mos...
Definition: cs_navsto_param.c:1044
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:151
Definition: cs_navsto_param.h:819
Definition: cs_navsto_param.h:148
cs_turb_model_t * turbulence
Definition: cs_navsto_param.h:525
Structure storing the parameters related to the resolution of the Navier-Stokes system.
Definition: cs_navsto_param.h:462
cs_lnum_t n_solid_cells
Definition: cs_navsto_param.h:709
int n_max_il_algo_iter
Definition: cs_navsto_param.h:379
cs_xdef_t ** velocity_bc_defs
Definition: cs_navsto_param.h:678
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
Definition: cs_navsto_param.h:311
cs_navsto_nl_algo_t
Type of algorithm used to tackle the non-linearity arising from the Navier-Stokes system...
Definition: cs_navsto_param.h:331
int n_max_nl_algo_iter
Definition: cs_navsto_param.h:421
cs_navsto_param_t * cs_navsto_param_create(const cs_boundary_t *boundaries, cs_navsto_param_model_t model, cs_navsto_param_coupling_t algo_coupling, cs_flag_t option_flag, cs_flag_t post_flag)
Create a new structure to store all numerical parameters related to the resolution of the Navier-Stok...
Definition: cs_navsto_param.c:241
cs_real_t nl_algo_atol
Definition: cs_navsto_param.h:409
cs_real_t nl_algo_dtol
Definition: cs_navsto_param.h:415
cs_param_space_scheme_t
Type of numerical scheme for the discretization in space.
Definition: cs_param_types.h:178
cs_quadrature_type_t
Definition: cs_quadrature.h:52
Definition: cs_navsto_param.h:821
void() cs_analytic_func_t(cs_real_t time, cs_lnum_t n_elts, const cs_lnum_t *elt_ids, const cs_real_t *coords, bool compact, void *input, cs_real_t *retval)
Generic function pointer for an analytic function elt_ids is optional. If not NULL, it enables to access in coords at the right location and the same thing to fill retval if compact is set to false.
Definition: cs_param_types.h:93
cs_real_t il_algo_atol
Definition: cs_navsto_param.h:368
cs_navsto_key_t
List of available keys for setting the parameters of the Navier-Stokes system.
Definition: cs_navsto_param.h:809
Definition: cs_navsto_param.h:812
void cs_navsto_set_reference_pressure(cs_navsto_param_t *nsp, cs_real_t pref)
Set the value to consider for the reference pressure.
Definition: cs_navsto_param.c:1108
bool velocity_bc_is_owner
Definition: cs_navsto_param.h:676
cs_navsto_nl_algo_t nl_algo
Definition: cs_navsto_param.h:397
void cs_navsto_set_velocity_inlet_by_value(cs_navsto_param_t *nsp, const char *z_name, cs_real_t *values)
Define the velocity field for an inlet boundary using a uniform value.
Definition: cs_navsto_param.c:1656
cs_param_time_scheme_t time_scheme
Definition: cs_navsto_param.h:554
const cs_boundary_t * boundaries
Definition: cs_navsto_param.h:659
cs_navsto_param_model_t model
Definition: cs_navsto_param.h:484
cs_flag_t post_flag
Definition: cs_navsto_param.h:472
RANS turbulence model descriptor.
Definition: cs_turbulence_model.h:165
cs_xdef_t ** velocity_ic_defs
Definition: cs_navsto_param.h:628
cs_param_advection_form_t adv_form
Definition: cs_navsto_param.h:585
Definition: cs_navsto_param.h:305
cs_xdef_t * cs_navsto_add_pressure_ic_by_value(cs_navsto_param_t *nsp, const char *z_name, cs_real_t *val)
Define the initial condition for the pressure unknowns. This definition can be done on a specified me...
Definition: cs_navsto_param.c:1268
Definition: cs_navsto_param.h:824
bool pressure_ic_is_owner
Definition: cs_navsto_param.h:644
Definition: cs_navsto_param.h:829
Definition: cs_navsto_param.h:155
void cs_navsto_set_symmetries(cs_navsto_param_t *nsp)
Add the definition of boundary conditions related to a symmetry into the set of parameters for the ma...
Definition: cs_navsto_param.c:1416
cs_flag_t cs_navsto_param_model_t
Definition: cs_navsto_param.h:99
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:136
Definition: cs_navsto_param.h:306
cs_real_t theta
Definition: cs_navsto_param.h:555
Definition: cs_navsto_param.h:823
Definition: cs_navsto_param.h:333
Definition: cs_navsto_param.h:146
Definition: cs_navsto_param.h:156
const char * cs_navsto_param_get_coupling_name(cs_navsto_param_coupling_t coupling)
Retrieve the name of the coupling algorithm.
Definition: cs_navsto_param.c:1080
cs_xdef_t * cs_navsto_add_pressure_ic_by_analytic(cs_navsto_param_t *nsp, const char *z_name, cs_analytic_func_t *analytic, void *input)
Define the initial condition for the pressure unknowns. This definition can be done on a specified me...
Definition: cs_navsto_param.c:1317
cs_navsto_sles_t
High-level information about the way of settings the SLES for solving the Navier-Stokes system...
Definition: cs_navsto_param.h:301
cs_real_t il_algo_dtol
Definition: cs_navsto_param.h:374
Definition: cs_navsto_param.h:304
bool pressure_bc_is_owner
Definition: cs_navsto_param.h:693
Definition: cs_navsto_param.h:308
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
cs_xdef_t ** pressure_bc_defs
Definition: cs_navsto_param.h:695
int n_pressure_bc_defs
Definition: cs_navsto_param.h:694
cs_navsto_param_model_bit_t
Bit values for physical modelling related to the Navier-Stokes system of equations.
Definition: cs_navsto_param.h:141
#define END_C_DECLS
Definition: cs_defs.h:496
unsigned short int cs_flag_t
Definition: cs_defs.h:309
cs_navsto_param_t * cs_navsto_param_free(cs_navsto_param_t *param)
Free a cs_navsto_param_t structure.
Definition: cs_navsto_param.c:385
cs_param_dof_reduction_t
Definition: cs_param_types.h:205
Physical constants descriptor.
Definition: cs_physical_constants.h:51
int verbosity
Definition: cs_navsto_param.h:467
Definition: cs_navsto_param.h:313
int n_velocity_bc_defs
Definition: cs_navsto_param.h:677
Definition: cs_navsto_param.h:451
Definition: cs_navsto_param.h:449
Definition: cs_navsto_param.h:309
cs_param_advection_scheme_t
Definition: cs_param_types.h:313
cs_lnum_t * solid_cell_ids
Definition: cs_navsto_param.h:710
Definition: cs_navsto_param.h:828
cs_param_dof_reduction_t dof_reduction_mode
Definition: cs_navsto_param.h:565
Definition: cs_navsto_param.h:816
cs_param_time_scheme_t
Definition: cs_param_types.h:237
Structure and routines handling the specific settings related to a cs_equation_t structure.
void cs_navsto_set_pressure_bc_by_value(cs_navsto_param_t *nsp, const char *z_name, cs_real_t *values)
Define the pressure field on a boundary using a uniform value.
Definition: cs_navsto_param.c:1518
cs_navsto_sles_t strategy
Definition: cs_navsto_param.h:348
cs_param_advection_form_t
Definition: cs_param_types.h:269
Definition: cs_navsto_param.h:813
Structure associated to the definition of a property relying on the cs_xdef_t structure.
cs_physical_constants_t * phys_constants
Definition: cs_navsto_param.h:497
cs_param_advection_scheme_t adv_scheme
Definition: cs_navsto_param.h:586
cs_real_t nl_algo_rtol
Definition: cs_navsto_param.h:403
cs_navsto_param_coupling_t coupling
Definition: cs_navsto_param.h:570
cs_param_space_scheme_t space_scheme
Definition: cs_navsto_param.h:560
Definition: cs_navsto_param.h:307
#define CS_NAVSTO_FLAG_STEADY
Definition: cs_navsto_param.h:58