7.3
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-2022 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 "cs_cdo_bc.h"
34 #include "cs_cdo_connect.h"
35 #include "cs_cdo_local.h"
36 #include "cs_cdo_quantities.h"
37 #include "cs_equation_param.h"
38 #include "cs_hodge.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /*----------------------------------------------------------------------------*/
62 /*----------------------------------------------------------------------------*/
63 
64 typedef void
66  const cs_real_t *pot,
67  const cs_hodge_t *hodge,
69  cs_real_t *flx);
70 
71 /*============================================================================
72  * Public function prototypes
73  *============================================================================*/
74 
75 /*----------------------------------------------------------------------------*/
89 /*----------------------------------------------------------------------------*/
90 
91 void
93  const cs_cell_mesh_t *cm,
95  cs_hodge_t *hodge,
97  cs_cell_sys_t *csys);
98 
99 /*----------------------------------------------------------------------------*/
114 /*----------------------------------------------------------------------------*/
115 
116 void
118  const cs_cell_mesh_t *cm,
120  cs_hodge_t *hodge,
121  cs_cell_builder_t *cb,
122  cs_cell_sys_t *csys);
123 
124 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
149 void
151  const cs_cell_mesh_t *cm,
153  cs_hodge_t *hodge,
154  cs_cell_builder_t *cb,
155  cs_cell_sys_t *csys);
156 
157 /*----------------------------------------------------------------------------*/
181 /*----------------------------------------------------------------------------*/
182 
183 void
185  const cs_cell_mesh_t *cm,
187  cs_hodge_t *hodge,
188  cs_cell_builder_t *cb,
189  cs_cell_sys_t *csys);
190 
191 /*----------------------------------------------------------------------------*/
206 /*----------------------------------------------------------------------------*/
207 
208 void
210  const cs_cell_mesh_t *cm,
212  cs_hodge_t *hodge,
213  cs_cell_builder_t *cb,
214  cs_cell_sys_t *csys);
215 
216 /*----------------------------------------------------------------------------*/
233 /*----------------------------------------------------------------------------*/
234 
235 void
237  const cs_cell_mesh_t *cm,
239  cs_hodge_t *hodge,
240  cs_cell_builder_t *cb,
241  cs_cell_sys_t *csys);
242 
243 /*----------------------------------------------------------------------------*/
258 /*----------------------------------------------------------------------------*/
259 
260 void
262  const cs_cell_mesh_t *cm,
264  cs_hodge_t *hodge,
265  cs_cell_builder_t *cb,
266  cs_cell_sys_t *csys);
267 
268 /*----------------------------------------------------------------------------*/
285 /*----------------------------------------------------------------------------*/
286 
287 void
289  const cs_cell_mesh_t *cm,
291  cs_hodge_t *hodge,
292  cs_cell_builder_t *cb,
293  cs_cell_sys_t *csys);
294 
295 /*----------------------------------------------------------------------------*/
310 /*----------------------------------------------------------------------------*/
311 
312 void
314  const cs_cell_mesh_t *cm,
316  cs_hodge_t *hodge,
317  cs_cell_builder_t *cb,
318  cs_cell_sys_t *csys);
319 
320 /*----------------------------------------------------------------------------*/
334 /*----------------------------------------------------------------------------*/
335 
336 void
338  const cs_cell_mesh_t *cm,
340  cs_hodge_t *hodge,
341  cs_cell_builder_t *cb,
342  cs_cell_sys_t *csys);
343 
344 /*----------------------------------------------------------------------------*/
358 /*----------------------------------------------------------------------------*/
359 
360 void
362  const cs_cell_mesh_t *cm,
364  cs_hodge_t *hodge,
365  cs_cell_builder_t *cb,
366  cs_cell_sys_t *csys);
367 
368 /*----------------------------------------------------------------------------*/
383 /*----------------------------------------------------------------------------*/
384 
385 void
387  const cs_cell_mesh_t *cm,
389  cs_hodge_t *hodge,
390  cs_cell_builder_t *cb,
391  cs_cell_sys_t *csys);
392 
393 /*----------------------------------------------------------------------------*/
409 /*----------------------------------------------------------------------------*/
410 
411 void
413  const cs_cell_mesh_t *cm,
415  cs_hodge_t *hodge,
416  cs_cell_builder_t *cb,
417  cs_cell_sys_t *csys);
418 
419 /*----------------------------------------------------------------------------*/
434 /*----------------------------------------------------------------------------*/
435 
436 void
438  const cs_cell_mesh_t *cm,
440  cs_hodge_t *hodge,
441  cs_cell_builder_t *cb,
442  cs_cell_sys_t *csys);
443 
444 /*----------------------------------------------------------------------------*/
460 /*----------------------------------------------------------------------------*/
461 
462 void
464  const cs_cell_mesh_t *cm,
466  cs_hodge_t *hodge,
467  cs_cell_builder_t *cb,
468  cs_cell_sys_t *csys);
469 
470 /*----------------------------------------------------------------------------*/
484 /*----------------------------------------------------------------------------*/
485 
486 void
488  const cs_cell_mesh_t *cm,
490  cs_hodge_t *hodge,
491  cs_cell_builder_t *cb,
492  cs_cell_sys_t *csys);
493 
494 /*----------------------------------------------------------------------------*/
508 /*----------------------------------------------------------------------------*/
509 
510 void
512  const cs_cell_mesh_t *cm,
514  cs_hodge_t *hodge,
515  cs_cell_builder_t *cb,
516  cs_cell_sys_t *csys);
517 
518 /*----------------------------------------------------------------------------*/
533 /*----------------------------------------------------------------------------*/
534 
535 void
537  const cs_cell_mesh_t *cm,
539  cs_hodge_t *hodge,
540  cs_cell_builder_t *cb,
541  cs_cell_sys_t *csys);
542 
543 /*----------------------------------------------------------------------------*/
557 /*----------------------------------------------------------------------------*/
558 
559 void
561  const cs_cell_mesh_t *cm,
563  cs_hodge_t *hodge,
564  cs_cell_builder_t *cb,
565  cs_cell_sys_t *csys);
566 
567 /*----------------------------------------------------------------------------*/
582 /*----------------------------------------------------------------------------*/
583 
584 void
586  const cs_cell_mesh_t *cm,
588  cs_hodge_t *hodge,
589  cs_cell_builder_t *cb,
590  cs_cell_sys_t *csys);
591 
592 /*----------------------------------------------------------------------------*/
608 /*----------------------------------------------------------------------------*/
609 
610 void
612  const double *pot,
613  const cs_hodge_t *hodge,
614  cs_cell_builder_t *cb,
615  double *flx);
616 
617 /*----------------------------------------------------------------------------*/
633 /*----------------------------------------------------------------------------*/
634 
635 void
637  const double *pot,
638  const cs_hodge_t *hodge,
639  cs_cell_builder_t *cb,
640  double *flx);
641 
642 /*----------------------------------------------------------------------------*/
658 /*----------------------------------------------------------------------------*/
659 
660 void
662  const double *pot,
663  const cs_hodge_t *hodge,
664  cs_cell_builder_t *cb,
665  double *flx);
666 
667 /*----------------------------------------------------------------------------*/
683 /*----------------------------------------------------------------------------*/
684 
685 void
687  const cs_cell_mesh_t *cm,
688  const cs_real_t *pot,
689  const cs_hodge_t *hodge,
690  cs_cell_builder_t *cb,
691  cs_real_t *flux);
692 
693 /*----------------------------------------------------------------------------*/
708 /*----------------------------------------------------------------------------*/
709 
710 void
712  const cs_real_t *pot,
713  const cs_hodge_t *hodge,
714  cs_cell_builder_t *cb,
715  cs_real_t *flx);
716 
717 /*----------------------------------------------------------------------------*/
732 /*----------------------------------------------------------------------------*/
733 
734 void
736  const cs_real_t *pot,
737  const cs_hodge_t *hodge,
738  cs_cell_builder_t *cb,
739  cs_real_t *flx);
740 
741 /*----------------------------------------------------------------------------*/
754 /*----------------------------------------------------------------------------*/
755 
756 void
758  const cs_cell_mesh_t *cm,
759  const cs_real_t *pot,
760  const cs_hodge_t *hodge,
761  cs_cell_builder_t *cb,
762  cs_real_t *flux);
763 
764 /*----------------------------------------------------------------------------*/
778 /*----------------------------------------------------------------------------*/
779 
780 double
782  const cs_real_t pty_tens[3][3],
783  const double *p_v,
784  const double p_f,
785  const double p_c,
786  cs_cell_builder_t *cb);
787 
788 /*----------------------------------------------------------------------------*/
802 /*----------------------------------------------------------------------------*/
803 
804 void
806  const cs_cell_mesh_t *cm,
807  const cs_real_t *pot,
808  const cs_hodge_t *hodge,
809  cs_cell_builder_t *cb,
810  cs_real_t *flux);
811 
812 /*----------------------------------------------------------------------------*/
826 /*----------------------------------------------------------------------------*/
827 
828 void
829 cs_cdovb_diffusion_p0_face_flux(const short int f,
830  const cs_cell_mesh_t *cm,
831  const cs_real_t diff_tensor[3][3],
832  const cs_real_t *pot_values,
833  cs_real_t *fluxes);
834 
835 /*----------------------------------------------------------------------------*/
836 
838 
839 #endif /* __CS_CDO_DIFFUSION_H__ */
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. Predefined prototype to match the function pointer cs_cdo_enforce_bc_t.
Definition: cs_cdo_diffusion.c:2398
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.c:3531
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.c:2920
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. Predefined prototype to match the function pointer cs_cdo_enforce_bc_t.
Definition: cs_cdo_diffusion.c:1793
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.c:2879
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:186
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.c:3233
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.c:2503
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.c:3372
#define BEGIN_C_DECLS
Definition: cs_defs.h:512
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.c:2692
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.c:1381
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.c:1033
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:203
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. Orthogonal splitting between Consistency/Stabilization parts. Predefined prototype to match the function pointer cs_cdo_enforce_bc_t.
Definition: cs_cdo_diffusion.c:2166
Structure associated to a discrete Hodge operator *.
Definition: cs_hodge.h:186
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.c:1503
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.c:1951
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.c:946
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
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.c:1656
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.c:3129
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
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.c:1256
Definition: cs_field_pointer.h:128
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 P...
Definition: cs_cdo_diffusion.c:819
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.c:2042
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:65
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.c:2779
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.c:870
Set of local and temporary buffers.
Definition: cs_cdo_local.h:60
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.c:3027
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. Predefined prototype to match the function pointer cs_cdo_enforce_bc_t.
Definition: cs_cdo_diffusion.c:1862
#define END_C_DECLS
Definition: cs_defs.h:513
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.c:3272
Set of local quantities and connectivities related to a mesh face Structure used to get a better memo...
Definition: cs_cdo_local.h:279
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.c:2590
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.c:1150
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.c:2300
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.c:2969
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.c:3453