9.2
general documentation
cs_macfb_navsto.h
Go to the documentation of this file.
1#ifndef CS_MACFB_NAVSTO_H
2#define CS_MACFB_NAVSTO_H
3
4/*============================================================================
5 * Functions shared for MAC face-based schemes for the discretization of the
6 * Navier--Stokes system
7 *============================================================================*/
8
9/*
10 This file is part of code_saturne, a general-purpose CFD tool.
11
12 Copyright (C) 1998-2026 EDF S.A.
13
14 This program is free software; you can redistribute it and/or modify it under
15 the terms of the GNU General Public License as published by the Free Software
16 Foundation; either version 2 of the License, or (at your option) any later
17 version.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22 details.
23
24 You should have received a copy of the GNU General Public License along with
25 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26 Street, Fifth Floor, Boston, MA 02110-1301, USA.
27*/
28
29/*----------------------------------------------------------------------------*/
30
31#include "base/cs_defs.h"
32
33/*----------------------------------------------------------------------------
34 * Standard C library headers
35 *----------------------------------------------------------------------------*/
36
37/*----------------------------------------------------------------------------
38 * Local headers
39 *----------------------------------------------------------------------------*/
40
41#include "alge/cs_matrix.h"
42#include "base/cs_base.h"
43#include "base/cs_field.h"
44#include "base/cs_math.h"
45#include "base/cs_time_plot.h"
46#include "base/cs_time_step.h"
47#include "cdo/cs_cdo_connect.h"
49#include "cdo/cs_cdofb_navsto.h"
50#include "cdo/cs_iter_algo.h"
51#include "cdo/cs_navsto_param.h"
52#include "cdo/cs_sdm.h"
53#include "mesh/cs_mesh.h"
54
55/*============================================================================
56 * Macro definitions
57 *============================================================================*/
58
59/*============================================================================
60 * Type definitions
61 *============================================================================*/
62
69
80
81/*----------------------------------------------------------------------------*/
93/*----------------------------------------------------------------------------*/
94
96 const cs_cell_mesh_t *cm,
98 cs_cell_sys_t *csys);
99
100/*============================================================================
101 * Public function prototypes
102 *============================================================================*/
103
104/*----------------------------------------------------------------------------*/
110/*----------------------------------------------------------------------------*/
111
112void
114
115/*----------------------------------------------------------------------------*/
124/*----------------------------------------------------------------------------*/
125
128 const cs_cdo_connect_t *connect);
129
130/*----------------------------------------------------------------------------*/
136/*----------------------------------------------------------------------------*/
137
139
140/*----------------------------------------------------------------------------*/
153/*----------------------------------------------------------------------------*/
154
156 const cs_navsto_param_t *nsp,
157 const cs_cell_mesh_t *cm,
158 const cs_macfb_builder_t *macb,
159 const cs_cell_sys_t *csys,
160 const cs_cdo_bc_face_t *pr_bc,
161 const cs_boundary_type_t *bf_type,
163
164/*----------------------------------------------------------------------------*/
176/*----------------------------------------------------------------------------*/
177
179 const cs_cdo_quantities_t *quant,
180 const cs_real_t *face_vel,
181 cs_real_t *mass_flux);
182
183/*----------------------------------------------------------------------------*/
196/*----------------------------------------------------------------------------*/
197
199 const cs_cdo_quantities_t *quant,
200 const cs_adjacency_t *c2f,
201 const cs_real_t *f_vals);
202
203/*----------------------------------------------------------------------------*/
215/*----------------------------------------------------------------------------*/
216
218 const cs_cdo_connect_t *connect,
219 const cs_cdo_quantities_t *quant,
220 const cs_time_step_t *ts,
221 const cs_navsto_param_t *nsp,
222 const cs_real_t *p_cell,
223 cs_real_t *p_face);
224
225/*----------------------------------------------------------------------------*/
234/*----------------------------------------------------------------------------*/
235
237 const cs_cdo_quantities_t *quant,
238 const cs_real_t *mass_flux,
239 cs_real_t *u_cell);
240
241/*----------------------------------------------------------------------------*/
251/*----------------------------------------------------------------------------*/
252
253void cs_macfb_navsto_add_grad_div(short int n_fc,
254 const cs_real_t zeta,
255 const cs_real_t div[],
256 cs_sdm_t *mat);
257
258/*----------------------------------------------------------------------------*/
267/*----------------------------------------------------------------------------*/
268
270 const cs_cdo_quantities_t *quant,
271 const cs_time_step_t *ts,
272 cs_field_t *pr);
273
274/*----------------------------------------------------------------------------*/
284/*----------------------------------------------------------------------------*/
285
287 const cs_cdo_connect_t *connect,
288 const cs_time_step_t *ts,
289 cs_real_t *pr_f);
290
291/*----------------------------------------------------------------------------*/
300/*----------------------------------------------------------------------------*/
301
303 const cs_cdo_quantities_t *quant,
304 cs_real_t values[]);
305
306/*----------------------------------------------------------------------------*/
314/*----------------------------------------------------------------------------*/
315
317 cs_real_t values[]);
318
319/*----------------------------------------------------------------------------*/
347/*----------------------------------------------------------------------------*/
348
350 const cs_mesh_t *mesh,
351 const cs_cdo_quantities_t *quant,
352 const cs_cdo_connect_t *connect,
353 const cs_time_step_t *ts,
354 cs_time_plot_t *time_plotter,
355 const cs_adv_field_t *adv_field,
356 const cs_real_t *mass_flux,
357 const cs_real_t *p_cell,
358 const cs_real_t *u_face);
359
360/*----------------------------------------------------------------------------*/
375/*----------------------------------------------------------------------------*/
376
377void cs_macfb_block_dirichlet_alge(short int f,
378 const cs_equation_param_t *eqp,
379 const cs_cell_mesh_t *cm,
380 const cs_property_data_t *pty,
382 cs_cell_sys_t *csys);
383
384/*----------------------------------------------------------------------------*/
401/*----------------------------------------------------------------------------*/
402
403void cs_macfb_block_dirichlet_pena(short int f,
404 const cs_equation_param_t *eqp,
405 const cs_cell_mesh_t *cm,
406 const cs_property_data_t *pty,
408 cs_cell_sys_t *csys);
409
410/*----------------------------------------------------------------------------*/
427/*----------------------------------------------------------------------------*/
428
429void cs_macfb_block_dirichlet_weak(short int fb,
430 const cs_equation_param_t *eqp,
431 const cs_cell_mesh_t *cm,
432 const cs_property_data_t *pty,
434 cs_cell_sys_t *csys);
435
436/*----------------------------------------------------------------------------*/
453/*----------------------------------------------------------------------------*/
454
455void cs_macfb_block_dirichlet_wsym(short int fb,
456 const cs_equation_param_t *eqp,
457 const cs_cell_mesh_t *cm,
458 const cs_property_data_t *pty,
460 cs_cell_sys_t *csys);
461
462/*----------------------------------------------------------------------------*/
476/*----------------------------------------------------------------------------*/
477
478void cs_macfb_symmetry(short int fb,
479 const cs_equation_param_t *eqp,
480 const cs_cell_mesh_t *cm,
481 const cs_property_data_t *pty,
483 cs_cell_sys_t *csys);
484
485/*----------------------------------------------------------------------------*/
498/*----------------------------------------------------------------------------*/
499
500void cs_macfb_fixed_wall(short int fb,
501 const cs_equation_param_t *eqp,
502 const cs_cell_mesh_t *cm,
503 const cs_property_data_t *pty,
505 cs_cell_sys_t *csys);
506
507/*----------------------------------------------------------------------------*/
520/*----------------------------------------------------------------------------*/
521
524 const cs_real_t *pre_iterate,
525 cs_real_t *cur_iterate,
527
528/*----------------------------------------------------------------------------*/
537/*----------------------------------------------------------------------------*/
538
540 cs_macfb_navsto_source_t **p_func);
541
542/*----------------------------------------------------------------------------*/
554/*----------------------------------------------------------------------------*/
555
557 const cs_cell_mesh_t *cm,
558 const cs_macfb_navsto_builder_t *nsb,
559 cs_cell_sys_t *csys);
560
561/*----------------------------------------------------------------------------*/
574/*----------------------------------------------------------------------------*/
575
577 const cs_cell_mesh_t *cm,
578 const cs_macfb_navsto_builder_t *nsb,
579 cs_cell_sys_t *csys);
580
581/*----------------------------------------------------------------------------*/
594/*----------------------------------------------------------------------------*/
595
597 const cs_cell_mesh_t *cm,
598 const cs_macfb_navsto_builder_t *nsb,
599 cs_cell_sys_t *csys);
600
601/*----------------------------------------------------------------------------*/
614/*----------------------------------------------------------------------------*/
615
617 const cs_cell_mesh_t *cm,
618 const cs_macfb_navsto_builder_t *nsb,
619 cs_cell_sys_t *csys);
620
621/*----------------------------------------------------------------------------*/
633/*----------------------------------------------------------------------------*/
634
636 const cs_lnum_t *elt_ids,
637 bool dense_output,
638 void *input,
639 cs_real_t *retval);
640
641#endif /* CS_MACFB_NAVSTO_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
cs_cdofb_navsto_boussinesq_type_t
Type of algorithm to compute the Boussinesq approximation.
Definition: cs_cdofb_navsto.h:69
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
void cs_macfb_symmetry(short int fb, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_property_data_t *pty, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account a boundary defined as 'symmetry' (treated as a sliding BCs on the three velocity co...
Definition: cs_macfb_navsto.cpp:1122
void cs_macfb_navsto_boussinesq_at_cell(const cs_navsto_param_t *nsp, const cs_cell_mesh_t *cm, const cs_macfb_navsto_builder_t *nsb, cs_cell_sys_t *csys)
Take into account the buoyancy force with the Boussinesq approx. Compute and add the source term to t...
Definition: cs_macfb_navsto.cpp:1280
void cs_macfb_fixed_wall(short int fb, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_property_data_t *pty, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account a wall BCs by a weak enforcement using Nitsche technique plus a symmetric treatment...
Definition: cs_macfb_navsto.cpp:1155
void cs_macfb_block_dirichlet_alge(short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_property_data_t *pty, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account a Dirichlet BCs on the three velocity components. For instance for a velocity inlet...
Definition: cs_macfb_navsto.cpp:924
void cs_macfb_navsto_stream_source_term(cs_lnum_t n_elts, const cs_lnum_t *elt_ids, bool dense_output, void *input, cs_real_t *retval)
Get the source term for computing the stream function. This relies on the prototype associated to the...
Definition: cs_macfb_navsto.cpp:1336
void cs_macfb_navsto_rescale_pressure_to_ref(const cs_navsto_param_t *nsp, const cs_cdo_quantities_t *quant, cs_real_t values[])
Update the pressure field in order to get a field with a mean-value equal to the reference value.
Definition: cs_macfb_navsto.cpp:559
void cs_macfb_navsto_extra_op(const cs_navsto_param_t *nsp, const cs_mesh_t *mesh, const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *ts, cs_time_plot_t *time_plotter, const cs_adv_field_t *adv_field, const cs_real_t *mass_flux, const cs_real_t *p_cell, const cs_real_t *u_face)
Perform extra-operation related to MAC-Fb schemes when solving Navier-Stokes. Computation of the foll...
Definition: cs_macfb_navsto.cpp:614
void cs_macfb_navsto_set_zero_mean_pressure(const cs_cdo_quantities_t *quant, cs_real_t values[])
Update the pressure field in order to get a field with a zero-mean average.
Definition: cs_macfb_navsto.cpp:577
void cs_macfb_navsto_free_builder(cs_macfb_navsto_builder_t *nsb)
Destroy the given cs_macfb_navsto_builder_t structure.
Definition: cs_macfb_navsto.cpp:176
void cs_macfb_navsto_boussinesq_by_part(const cs_navsto_param_t *nsp, const cs_cell_mesh_t *cm, const cs_macfb_navsto_builder_t *nsb, cs_cell_sys_t *csys)
Take into account the buoyancy force with the Boussinesq approx. Compute and add the source term to t...
void cs_macfb_navsto_define_builder(cs_real_t t_eval, const cs_navsto_param_t *nsp, const cs_cell_mesh_t *cm, const cs_macfb_builder_t *macb, const cs_cell_sys_t *csys, const cs_cdo_bc_face_t *pr_bc, const cs_boundary_type_t *bf_type, cs_macfb_navsto_builder_t *nsb)
Set the members of the cs_macfb_navsto_builder_t structure.
Definition: cs_macfb_navsto.cpp:205
void cs_macfb_navsto_init_face_pressure(const cs_navsto_param_t *nsp, const cs_cdo_connect_t *connect, const cs_time_step_t *ts, cs_real_t *pr_f)
Initialize the pressure values when the pressure is defined at faces.
Definition: cs_macfb_navsto.cpp:539
void cs_macfb_navsto_mass_flux(const cs_navsto_param_t *nsp, const cs_cdo_quantities_t *quant, const cs_real_t *face_vel, cs_real_t *mass_flux)
Compute the mass flux playing the role of the advection field in the Navier-Stokes equations One cons...
Definition: cs_macfb_navsto.cpp:351
void cs_macfb_block_dirichlet_pena(short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_property_data_t *pty, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account a Dirichlet BCs on the three velocity components. For instance for a velocity inlet...
Definition: cs_macfb_navsto.cpp:1019
void() cs_macfb_navsto_source_t(const cs_navsto_param_t *nsp, const cs_cell_mesh_t *cm, const cs_macfb_navsto_builder_t *nsb, cs_cell_sys_t *csys)
Compute and add a source term to the local RHS. This is a special treatment to enable source involvin...
Definition: cs_macfb_navsto.h:95
void cs_macfb_navsto_compute_cell_velocity(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *mass_flux, cs_real_t *u_cell)
Compute an estimation of the velocity at cells.
Definition: cs_macfb_navsto.cpp:451
void cs_macfb_navsto_init_pressure(const cs_navsto_param_t *nsp, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, cs_field_t *pr)
Initialize the pressure values.
Definition: cs_macfb_navsto.cpp:518
void cs_macfb_navsto_add_grad_div(short int n_fc, const cs_real_t zeta, const cs_real_t div[], cs_sdm_t *mat)
Add the grad-div part to the local matrix (i.e. for the current cell)
Definition: cs_macfb_navsto.cpp:472
void cs_macfb_block_dirichlet_wsym(short int fb, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_property_data_t *pty, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account a Dirichlet BCs on the three velocity components. For instance for a velocity inlet...
Definition: cs_macfb_navsto.cpp:1088
void cs_macfb_block_dirichlet_weak(short int fb, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, const cs_property_data_t *pty, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account a Dirichlet BCs on the three velocity components. For instance for a velocity inlet...
Definition: cs_macfb_navsto.cpp:1052
double cs_macfb_navsto_cell_divergence(const cs_lnum_t c_id, const cs_cdo_quantities_t *quant, const cs_adjacency_t *c2f, const cs_real_t *f_vals)
Compute the divergence in a cell of a vector-valued array defined at faces (values are defined both a...
Definition: cs_macfb_navsto.cpp:390
void cs_macfb_navsto_set_gravity_func(const cs_navsto_param_t *nsp, cs_macfb_navsto_source_t **p_func)
Set the function pointer computing the source term in the momentum equation related to the gravity ef...
Definition: cs_macfb_navsto.cpp:1205
void cs_macfb_navsto_gravity_term(const cs_navsto_param_t *nsp, const cs_cell_mesh_t *cm, const cs_macfb_navsto_builder_t *nsb, cs_cell_sys_t *csys)
Take into account the gravity effects. Compute and add the source term to the local RHS....
Definition: cs_macfb_navsto.cpp:1252
cs_macfb_navsto_builder_t cs_macfb_navsto_create_builder(const cs_navsto_param_t *nsp, const cs_cdo_connect_t *connect)
Create and allocate a local NavSto builder when Fb schemes are used.
Definition: cs_macfb_navsto.cpp:142
cs_cdofb_navsto_boussinesq_type_t cs_macfb_navsto_boussinesq_type_t
Definition: cs_macfb_navsto.h:68
cs_sles_convergence_state_t cs_macfb_navsto_nl_algo_cvg(const cs_navsto_param_t *nsp, const cs_real_t *pre_iterate, cs_real_t *cur_iterate, cs_iter_algo_t *algo)
Test if one has to do one more non-linear iteration. Test if performed on the relative norm on the in...
Definition: cs_macfb_navsto.cpp:1185
cs_cdofb_navsto_builder_t cs_macfb_navsto_builder_t
Definition: cs_macfb_navsto.h:79
void cs_macfb_navsto_compute_face_pressure(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, const cs_navsto_param_t *nsp, const cs_real_t *p_cell, cs_real_t *p_face)
Compute an estimation of the pressure at faces.
Definition: cs_macfb_navsto.cpp:427
void cs_macfb_navsto_boussinesq_at_face(const cs_navsto_param_t *nsp, const cs_cell_mesh_t *cm, const cs_macfb_navsto_builder_t *nsb, cs_cell_sys_t *csys)
Take into account the buoyancy force with the Boussinesq approx. Compute and add the source term to t...
Definition: cs_macfb_navsto.cpp:1309
void cs_macfb_navsto_set_boussinesq_algo(cs_macfb_navsto_boussinesq_type_t type)
Set the way to compute the Boussinesq approximation.
Definition: cs_macfb_navsto.cpp:124
cs_sles_convergence_state_t
Definition: cs_sles.h:57
struct _cs_time_plot_t cs_time_plot_t
Definition: cs_time_plot.h:44
char * algo
Definition: field_names.h:106
Definition: mesh.f90:26
Definition: cs_mesh_adjacencies.h:68
Definition: cs_advection_field.h:151
Definition: cs_cdo_bc.h:105
Definition: cs_cdo_connect.h:57
Definition: cs_cdo_quantities.h:142
Structure storing additional arrays related to the building of the Navier-Stokes system.
Definition: cs_cdofb_navsto.h:105
Set of local and temporary buffers.
Definition: cs_cdo_local.h:56
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:242
Set of arrays and local (small) dense matrices related to a mesh cell This is a key structure for bui...
Definition: cs_cdo_local.h:163
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:190
Structure to handle the convergence of an iterative algorithm.
Definition: cs_iter_algo.h:285
Definition: cs_macfb_builder.h:50
Structure storing additional arrays related to the building of the Navier-Stokes system.
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 storing the evaluation of a property and its related data.
Definition: cs_property.h:219