7.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-2021 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_scalar for convection/diffusion multigrid
129  *----------------------------------------------------------------------------*/
130 
131 void
133  int idiffp,
134  int ndircp,
135  double thetap,
136  int imucpp,
137  const cs_real_t coefbp[],
138  const cs_real_t cofbfp[],
139  const cs_real_t rovsdt[],
140  const cs_real_t i_massflux[],
141  const cs_real_t b_massflux[],
142  const cs_real_t i_visc[],
143  const cs_real_t b_visc[],
144  const cs_real_t xcpp[],
145  cs_real_t da[],
146  cs_real_t xa[],
147  cs_real_t da_conv[],
148  cs_real_t xa_conv[],
149  cs_real_t da_diff[],
150  cs_real_t xa_diff[]);
151 
152 /*----------------------------------------------------------------------------
153  * Wrapper to cs_matrix_vector (or its counterpart for
154  * symmetric matrices)
155  *----------------------------------------------------------------------------*/
156 
157 void
158 cs_matrix_wrapper_vector(int iconvp,
159  int idiffp,
160  int tensorial_diffusion,
161  int ndircp,
162  int isym,
163  cs_lnum_t eb_size[4],
164  double thetap,
165  const cs_real_33_t coefbu[],
166  const cs_real_33_t cofbfu[],
167  const cs_real_33_t fimp[],
168  const cs_real_t i_massflux[],
169  const cs_real_t b_massflux[],
170  const cs_real_t i_visc[],
171  const cs_real_t b_visc[],
172  cs_real_33_t da[],
173  cs_real_t xa[]);
174 
175 /*----------------------------------------------------------------------------
176  * Wrapper to cs_matrix_tensor (or its counterpart for
177  * symmetric matrices)
178  *----------------------------------------------------------------------------*/
179 
180 void
181 cs_matrix_wrapper_tensor(int iconvp,
182  int idiffp,
183  int tensorial_diffusion,
184  int ndircp,
185  int isym,
186  double thetap,
187  const cs_real_66_t coefbts[],
188  const cs_real_66_t cofbfts[],
189  const cs_real_66_t fimp[],
190  const cs_real_t i_massflux[],
191  const cs_real_t b_massflux[],
192  const cs_real_t i_visc[],
193  const cs_real_t b_visc[],
194  cs_real_66_t da[],
195  cs_real_t xa[]);
196 
197 /*----------------------------------------------------------------------------*/
227 /*----------------------------------------------------------------------------*/
228 
229 void
231  int idiffp,
232  double thetap,
233  const cs_real_t cofbfp[],
234  const cs_real_t rovsdt[],
235  const cs_real_t i_visc[],
236  const cs_real_t b_visc[],
237  cs_real_t *restrict da,
238  cs_real_t *restrict xa);
239 
240 /*----------------------------------------------------------------------------*/
270 /*----------------------------------------------------------------------------*/
271 
272 void
274  int idiffp,
275  double thetap,
276  const cs_real_66_t cofbfts[],
277  const cs_real_66_t fimp[],
278  const cs_real_t i_visc[],
279  const cs_real_t b_visc[],
281  cs_real_t *restrict xa);
282 
283 /*----------------------------------------------------------------------------*/
320 /*----------------------------------------------------------------------------*/
321 
322 void
323 cs_matrix_tensor(const cs_mesh_t *m,
324  int iconvp,
325  int idiffp,
326  double thetap,
327  const cs_real_66_t coefbts[],
328  const cs_real_66_t cofbfts[],
329  const cs_real_66_t fimp[],
330  const cs_real_t i_massflux[],
331  const cs_real_t b_massflux[],
332  const cs_real_t i_visc[],
333  const cs_real_t b_visc[],
335  cs_real_2_t *restrict xa);
336 
337 /*----------------------------------------------------------------------------*/
377 /*----------------------------------------------------------------------------*/
378 
379 void
380 cs_matrix_scalar(const cs_mesh_t *m,
381  int iconvp,
382  int idiffp,
383  double thetap,
384  int imucpp,
385  const cs_real_t coefbp[],
386  const cs_real_t cofbfp[],
387  const cs_real_t rovsdt[],
388  const cs_real_t i_massflux[],
389  const cs_real_t b_massflux[],
390  const cs_real_t i_visc[],
391  const cs_real_t b_visc[],
392  const cs_real_t xcpp[],
393  cs_real_t *restrict da,
394  cs_real_2_t *restrict xa);
395 
396 /*----------------------------------------------------------------------------*/
426 /*----------------------------------------------------------------------------*/
427 
428 void
430  int idiffp,
431  double thetap,
432  const cs_real_33_t cofbfu[],
433  const cs_real_33_t fimp[],
434  const cs_real_t i_visc[],
435  const cs_real_t b_visc[],
437  cs_real_t *restrict xa);
438 
439 /*----------------------------------------------------------------------------*/
477 /*----------------------------------------------------------------------------*/
478 
479 void
480 cs_matrix_vector(const cs_mesh_t *m,
481  const cs_mesh_quantities_t *mq,
482  int iconvp,
483  int idiffp,
484  cs_lnum_t eb_size[4],
485  double thetap,
486  const cs_real_33_t coefbu[],
487  const cs_real_33_t cofbfu[],
488  const cs_real_33_t fimp[],
489  const cs_real_t i_massflux[],
490  const cs_real_t b_massflux[],
491  const cs_real_t i_visc[],
492  const cs_real_t b_visc[],
494  cs_real_2_t *restrict xa);
495 
496 /*----------------------------------------------------------------------------*/
523 /*----------------------------------------------------------------------------*/
524 
525 void
527  int iconvp,
528  int idiffp,
529  int isym,
530  const cs_real_t coefbp[],
531  const cs_real_t cofbfp[],
532  const cs_real_t i_massflux[],
533  const cs_real_t b_massflux[],
534  const cs_real_t i_visc[],
535  const cs_real_t b_visc[],
536  cs_real_t *restrict da);
537 
538 /*----------------------------------------------------------------------------*/
576 /*----------------------------------------------------------------------------*/
577 
578 void
580  const cs_mesh_quantities_t *mq,
581  int iconvp,
582  int idiffp,
583  double thetap,
584  const cs_real_33_t coefbu[],
585  const cs_real_33_t cofbfu[],
586  const cs_real_33_t fimp[],
587  const cs_real_t i_massflux[],
588  const cs_real_t b_massflux[],
589  const cs_real_33_t i_visc[],
590  const cs_real_t b_visc[],
592  cs_real_332_t *restrict xa);
593 
594 /*----------------------------------------------------------------------------*/
631 /*----------------------------------------------------------------------------*/
632 
633 void
635  int iconvp,
636  int idiffp,
637  double thetap,
638  const cs_real_66_t coefbu[],
639  const cs_real_66_t cofbfu[],
640  const cs_real_66_t fimp[],
641  const cs_real_t i_massflux[],
642  const cs_real_t b_massflux[],
643  const cs_real_66_t i_visc[],
644  const cs_real_t b_visc[],
646  cs_real_662_t *restrict xa);
647 
648 /*----------------------------------------------------------------------------*/
677 /*----------------------------------------------------------------------------*/
678 
679 void
681  int idiffp,
682  double thetap,
683  const cs_real_33_t cofbfu[],
684  const cs_real_33_t fimp[],
685  const cs_real_33_t i_visc[],
686  const cs_real_t b_visc[],
688  cs_real_33_t *restrict xa);
689 
690 /*----------------------------------------------------------------------------*/
720 /*----------------------------------------------------------------------------*/
721 
722 void
724  int idiffp,
725  double thetap,
726  const cs_real_66_t cofbfu[],
727  const cs_real_66_t fimp[],
728  const cs_real_66_t i_visc[],
729  const cs_real_t b_visc[],
731  cs_real_66_t *restrict xa);
732 
733 /*----------------------------------------------------------------------------*/
734 
736 
737 #endif /* __CS_MATRIX_BUILDING_H__ */
#define restrict
Definition: cs_defs.h:142
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:334
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:343
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
cs_real_66_t cs_real_662_t[2]
Definition: cs_defs.h:356
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:1146
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:1027
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:513
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
Definition: cs_mesh.h:84
void cs_matrix_wrapper_vector(int iconvp, int idiffp, int tensorial_diffusion, int ndircp, int isym, cs_lnum_t eb_size[4], 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:385
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:153
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:1555
void cs_matrix_vector(const cs_mesh_t *m, const cs_mesh_quantities_t *mq, int iconvp, int idiffp, cs_lnum_t eb_size[4], 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:1273
Definition: cs_mesh_quantities.h:89
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:354
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:662
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:1701
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:803
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
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:2230
#define END_C_DECLS
Definition: cs_defs.h:511
#define CS_PROCF(x, y)
Definition: cs_defs.h:524
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:342
void cs_matrix_wrapper_scalar_conv_diff(int iconvp, int idiffp, int ndircp, 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[], cs_real_t da_conv[], cs_real_t xa_conv[], cs_real_t da_diff[], cs_real_t xa_diff[])
Definition: cs_matrix_building.c:279
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:1860
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:2072
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:191
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:2359
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[])
Definition: cs_matrix_building.c:111