8.1
general documentation
cs_matrix_building.h
Go to the documentation of this file.
1 #ifndef __CS_MATRIX_BUILDING_H__
2 #define __CS_MATRIX_BUILDING_H__
3 
4 /*============================================================================
5  * Matrix building
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_halo.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
40 
41 /*=============================================================================
42  * Local Macro definitions
43  *============================================================================*/
44 
45 /*============================================================================
46  * Type definition
47  *============================================================================*/
48 
49 /*============================================================================
50  * Global variables
51  *============================================================================*/
52 
53 /*============================================================================
54  * Public function prototypes for Fortran API
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------
58  * Fortran wrapper to cs_matrix_scalar (or its counterpart for
59  * symmetric matrices)
60  *----------------------------------------------------------------------------*/
61 
62 void CS_PROCF (matrix, MATRIX)
63 (
64  const int *iconvp,
65  const int *idiffp,
66  const int *ndircp,
67  const int *isym,
68  const cs_real_t *thetap,
69  const int *imucpp,
70  const cs_real_t coefbp[],
71  const cs_real_t cofbfp[],
72  const cs_real_t rovsdt[],
73  const cs_real_t i_massflux[],
74  const cs_real_t b_massflux[],
75  const cs_real_t i_visc[],
76  const cs_real_t b_visc[],
77  const cs_real_t xcpp[],
78  cs_real_t da[],
79  cs_real_t xa[]
80 );
81 
82 /*----------------------------------------------------------------------------
83  * Fortran wrapper to cs_matrix_time_step
84  *----------------------------------------------------------------------------*/
85 
86 void CS_PROCF (matrdt, MATRDT)
87 (
88  const int *const iconvp,
89  const int *const idiffp,
90  const int *const isym,
91  const cs_real_t coefbp[],
92  const cs_real_t cofbfp[],
93  const cs_real_t i_massflux[],
94  const cs_real_t b_massflux[],
95  const cs_real_t i_visc[],
96  const cs_real_t b_visc[],
97  cs_real_t da[]
98 );
99 
100 /*=============================================================================
101  * Public function prototypes
102  *============================================================================*/
103 
104 /*----------------------------------------------------------------------------
105  * Wrapper to cs_matrix_scalar (or its counterpart for
106  * symmetric matrices)
107  *----------------------------------------------------------------------------*/
108 
109 void
110 cs_matrix_wrapper_scalar(int iconvp,
111  int idiffp,
112  int ndircp,
113  int isym,
114  double thetap,
115  int imucpp,
116  const cs_real_t coefbp[],
117  const cs_real_t cofbfp[],
118  const cs_real_t rovsdt[],
119  const cs_real_t i_massflux[],
120  const cs_real_t b_massflux[],
121  const cs_real_t i_visc[],
122  const cs_real_t b_visc[],
123  const cs_real_t xcpp[],
124  cs_real_t da[],
125  cs_real_t xa[]);
126 
127 /*----------------------------------------------------------------------------
128  * Wrapper to cs_matrix_vector (or its counterpart for
129  * symmetric matrices)
130  *----------------------------------------------------------------------------*/
131 
132 void
133 cs_matrix_wrapper_vector(int iconvp,
134  int idiffp,
135  int tensorial_diffusion,
136  int ndircp,
137  int isym,
138  cs_lnum_t eb_size,
139  double thetap,
140  const cs_real_33_t coefbu[],
141  const cs_real_33_t cofbfu[],
142  const cs_real_33_t fimp[],
143  const cs_real_t i_massflux[],
144  const cs_real_t b_massflux[],
145  const cs_real_t i_visc[],
146  const cs_real_t b_visc[],
147  cs_real_33_t da[],
148  cs_real_t xa[]);
149 
150 /*----------------------------------------------------------------------------
151  * Wrapper to cs_matrix_tensor (or its counterpart for
152  * symmetric matrices)
153  *----------------------------------------------------------------------------*/
154 
155 void
156 cs_matrix_wrapper_tensor(int iconvp,
157  int idiffp,
158  int tensorial_diffusion,
159  int ndircp,
160  int isym,
161  double thetap,
162  const cs_real_66_t coefbts[],
163  const cs_real_66_t cofbfts[],
164  const cs_real_66_t fimp[],
165  const cs_real_t i_massflux[],
166  const cs_real_t b_massflux[],
167  const cs_real_t i_visc[],
168  const cs_real_t b_visc[],
169  cs_real_66_t da[],
170  cs_real_t xa[]);
171 
172 /*----------------------------------------------------------------------------*/
202 /*----------------------------------------------------------------------------*/
203 
204 void
206  int idiffp,
207  double thetap,
208  const cs_real_t cofbfp[],
209  const cs_real_t rovsdt[],
210  const cs_real_t i_visc[],
211  const cs_real_t b_visc[],
212  cs_real_t *restrict da,
213  cs_real_t *restrict xa);
214 
215 /*----------------------------------------------------------------------------*/
245 /*----------------------------------------------------------------------------*/
246 
247 void
249  int idiffp,
250  double thetap,
251  const cs_real_66_t cofbfts[],
252  const cs_real_66_t fimp[],
253  const cs_real_t i_visc[],
254  const cs_real_t b_visc[],
256  cs_real_t *restrict xa);
257 
258 /*----------------------------------------------------------------------------*/
295 /*----------------------------------------------------------------------------*/
296 
297 void
298 cs_matrix_tensor(const cs_mesh_t *m,
299  int iconvp,
300  int idiffp,
301  double thetap,
302  const cs_real_66_t coefbts[],
303  const cs_real_66_t cofbfts[],
304  const cs_real_66_t fimp[],
305  const cs_real_t i_massflux[],
306  const cs_real_t b_massflux[],
307  const cs_real_t i_visc[],
308  const cs_real_t b_visc[],
310  cs_real_2_t *restrict xa);
311 
312 /*----------------------------------------------------------------------------*/
352 /*----------------------------------------------------------------------------*/
353 
354 void
355 cs_matrix_scalar(const cs_mesh_t *m,
356  int iconvp,
357  int idiffp,
358  double thetap,
359  int imucpp,
360  const cs_real_t coefbp[],
361  const cs_real_t cofbfp[],
362  const cs_real_t rovsdt[],
363  const cs_real_t i_massflux[],
364  const cs_real_t b_massflux[],
365  const cs_real_t i_visc[],
366  const cs_real_t b_visc[],
367  const cs_real_t xcpp[],
368  cs_real_t *restrict da,
369  cs_real_2_t *restrict xa);
370 
371 /*----------------------------------------------------------------------------*/
401 /*----------------------------------------------------------------------------*/
402 
403 void
405  int idiffp,
406  double thetap,
407  const cs_real_33_t cofbfu[],
408  const cs_real_33_t fimp[],
409  const cs_real_t i_visc[],
410  const cs_real_t b_visc[],
412  cs_real_t *restrict xa);
413 
414 /*----------------------------------------------------------------------------*/
455 /*----------------------------------------------------------------------------*/
456 
457 void
458 cs_matrix_vector(const cs_mesh_t *m,
459  const cs_mesh_quantities_t *mq,
460  int iconvp,
461  int idiffp,
462  cs_lnum_t eb_size,
463  double thetap,
464  const cs_real_33_t coefbu[],
465  const cs_real_33_t cofbfu[],
466  const cs_real_33_t fimp[],
467  const cs_real_t i_massflux[],
468  const cs_real_t b_massflux[],
469  const cs_real_t i_visc[],
470  const cs_real_t b_visc[],
472  cs_real_2_t *restrict xa);
473 
474 /*----------------------------------------------------------------------------*/
501 /*----------------------------------------------------------------------------*/
502 
503 void
505  int iconvp,
506  int idiffp,
507  int isym,
508  const cs_real_t coefbp[],
509  const cs_real_t cofbfp[],
510  const cs_real_t i_massflux[],
511  const cs_real_t b_massflux[],
512  const cs_real_t i_visc[],
513  const cs_real_t b_visc[],
514  cs_real_t *restrict da);
515 
516 /*----------------------------------------------------------------------------*/
554 /*----------------------------------------------------------------------------*/
555 
556 void
558  const cs_mesh_quantities_t *mq,
559  int iconvp,
560  int idiffp,
561  double thetap,
562  const cs_real_33_t coefbu[],
563  const cs_real_33_t cofbfu[],
564  const cs_real_33_t fimp[],
565  const cs_real_t i_massflux[],
566  const cs_real_t b_massflux[],
567  const cs_real_33_t i_visc[],
568  const cs_real_t b_visc[],
570  cs_real_332_t *restrict xa);
571 
572 /*----------------------------------------------------------------------------*/
609 /*----------------------------------------------------------------------------*/
610 
611 void
613  int iconvp,
614  int idiffp,
615  double thetap,
616  const cs_real_66_t coefbu[],
617  const cs_real_66_t cofbfu[],
618  const cs_real_66_t fimp[],
619  const cs_real_t i_massflux[],
620  const cs_real_t b_massflux[],
621  const cs_real_66_t i_visc[],
622  const cs_real_t b_visc[],
624  cs_real_662_t *restrict xa);
625 
626 /*----------------------------------------------------------------------------*/
655 /*----------------------------------------------------------------------------*/
656 
657 void
659  int idiffp,
660  double thetap,
661  const cs_real_33_t cofbfu[],
662  const cs_real_33_t fimp[],
663  const cs_real_33_t i_visc[],
664  const cs_real_t b_visc[],
666  cs_real_33_t *restrict xa);
667 
668 /*----------------------------------------------------------------------------*/
698 /*----------------------------------------------------------------------------*/
699 
700 void
702  int idiffp,
703  double thetap,
704  const cs_real_66_t cofbfu[],
705  const cs_real_66_t fimp[],
706  const cs_real_66_t i_visc[],
707  const cs_real_t b_visc[],
709  cs_real_66_t *restrict xa);
710 
711 /*----------------------------------------------------------------------------*/
712 
714 
715 #endif /* __CS_MATRIX_BUILDING_H__ */
#define restrict
Definition: cs_defs.h:139
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:355
#define CS_PROCF(x, y)
Definition: cs_defs.h:528
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:344
cs_real_66_t cs_real_662_t[2]
Definition: cs_defs.h:357
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:333
#define END_C_DECLS
Definition: cs_defs.h:515
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:343
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
void cs_sym_matrix_anisotropic_diffusion_tensor(const cs_mesh_t *m, int idiffp, double thetap, const cs_real_66_t cofbfu[], const cs_real_66_t fimp[], const cs_real_66_t i_visc[], const cs_real_t b_visc[], cs_real_66_t *restrict da, cs_real_66_t *restrict xa)
Build the diffusion matrix for a vector field with a tensorial diffusivity (symmetric matrix).
Definition: cs_matrix_building.c:2203
void matrdt(const int *const iconvp, const int *const idiffp, const int *const isym, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t da[])
Definition: cs_matrix_building.c:110
void cs_matrix_wrapper_tensor(int iconvp, int idiffp, int tensorial_diffusion, int ndircp, int isym, double thetap, const cs_real_66_t coefbts[], const cs_real_66_t cofbfts[], const cs_real_66_t fimp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_66_t da[], cs_real_t xa[])
Definition: cs_matrix_building.c:365
void matrix(const int *iconvp, const int *idiffp, const int *ndircp, const int *isym, const cs_real_t *thetap, const int *imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t da[], cs_real_t xa[])
void cs_matrix_vector(const cs_mesh_t *m, const cs_mesh_quantities_t *mq, int iconvp, int idiffp, cs_lnum_t eb_size, double thetap, const cs_real_33_t coefbu[], const cs_real_33_t cofbfu[], const cs_real_33_t fimp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_33_t *restrict da, cs_real_2_t *restrict xa)
Build the advection/diffusion matrix for a vector field (non-symmetric matrix).
Definition: cs_matrix_building.c:1120
void cs_sym_matrix_vector(const cs_mesh_t *m, int idiffp, double thetap, const cs_real_33_t cofbfu[], const cs_real_33_t fimp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_33_t *restrict da, cs_real_t *restrict xa)
Build the diffusion matrix for a vector field (symmetric matrix).
Definition: cs_matrix_building.c:871
void cs_matrix_tensor(const cs_mesh_t *m, int iconvp, int idiffp, double thetap, const cs_real_66_t coefbts[], const cs_real_66_t cofbfts[], const cs_real_66_t fimp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_66_t *restrict da, cs_real_2_t *restrict xa)
Build the advection/diffusion matrix for a tensor field (non-symmetric matrix).
Definition: cs_matrix_building.c:1402
void cs_matrix_wrapper_scalar(int iconvp, int idiffp, int ndircp, int isym, double thetap, int imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t da[], cs_real_t xa[])
Definition: cs_matrix_building.c:148
void cs_sym_matrix_tensor(const cs_mesh_t *m, int idiffp, double thetap, const cs_real_66_t cofbfts[], const cs_real_66_t fimp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_66_t *restrict da, cs_real_t *restrict xa)
Build the diffusion matrix for a tensor field (symmetric matrix).
Definition: cs_matrix_building.c:990
void cs_matrix_anisotropic_diffusion_tensor(const cs_mesh_t *m, int iconvp, int idiffp, double thetap, const cs_real_66_t coefbu[], const cs_real_66_t cofbfu[], const cs_real_66_t fimp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_66_t i_visc[], const cs_real_t b_visc[], cs_real_66_t *restrict da, cs_real_662_t *restrict xa)
Build the advection/diffusion matrix for a tensor field with a tensorial diffusivity.
Definition: cs_matrix_building.c:1916
void cs_matrix_anisotropic_diffusion(const cs_mesh_t *m, const cs_mesh_quantities_t *mq, int iconvp, int idiffp, double thetap, const cs_real_33_t coefbu[], const cs_real_33_t cofbfu[], const cs_real_33_t fimp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_33_t i_visc[], const cs_real_t b_visc[], cs_real_33_t *restrict da, cs_real_332_t *restrict xa)
Build the advection/diffusion matrix for a vector field with a tensorial diffusivity.
Definition: cs_matrix_building.c:1704
void cs_matrix_time_step(const cs_mesh_t *m, int iconvp, int idiffp, int isym, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t *restrict da)
Build the diagonal of the advection/diffusion matrix for determining the variable time step,...
Definition: cs_matrix_building.c:1548
void cs_sym_matrix_scalar(const cs_mesh_t *m, int idiffp, double thetap, const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t *restrict da, cs_real_t *restrict xa)
Build the diffusion matrix for a scalar field. (symmetric matrix).
Definition: cs_matrix_building.c:514
void cs_matrix_wrapper_vector(int iconvp, int idiffp, int tensorial_diffusion, int ndircp, int isym, cs_lnum_t eb_size, double thetap, const cs_real_33_t coefbu[], const cs_real_33_t cofbfu[], const cs_real_33_t fimp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_33_t da[], cs_real_t xa[])
Definition: cs_matrix_building.c:237
void cs_sym_matrix_anisotropic_diffusion(const cs_mesh_t *m, int idiffp, double thetap, const cs_real_33_t cofbfu[], const cs_real_33_t fimp[], const cs_real_33_t i_visc[], const cs_real_t b_visc[], cs_real_33_t *restrict da, cs_real_33_t *restrict xa)
Build the diffusion matrix for a vector field with a tensorial diffusivity (symmetric matrix).
Definition: cs_matrix_building.c:2074
void cs_matrix_scalar(const cs_mesh_t *m, int iconvp, int idiffp, double thetap, int imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t *restrict da, cs_real_2_t *restrict xa)
Build the advection/diffusion matrix for a scalar field.
Definition: cs_matrix_building.c:652
Definition: cs_mesh_quantities.h:92
Definition: cs_mesh.h:85