My Project
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-2019 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  int 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[],
239 /*----------------------------------------------------------------------------*/
269 /*----------------------------------------------------------------------------*/
270 
271 void
273  int idiffp,
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[],
281 
282 /*----------------------------------------------------------------------------*/
319 /*----------------------------------------------------------------------------*/
320 
321 void
322 cs_matrix_tensor(const cs_mesh_t *m,
323  int iconvp,
324  int idiffp,
325  double thetap,
326  const cs_real_66_t coefbts[],
327  const cs_real_66_t cofbfts[],
328  const cs_real_66_t fimp[],
329  const cs_real_t i_massflux[],
330  const cs_real_t b_massflux[],
331  const cs_real_t i_visc[],
332  const cs_real_t b_visc[],
335 
336 /*----------------------------------------------------------------------------*/
376 /*----------------------------------------------------------------------------*/
377 
378 void
379 cs_matrix_scalar(const cs_mesh_t *m,
380  int iconvp,
381  int idiffp,
382  double thetap,
383  int imucpp,
384  const cs_real_t coefbp[],
385  const cs_real_t cofbfp[],
386  const cs_real_t rovsdt[],
387  const cs_real_t i_massflux[],
388  const cs_real_t b_massflux[],
389  const cs_real_t i_visc[],
390  const cs_real_t b_visc[],
391  const cs_real_t xcpp[],
394 
395 /*----------------------------------------------------------------------------*/
425 /*----------------------------------------------------------------------------*/
426 
427 void
429  int idiffp,
430  double thetap,
431  const cs_real_33_t cofbfu[],
432  const cs_real_33_t fimp[],
433  const cs_real_t i_visc[],
434  const cs_real_t b_visc[],
437 
438 /*----------------------------------------------------------------------------*/
476 /*----------------------------------------------------------------------------*/
477 
478 void
479 cs_matrix_vector(const cs_mesh_t *m,
480  const cs_mesh_quantities_t *mq,
481  int iconvp,
482  int idiffp,
483  int eb_size[4],
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[],
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[],
536 
537 /*----------------------------------------------------------------------------*/
575 /*----------------------------------------------------------------------------*/
576 
577 void
579  const cs_mesh_quantities_t *mq,
580  int iconvp,
581  int idiffp,
582  double thetap,
583  const cs_real_33_t coefbu[],
584  const cs_real_33_t cofbfu[],
585  const cs_real_33_t fimp[],
586  const cs_real_t i_massflux[],
587  const cs_real_t b_massflux[],
588  const cs_real_33_t i_visc[],
589  const cs_real_t b_visc[],
592 
593 /*----------------------------------------------------------------------------*/
630 /*----------------------------------------------------------------------------*/
631 
632 void
634  int iconvp,
635  int idiffp,
636  double thetap,
637  const cs_real_66_t coefbu[],
638  const cs_real_66_t cofbfu[],
639  const cs_real_66_t fimp[],
640  const cs_real_t i_massflux[],
641  const cs_real_t b_massflux[],
642  const cs_real_66_t i_visc[],
643  const cs_real_t b_visc[],
646 
647 /*----------------------------------------------------------------------------*/
676 /*----------------------------------------------------------------------------*/
677 
678 void
680  int idiffp,
681  double thetap,
682  const cs_real_33_t cofbfu[],
683  const cs_real_33_t fimp[],
684  const cs_real_33_t i_visc[],
685  const cs_real_t b_visc[],
688 
689 /*----------------------------------------------------------------------------*/
719 /*----------------------------------------------------------------------------*/
720 
721 void
723  int idiffp,
724  double thetap,
725  const cs_real_66_t cofbfu[],
726  const cs_real_66_t fimp[],
727  const cs_real_66_t i_visc[],
728  const cs_real_t b_visc[],
731 
732 /*----------------------------------------------------------------------------*/
733 
735 
736 #endif /* __CS_MATRIX_BUILDING_H__ */
cs_sym_matrix_anisotropic_diffusion_tensor
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:2370
i_visc
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t i_visc[]
Definition: cs_matrix_building.h:65
cs_sym_matrix_tensor
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:1151
cs_real_332_t
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:329
cs_matrix_anisotropic_diffusion_tensor
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:2082
cs_sym_matrix_vector
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:1031
restrict
#define restrict
Definition: cs_defs.h:127
i_massflux
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t const cs_real_t i_massflux[]
Definition: cs_matrix_building.h:65
cs_real_2_t
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:314
cs_real_662_t
cs_real_66_t cs_real_662_t[2]
Definition: cs_defs.h:331
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
isym
void const int const int const int * isym
Definition: cs_matrix_building.h:65
b_massflux
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t b_massflux[]
Definition: cs_matrix_building.h:65
cs_sym_matrix_anisotropic_diffusion
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:2241
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
coefbp
void const int const int const int const cs_real_t const int const cs_real_t coefbp[]
Definition: cs_matrix_building.h:65
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_matrix_vector
void cs_matrix_vector(const cs_mesh_t *m, const cs_mesh_quantities_t *mq, int iconvp, int idiffp, int 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:1281
cs_sym_matrix_scalar
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:660
cs_mesh_quantities_t
Definition: cs_mesh_quantities.h:90
cs_matrix_time_step
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:1709
cs_matrix_wrapper_tensor
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:511
cs_matrix_wrapper_scalar_conv_diff
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
da
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t cs_real_t da[]
Definition: cs_matrix_building.h:65
rovsdt
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t rovsdt[]
Definition: cs_matrix_building.h:65
xcpp
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t xcpp[]
Definition: cs_matrix_building.h:65
cs_matrix_scalar
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:805
cs_halo.h
cofbfp
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t cofbfp[]
Definition: cs_matrix_building.h:65
b_visc
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t b_visc[]
Definition: cs_matrix_building.h:65
imucpp
void const int const int const int const cs_real_t const int * imucpp
Definition: cs_matrix_building.h:65
CS_PROCF
void CS_PROCF(matrix, MATRIX)(const int *iconvp
cs_real_66_t
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:322
cs_real_33_t
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:321
cs_int_t
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:301
cs_matrix_wrapper_vector
void cs_matrix_wrapper_vector(int iconvp, int idiffp, int tensorial_diffusion, int ndircp, int isym, int 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
idiffp
void const int * idiffp
Definition: cs_matrix_building.h:65
ndircp
void const int const int * ndircp
Definition: cs_matrix_building.h:65
cs_matrix_tensor
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:1562
thetap
void const int const int const int const cs_real_t * thetap
Definition: cs_matrix_building.h:65
xa
void const int const int const int const cs_real_t const int const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t cs_real_t cs_real_t xa[]
Definition: cs_matrix_building.h:65
cs_mesh_t
Definition: cs_mesh.h:63
cs_base.h
cs_matrix_anisotropic_diffusion
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:1869
cs_matrix_wrapper_scalar
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