9.2
general documentation
cs_cdo_diffusion.h
Go to the documentation of this file.
1#ifndef CS_CDO_DIFFUSION_H
2#define CS_CDO_DIFFUSION_H
3
4/*============================================================================
5 * Build discrete stiffness matrices and handled boundary conditions for the
6 * diffusion term in CDO vertex-based and vertex+cell schemes
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 * Local headers
31 *----------------------------------------------------------------------------*/
32
33#include "cdo/cs_cdo_bc.h"
34#include "cdo/cs_cdo_connect.h"
35#include "cdo/cs_cdo_local.h"
38#include "cdo/cs_hodge.h"
40
41/*============================================================================
42 * Macro definitions
43 *============================================================================*/
44
45/*============================================================================
46 * Type definitions
47 *============================================================================*/
48
49/*----------------------------------------------------------------------------*/
59/*----------------------------------------------------------------------------*/
60
61typedef void
63 const cs_real_t *pot,
64 const cs_hodge_t *hodge,
66 cs_real_t *flx);
67
68/*============================================================================
69 * Public function prototypes
70 *============================================================================*/
71
72/*----------------------------------------------------------------------------*/
85/*----------------------------------------------------------------------------*/
86
87void
89 const cs_cell_mesh_t *cm,
91 cs_hodge_t *hodge,
93 cs_cell_sys_t *csys);
94
95/*----------------------------------------------------------------------------*/
110/*----------------------------------------------------------------------------*/
111
112void
114 const cs_cell_mesh_t *cm,
116 cs_hodge_t *hodge,
118 cs_cell_sys_t *csys);
119
120/*----------------------------------------------------------------------------*/
143/*----------------------------------------------------------------------------*/
144
145void
147 const cs_cell_mesh_t *cm,
149 cs_hodge_t *hodge,
151 cs_cell_sys_t *csys);
152
153/*----------------------------------------------------------------------------*/
180/*----------------------------------------------------------------------------*/
181
182void
184 const cs_cell_mesh_t *cm,
186 cs_hodge_t *hodge,
188 cs_cell_sys_t *csys);
189
190/*----------------------------------------------------------------------------*/
214/*----------------------------------------------------------------------------*/
215
216void
218 const cs_cell_mesh_t *cm,
220 cs_hodge_t *hodge,
222 cs_cell_sys_t *csys);
223
224/*----------------------------------------------------------------------------*/
239/*----------------------------------------------------------------------------*/
240
241void
243 const cs_cell_mesh_t *cm,
245 cs_hodge_t *hodge,
247 cs_cell_sys_t *csys);
248
249/*----------------------------------------------------------------------------*/
266/*----------------------------------------------------------------------------*/
267
268void
270 const cs_cell_mesh_t *cm,
272 cs_hodge_t *hodge,
274 cs_cell_sys_t *csys);
275
276/*----------------------------------------------------------------------------*/
291/*----------------------------------------------------------------------------*/
292
293void
295 const cs_cell_mesh_t *cm,
297 cs_hodge_t *hodge,
299 cs_cell_sys_t *csys);
300
301/*----------------------------------------------------------------------------*/
318/*----------------------------------------------------------------------------*/
319
320void
322 const cs_cell_mesh_t *cm,
324 cs_hodge_t *hodge,
326 cs_cell_sys_t *csys);
327
328/*----------------------------------------------------------------------------*/
343/*----------------------------------------------------------------------------*/
344
345void
347 const cs_cell_mesh_t *cm,
349 cs_hodge_t *hodge,
351 cs_cell_sys_t *csys);
352
353/*----------------------------------------------------------------------------*/
367/*----------------------------------------------------------------------------*/
368
369void
371 const cs_cell_mesh_t *cm,
373 cs_hodge_t *hodge,
375 cs_cell_sys_t *csys);
376
377/*----------------------------------------------------------------------------*/
391/*----------------------------------------------------------------------------*/
392
393void
395 const cs_cell_mesh_t *cm,
397 cs_hodge_t *hodge,
399 cs_cell_sys_t *csys);
400
401/*----------------------------------------------------------------------------*/
416/*----------------------------------------------------------------------------*/
417
418void
420 const cs_cell_mesh_t *cm,
422 cs_hodge_t *hodge,
424 cs_cell_sys_t *csys);
425
426/*----------------------------------------------------------------------------*/
442/*----------------------------------------------------------------------------*/
443
444void
446 const cs_cell_mesh_t *cm,
448 cs_hodge_t *hodge,
450 cs_cell_sys_t *csys);
451
452/*----------------------------------------------------------------------------*/
467/*----------------------------------------------------------------------------*/
468
469void
471 const cs_cell_mesh_t *cm,
473 cs_hodge_t *hodge,
475 cs_cell_sys_t *csys);
476
477/*----------------------------------------------------------------------------*/
493/*----------------------------------------------------------------------------*/
494
495void
497 const cs_cell_mesh_t *cm,
499 cs_hodge_t *hodge,
501 cs_cell_sys_t *csys);
502
503/*----------------------------------------------------------------------------*/
517/*----------------------------------------------------------------------------*/
518
519void
521 const cs_cell_mesh_t *cm,
523 cs_hodge_t *hodge,
525 cs_cell_sys_t *csys);
526
527/*----------------------------------------------------------------------------*/
541/*----------------------------------------------------------------------------*/
542
543void
545 const cs_cell_mesh_t *cm,
547 cs_hodge_t *hodge,
549 cs_cell_sys_t *csys);
550
551/*----------------------------------------------------------------------------*/
566/*----------------------------------------------------------------------------*/
567
568void
570 const cs_cell_mesh_t *cm,
572 cs_hodge_t *hodge,
574 cs_cell_sys_t *csys);
575
576/*----------------------------------------------------------------------------*/
590/*----------------------------------------------------------------------------*/
591
592void
594 const cs_cell_mesh_t *cm,
596 cs_hodge_t *hodge,
598 cs_cell_sys_t *csys);
599
600/*----------------------------------------------------------------------------*/
615/*----------------------------------------------------------------------------*/
616
617void
619 const cs_cell_mesh_t *cm,
621 cs_hodge_t *hodge,
623 cs_cell_sys_t *csys);
624
625/*----------------------------------------------------------------------------*/
641/*----------------------------------------------------------------------------*/
642
643void
645 const double *pot,
646 const cs_hodge_t *hodge,
648 double *flx);
649
650/*----------------------------------------------------------------------------*/
666/*----------------------------------------------------------------------------*/
667
668void
670 const double *pot,
671 const cs_hodge_t *hodge,
673 double *flx);
674
675/*----------------------------------------------------------------------------*/
691/*----------------------------------------------------------------------------*/
692
693void
695 const double *pot,
696 const cs_hodge_t *hodge,
698 double *flx);
699
700/*----------------------------------------------------------------------------*/
716/*----------------------------------------------------------------------------*/
717
718void
720 const cs_cell_mesh_t *cm,
721 const cs_real_t *pot,
722 const cs_hodge_t *hodge,
724 cs_real_t *flux);
725
726/*----------------------------------------------------------------------------*/
741/*----------------------------------------------------------------------------*/
742
743void
745 const cs_real_t *pot,
746 const cs_hodge_t *hodge,
748 cs_real_t *flx);
749
750/*----------------------------------------------------------------------------*/
765/*----------------------------------------------------------------------------*/
766
767void
769 const cs_real_t *pot,
770 const cs_hodge_t *hodge,
772 cs_real_t *flx);
773
774/*----------------------------------------------------------------------------*/
787/*----------------------------------------------------------------------------*/
788
789void
791 const cs_cell_mesh_t *cm,
792 const cs_real_t *pot,
793 const cs_hodge_t *hodge,
795 cs_real_t *flux);
796
797/*----------------------------------------------------------------------------*/
811/*----------------------------------------------------------------------------*/
812
813double
815 const cs_real_t pty_tens[3][3],
816 const double *p_v,
817 const double p_f,
818 const double p_c,
820
821/*----------------------------------------------------------------------------*/
835/*----------------------------------------------------------------------------*/
836
837void
839 const cs_cell_mesh_t *cm,
840 const cs_real_t *pot,
841 const cs_hodge_t *hodge,
843 cs_real_t *flux);
844
845/*----------------------------------------------------------------------------*/
859/*----------------------------------------------------------------------------*/
860
861void
862cs_cdovb_diffusion_p0_face_flux(const short int f,
863 const cs_cell_mesh_t *cm,
864 const cs_real_t diff_tensor[3][3],
865 const cs_real_t *pot_values,
866 cs_real_t *fluxes);
867
868/*----------------------------------------------------------------------------*/
880/*----------------------------------------------------------------------------*/
881
883 const cs_macfb_builder_t *macb,
884 const cs_property_t *diff_pty,
885 cs_sdm_t *mat,
886 cs_real_t *rhs);
887
888#endif /* CS_CDO_DIFFUSION_H */
void cs_cdo_diffusion_svb_wbs_wsym_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique plus a symmetric treatm...
Definition: cs_cdo_diffusion.cpp:2593
void cs_cdo_diffusion_wbs_get_dfbyc_flux(const cs_cell_mesh_t *cm, const cs_real_t *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_real_t *flx)
Compute the diffusive flux across dual faces for a given cell Use the WBS algo. for approximating the...
Definition: cs_cdo_diffusion.cpp:3132
void cs_cdo_diffusion_vvb_ocs_weak_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique. A Dirichlet is set for...
Definition: cs_cdo_diffusion.cpp:2045
void() cs_cdo_diffusion_cw_flux_t(const cs_cell_mesh_t *cm, const cs_real_t *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_real_t *flx)
Cellwise computation of the diffusive flux.
Definition: cs_cdo_diffusion.h:62
void cs_cdo_diffusion_vcb_weak_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique. Case of CDO-VCb scheme...
Definition: cs_cdo_diffusion.cpp:2695
void cs_cdo_diffusion_sfb_cost_flux(short int f, const cs_cell_mesh_t *cm, const cs_real_t *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_real_t *flux)
Compute the normal diffusive flux for a face assuming only the knowledge of the potential at faces an...
Definition: cs_cdo_diffusion.cpp:3456
void cs_cdo_diffusion_sfb_cost_robin(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Robin BCs. Case of scalar-valued CDO-Fb schemes with a CO+ST algorithm....
Definition: cs_cdo_diffusion.cpp:1796
void cs_cdo_diffusion_alge_dirichlet_extra_block(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Function close to cs_cdo_diffusion_alge_dirichlet but dedicated to systems by blocks and especially f...
Definition: cs_cdo_diffusion.cpp:944
void cs_macfb_diffusion(const cs_cell_mesh_t *cm, const cs_macfb_builder_t *macb, const cs_property_t *diff_pty, cs_sdm_t *mat, cs_real_t *rhs)
Compute the diffusion operator for the MAC face-based scheme.
Definition: cs_cdo_diffusion.cpp:3583
void cs_cdo_diffusion_vfb_wsym_sliding(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account sliding BCs by a weak enforcement using Nitsche technique plus a symmetric treatmen...
Definition: cs_cdo_diffusion.cpp:1658
void cs_cdo_diffusion_sfb_get_face_flux(const cs_cell_mesh_t *cm, const double *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, double *flx)
Compute the diffusive flux across primal faces for a given cell. Use the same consistent approximatio...
Definition: cs_cdo_diffusion.cpp:2882
void cs_cdo_diffusion_vfb_weak_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique. Case of vector-valued ...
Definition: cs_cdo_diffusion.cpp:1255
void cs_cdo_diffusion_svb_ocs_weak_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique. Case of scalar-valued ...
Definition: cs_cdo_diffusion.cpp:1954
void cs_cdo_diffusion_svb_get_dfbyc_flux(const cs_cell_mesh_t *cm, const double *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, double *flx)
Compute the diffusive flux across dual faces for a given cell. Use the same consistent approximation ...
Definition: cs_cdo_diffusion.cpp:2923
void cs_cdo_diffusion_svb_get_cell_flux(const cs_cell_mesh_t *cm, const double *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, double *flx)
Compute the constant approximation of the diffusive flux inside a (primal) cell. Use the same consist...
Definition: cs_cdo_diffusion.cpp:2972
double cs_cdo_diffusion_wbs_face_flux(const cs_face_mesh_t *fm, const cs_real_t pty_tens[3][3], const double *p_v, const double p_f, const double p_c, cs_cell_builder_t *cb)
Compute the diffusive flux across a face (based on a subdivision into tetrahedra of the volume p_{f,...
Definition: cs_cdo_diffusion.cpp:3375
void cs_cdo_diffusion_svb_cost_robin(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Robin BCs. Case of scalar-valued CDO-Vb schemes with a CO+ST algorithm....
Definition: cs_cdo_diffusion.cpp:1865
void cs_cdo_diffusion_alge_block_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by keeping the DoFs related to Dirichlet BCs in the algebraic system ...
Definition: cs_cdo_diffusion.cpp:1032
void cs_cdo_diffusion_svb_wbs_weak_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique. Case of CDO-Vb schemes...
Definition: cs_cdo_diffusion.cpp:2506
void cs_cdo_diffusion_vfb_wsym_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique plus a symmetric treatm...
Definition: cs_cdo_diffusion.cpp:1504
void cs_cdo_diffusion_wbs_vbyf_flux(short int f, const cs_cell_mesh_t *cm, const cs_real_t *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_real_t *flux)
Compute the normal flux for a face assuming only the knowledge of the potential at cell vertices (and...
Definition: cs_cdo_diffusion.cpp:3275
void cs_cdo_diffusion_svb_ocs_wsym_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique plus a symmetric treatm...
Definition: cs_cdo_diffusion.cpp:2303
void cs_cdo_diffusion_sfb_wsym_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique plus a symmetric treatm...
Definition: cs_cdo_diffusion.cpp:1381
void cs_cdovb_diffusion_p0_face_flux(const short int f, const cs_cell_mesh_t *cm, const cs_real_t diff_tensor[3][3], const cs_real_t *pot_values, cs_real_t *fluxes)
Compute the normal flux for a face assuming only the knowledge of the potential at cell vertices....
Definition: cs_cdo_diffusion.cpp:3540
void cs_cdo_diffusion_alge_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by keeping the DoFs related to Dirichlet BCs in the algebraic system ...
Definition: cs_cdo_diffusion.cpp:852
void cs_cdo_diffusion_vcb_wsym_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique plus a symmetric treatm...
Definition: cs_cdo_diffusion.cpp:2782
void cs_cdo_diffusion_vvb_ocs_sliding(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account a sliding BCs. Case of vector-valued CDO-Vb schemes with a OCS algorithm....
Definition: cs_cdo_diffusion.cpp:2169
void cs_cdo_diffusion_svb_vbyf_flux(short int f, const cs_cell_mesh_t *cm, const cs_real_t *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_real_t *flux)
Compute the normal flux for a face assuming only the knowledge of the potential at cell vertices....
Definition: cs_cdo_diffusion.cpp:3030
void cs_cdo_diffusion_pena_block_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement by a penalization technique with a huge value....
Definition: cs_cdo_diffusion.cpp:777
void cs_cdo_diffusion_wbs_get_cell_flux(const cs_cell_mesh_t *cm, const cs_real_t *pot, const cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_real_t *flx)
Compute the diffusive flux inside a given primal cell Use the WBS algo. for approximating the gradien...
Definition: cs_cdo_diffusion.cpp:3236
void cs_cdo_diffusion_sfb_weak_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement using Nitsche technique. Case of scalar-valued ...
Definition: cs_cdo_diffusion.cpp:1147
void cs_cdo_diffusion_pena_dirichlet(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Dirichlet BCs by a weak enforcement by a penalization technique with a huge value....
Definition: cs_cdo_diffusion.cpp:727
void cs_cdo_diffusion_svb_wbs_robin(const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, cs_face_mesh_t *fm, cs_hodge_t *hodge, cs_cell_builder_t *cb, cs_cell_sys_t *csys)
Take into account Robin BCs. Case of scalar-valued CDO-Vb schemes with a WBS algorithm....
Definition: cs_cdo_diffusion.cpp:2401
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
@ fm
Definition: cs_field_pointer.h:126
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
Set of local quantities and connectivities related to a mesh face Structure used to get a better memo...
Definition: cs_cdo_local.h:432
Structure associated to a discrete Hodge operator *.
Definition: cs_hodge.h:179
Definition: cs_macfb_builder.h:50
Structure associated to the definition of a property relying on the cs_xdef_t structure.