8.0
general documentation
cs_gradient_priv.h
Go to the documentation of this file.
1 #ifndef __CS_GRADIENT_CUDA_H__
2 #define __CS_GRADIENT_CUDA_H__
3 
4 /*============================================================================
5  * Private functions for gradient reconstruction.
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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_base_accel.h"
36 #include "cs_halo.h"
37 #include "cs_internal_coupling.h"
38 #include "cs_mesh.h"
39 #include "cs_mesh_quantities.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
47 /*============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*=============================================================================
52  * Local type definitions
53  *============================================================================*/
54 
55 /* Type for symmetric least-squares covariance matrices
56  as they are adimensional, single-precision should be usable here */
57 
58 typedef cs_real_t cs_cocg_t;
59 typedef cs_real_t cs_cocg_6_t[6];
60 typedef cs_real_t cs_cocg_33_t[3][3];
61 
62 /*============================================================================
63  * Global variables
64  *============================================================================*/
65 
66 /*=============================================================================
67  * Semi-private function prototypes
68  *============================================================================*/
69 
70 #if defined(HAVE_CUDA)
71 
72 /*----------------------------------------------------------------------------
73  * Compute cell gradient using least-squares reconstruction for non-orthogonal
74  * meshes (nswrgp > 1).
75  *
76  * Optionally, a volume force generating a hydrostatic pressure component
77  * may be accounted for.
78  *
79  * cocg is computed to account for variable B.C.'s (flux).
80  *
81  * parameters:
82  * m <-- pointer to associated mesh structure
83  * fvq <-- pointer to associated finite volume quantities
84  * halo_type <-- halo type (extended or not)
85  * recompute_cocg <-- flag to recompute cocg
86  * inc <-- if 0, solve on increment; 1 otherwise
87  * coefap <-- B.C. coefficients for boundary face normals
88  * coefbp <-- B.C. coefficients for boundary face normals
89  * pvar <-- variable
90  * c_weight <-- weighted gradient coefficient variable,
91  * or NULL
92  * cocg <-> associated cell covariance array (on device)
93  * cocgb <-> saved boundary cell covariance array (on device)
94  * grad <-> gradient of pvar (halo prepared for periodicity
95  * of rotation)
96  *----------------------------------------------------------------------------*/
97 
98 void
99 cs_gradient_scalar_lsq_cuda(const cs_mesh_t *m,
100  const cs_mesh_quantities_t *fvq,
101  cs_halo_type_t halo_type,
102  bool recompute_cocg,
103  cs_real_t inc,
104  const cs_real_t coefap[],
105  const cs_real_t coefbp[],
106  const cs_real_t pvar[],
107  const cs_real_t *restrict c_weight,
108  cs_cocg_6_t *restrict cocg,
109  cs_cocg_6_t *restrict cocgb,
110  cs_real_3_t *restrict grad);
111 
112 #endif /* defined(HAVE_CUDA) */
113 
116 /*----------------------------------------------------------------------------*/
117 
119 
120 #endif /* __CS_GRADIENT_CUDA_H__ */
#define restrict
Definition: cs_defs.h:139
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:332
#define END_C_DECLS
Definition: cs_defs.h:510
cs_halo_type_t
Definition: cs_halo.h:56
Definition: cs_mesh_quantities.h:92
Definition: cs_mesh.h:85