8.0
general documentation
cs_navsto_system.h
Go to the documentation of this file.
1 #ifndef __CS_NAVSTO_SYSTEM_H__
2 #define __CS_NAVSTO_SYSTEM_H__
3 
4 /*============================================================================
5  * Functions to handle cs_navsto_system_t structure
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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_advection_field.h"
33 #include "cs_cdo_turbulence.h"
34 #include "cs_equation.h"
35 #include "cs_field.h"
36 #include "cs_param_types.h"
37 #include "cs_property.h"
38 #include "cs_maxwell.h"
39 #include "cs_mesh.h"
40 #include "cs_navsto_param.h"
41 #include "cs_time_plot.h"
42 #include "cs_time_step.h"
43 #include "cs_thermal_system.h"
44 #include "cs_xdef.h"
45 
46 /*----------------------------------------------------------------------------*/
47 
49 
50 /*============================================================================
51  * Macro definitions
52  *============================================================================*/
53 
54 /*============================================================================
55  * Function pointer definitions
56  *============================================================================*/
57 
58 /*----------------------------------------------------------------------------*/
74 /*----------------------------------------------------------------------------*/
75 
76 typedef void *
78  cs_adv_field_t *adv_field,
79  cs_real_t *mflux,
80  cs_real_t *mflux_pre,
81  cs_boundary_type_t *fb_type,
82  void *nscc);
83 
84 /*----------------------------------------------------------------------------*/
94 /*----------------------------------------------------------------------------*/
95 
96 typedef void *
97 (cs_navsto_free_scheme_context_t)(void *scheme_context);
98 
99 /*----------------------------------------------------------------------------*/
110 /*----------------------------------------------------------------------------*/
111 
112 typedef void
114  const cs_cdo_quantities_t *quant,
115  const cs_time_step_t *ts,
116  cs_field_t *field);
117 
118 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 typedef void
132  const cs_navsto_param_t *nsp,
133  void *scheme_context);
134 
135 /*=============================================================================
136  * Structure definitions
137  *============================================================================*/
138 
143 typedef struct {
144 
150 
157 
165 
173 
179 
191 
197 
214 
231 
238 
245 
252 
260 
268 
275 
282 
289 
295 
304 
319 
327 
341 
349 
356 
362 
369 
376 
378 
379 /*============================================================================
380  * Public function prototypes
381  *============================================================================*/
382 
383 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 
392 bool
394 
395 /*----------------------------------------------------------------------------*/
401 /*----------------------------------------------------------------------------*/
402 
403 void
404 cs_navsto_system_update_model(bool with_thermal);
405 
406 /*----------------------------------------------------------------------------*/
418 /*----------------------------------------------------------------------------*/
419 
421 cs_navsto_system_activate(const cs_boundary_t *boundaries,
423  cs_navsto_param_model_flag_t model_flag,
424  cs_navsto_param_coupling_t algo_coupling,
425  cs_navsto_param_post_flag_t post_flag);
426 
427 /*----------------------------------------------------------------------------*/
431 /*----------------------------------------------------------------------------*/
432 
433 void
435 
436 /*----------------------------------------------------------------------------*/
443 /*----------------------------------------------------------------------------*/
444 
447 
448 /*----------------------------------------------------------------------------*/
454 /*----------------------------------------------------------------------------*/
455 
458 
459 /*----------------------------------------------------------------------------*/
466 /*----------------------------------------------------------------------------*/
467 
470 
471 /*----------------------------------------------------------------------------*/
480 /*----------------------------------------------------------------------------*/
481 
482 cs_real_t *
483 cs_navsto_get_mass_flux(bool previous);
484 
485 /*----------------------------------------------------------------------------*/
491 /*----------------------------------------------------------------------------*/
492 
493 void
495 
496 /*----------------------------------------------------------------------------*/
505 /*----------------------------------------------------------------------------*/
506 
507 void
509  const cs_cdo_connect_t *connect,
510  const cs_cdo_quantities_t *quant,
511  const cs_time_step_t *time_step);
512 
513 /*----------------------------------------------------------------------------*/
517 /*----------------------------------------------------------------------------*/
518 
519 void
521 
522 /*----------------------------------------------------------------------------*/
529 /*----------------------------------------------------------------------------*/
530 
531 void
533 
534 /*----------------------------------------------------------------------------*/
544 /*----------------------------------------------------------------------------*/
545 
546 void
548  const cs_cdo_connect_t *connect,
549  const cs_cdo_quantities_t *quant,
550  const cs_time_step_t *time_step);
551 
552 /*----------------------------------------------------------------------------*/
559 /*----------------------------------------------------------------------------*/
560 
561 void
563  cs_lnum_t solid_cell_ids[]);
564 
565 /*----------------------------------------------------------------------------*/
575 /*----------------------------------------------------------------------------*/
576 
577 void
579  const cs_cdo_connect_t *connect,
580  const cs_cdo_quantities_t *quant,
581  const cs_time_step_t *time_step);
582 
583 /*----------------------------------------------------------------------------*/
593 /*----------------------------------------------------------------------------*/
594 
595 void
597  const cs_cdo_connect_t *connect,
598  const cs_cdo_quantities_t *quant,
599  const cs_time_step_t *time_step);
600 
601 /*----------------------------------------------------------------------------*/
610 /*----------------------------------------------------------------------------*/
611 
612 void
614  const cs_cdo_connect_t *connect,
615  const cs_cdo_quantities_t *quant,
616  const cs_time_step_t *time_step);
617 
618 /*----------------------------------------------------------------------------*/
627 /*----------------------------------------------------------------------------*/
628 
629 void
631  const cs_cdo_connect_t *connect,
632  const cs_cdo_quantities_t *quant,
633  const cs_time_step_t *time_step);
634 
635 /*----------------------------------------------------------------------------*/
657 /*----------------------------------------------------------------------------*/
658 
659 void
660 cs_navsto_system_extra_post(void *input,
661  int mesh_id,
662  int cat_id,
663  int ent_flag[5],
664  cs_lnum_t n_cells,
665  cs_lnum_t n_i_faces,
666  cs_lnum_t n_b_faces,
667  const cs_lnum_t cell_ids[],
668  const cs_lnum_t i_face_ids[],
669  const cs_lnum_t b_face_ids[],
670  const cs_time_step_t *time_step);
671 
672 /*----------------------------------------------------------------------------*/
676 /*----------------------------------------------------------------------------*/
677 
678 void
680 
681 /*----------------------------------------------------------------------------*/
682 
684 
685 #endif /* __CS_NAVSTO_SYSTEM_H__ */
int cs_boundary_type_t
Definition: cs_boundary.h:69
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:510
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
Structure and functions handling the Maxwell module dedicated to the resolution of electro-magnetic e...
cs_flag_t cs_navsto_param_post_flag_t
Definition: cs_navsto_param.h:59
cs_navsto_param_coupling_t
Choice of algorithm for solving the system.
Definition: cs_navsto_param.h:577
cs_navsto_param_model_t
Describe the system of equations related to the Navier-Stokes to be solved.
Definition: cs_navsto_param.h:82
cs_flag_t cs_navsto_param_model_flag_t
Definition: cs_navsto_param.h:58
void cs_navsto_system_set_solid_cells(cs_lnum_t n_solid_cells, cs_lnum_t solid_cell_ids[])
Set a solid zone related to the Navier-Stokes equations.
Definition: cs_navsto_system.c:1368
cs_equation_t * cs_navsto_system_get_momentum_eq(void)
Retrieve a pointer to the equation related to the momentum equation.
Definition: cs_navsto_system.c:519
void cs_navsto_system_log_setup(void)
Summary of the main cs_navsto_system_t structure.
Definition: cs_navsto_system.c:1952
cs_navsto_system_t * cs_navsto_system_activate(const cs_boundary_t *boundaries, cs_navsto_param_model_t model, cs_navsto_param_model_flag_t model_flag, cs_navsto_param_coupling_t algo_coupling, cs_navsto_param_post_flag_t post_flag)
Allocate and initialize the Navier-Stokes (NS) system.
Definition: cs_navsto_system.c:299
cs_adv_field_t * cs_navsto_get_adv_field(void)
Retrieve the advection field structure (the mass flux) related to the Navier-Stokes system.
Definition: cs_navsto_system.c:560
void() cs_navsto_compute_t(const cs_mesh_t *mesh, const cs_navsto_param_t *nsp, void *scheme_context)
Compute for the current time step the new state for the Navier-Stokes system. This means that equatio...
Definition: cs_navsto_system.h:131
void cs_navsto_system_destroy(void)
Free the main structure related to the Navier-Stokes system.
Definition: cs_navsto_system.c:420
void cs_navsto_system_extra_op(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Predefined extra-operations for the Navier-Stokes system.
Definition: cs_navsto_system.c:1738
void cs_navsto_system_init_setup(void)
Start setting-up the Navier-Stokes system At this stage, numerical settings should be completely dete...
Definition: cs_navsto_system.c:603
void cs_navsto_system_finalize_setup(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Last step of the setup of the Navier-Stokes system.
Definition: cs_navsto_system.c:968
bool cs_navsto_system_is_activated(void)
Check if the resolution of the Navier-Stokes system has been activated.
Definition: cs_navsto_system.c:241
void cs_navsto_system_compute_steady_state(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Build, solve and update the Navier-Stokes system in case of a steady-state approach.
Definition: cs_navsto_system.c:1448
void cs_navsto_system_set_sles(void)
Define the settings for SLES related to the Navier-Stokes system.
Definition: cs_navsto_system.c:904
void cs_navsto_system_update(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Update variables and related quantities when a new state of the Navier-Stokes system has been compute...
Definition: cs_navsto_system.c:1408
void cs_navsto_system_define_context(const cs_mesh_t *mesh)
Initialize the scheme context structure used to build the algebraic system. This is done after the se...
Definition: cs_navsto_system.c:1263
void cs_navsto_system_extra_post(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_ids[], const cs_lnum_t i_face_ids[], const cs_lnum_t b_face_ids[], const cs_time_step_t *time_step)
Predefined post-processing output for the Navier-Stokes system. The prototype of this function is fix...
Definition: cs_navsto_system.c:1812
cs_real_t * cs_navsto_get_mass_flux(bool previous)
Retrieve the mass flux array related to the Navier-Stokes system.
Definition: cs_navsto_system.c:581
void *() cs_navsto_free_scheme_context_t(void *scheme_context)
Free the context structure related to a given discretization scheme for the resolution of the Navier-...
Definition: cs_navsto_system.h:97
void cs_navsto_system_update_model(bool with_thermal)
Update the flag associated to the modelling options.
Definition: cs_navsto_system.c:258
void cs_navsto_system_init_values(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Set an initial value for the velocity and pressure fields as well as mass fluxes and tubulent quantit...
Definition: cs_navsto_system.c:1303
void *() cs_navsto_init_scheme_context_t(const cs_navsto_param_t *nsp, cs_adv_field_t *adv_field, cs_real_t *mflux, cs_real_t *mflux_pre, cs_boundary_type_t *fb_type, void *nscc)
Allocate and initialize the context structure related to a given discretization scheme for the resolu...
Definition: cs_navsto_system.h:77
void cs_navsto_system_compute(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Build, solve and update the Navier-Stokes system.
Definition: cs_navsto_system.c:1612
void() cs_navsto_init_values_t(const cs_navsto_param_t *nsp, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, cs_field_t *field)
According to the model, coupling algorithm and the space discretization, initialize the field values ...
Definition: cs_navsto_system.h:113
cs_navsto_param_t * cs_navsto_system_get_param(void)
Retrieve the structure storing the parameters for the Navier–Stokes system.
Definition: cs_navsto_system.c:500
Functions to handle the cs_thermal_system_t structure. This module can be used stand alone or linked ...
struct _cs_time_plot_t cs_time_plot_t
Definition: cs_time_plot.h:48
Definition: field.f90:27
Definition: mesh.f90:26
Definition: cs_advection_field.h:150
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:155
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:137
Main structure to handle the discretization and the resolution of an equation.
Field descriptor.
Definition: cs_field.h:130
Definition: cs_mesh.h:85
Structure storing the parameters related to the resolution of the Navier-Stokes system.
Definition: cs_navsto_param.h:611
Structure managing the Navier-Stokes system.
Definition: cs_navsto_system.h:143
void * scheme_context
Definition: cs_navsto_system.h:326
cs_field_t * mass_density
Definition: cs_navsto_system.h:259
cs_navsto_init_values_t * init_pressure
Definition: cs_navsto_system.h:361
cs_field_t * velocity_gradient
Definition: cs_navsto_system.h:294
cs_navsto_init_values_t * init_velocity
Definition: cs_navsto_system.h:355
cs_real_t * mass_flux_array
Definition: cs_navsto_system.h:164
cs_navsto_compute_t * compute_steady
Definition: cs_navsto_system.h:368
cs_field_t * pressure
Definition: cs_navsto_system.h:196
cs_field_t * helicity
Definition: cs_navsto_system.h:281
cs_navsto_param_t * param
Definition: cs_navsto_system.h:149
cs_adv_field_t * adv_field
Definition: cs_navsto_system.h:156
cs_navsto_free_scheme_context_t * free_scheme_context
Definition: cs_navsto_system.h:348
cs_field_t * velocity_divergence
Definition: cs_navsto_system.h:237
cs_field_t * kinetic_energy
Definition: cs_navsto_system.h:251
cs_turbulence_t * turbulence
Definition: cs_navsto_system.h:213
cs_navsto_compute_t * compute
Definition: cs_navsto_system.h:375
void * coupling_context
Definition: cs_navsto_system.h:318
cs_navsto_init_scheme_context_t * init_scheme_context
Definition: cs_navsto_system.h:340
cs_field_t * vorticity
Definition: cs_navsto_system.h:274
cs_real_t * mass_flux_array_pre
Definition: cs_navsto_system.h:172
cs_equation_t * stream_function_eq
Definition: cs_navsto_system.h:303
cs_field_t * mass_flux_balance
Definition: cs_navsto_system.h:267
cs_field_t * enstrophy
Definition: cs_navsto_system.h:288
cs_boundary_type_t * bf_type
Definition: cs_navsto_system.h:178
cs_field_t * pressure_gradient
Definition: cs_navsto_system.h:244
cs_time_plot_t * plot_writer
Definition: cs_navsto_system.h:230
cs_field_t * velocity
Definition: cs_navsto_system.h:190
time step descriptor
Definition: cs_time_step.h:64
Structure storing the parameters related to the resolution of the turbulence modelling....