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-2016 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 cs_int_t *const iconvp,
89  const cs_int_t *const idiffp,
90  const cs_int_t *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 ndircp,
161  int isym,
162  double thetap,
163  const cs_real_33_t coefbu[],
164  const cs_real_33_t cofbfu[],
165  const cs_real_33_t fimp[],
166  const cs_real_t i_massflux[],
167  const cs_real_t b_massflux[],
168  const cs_real_t i_visc[],
169  const cs_real_t b_visc[],
170  cs_real_33_t da[],
171  cs_real_t xa[]);
172 
173 /*----------------------------------------------------------------------------
174  * Wrapper to cs_matrix_tensor (or its counterpart for
175  * symmetric matrices)
176  *----------------------------------------------------------------------------*/
177 
178 void
179 cs_matrix_wrapper_tensor(int iconvp,
180  int idiffp,
181  int ndircp,
182  int isym,
183  double thetap,
184  const cs_real_66_t coefbts[],
185  const cs_real_66_t cofbfts[],
186  const cs_real_66_t fimp[],
187  const cs_real_t i_massflux[],
188  const cs_real_t b_massflux[],
189  const cs_real_t i_visc[],
190  const cs_real_t b_visc[],
191  cs_real_66_t da[],
192  cs_real_t xa[]);
193 
194 /*----------------------------------------------------------------------------
195  * Wrapper to cs_matrix_anisotropic_diffusion (or its counterpart for
196  * symmetric matrices)
197  *----------------------------------------------------------------------------*/
198 
199 void
201  int idiffp,
202  int ndircp,
203  int isym,
204  double thetap,
205  const cs_real_33_t coefbu[],
206  const cs_real_33_t cofbfu[],
207  const cs_real_33_t fimp[],
208  const cs_real_t i_massflux[],
209  const cs_real_t b_massflux[],
210  const cs_real_33_t i_visc[],
211  const cs_real_t b_visc[],
212  cs_real_33_t da[],
213  cs_real_t xa[]);
214 
215 /*----------------------------------------------------------------------------
216  * Wrapper to cs_matrix_anisotropic_diffusion_tensor (or its counterpart for
217  * symmetric matrices)
218  *----------------------------------------------------------------------------*/
219 
220 void
222  int idiffp,
223  int ndircp,
224  int isym,
225  double thetap,
226  const cs_real_66_t coefbts[],
227  const cs_real_66_t cofbfts[],
228  const cs_real_66_t fimp[],
229  const cs_real_t i_massflux[],
230  const cs_real_t b_massflux[],
231  cs_real_t i_visc[],
232  const cs_real_t b_visc[],
233  cs_real_66_t da[],
234  cs_real_662_t xa[]);
235 
236 /*----------------------------------------------------------------------------*/
266 /*----------------------------------------------------------------------------*/
267 
268 void
270  int idiffp,
271  double thetap,
272  const cs_real_t cofbfp[],
273  const cs_real_t rovsdt[],
274  const cs_real_t i_visc[],
275  const cs_real_t b_visc[],
276  cs_real_t *restrict da,
277  cs_real_t *restrict xa);
278 /*----------------------------------------------------------------------------*/
308 /*----------------------------------------------------------------------------*/
309 
310 void
312  int idiffp,
313  double thetap,
314  const cs_real_66_t cofbfts[],
315  const cs_real_66_t fimp[],
316  const cs_real_t i_visc[],
317  const cs_real_t b_visc[],
319  cs_real_t *restrict xa);
320 
321 /*----------------------------------------------------------------------------*/
358 /*----------------------------------------------------------------------------*/
359 
360 void
361 cs_matrix_tensor(const cs_mesh_t *m,
362  int iconvp,
363  int idiffp,
364  double thetap,
365  const cs_real_66_t coefbts[],
366  const cs_real_66_t cofbfts[],
367  const cs_real_66_t fimp[],
368  const cs_real_t i_massflux[],
369  const cs_real_t b_massflux[],
370  const cs_real_t i_visc[],
371  const cs_real_t b_visc[],
373  cs_real_2_t *restrict xa);
374 
375 /*----------------------------------------------------------------------------*/
415 /*----------------------------------------------------------------------------*/
416 
417 void
418 cs_matrix_scalar(const cs_mesh_t *m,
419  int iconvp,
420  int idiffp,
421  double thetap,
422  int imucpp,
423  const cs_real_t coefbp[],
424  const cs_real_t cofbfp[],
425  const cs_real_t rovsdt[],
426  const cs_real_t i_massflux[],
427  const cs_real_t b_massflux[],
428  const cs_real_t i_visc[],
429  const cs_real_t b_visc[],
430  const cs_real_t xcpp[],
431  cs_real_t *restrict da,
432  cs_real_2_t *restrict xa);
433 
434 /*----------------------------------------------------------------------------*/
464 /*----------------------------------------------------------------------------*/
465 
466 void
468  int idiffp,
469  double thetap,
470  const cs_real_33_t cofbfu[],
471  const cs_real_33_t fimp[],
472  const cs_real_t i_visc[],
473  const cs_real_t b_visc[],
475  cs_real_t *restrict xa);
476 
477 /*----------------------------------------------------------------------------*/
514 /*----------------------------------------------------------------------------*/
515 
516 void
517 cs_matrix_vector(const cs_mesh_t *m,
518  int iconvp,
519  int idiffp,
520  double thetap,
521  const cs_real_33_t coefbu[],
522  const cs_real_33_t cofbfu[],
523  const cs_real_33_t fimp[],
524  const cs_real_t i_massflux[],
525  const cs_real_t b_massflux[],
526  const cs_real_t i_visc[],
527  const cs_real_t b_visc[],
529  cs_real_2_t *restrict xa);
530 
531 /*----------------------------------------------------------------------------*/
558 /*----------------------------------------------------------------------------*/
559 
560 void
562  int iconvp,
563  int idiffp,
564  int isym,
565  const cs_real_t coefbp[],
566  const cs_real_t cofbfp[],
567  const cs_real_t i_massflux[],
568  const cs_real_t b_massflux[],
569  const cs_real_t i_visc[],
570  const cs_real_t b_visc[],
571  cs_real_t *restrict da);
572 
573 /*----------------------------------------------------------------------------*/
610 /*----------------------------------------------------------------------------*/
611 
612 void
614  int iconvp,
615  int idiffp,
616  double thetap,
617  const cs_real_33_t coefbu[],
618  const cs_real_33_t cofbfu[],
619  const cs_real_33_t fimp[],
620  const cs_real_t i_massflux[],
621  const cs_real_t b_massflux[],
622  const cs_real_33_t i_visc[],
623  const cs_real_t b_visc[],
625  cs_real_332_t *restrict xa);
626 
627 /*----------------------------------------------------------------------------*/
664 /*----------------------------------------------------------------------------*/
665 
666 void
668  int iconvp,
669  int idiffp,
670  double thetap,
671  const cs_real_66_t coefbu[],
672  const cs_real_66_t cofbfu[],
673  const cs_real_66_t fimp[],
674  const cs_real_t i_massflux[],
675  const cs_real_t b_massflux[],
676  const cs_real_66_t i_visc[],
677  const cs_real_t b_visc[],
679  cs_real_662_t *restrict xa);
680 
681 /*----------------------------------------------------------------------------*/
710 /*----------------------------------------------------------------------------*/
711 
712 void
714  int idiffp,
715  double thetap,
716  const cs_real_33_t cofbfu[],
717  const cs_real_33_t fimp[],
718  const cs_real_33_t i_visc[],
719  const cs_real_t b_visc[],
721  cs_real_33_t *restrict xa);
722 
723 /*----------------------------------------------------------------------------*/
753 /*----------------------------------------------------------------------------*/
754 
755 void
757  int idiffp,
758  double thetap,
759  const cs_real_66_t cofbfu[],
760  const cs_real_66_t fimp[],
761  const cs_real_66_t i_visc[],
762  const cs_real_t b_visc[],
764  cs_real_66_t *restrict xa);
765 
766 /*----------------------------------------------------------------------------*/
767 
769 
770 #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:1822
#define restrict
Definition: cs_defs.h:122
void cs_matrix_wrapper_vector(int iconvp, int idiffp, int ndircp, int isym, 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:381
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:307
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:1357
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:315
#define BEGIN_C_DECLS
Definition: cs_defs.h:448
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
cs_real_66_t cs_real_662_t[2]
Definition: cs_defs.h:323
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:1228
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:1108
double cs_real_t
Floating-point value.
Definition: cs_defs.h:296
Definition: cs_mesh.h:62
void cs_matrix_anisotropic_diffusion_wrapper(int iconvp, int idiffp, int ndircp, int isym, 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 da[], cs_real_t xa[])
Definition: cs_matrix_building.c:549
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:1515
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:321
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:744
void cs_matrix_anisotropic_diffusion_wrapper_tensor(int iconvp, int idiffp, 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[], 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:632
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:153
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:1663
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:881
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:2146
#define END_C_DECLS
Definition: cs_defs.h:449
#define CS_PROCF(x, y)
Definition: cs_defs.h:472
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:314
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:277
void cs_matrix_wrapper_tensor(int iconvp, int idiffp, 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:464
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:1987
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:2275
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