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 /*----------------------------------------------------------------------------
106  * Wrapper to cs_matrix_time_step
107  *----------------------------------------------------------------------------*/
108 
109 void CS_PROCF (matrdt, MATRDT)
110 (
111  const cs_int_t *const iconvp,
112  const cs_int_t *const idiffp,
113  const cs_int_t *const isym,
114  const cs_real_t coefbp[],
115  const cs_real_t cofbfp[],
116  const cs_real_t i_massflux[],
117  const cs_real_t b_massflux[],
118  const cs_real_t i_visc[],
119  const cs_real_t b_visc[],
120  cs_real_t da[]
121 );
122 
123 /*----------------------------------------------------------------------------
124  * Wrapper to cs_matrix_anisotropic_diffusion (or its counterpart for
125  * symmetric matrices)
126  *----------------------------------------------------------------------------*/
127 
128 void CS_PROCF (matrvv, MATRVV)
129 (
130  const cs_int_t *const iconvp,
131  const cs_int_t *const idiffp,
132  const cs_int_t *const ndircp,
133  const cs_int_t *const isym,
134  const cs_real_t *const thetap,
135  const cs_real_33_t coefbu[],
136  const cs_real_33_t cofbfu[],
137  const cs_real_33_t fimp[],
138  const cs_real_t i_massflux[],
139  const cs_real_t b_massflux[],
140  const cs_real_33_t i_visc[],
141  const cs_real_t b_visc[],
142  cs_real_33_t da[],
143  cs_real_332_t xa[]
144 );
145 
146 /*=============================================================================
147  * Public function prototypes
148  *============================================================================*/
149 
150 /*----------------------------------------------------------------------------*/
180 /*----------------------------------------------------------------------------*/
181 
182 void
184  int idiffp,
185  double thetap,
186  const cs_real_t cofbfp[],
187  const cs_real_t rovsdt[],
188  const cs_real_t i_visc[],
189  const cs_real_t b_visc[],
190  cs_real_t *restrict da,
191  cs_real_t *restrict xa);
192 
193 /*----------------------------------------------------------------------------*/
233 /*----------------------------------------------------------------------------*/
234 
235 void
236 cs_matrix_scalar(const cs_mesh_t *m,
237  int iconvp,
238  int idiffp,
239  double thetap,
240  int imucpp,
241  const cs_real_t coefbp[],
242  const cs_real_t cofbfp[],
243  const cs_real_t rovsdt[],
244  const cs_real_t i_massflux[],
245  const cs_real_t b_massflux[],
246  const cs_real_t i_visc[],
247  const cs_real_t b_visc[],
248  const cs_real_t xcpp[],
249  cs_real_t *restrict da,
250  cs_real_2_t *restrict xa);
251 
252 /*----------------------------------------------------------------------------*/
281 /*----------------------------------------------------------------------------*/
282 
283 void
285  int idiffp,
286  double thetap,
287  const cs_real_33_t cofbfu[],
288  const cs_real_33_t fimp[],
289  const cs_real_t i_visc[],
290  const cs_real_t b_visc[],
292  cs_real_t *restrict xa);
293 
294 /*----------------------------------------------------------------------------*/
330 /*----------------------------------------------------------------------------*/
331 
332 void
333 cs_matrix_vector(const cs_mesh_t *m,
334  int iconvp,
335  int idiffp,
336  double thetap,
337  const cs_real_33_t coefbu[],
338  const cs_real_33_t cofbfu[],
339  const cs_real_33_t fimp[],
340  const cs_real_t i_massflux[],
341  const cs_real_t b_massflux[],
342  const cs_real_t i_visc[],
343  const cs_real_t b_visc[],
345  cs_real_2_t *restrict xa);
346 
347 /*----------------------------------------------------------------------------*/
374 /*----------------------------------------------------------------------------*/
375 
376 void
378  int iconvp,
379  int idiffp,
380  int isym,
381  const cs_real_t coefbp[],
382  const cs_real_t cofbfp[],
383  const cs_real_t i_massflux[],
384  const cs_real_t b_massflux[],
385  const cs_real_t i_visc[],
386  const cs_real_t b_visc[],
387  cs_real_t *restrict da);
388 
389 /*----------------------------------------------------------------------------*/
426 /*----------------------------------------------------------------------------*/
427 
428 void
430  int iconvp,
431  int idiffp,
432  double thetap,
433  const cs_real_33_t coefbu[],
434  const cs_real_33_t cofbfu[],
435  const cs_real_33_t fimp[],
436  const cs_real_t i_massflux[],
437  const cs_real_t b_massflux[],
438  const cs_real_33_t i_visc[],
439  const cs_real_t b_visc[],
441  cs_real_332_t *restrict xa);
442 
443 /*----------------------------------------------------------------------------*/
472 /*----------------------------------------------------------------------------*/
473 
474 void
476  int idiffp,
477  double thetap,
478  const cs_real_33_t cofbfu[],
479  const cs_real_33_t fimp[],
480  const cs_real_33_t i_visc[],
481  const cs_real_t b_visc[],
483  cs_real_33_t *restrict xa);
484 
485 /*----------------------------------------------------------------------------*/
486 
488 
489 #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:1201
#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:199
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:907
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:419
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
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:775
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:317
Definition: cs_mesh.h:62
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:316
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:433
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:283
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:1042
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:571
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:1347
#define END_C_DECLS
Definition: cs_defs.h:420
double cs_real_t
Definition: cs_defs.h:296
#define CS_PROCF(x, y)
Definition: cs_defs.h:443
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:311