8.3
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-2024 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 "cs_defs.h"
32
33/*----------------------------------------------------------------------------
34 * Standard C library headers
35 *----------------------------------------------------------------------------*/
36
37/*----------------------------------------------------------------------------
38 * Local headers
39 *----------------------------------------------------------------------------*/
40
41#include "cs_base.h"
42#include "cs_cdo_connect.h"
43#include "cs_cdo_quantities.h"
44#include "cs_cdofb_navsto.h"
45#include "cs_field.h"
46#include "cs_iter_algo.h"
47#include "cs_math.h"
48#include "cs_matrix.h"
49#include "cs_mesh.h"
50#include "cs_navsto_param.h"
51#include "cs_sdm.h"
52#include "cs_time_plot.h"
53#include "cs_time_step.h"
54
55/*----------------------------------------------------------------------------*/
56
58
59/*============================================================================
60 * Macro definitions
61 *============================================================================*/
62
63/*============================================================================
64 * Type definitions
65 *============================================================================*/
66
73
84
85/*----------------------------------------------------------------------------*/
97/*----------------------------------------------------------------------------*/
98
100 const cs_cell_mesh_t *cm,
101 const cs_macfb_navsto_builder_t *nsb,
102 cs_cell_sys_t *csys);
103
104/*============================================================================
105 * Public function prototypes
106 *============================================================================*/
107
108/*----------------------------------------------------------------------------*/
114/*----------------------------------------------------------------------------*/
115
116void
118
119/*----------------------------------------------------------------------------*/
128/*----------------------------------------------------------------------------*/
129
132 const cs_cdo_connect_t *connect);
133
134/*----------------------------------------------------------------------------*/
140/*----------------------------------------------------------------------------*/
141
143
144/*----------------------------------------------------------------------------*/
157/*----------------------------------------------------------------------------*/
158
160 const cs_navsto_param_t *nsp,
161 const cs_cell_mesh_t *cm,
162 const cs_macfb_builder_t *macb,
163 const cs_cell_sys_t *csys,
164 const cs_cdo_bc_face_t *pr_bc,
165 const cs_boundary_type_t *bf_type,
167
168/*----------------------------------------------------------------------------*/
180/*----------------------------------------------------------------------------*/
181
183 const cs_cdo_quantities_t *quant,
184 const cs_real_t *face_vel,
185 cs_real_t *mass_flux);
186
187/*----------------------------------------------------------------------------*/
200/*----------------------------------------------------------------------------*/
201
203 const cs_cdo_quantities_t *quant,
204 const cs_adjacency_t *c2f,
205 const cs_real_t *f_vals);
206
207/*----------------------------------------------------------------------------*/
219/*----------------------------------------------------------------------------*/
220
222 const cs_cdo_connect_t *connect,
223 const cs_cdo_quantities_t *quant,
224 const cs_time_step_t *ts,
225 const cs_navsto_param_t *nsp,
226 const cs_real_t *p_cell,
227 cs_real_t *p_face);
228
229/*----------------------------------------------------------------------------*/
238/*----------------------------------------------------------------------------*/
239
241 const cs_cdo_quantities_t *quant,
242 const cs_real_t *mass_flux,
243 cs_real_t *u_cell);
244
245/*----------------------------------------------------------------------------*/
255/*----------------------------------------------------------------------------*/
256
257void cs_macfb_navsto_add_grad_div(short int n_fc,
258 const cs_real_t zeta,
259 const cs_real_t div[],
260 cs_sdm_t *mat);
261
262/*----------------------------------------------------------------------------*/
271/*----------------------------------------------------------------------------*/
272
274 const cs_cdo_quantities_t *quant,
275 const cs_time_step_t *ts,
276 cs_field_t *pr);
277
278/*----------------------------------------------------------------------------*/
288/*----------------------------------------------------------------------------*/
289
291 const cs_cdo_connect_t *connect,
292 const cs_time_step_t *ts,
293 cs_real_t *pr_f);
294
295/*----------------------------------------------------------------------------*/
304/*----------------------------------------------------------------------------*/
305
307 const cs_cdo_quantities_t *quant,
308 cs_real_t values[]);
309
310/*----------------------------------------------------------------------------*/
318/*----------------------------------------------------------------------------*/
319
321 cs_real_t values[]);
322
323/*----------------------------------------------------------------------------*/
351/*----------------------------------------------------------------------------*/
352
354 const cs_mesh_t *mesh,
355 const cs_cdo_quantities_t *quant,
356 const cs_cdo_connect_t *connect,
357 const cs_time_step_t *ts,
358 cs_time_plot_t *time_plotter,
359 const cs_adv_field_t *adv_field,
360 const cs_real_t *mass_flux,
361 const cs_real_t *p_cell,
362 const cs_real_t *u_face);
363
364/*----------------------------------------------------------------------------*/
379/*----------------------------------------------------------------------------*/
380
381void cs_macfb_block_dirichlet_alge(short int f,
382 const cs_equation_param_t *eqp,
383 const cs_cell_mesh_t *cm,
384 const cs_property_data_t *pty,
386 cs_cell_sys_t *csys);
387
388/*----------------------------------------------------------------------------*/
405/*----------------------------------------------------------------------------*/
406
407void cs_macfb_block_dirichlet_pena(short int f,
408 const cs_equation_param_t *eqp,
409 const cs_cell_mesh_t *cm,
410 const cs_property_data_t *pty,
412 cs_cell_sys_t *csys);
413
414/*----------------------------------------------------------------------------*/
431/*----------------------------------------------------------------------------*/
432
433void cs_macfb_block_dirichlet_weak(short int fb,
434 const cs_equation_param_t *eqp,
435 const cs_cell_mesh_t *cm,
436 const cs_property_data_t *pty,
438 cs_cell_sys_t *csys);
439
440/*----------------------------------------------------------------------------*/
457/*----------------------------------------------------------------------------*/
458
459void cs_macfb_block_dirichlet_wsym(short int fb,
460 const cs_equation_param_t *eqp,
461 const cs_cell_mesh_t *cm,
462 const cs_property_data_t *pty,
464 cs_cell_sys_t *csys);
465
466/*----------------------------------------------------------------------------*/
480/*----------------------------------------------------------------------------*/
481
482void cs_macfb_symmetry(short int fb,
483 const cs_equation_param_t *eqp,
484 const cs_cell_mesh_t *cm,
485 const cs_property_data_t *pty,
487 cs_cell_sys_t *csys);
488
489/*----------------------------------------------------------------------------*/
502/*----------------------------------------------------------------------------*/
503
504void cs_macfb_fixed_wall(short int fb,
505 const cs_equation_param_t *eqp,
506 const cs_cell_mesh_t *cm,
507 const cs_property_data_t *pty,
509 cs_cell_sys_t *csys);
510
511/*----------------------------------------------------------------------------*/
524/*----------------------------------------------------------------------------*/
525
528 const cs_real_t *pre_iterate,
529 cs_real_t *cur_iterate,
531
532/*----------------------------------------------------------------------------*/
541/*----------------------------------------------------------------------------*/
542
544 cs_macfb_navsto_source_t **p_func);
545
546/*----------------------------------------------------------------------------*/
558/*----------------------------------------------------------------------------*/
559
561 const cs_cell_mesh_t *cm,
562 const cs_macfb_navsto_builder_t *nsb,
563 cs_cell_sys_t *csys);
564
565/*----------------------------------------------------------------------------*/
578/*----------------------------------------------------------------------------*/
579
581 const cs_cell_mesh_t *cm,
582 const cs_macfb_navsto_builder_t *nsb,
583 cs_cell_sys_t *csys);
584
585/*----------------------------------------------------------------------------*/
598/*----------------------------------------------------------------------------*/
599
601 const cs_cell_mesh_t *cm,
602 const cs_macfb_navsto_builder_t *nsb,
603 cs_cell_sys_t *csys);
604
605/*----------------------------------------------------------------------------*/
618/*----------------------------------------------------------------------------*/
619
621 const cs_cell_mesh_t *cm,
622 const cs_macfb_navsto_builder_t *nsb,
623 cs_cell_sys_t *csys);
624
625/*----------------------------------------------------------------------------*/
637/*----------------------------------------------------------------------------*/
638
640 const cs_lnum_t *elt_ids,
641 bool dense_output,
642 void *input,
643 cs_real_t *retval);
644
645/*----------------------------------------------------------------------------*/
646
648
649#endif /* __CS_MACFB_NAVSTO_H__ */
int cs_boundary_type_t
Definition: cs_boundary.h:69
cs_cdofb_navsto_boussinesq_type_t
Type of algorithm to compute the Boussinesq approximation.
Definition: cs_cdofb_navsto.h:71
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
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:1136
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:1298
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:1168
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:935
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:1356
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:570
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:625
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:588
cs_sles_convergence_state_t cs_macfb_navsto_nl_algo_cvg(cs_param_nl_algo_t nl_algo_type, 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:1201
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:186
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:215
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:550
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:361
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:1029
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:99
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:462
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:529
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:483
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:1103
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:1067
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:401
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:1222
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:1268
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:152
cs_cdofb_navsto_boussinesq_type_t cs_macfb_navsto_boussinesq_type_t
Definition: cs_macfb_navsto.h:72
cs_cdofb_navsto_builder_t cs_macfb_navsto_builder_t
Definition: cs_macfb_navsto.h:83
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:438
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:1327
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:134
cs_param_nl_algo_t
Class of non-linear iterative algorithm.
Definition: cs_param_types.h:606
cs_sles_convergence_state_t
Definition: cs_sles.h:56
struct _cs_time_plot_t cs_time_plot_t
Definition: cs_time_plot.h:48
char * algo
Definition: field_names.h:100
Definition: mesh.f90:26
Definition: cs_mesh_adjacencies.h:68
Definition: cs_advection_field.h:151
Definition: cs_cdo_bc.h:106
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:139
Structure storing additional arrays related to the building of the Navier-Stokes system.
Definition: cs_cdofb_navsto.h:107
Set of local and temporary buffers.
Definition: cs_cdo_local.h:60
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:203
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:147
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:192
Field descriptor.
Definition: cs_field.h:131
Structure to handle the convergence of an iterative algorithm.
Definition: cs_iter_algo.h:290
Definition: cs_macfb_builder.h:54
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:263
Structure storing the evaluation of a property and its related data.
Definition: cs_property.h:223
time step descriptor
Definition: cs_time_step.h:64