9.2
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-2026 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 "base/cs_field.h"
33#include "base/cs_param_types.h"
34#include "base/cs_time_plot.h"
35#include "base/cs_time_step.h"
38#include "cdo/cs_equation.h"
39#include "cdo/cs_maxwell.h"
41#include "cdo/cs_navsto_param.h"
42#include "cdo/cs_property.h"
44#include "cdo/cs_xdef.h"
45#include "mesh/cs_mesh.h"
46
47/*============================================================================
48 * Macro definitions
49 *============================================================================*/
50
51/*============================================================================
52 * Function pointer definitions
53 *============================================================================*/
54
55/*----------------------------------------------------------------------------*/
71/*----------------------------------------------------------------------------*/
72
75 cs_adv_field_t *adv_field,
76 cs_real_t *mflux,
77 cs_real_t *mflux_pre,
78 cs_boundary_type_t *fb_type,
79 void *nscc);
80
81/*----------------------------------------------------------------------------*/
92/*----------------------------------------------------------------------------*/
93
95 scheme_context);
96
97/*----------------------------------------------------------------------------*/
108/*----------------------------------------------------------------------------*/
109
110typedef void
112 const cs_cdo_quantities_t *quant,
113 const cs_time_step_t *ts,
115
116/*----------------------------------------------------------------------------*/
126/*----------------------------------------------------------------------------*/
127
128typedef void(cs_navsto_compute_t)(const cs_mesh_t *mesh,
129 const cs_navsto_param_t *nsp,
131
132/*----------------------------------------------------------------------------*/
145/*----------------------------------------------------------------------------*/
146
148 const cs_cdo_connect_t *connect,
149 const cs_cdo_quantities_t *quant,
150 const cs_time_step_t *ts,
151 const cs_field_t *velocity,
152 const cs_real_t *face_vel,
153 const cs_field_t *pressure);
154
155/*----------------------------------------------------------------------------*/
173/*----------------------------------------------------------------------------*/
174
176 const cs_navsto_param_t *nsp,
177 const cs_cdo_quantities_t *quant,
178 const cs_time_step_t *ts,
179 const cs::cdo_navsto_ctx_t *sc,
180 const cs_turbulence_t *tbs,
182
183/*=============================================================================
184 * Structure definitions
185 *============================================================================*/
186
191typedef struct {
192
198
205
213
221
227
239
245
262
279
286
293
300
308
316
323
330
337
343
349
358
373
381
388
402
410
417
423
429
436
443
450
452
453/*============================================================================
454 * Public function prototypes
455 *============================================================================*/
456
457/*----------------------------------------------------------------------------*/
464/*----------------------------------------------------------------------------*/
465
466bool
468
469/*----------------------------------------------------------------------------*/
475/*----------------------------------------------------------------------------*/
476
477void
478cs_navsto_system_update_model(bool with_thermal);
479
480/*----------------------------------------------------------------------------*/
492/*----------------------------------------------------------------------------*/
493
498 cs_navsto_param_coupling_t algo_coupling,
500
501/*----------------------------------------------------------------------------*/
511/*----------------------------------------------------------------------------*/
512
516 cs_navsto_param_coupling_t algo_coupling);
517
518/*----------------------------------------------------------------------------*/
522/*----------------------------------------------------------------------------*/
523
524void
526
527/*----------------------------------------------------------------------------*/
534/*----------------------------------------------------------------------------*/
535
538
539/*----------------------------------------------------------------------------*/
545/*----------------------------------------------------------------------------*/
546
549
550/*----------------------------------------------------------------------------*/
557/*----------------------------------------------------------------------------*/
558
561
562/*----------------------------------------------------------------------------*/
571/*----------------------------------------------------------------------------*/
572
573cs_real_t *
574cs_navsto_get_mass_flux(bool previous);
575
576/*----------------------------------------------------------------------------*/
582/*----------------------------------------------------------------------------*/
583
584void
586
587/*----------------------------------------------------------------------------*/
596/*----------------------------------------------------------------------------*/
597
598void
600 const cs_cdo_connect_t *connect,
601 const cs_cdo_quantities_t *quant,
602 const cs_time_step_t *time_step);
603
604/*----------------------------------------------------------------------------*/
611/*----------------------------------------------------------------------------*/
612
613void
615
616/*----------------------------------------------------------------------------*/
626/*----------------------------------------------------------------------------*/
627
628void
630 const cs_cdo_connect_t *connect,
631 const cs_cdo_quantities_t *quant,
632 const cs_time_step_t *time_step);
633
634/*----------------------------------------------------------------------------*/
641/*----------------------------------------------------------------------------*/
642
643void
645 cs_lnum_t solid_cell_ids[]);
646
647/*----------------------------------------------------------------------------*/
657/*----------------------------------------------------------------------------*/
658
659void
661 const cs_cdo_connect_t *connect,
662 const cs_cdo_quantities_t *quant,
663 const cs_time_step_t *time_step);
664
665/*----------------------------------------------------------------------------*/
675/*----------------------------------------------------------------------------*/
676
677void
679 const cs_cdo_connect_t *connect,
680 const cs_cdo_quantities_t *quant,
681 const cs_time_step_t *time_step);
682
683/*----------------------------------------------------------------------------*/
693/*----------------------------------------------------------------------------*/
694
695void
697 const cs_cdo_connect_t *connect,
698 const cs_cdo_quantities_t *quant,
699 const cs_time_step_t *time_step,
700 bool &is_last_iter);
701
702/*----------------------------------------------------------------------------*/
711/*----------------------------------------------------------------------------*/
712
713void
715 const cs_cdo_connect_t *connect,
716 const cs_cdo_quantities_t *quant,
717 const cs_time_step_t *time_step);
718
719/*----------------------------------------------------------------------------*/
741/*----------------------------------------------------------------------------*/
742
743void
745 int mesh_id,
746 int cat_id,
747 int ent_flag[5],
748 cs_lnum_t n_cells,
749 cs_lnum_t n_i_faces,
750 cs_lnum_t n_b_faces,
751 const cs_lnum_t cell_ids[],
752 const cs_lnum_t i_face_ids[],
753 const cs_lnum_t b_face_ids[],
754 const cs_time_step_t *time_step);
755
756/*----------------------------------------------------------------------------*/
763/*----------------------------------------------------------------------------*/
764
765void
767
768/*----------------------------------------------------------------------------*/
775/*----------------------------------------------------------------------------*/
776
777void
779
780/*----------------------------------------------------------------------------*/
787/*----------------------------------------------------------------------------*/
788
789void
791
792/*----------------------------------------------------------------------------*/
796/*----------------------------------------------------------------------------*/
797
798void
800
801#endif /* CS_NAVSTO_SYSTEM_H */
Field descriptor.
Definition: cs_field.h:275
time step descriptor
Definition: cs_time_step.h:60
int cs_boundary_type_t
Definition: cs_boundary.h:65
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
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:56
cs_navsto_param_coupling_t
Choice of algorithm for solving the system.
Definition: cs_navsto_param.h:237
cs_navsto_param_model_t
Describe the system of equations related to the Navier-Stokes to be solved.
Definition: cs_navsto_param.h:80
cs_flag_t cs_navsto_param_model_flag_t
Definition: cs_navsto_param.h:55
cs_flag_t cs_navsto_param_num_flag_t
Definition: cs_navsto_param.h:57
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.cpp:596
void cs_navsto_system_set_model_flag(cs_navsto_param_model_flag_t model_flag)
Set model flags for the Navier-Stokes (NS) system.
Definition: cs_navsto_system.cpp:2315
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.cpp:1585
void cs_navsto_system_set_post_flag(cs_navsto_param_post_flag_t post_flag)
Set post flags for the Navier-Stokes (NS) system.
Definition: cs_navsto_system.cpp:2270
void cs_navsto_system_log_setup(void)
Summary of the main cs_navsto_system_t structure.
Definition: cs_navsto_system.cpp:2226
void() cs_navsto_check_convergence_t(const cs_navsto_param_t *nsp, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, const cs::cdo_navsto_ctx_t *sc, const cs_turbulence_t *tbs, cs_cdo_navsto_psteady_cvg_t &ps_cvg)
Compute for the current time step the new state for the Navier-Stokes system. This means that equatio...
Definition: cs_navsto_system.h:175
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.cpp:577
void cs_navsto_system_destroy(void)
Free the main structure related to the Navier-Stokes system.
Definition: cs_navsto_system.cpp:494
void() cs_navsto_compute_t(const cs_mesh_t *mesh, const cs_navsto_param_t *nsp, cs::cdo_navsto_ctx_t *sc)
Compute for the current time step the new state for the Navier-Stokes system. This means that equatio...
Definition: cs_navsto_system.h:128
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.cpp:381
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.cpp:1969
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.cpp:681
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.cpp:1002
void cs_navsto_system_set_num_flag(cs_navsto_param_num_flag_t num_flag)
Set numerical flags for the Navier-Stokes (NS) system.
Definition: cs_navsto_system.cpp:2336
bool cs_navsto_system_is_activated(void)
Check if the resolution of the Navier-Stokes system has been activated.
Definition: cs_navsto_system.cpp:321
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.cpp:1665
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.cpp:1628
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.cpp:1445
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.cpp:2087
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.cpp:658
void cs_navsto_system_update_model(bool with_thermal)
Update the flag associated to the modelling options.
Definition: cs_navsto_system.cpp:338
void *() cs_navsto_free_scheme_context_t(cs::cdo_navsto_ctx_t *scheme_context)
Free the context structure related to a given discretization scheme for the resolution of the Navier-...
Definition: cs_navsto_system.h:94
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, bool &is_last_iter)
Build, solve and update the Navier-Stokes system.
Definition: cs_navsto_system.cpp:1823
cs::cdo_navsto_ctx_t *() 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:74
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.cpp:1490
void() cs_navsto_check_init_t(const cs_navsto_param_t *nsp, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, const cs_field_t *velocity, const cs_real_t *face_vel, const cs_field_t *pressure)
According to the model, coupling algorithm and the space discretization, check initializion of the fi...
Definition: cs_navsto_system.h:147
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.cpp:636
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:111
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:44
Definition: field.f90:27
Definition: mesh.f90:26
Context related to CDO face-based discretization when dealing with Navier-Stokes equations and vector...
Definition: cs_navsto_context.h:48
Definition: cs_advection_field.h:151
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:154
Definition: cs_cdo_connect.h:57
Definition: cs_param_types.h:660
Definition: cs_cdo_quantities.h:142
Main structure to handle the discretization and the resolution of an equation.
Definition: cs_mesh.h:85
Structure storing the parameters related to the resolution of the Navier-Stokes system.
Definition: cs_navsto_param.h:296
Structure managing the Navier-Stokes system.
Definition: cs_navsto_system.h:191
cs_cdo_navsto_psteady_cvg_t psteady_cvg
Definition: cs_navsto_system.h:387
cs::cdo_navsto_ctx_t * scheme_context
Definition: cs_navsto_system.h:380
cs_field_t * mass_density
Definition: cs_navsto_system.h:307
cs_navsto_init_values_t * init_pressure
Definition: cs_navsto_system.h:422
cs_field_t * velocity_gradient
Definition: cs_navsto_system.h:342
cs_navsto_init_values_t * init_velocity
Definition: cs_navsto_system.h:416
cs_real_t * mass_flux_array
Definition: cs_navsto_system.h:212
cs_navsto_compute_t * compute_steady
Definition: cs_navsto_system.h:435
cs_field_t * pressure
Definition: cs_navsto_system.h:244
cs_field_t * helicity
Definition: cs_navsto_system.h:329
cs_navsto_param_t * param
Definition: cs_navsto_system.h:197
cs_adv_field_t * adv_field
Definition: cs_navsto_system.h:204
cs_navsto_free_scheme_context_t * free_scheme_context
Definition: cs_navsto_system.h:409
cs_field_t * velocity_divergence
Definition: cs_navsto_system.h:285
cs_navsto_check_init_t * check_init
Definition: cs_navsto_system.h:428
cs_field_t * kinetic_energy
Definition: cs_navsto_system.h:299
cs_turbulence_t * turbulence
Definition: cs_navsto_system.h:261
cs_navsto_compute_t * compute
Definition: cs_navsto_system.h:442
void * coupling_context
Definition: cs_navsto_system.h:372
cs_navsto_init_scheme_context_t * init_scheme_context
Definition: cs_navsto_system.h:401
cs_field_t * vorticity
Definition: cs_navsto_system.h:322
cs_real_t * mass_flux_array_pre
Definition: cs_navsto_system.h:220
cs_navsto_check_convergence_t * check_convergence
Definition: cs_navsto_system.h:449
cs_equation_t * stream_function_eq
Definition: cs_navsto_system.h:357
cs_field_t * boundary_stress
Definition: cs_navsto_system.h:348
cs_field_t * mass_flux_balance
Definition: cs_navsto_system.h:315
cs_field_t * enstrophy
Definition: cs_navsto_system.h:336
cs_boundary_type_t * bf_type
Definition: cs_navsto_system.h:226
cs_field_t * pressure_gradient
Definition: cs_navsto_system.h:292
cs_time_plot_t * plot_writer
Definition: cs_navsto_system.h:278
cs_field_t * velocity
Definition: cs_navsto_system.h:238
Structure storing the parameters related to the resolution of the turbulence modelling....