/usr/include/code_saturne/cs_gradient.h is in code-saturne-include 3.2.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | #ifndef __CS_GRADIENT_H__
#define __CS_GRADIENT_H__
/*============================================================================
* Gradient reconstruction.
*============================================================================*/
/*
This file is part of Code_Saturne, a general-purpose CFD tool.
Copyright (C) 1998-2013 EDF S.A.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Local headers
*----------------------------------------------------------------------------*/
#include "cs_base.h"
#include "cs_halo.h"
/*----------------------------------------------------------------------------*/
BEGIN_C_DECLS
/*=============================================================================
* Local Macro definitions
*============================================================================*/
/*============================================================================
* Type definition
*============================================================================*/
/*----------------------------------------------------------------------------
* Gradient reconstruction method
*----------------------------------------------------------------------------*/
typedef enum {
CS_GRADIENT_ITER, /* Iterative */
CS_GRADIENT_LSQ, /* Least-squares */
CS_GRADIENT_LSQ_ITER /* LSQ followed with iterative */
} cs_gradient_type_t;
/*============================================================================
* Global variables
*============================================================================*/
/* Short names for gradient types */
extern const char *cs_gradient_type_name[];
/*============================================================================
* Public function prototypes for Fortran API
*============================================================================*/
/*----------------------------------------------------------------------------
* Compute cell gradient of scalar field or component of vector or
* tensor field.
*----------------------------------------------------------------------------*/
void CS_PROCF (cgdcel, CGDCEL)
(
const cs_int_t *const ivar, /* <-- variable number */
const cs_int_t *const imrgra, /* <-- gradient computation mode */
const cs_int_t *const ilved, /* <-- 1: interleaved; 0: non-interl. */
const cs_int_t *const inc, /* <-- 0 or 1: increment or not */
const cs_int_t *const iccocg, /* <-- 1 or 0: recompute COCG or not */
const cs_int_t *const nswrgp, /* <-- >1: with reconstruction */
const cs_int_t *const idimtr, /* <-- 0, 1, 2: scalar, vector, tensor
in case of rotation */
const cs_int_t *const iphydp, /* <-- use hydrosatatic pressure */
const cs_int_t *const ipond, /* <-- >0: weighted gradient computation*/
const cs_int_t *const iwarnp, /* <-- verbosity level */
const cs_int_t *const imligp, /* <-- type of clipping */
const cs_real_t *const epsrgp, /* <-- precision for iterative gradient
calculation */
const cs_real_t *const extrap, /* <-- extrapolate gradient at boundary */
const cs_real_t *const climgp, /* <-- clipping coefficient */
cs_real_3_t fext[], /* <-- exterior force generating the
hydrostatic pressure */
const cs_real_t coefap[], /* <-- boundary condition term */
const cs_real_t coefbp[], /* <-- boundary condition term */
cs_real_t pvar[], /* <-- gradient's base variable */
cs_real_t ktvar[], /* <-- gradient coefficient variable */
cs_real_t grad[] /* <-> gradient */
);
/*----------------------------------------------------------------------------
* Compute cell gradient of vector field.
*----------------------------------------------------------------------------*/
void CS_PROCF (cgdvec, CGDVEC)
(
const cs_int_t *const ivar,
const cs_int_t *const imrgra, /* <-- gradient computation mode */
const cs_int_t *const inc, /* <-- 0 or 1: increment or not */
const cs_int_t *const nswrgp, /* <-- >1: with reconstruction */
const cs_int_t *const iwarnp, /* <-- verbosity level */
const cs_int_t *const imligp, /* <-- type of clipping */
const cs_real_t *const epsrgp, /* <-- precision for iterative
gradient calculation */
const cs_real_t *const climgp, /* <-- clipping coefficient */
const cs_real_3_t coefav[], /* <-- boundary condition term */
const cs_real_33_t coefbv[], /* <-- boundary condition term */
cs_real_3_t pvar[], /* <-- gradient's base variable */
cs_real_33_t gradv[] /* <-> gradient of the variable
(du_i/dx_j : gradv[][i][j]) */
);
/*=============================================================================
* Public function prototypes
*============================================================================*/
/*----------------------------------------------------------------------------
* Initialize gradient computation API.
*----------------------------------------------------------------------------*/
void
cs_gradient_initialize(void);
/*----------------------------------------------------------------------------
* Finalize gradient computation API.
*----------------------------------------------------------------------------*/
void
cs_gradient_finalize(void);
/*----------------------------------------------------------------------------
* Compute cell gradient of scalar field or component of vector or
* tensor field.
*
* parameters:
* var_name <-- variable name
* gradient_type <-- gradient type
* halo_type <-- halo type
* inc <-- if 0, solve on increment; 1 otherwise
* recompute_cocg <-- should COCG FV quantities be recomputed ?
* n_r_sweeps <-- if > 1, number of reconstruction sweeps
* tr_dim <-- 2 for tensor with periodicity of rotation,
* 0 otherwise
* hyd_p_flag <-- flag for hydrostatic pressure
* verbosity <-- verbosity level
* clip_mode <-- clipping mode
* epsilon <-- precision for iterative gradient calculation
* extrap <-- boundary gradient extrapolation coefficient
* clip_coeff <-- clipping coefficient
* f_ext <-- exterior force generating the hydrostatic pressure
* bc_coeff_a <-- boundary condition term a
* bc_coeff_b <-- boundary condition term b
* var <-> gradient's base variable
* weight_var <-> weighted gradient coefficient variable, or NULL
* grad --> gradient
*----------------------------------------------------------------------------*/
void cs_gradient_scalar(const char *var_name,
cs_gradient_type_t gradient_type,
cs_halo_type_t halo_type,
int inc,
bool recompute_cocg,
int n_r_sweeps,
int tr_dim,
int hyd_p_flag,
int verbosity,
int clip_mode,
double epsilon,
double extrap,
double clip_coeff,
cs_real_3_t f_ext[],
const cs_real_t bc_coeff_a[],
const cs_real_t bc_coeff_b[],
cs_real_t *restrict var,
cs_real_t *restrict weight_var,
cs_real_3_t *restrict grad);
/*----------------------------------------------------------------------------
* Compute cell gradient of a vector field.
*
* parameters:
* var_name <-- variable name
* gradient_type <-- gradient type
* halo_type <-- halo type
* inc <-- if 0, solve on increment; 1 otherwise
* n_r_sweeps <-- if > 1, number of reconstruction sweeps
* verbosity <-- verbosity level
* clip_mode <-- clipping mode
* epsilon <-- precision for iterative gradient calculation
* clip_coeff <-- clipping coefficient
* bc_coeff_a <-- boundary condition term a
* bc_coeff_b <-- boundary condition term b
* var <-> gradient's base variable
* gradv --> gradient (du_i/dx_j : gradv[][i][j])
*----------------------------------------------------------------------------*/
void cs_gradient_vector(const char *var_name,
cs_gradient_type_t gradient_type,
cs_halo_type_t halo_type,
int inc,
int n_r_sweeps,
int verbosity,
int clip_mode,
double epsilon,
double clip_coeff,
const cs_real_3_t bc_coeff_a[],
const cs_real_33_t bc_coeff_b[],
cs_real_3_t *restrict var,
cs_real_33_t *restrict gradv);
/*----------------------------------------------------------------------------
* Determine gradient type by Fortran "imrgra" value
*
* parameters:
* imrgra <-- Fortran gradient option
* gradient_type --> gradient type
* halo_type --> halo type
*----------------------------------------------------------------------------*/
void
cs_gradient_type_by_imrgra(int imrgra,
cs_gradient_type_t *gradient_type,
cs_halo_type_t *halo_type);
/*----------------------------------------------------------------------------*/
END_C_DECLS
#endif /* __CS_GRADIENT__ */
|