programmer's documentation
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
alge
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-2013 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
39
BEGIN_C_DECLS
40
41
/*=============================================================================
42
* Local Macro definitions
43
*============================================================================*/
44
45
/*============================================================================
46
* Type definition
47
*============================================================================*/
48
49
/*----------------------------------------------------------------------------
50
* Gradient reconstruction method
51
*----------------------------------------------------------------------------*/
52
53
typedef
enum
{
54
55
CS_GRADIENT_ITER
,
/* Iterative */
56
CS_GRADIENT_LSQ
,
/* Least-squares */
57
CS_GRADIENT_LSQ_ITER
/* LSQ followed with iterative */
58
59
}
cs_gradient_type_t
;
60
61
/*============================================================================
62
* Global variables
63
*============================================================================*/
64
65
/* Short names for gradient types */
66
67
extern
const
char
*
cs_gradient_type_name
[];
68
69
/*============================================================================
70
* Public function prototypes for Fortran API
71
*============================================================================*/
72
73
/*----------------------------------------------------------------------------
74
* Compute cell gradient of scalar field or component of vector or
75
* tensor field.
76
*----------------------------------------------------------------------------*/
77
78
void
CS_PROCF
(
cgdcel
, CGDCEL)
79
(
80
const
cs_int_t
*
const
ivar,
/* <-- variable number */
81
const
cs_int_t
*
const
imrgra,
/* <-- gradient computation mode */
82
const
cs_int_t
*
const
ilved,
/* <-- 1: interleaved; 0: non-interl. */
83
const
cs_int_t
*
const
inc,
/* <-- 0 or 1: increment or not */
84
const
cs_int_t
*
const
iccocg,
/* <-- 1 or 0: recompute COCG or not */
85
const
cs_int_t
*
const
nswrgp,
/* <-- >1: with reconstruction */
86
const
cs_int_t
*
const
idimtr,
/* <-- 0, 1, 2: scalar, vector, tensor
87
in case of rotation */
88
const
cs_int_t
*
const
iphydp,
/* <-- use hydrosatatic pressure */
89
const
cs_int_t
*
const
ipond,
/* <-- >0: weighted gradient computation*/
90
const
cs_int_t
*
const
iwarnp,
/* <-- verbosity level */
91
const
cs_int_t
*
const
imligp,
/* <-- type of clipping */
92
const
cs_real_t
*
const
epsrgp,
/* <-- precision for iterative gradient
93
calculation */
94
const
cs_real_t
*
const
extrap,
/* <-- extrapolate gradient at boundary */
95
const
cs_real_t
*
const
climgp,
/* <-- clipping coefficient */
96
cs_real_3_t
fext[],
/* <-- exterior force generating the
97
hydrostatic pressure */
98
const
cs_real_t
coefap[],
/* <-- boundary condition term */
99
const
cs_real_t
coefbp[],
/* <-- boundary condition term */
100
cs_real_t
pvar[],
/* <-- gradient's base variable */
101
cs_real_t
ktvar[],
/* <-- gradient coefficient variable */
102
cs_real_t
grad[]
/* <-> gradient */
103
);
104
105
/*----------------------------------------------------------------------------
106
* Compute cell gradient of vector field.
107
*----------------------------------------------------------------------------*/
108
109
void
CS_PROCF
(
cgdvec
, CGDVEC)
110
(
111
const
cs_int_t
*
const
ivar,
112
const
cs_int_t
*
const
imrgra,
/* <-- gradient computation mode */
113
const
cs_int_t
*
const
inc,
/* <-- 0 or 1: increment or not */
114
const
cs_int_t
*
const
nswrgp,
/* <-- >1: with reconstruction */
115
const
cs_int_t
*
const
iwarnp,
/* <-- verbosity level */
116
const
cs_int_t
*
const
imligp,
/* <-- type of clipping */
117
const
cs_real_t
*
const
epsrgp,
/* <-- precision for iterative
118
gradient calculation */
119
const
cs_real_t
*
const
climgp,
/* <-- clipping coefficient */
120
const
cs_real_3_t
coefav[],
/* <-- boundary condition term */
121
const
cs_real_33_t
coefbv[],
/* <-- boundary condition term */
122
cs_real_3_t
pvar[],
/* <-- gradient's base variable */
123
cs_real_33_t
gradv[]
/* <-> gradient of the variable
124
(du_i/dx_j : gradv[][i][j]) */
125
);
126
127
/*=============================================================================
128
* Public function prototypes
129
*============================================================================*/
130
131
/*----------------------------------------------------------------------------
132
* Initialize gradient computation API.
133
*----------------------------------------------------------------------------*/
134
135
void
136
cs_gradient_initialize
(
void
);
137
138
/*----------------------------------------------------------------------------
139
* Finalize gradient computation API.
140
*----------------------------------------------------------------------------*/
141
142
void
143
cs_gradient_finalize
(
void
);
144
145
/*----------------------------------------------------------------------------
146
* Compute cell gradient of scalar field or component of vector or
147
* tensor field.
148
*
149
* parameters:
150
* var_name <-- variable name
151
* gradient_type <-- gradient type
152
* halo_type <-- halo type
153
* inc <-- if 0, solve on increment; 1 otherwise
154
* recompute_cocg <-- should COCG FV quantities be recomputed ?
155
* n_r_sweeps <-- if > 1, number of reconstruction sweeps
156
* tr_dim <-- 2 for tensor with periodicity of rotation,
157
* 0 otherwise
158
* hyd_p_flag <-- flag for hydrostatic pressure
159
* verbosity <-- verbosity level
160
* clip_mode <-- clipping mode
161
* epsilon <-- precision for iterative gradient calculation
162
* extrap <-- boundary gradient extrapolation coefficient
163
* clip_coeff <-- clipping coefficient
164
* f_ext <-- exterior force generating the hydrostatic pressure
165
* bc_coeff_a <-- boundary condition term a
166
* bc_coeff_b <-- boundary condition term b
167
* var <-> gradient's base variable
168
* weight_var <-> weighted gradient coefficient variable, or NULL
169
* grad --> gradient
170
*----------------------------------------------------------------------------*/
171
172
void
cs_gradient_scalar
(
const
char
*var_name,
173
cs_gradient_type_t
gradient_type,
174
cs_halo_type_t
halo_type,
175
int
inc,
176
bool
recompute_cocg,
177
int
n_r_sweeps,
178
int
tr_dim,
179
int
hyd_p_flag,
180
int
verbosity,
181
int
clip_mode,
182
double
epsilon,
183
double
extrap,
184
double
clip_coeff,
185
cs_real_3_t
f_ext[],
186
const
cs_real_t
bc_coeff_a[],
187
const
cs_real_t
bc_coeff_b[],
188
cs_real_t
*
restrict
var,
189
cs_real_t
*
restrict
weight_var,
190
cs_real_3_t
*
restrict
grad);
191
192
/*----------------------------------------------------------------------------
193
* Compute cell gradient of a vector field.
194
*
195
* parameters:
196
* var_name <-- variable name
197
* gradient_type <-- gradient type
198
* halo_type <-- halo type
199
* inc <-- if 0, solve on increment; 1 otherwise
200
* n_r_sweeps <-- if > 1, number of reconstruction sweeps
201
* verbosity <-- verbosity level
202
* clip_mode <-- clipping mode
203
* epsilon <-- precision for iterative gradient calculation
204
* clip_coeff <-- clipping coefficient
205
* bc_coeff_a <-- boundary condition term a
206
* bc_coeff_b <-- boundary condition term b
207
* var <-> gradient's base variable
208
* gradv --> gradient (du_i/dx_j : gradv[][i][j])
209
*----------------------------------------------------------------------------*/
210
211
void
cs_gradient_vector
(
const
char
*var_name,
212
cs_gradient_type_t
gradient_type,
213
cs_halo_type_t
halo_type,
214
int
inc,
215
int
n_r_sweeps,
216
int
verbosity,
217
int
clip_mode,
218
double
epsilon,
219
double
clip_coeff,
220
const
cs_real_3_t
bc_coeff_a[],
221
const
cs_real_33_t
bc_coeff_b[],
222
cs_real_3_t
*
restrict
var,
223
cs_real_33_t
*
restrict
gradv);
224
225
/*----------------------------------------------------------------------------
226
* Determine gradient type by Fortran "imrgra" value
227
*
228
* parameters:
229
* imrgra <-- Fortran gradient option
230
* gradient_type --> gradient type
231
* halo_type --> halo type
232
*----------------------------------------------------------------------------*/
233
234
void
235
cs_gradient_type_by_imrgra
(
int
imrgra,
236
cs_gradient_type_t
*gradient_type,
237
cs_halo_type_t
*halo_type);
238
239
/*----------------------------------------------------------------------------*/
240
241
END_C_DECLS
242
243
#endif
/* __CS_GRADIENT__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1