Code_Saturne
CFD tool
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cs_gradient.h
Go to the documentation of this file.
1 #ifndef __CS_GRADIENT_H__
2 #define __CS_GRADIENT_H__
3 
4 /*============================================================================
5  * Gradient reconstruction.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2012 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 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Local Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definition
46  *============================================================================*/
47 
48 /*----------------------------------------------------------------------------
49  * Gradient types
50  *----------------------------------------------------------------------------*/
51 
52 typedef enum {
53 
54  CS_GRADIENT_ITER, /* Iterative method */
55  CS_GRADIENT_LSQ_STD, /* Least-square method */
56  CS_GRADIENT_LSQ_EXT, /* Least-square method with extended neighborhood */
57  CS_GRADIENT_LSQ_EXT_RED, /* Least-square method with reduced extended neig. */
58  CS_GRADIENT_LSQ_ITER, /* LSQ followed with iterative */
60 
62 
63 /*============================================================================
64  * Global variables
65  *============================================================================*/
66 
67 /* Short names for gradient types */
68 
69 extern const char *cs_gradient_type_name[];
70 
71 /*============================================================================
72  * Public function prototypes for Fortran API
73  *============================================================================*/
74 
75 /*----------------------------------------------------------------------------
76  * Compute cell gradient of scalar field or component of vector or
77  * tensor field.
78  *----------------------------------------------------------------------------*/
79 
80 void CS_PROCF (cgdcel, CGDCEL)
81 (
82  const cs_int_t *const ivar, /* <-- variable number */
83  const cs_int_t *const imrgra, /* <-- gradient computation mode */
84  const cs_int_t *const inc, /* <-- 0 or 1: increment or not */
85  const cs_int_t *const iccocg, /* <-- 1 or 0: recompute COCG or not */
86  const cs_int_t *const imobil, /* <-- 1 for mobile mesh, 0 otherwise */
87  const cs_int_t *const iale, /* <-- 1 for ALE, 0 otherwise */
88  const cs_int_t *const nswrgp, /* <-- >1: with reconstruction */
89  const cs_int_t *const idimtr, /* <-- 0, 1, 2: scalar, vector, tensor
90  in case of rotation */
91  const cs_int_t *const iphydp, /* <-- use hydrosatatic pressure */
92  const cs_int_t *const iwarnp, /* <-- verbosity level */
93  const cs_int_t *const imligp, /* <-- type of clipping */
94  const cs_real_t *const epsrgp, /* <-- precision for iterative gradient
95  calculation */
96  const cs_real_t *const extrap, /* <-- extrapolate gradient at boundary */
97  const cs_real_t *const climgp, /* <-- clipping coefficient */
98  const cs_int_t isympa[], /* <-- indicator for symmetry faces */
99  cs_real_t fextx[], /* <-- components of the exterior force */
100  cs_real_t fexty[], /* generating the hydrostatic */
101  cs_real_t fextz[], /* pressure */
102  const cs_real_t coefap[], /* <-- boundary condition term */
103  const cs_real_t coefbp[], /* <-- boundary condition term */
104  cs_real_t pvar[], /* <-- gradient's base variable */
105  cs_real_t grad[] /* <-> gradient */
106 );
107 
108 /*----------------------------------------------------------------------------
109  * Compute cell gradient of vector field.
110  *----------------------------------------------------------------------------*/
111 
112 void CS_PROCF (cgdvec, CGDVEC)
113 (
114  const cs_int_t *const ivar,
115  const cs_int_t *const imrgra, /* <-- gradient computation mode */
116  const cs_int_t *const inc, /* <-- 0 or 1: increment or not */
117  const cs_int_t *const nswrgp, /* <-- >1: with reconstruction */
118  const cs_int_t *const iwarnp, /* <-- verbosity level */
119  const cs_int_t *const imligp, /* <-- type of clipping */
120  const cs_real_t *const epsrgp, /* <-- precision for iterative
121  gradient calculation */
122  const cs_real_t *const climgp, /* <-- clipping coefficient */
123  const cs_real_3_t (*restrict coefav), /* <-- boundary condition term */
124  const cs_real_33_t (*restrict coefbv), /* <-- boundary condition term */
125  const cs_real_3_t (*restrict pvar), /* <-- gradient's base variable */
126  cs_real_33_t (*restrict gradv) /* <-> gradient of the variable */
127 );
128 
129 /*=============================================================================
130  * Public function prototypes
131  *============================================================================*/
132 
133 /*----------------------------------------------------------------------------
134  * Initialize gradient computation API.
135  *----------------------------------------------------------------------------*/
136 
137 void
139 
140 /*----------------------------------------------------------------------------
141  * Finalize gradient computation API.
142  *----------------------------------------------------------------------------*/
143 
144 void
146 
147 /*----------------------------------------------------------------------------*/
148 
150 
151 #endif /* __CS_GRADIENT__ */
Definition: cs_gradient.h:54
#define restrict
Definition: cs_defs.h:105
Definition: cs_gradient.h:57
void cs_gradient_finalize(void)
Definition: cs_gradient.c:3985
#define BEGIN_C_DECLS
Definition: cs_defs.h:365
Definition: cs_gradient.h:56
int cs_int_t
Definition: cs_defs.h:263
Definition: cs_gradient.h:58
cs_gradient_type_t
Definition: cs_gradient.h:52
Definition: cs_gradient.h:55
#define END_C_DECLS
Definition: cs_defs.h:366
double cs_real_t
Definition: cs_defs.h:264
Definition: cs_gradient.h:59
void cgdvec(const cs_int_t *const ivar, const cs_int_t *const imrgra, const cs_int_t *const inc, const cs_int_t *const nswrgp, const cs_int_t *const iwarnp, const cs_int_t *const imligp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_3_t(*restrict coefav), const cs_real_33_t(*restrict coefbv), const cs_real_3_t(*restrict pvar), cs_real_33_t(*restrict gradv))
#define CS_PROCF(x, y)
Definition: cs_defs.h:379
void cgdcel(const cs_int_t *const ivar, const cs_int_t *const imrgra, const cs_int_t *const inc, const cs_int_t *const iccocg, const cs_int_t *const imobil, const cs_int_t *const iale, const cs_int_t *const nswrgp, const cs_int_t *const idimtr, const cs_int_t *const iphydp, const cs_int_t *const iwarnp, const cs_int_t *const imligp, const cs_real_t *const epsrgp, const cs_real_t *const extrap, const cs_real_t *const climgp, const cs_int_t isympa[], cs_real_t fextx[], cs_real_t fexty[], cs_real_t fextz[], const cs_real_t coefap[], const cs_real_t coefbp[], cs_real_t pvar[], cs_real_t grad[])
Definition: cs_gradient.c:3563
cs_real_t cs_real_3_t[3]
Definition: cs_defs.h:271
const char * cs_gradient_type_name[]
Definition: cs_gradient.c:108
void cs_gradient_initialize(void)
Definition: cs_gradient.c:3975
cs_real_t cs_real_33_t[3][3]
Definition: cs_defs.h:273