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-2018 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 tensorial_diffusion,
161  int ndircp,
162  int isym,
163  double thetap,
164  const cs_real_33_t coefbu[],
165  const cs_real_33_t cofbfu[],
166  const cs_real_33_t fimp[],
167  const cs_real_t i_massflux[],
168  const cs_real_t b_massflux[],
169  const cs_real_t i_visc[],
170  const cs_real_t b_visc[],
171  cs_real_33_t da[],
172  cs_real_t xa[]);
173 
174 /*----------------------------------------------------------------------------
175  * Wrapper to cs_matrix_tensor (or its counterpart for
176  * symmetric matrices)
177  *----------------------------------------------------------------------------*/
178 
179 void
180 cs_matrix_wrapper_tensor(int iconvp,
181  int idiffp,
182  int tensorial_diffusion,
183  int ndircp,
184  int isym,
185  double thetap,
186  const cs_real_66_t coefbts[],
187  const cs_real_66_t cofbfts[],
188  const cs_real_66_t fimp[],
189  const cs_real_t i_massflux[],
190  const cs_real_t b_massflux[],
191  const cs_real_t i_visc[],
192  const cs_real_t b_visc[],
193  cs_real_66_t da[],
194  cs_real_t xa[]);
195 
196 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
228 void
230  int idiffp,
231  double thetap,
232  const cs_real_t cofbfp[],
233  const cs_real_t rovsdt[],
234  const cs_real_t i_visc[],
235  const cs_real_t b_visc[],
236  cs_real_t *restrict da,
237  cs_real_t *restrict xa);
238 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 void
272  int idiffp,
273  double thetap,
274  const cs_real_66_t cofbfts[],
275  const cs_real_66_t fimp[],
276  const cs_real_t i_visc[],
277  const cs_real_t b_visc[],
279  cs_real_t *restrict xa);
280 
281 /*----------------------------------------------------------------------------*/
318 /*----------------------------------------------------------------------------*/
319 
320 void
321 cs_matrix_tensor(const cs_mesh_t *m,
322  int iconvp,
323  int idiffp,
324  double thetap,
325  const cs_real_66_t coefbts[],
326  const cs_real_66_t cofbfts[],
327  const cs_real_66_t fimp[],
328  const cs_real_t i_massflux[],
329  const cs_real_t b_massflux[],
330  const cs_real_t i_visc[],
331  const cs_real_t b_visc[],
333  cs_real_2_t *restrict xa);
334 
335 /*----------------------------------------------------------------------------*/
375 /*----------------------------------------------------------------------------*/
376 
377 void
378 cs_matrix_scalar(const cs_mesh_t *m,
379  int iconvp,
380  int idiffp,
381  double thetap,
382  int imucpp,
383  const cs_real_t coefbp[],
384  const cs_real_t cofbfp[],
385  const cs_real_t rovsdt[],
386  const cs_real_t i_massflux[],
387  const cs_real_t b_massflux[],
388  const cs_real_t i_visc[],
389  const cs_real_t b_visc[],
390  const cs_real_t xcpp[],
391  cs_real_t *restrict da,
392  cs_real_2_t *restrict xa);
393 
394 /*----------------------------------------------------------------------------*/
424 /*----------------------------------------------------------------------------*/
425 
426 void
428  int idiffp,
429  double thetap,
430  const cs_real_33_t cofbfu[],
431  const cs_real_33_t fimp[],
432  const cs_real_t i_visc[],
433  const cs_real_t b_visc[],
435  cs_real_t *restrict xa);
436 
437 /*----------------------------------------------------------------------------*/
474 /*----------------------------------------------------------------------------*/
475 
476 void
477 cs_matrix_vector(const cs_mesh_t *m,
478  int iconvp,
479  int idiffp,
480  double thetap,
481  const cs_real_33_t coefbu[],
482  const cs_real_33_t cofbfu[],
483  const cs_real_33_t fimp[],
484  const cs_real_t i_massflux[],
485  const cs_real_t b_massflux[],
486  const cs_real_t i_visc[],
487  const cs_real_t b_visc[],
489  cs_real_2_t *restrict xa);
490 
491 /*----------------------------------------------------------------------------*/
518 /*----------------------------------------------------------------------------*/
519 
520 void
522  int iconvp,
523  int idiffp,
524  int isym,
525  const cs_real_t coefbp[],
526  const cs_real_t cofbfp[],
527  const cs_real_t i_massflux[],
528  const cs_real_t b_massflux[],
529  const cs_real_t i_visc[],
530  const cs_real_t b_visc[],
531  cs_real_t *restrict da);
532 
533 /*----------------------------------------------------------------------------*/
570 /*----------------------------------------------------------------------------*/
571 
572 void
574  int iconvp,
575  int idiffp,
576  double thetap,
577  const cs_real_33_t coefbu[],
578  const cs_real_33_t cofbfu[],
579  const cs_real_33_t fimp[],
580  const cs_real_t i_massflux[],
581  const cs_real_t b_massflux[],
582  const cs_real_33_t i_visc[],
583  const cs_real_t b_visc[],
585  cs_real_332_t *restrict xa);
586 
587 /*----------------------------------------------------------------------------*/
624 /*----------------------------------------------------------------------------*/
625 
626 void
628  int iconvp,
629  int idiffp,
630  double thetap,
631  const cs_real_66_t coefbu[],
632  const cs_real_66_t cofbfu[],
633  const cs_real_66_t fimp[],
634  const cs_real_t i_massflux[],
635  const cs_real_t b_massflux[],
636  const cs_real_66_t i_visc[],
637  const cs_real_t b_visc[],
639  cs_real_662_t *restrict xa);
640 
641 /*----------------------------------------------------------------------------*/
670 /*----------------------------------------------------------------------------*/
671 
672 void
674  int idiffp,
675  double thetap,
676  const cs_real_33_t cofbfu[],
677  const cs_real_33_t fimp[],
678  const cs_real_33_t i_visc[],
679  const cs_real_t b_visc[],
681  cs_real_33_t *restrict xa);
682 
683 /*----------------------------------------------------------------------------*/
713 /*----------------------------------------------------------------------------*/
714 
715 void
717  int idiffp,
718  double thetap,
719  const cs_real_66_t cofbfu[],
720  const cs_real_66_t fimp[],
721  const cs_real_66_t i_visc[],
722  const cs_real_t b_visc[],
724  cs_real_66_t *restrict xa);
725 
726 /*----------------------------------------------------------------------------*/
727 
729 
730 #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:1726
#define restrict
Definition: cs_defs.h:122
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:308
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:1261
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:316
#define BEGIN_C_DECLS
Definition: cs_defs.h:461
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:296
cs_real_66_t cs_real_662_t[2]
Definition: cs_defs.h:325
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:1132
void cs_matrix_wrapper_vector(int iconvp, int idiffp, int tensorial_diffusion, 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
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:1012
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:501
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_mesh.h:63
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:1419
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:323
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:648
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:1567
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:785
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:2050
#define END_C_DECLS
Definition: cs_defs.h:462
#define CS_PROCF(x, y)
Definition: cs_defs.h:475
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:315
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_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:1891
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:2179
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