programmer's 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-2015 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  * Wrapper to cs_matrix_scalar (or its counterpart for
59  * symmetric matrices)
60  *----------------------------------------------------------------------------*/
61 
62 void CS_PROCF (matrix, MATRIX)
63 (
64  const cs_int_t *const iconvp,
65  const cs_int_t *const idiffp,
66  const cs_int_t *const ndircp,
67  const cs_int_t *const isym,
68  const cs_real_t *const thetap,
69  const cs_int_t *const 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  * Wrapper to cs_matrix_vector (or its counterpart for
84  * symmetric matrices)
85  *----------------------------------------------------------------------------*/
86 
87 void CS_PROCF (matrxv, MATRXV)
88 (
89  const cs_int_t *const iconvp,
90  const cs_int_t *const idiffp,
91  const cs_int_t *const ndircp,
92  const cs_int_t *const isym,
93  const cs_real_t *const thetap,
94  const cs_real_33_t coefbu[],
95  const cs_real_33_t cofbfu[],
96  const cs_real_33_t fimp[],
97  const cs_real_t i_massflux[],
98  const cs_real_t b_massflux[],
99  const cs_real_t i_visc[],
100  const cs_real_t b_visc[],
101  cs_real_33_t da[],
102  cs_real_t xa[]
103 );
104 /*----------------------------------------------------------------------------
105  * Wrapper to cs_matrix_tensor (or its counterpart for
106  * symmetric matrices)
107  *----------------------------------------------------------------------------*/
108 
109 void CS_PROCF (matrxts, MATRXTS)
110 (
111  const cs_int_t *const iconvp,
112  const cs_int_t *const idiffp,
113  const cs_int_t *const ndircp,
114  const cs_int_t *const isym,
115  const cs_real_t *const thetap,
116  const cs_real_66_t coefbts[],
117  const cs_real_66_t cofbfts[],
118  const cs_real_66_t fimp[],
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  cs_real_66_t da[],
124  cs_real_t xa[]
125 );
126 /*----------------------------------------------------------------------------
127  * Wrapper to cs_matrix_time_step
128  *----------------------------------------------------------------------------*/
129 
130 void CS_PROCF (matrdt, MATRDT)
131 (
132  const cs_int_t *const iconvp,
133  const cs_int_t *const idiffp,
134  const cs_int_t *const isym,
135  const cs_real_t coefbp[],
136  const cs_real_t cofbfp[],
137  const cs_real_t i_massflux[],
138  const cs_real_t b_massflux[],
139  const cs_real_t i_visc[],
140  const cs_real_t b_visc[],
141  cs_real_t da[]
142 );
143 
144 /*----------------------------------------------------------------------------
145  * Wrapper to cs_matrix_anisotropic_diffusion (or its counterpart for
146  * symmetric matrices)
147  *----------------------------------------------------------------------------*/
148 
149 void CS_PROCF (matrvv, MATRVV)
150 (
151  const cs_int_t *const iconvp,
152  const cs_int_t *const idiffp,
153  const cs_int_t *const ndircp,
154  const cs_int_t *const isym,
155  const cs_real_t *const thetap,
156  const cs_real_33_t coefbu[],
157  const cs_real_33_t cofbfu[],
158  const cs_real_33_t fimp[],
159  const cs_real_t i_massflux[],
160  const cs_real_t b_massflux[],
161  const cs_real_33_t i_visc[],
162  const cs_real_t b_visc[],
163  cs_real_33_t da[],
164  cs_real_332_t xa[]
165 );
166 
167 /*----------------------------------------------------------------------------
168  * Wrapper to cs_matrix_anisotropic_diffusion_tenssor (or its counterpart for
169  * symmetric matrices)
170  *----------------------------------------------------------------------------*/
171 
172 void CS_PROCF (matrvts, MATRVTS)
173 (
174  const cs_int_t *const iconvp,
175  const cs_int_t *const idiffp,
176  const cs_int_t *const ndircp,
177  const cs_int_t *const isym,
178  const cs_real_t *const thetap,
179  const cs_real_66_t coefbts[],
180  const cs_real_66_t cofbfts[],
181  const cs_real_66_t fimp[],
182  const cs_real_t i_massflux[],
183  const cs_real_t b_massflux[],
184  const cs_real_t i_visc[],
185  const cs_real_t b_visc[],
186  cs_real_66_t da[],
187  cs_real_662_t xa[]
188 );
189 
190 /*=============================================================================
191  * Public function prototypes
192  *============================================================================*/
193 
194 /*----------------------------------------------------------------------------*/
224 /*----------------------------------------------------------------------------*/
225 
226 void
228  int idiffp,
229  double thetap,
230  const cs_real_t cofbfp[],
231  const cs_real_t rovsdt[],
232  const cs_real_t i_visc[],
233  const cs_real_t b_visc[],
234  cs_real_t *restrict da,
235  cs_real_t *restrict xa);
236 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 void
272  int idiffp,
273  int ndircp,
274  double thetap,
275  const cs_real_66_t cofbfts[],
276  const cs_real_66_t fimp[],
277  const cs_real_t i_visc[],
278  const cs_real_t b_visc[],
280  cs_real_t *restrict xa);
281 
282 /*----------------------------------------------------------------------------*/
321 /*----------------------------------------------------------------------------*/
322 
323 void
324 cs_matrix_tensor(const cs_mesh_t *m,
325  int iconvp,
326  int idiffp,
327  int ndircp,
328  double thetap,
329  const cs_real_66_t coefbts[],
330  const cs_real_66_t cofbfts[],
331  const cs_real_66_t fimp[],
332  const cs_real_t i_massflux[],
333  const cs_real_t b_massflux[],
334  const cs_real_t i_visc[],
335  const cs_real_t b_visc[],
337  cs_real_2_t *restrict xa);
338 
339 /*----------------------------------------------------------------------------*/
379 /*----------------------------------------------------------------------------*/
380 
381 void
382 cs_matrix_scalar(const cs_mesh_t *m,
383  int iconvp,
384  int idiffp,
385  double thetap,
386  int imucpp,
387  const cs_real_t coefbp[],
388  const cs_real_t cofbfp[],
389  const cs_real_t rovsdt[],
390  const cs_real_t i_massflux[],
391  const cs_real_t b_massflux[],
392  const cs_real_t i_visc[],
393  const cs_real_t b_visc[],
394  const cs_real_t xcpp[],
395  cs_real_t *restrict da,
396  cs_real_2_t *restrict xa);
397 
398 /*----------------------------------------------------------------------------*/
428 /*----------------------------------------------------------------------------*/
429 
430 void
432  int idiffp,
433  double thetap,
434  const cs_real_33_t cofbfu[],
435  const cs_real_33_t fimp[],
436  const cs_real_t i_visc[],
437  const cs_real_t b_visc[],
439  cs_real_t *restrict xa);
440 
441 /*----------------------------------------------------------------------------*/
478 /*----------------------------------------------------------------------------*/
479 
480 void
481 cs_matrix_vector(const cs_mesh_t *m,
482  int iconvp,
483  int idiffp,
484  double thetap,
485  const cs_real_33_t coefbu[],
486  const cs_real_33_t cofbfu[],
487  const cs_real_33_t fimp[],
488  const cs_real_t i_massflux[],
489  const cs_real_t b_massflux[],
490  const cs_real_t i_visc[],
491  const cs_real_t b_visc[],
493  cs_real_2_t *restrict xa);
494 
495 /*----------------------------------------------------------------------------*/
522 /*----------------------------------------------------------------------------*/
523 
524 void
526  int iconvp,
527  int idiffp,
528  int isym,
529  const cs_real_t coefbp[],
530  const cs_real_t cofbfp[],
531  const cs_real_t i_massflux[],
532  const cs_real_t b_massflux[],
533  const cs_real_t i_visc[],
534  const cs_real_t b_visc[],
535  cs_real_t *restrict da);
536 
537 /*----------------------------------------------------------------------------*/
574 /*----------------------------------------------------------------------------*/
575 
576 void
578  int iconvp,
579  int idiffp,
580  double thetap,
581  const cs_real_33_t coefbu[],
582  const cs_real_33_t cofbfu[],
583  const cs_real_33_t fimp[],
584  const cs_real_t i_massflux[],
585  const cs_real_t b_massflux[],
586  const cs_real_33_t i_visc[],
587  const cs_real_t b_visc[],
589  cs_real_332_t *restrict xa);
590 
591 /*----------------------------------------------------------------------------*/
630 /*----------------------------------------------------------------------------*/
631 
632 void
634  int iconvp,
635  int idiffp,
636  int ndircp,
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 /*----------------------------------------------------------------------------*/
722 /*----------------------------------------------------------------------------*/
723 
724 void
726  int idiffp,
727  int ndircp,
728  double thetap,
729  const cs_real_66_t cofbfu[],
730  const cs_real_66_t fimp[],
731  const cs_real_66_t i_visc[],
732  const cs_real_t b_visc[],
734  cs_real_66_t *restrict xa);
735 
736 /*----------------------------------------------------------------------------*/
737 
739 
740 #endif /* __CS_MATRIX_BUILDING_H__ */
void cs_matrix_anisotropic_diffusion(const cs_mesh_t *m, 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:1640
#define restrict
Definition: cs_defs.h:122
void matrxv(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *const ndircp, const cs_int_t *const isym, const cs_real_t *const 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:262
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:306
void cs_matrix_vector(const cs_mesh_t *m, 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_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:1179
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:312
void matrix(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *const ndircp, const cs_int_t *const isym, const cs_real_t *const thetap, const cs_int_t *const 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
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
void cs_matrix_anisotropic_diffusion_tensor(const cs_mesh_t *m, int iconvp, int idiffp, int ndircp, 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:1795
void matrvts(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *const ndircp, const cs_int_t *const isym, const cs_real_t *const 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_662_t xa[])
Definition: cs_matrix_building.c:465
cs_real_66_t cs_real_662_t[2]
Definition: cs_defs.h:320
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:901
void matrvv(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *const ndircp, const cs_int_t *const isym, const cs_real_t *const 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 da[], cs_real_332_t xa[])
Definition: cs_matrix_building.c:380
Definition: cs_mesh.h:62
void matrxts(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *const ndircp, const cs_int_t *const isym, const cs_real_t *const 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:199
void cs_matrix_tensor(const cs_mesh_t *m, int iconvp, int idiffp, int ndircp, 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:1327
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:318
void cs_sym_matrix_anisotropic_diffusion_tensor(const cs_mesh_t *m, int idiffp, int ndircp, 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:2087
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:559
void matrdt(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *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:346
void cs_sym_matrix_tensor(const cs_mesh_t *m, int idiffp, int ndircp, 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:1028
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:1481
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:697
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:1956
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296
#define CS_PROCF(x, y)
Definition: cs_defs.h:453
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:311