9.2
general documentation
cs_field_operator.h
Go to the documentation of this file.
1#ifndef CS_FIELD_OPERATOR_H
2#define CS_FIELD_OPERATOR_H
3
4/*============================================================================
5 * Field based algebraic operators.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 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 "base/cs_defs.h"
35#include "base/cs_field.h"
36#include "alge/cs_gradient.h"
37
38/*=============================================================================
39 * Macro definitions
40 *============================================================================*/
41
42/*============================================================================
43 * Type definitions
44 *============================================================================*/
45
46/*----------------------------------------------------------------------------
47 * Field values interpolation type
48 *----------------------------------------------------------------------------*/
49
50typedef enum {
51
52 CS_FIELD_INTERPOLATE_MEAN, /* mean element value (P0 interpolation) */
53 CS_FIELD_INTERPOLATE_GRADIENT /* mean + gradient correction (pseudo-P1) */
54
56
57/*=============================================================================
58 * Public function prototypes
59 *============================================================================*/
60
61/*----------------------------------------------------------------------------
62 * Compute cell gradient of scalar field or component of vector or
63 * tensor field.
64 *
65 * parameters:
66 * f <-- pointer to field
67 * use_previous_t <-- should we use values from the previous time step ?
68 * inc <-- if 0, solve on increment; 1 otherwise
69 * grad --> gradient
70 *----------------------------------------------------------------------------*/
71
72void
74 bool use_previous_t,
75 int inc,
76 cs_real_3_t *grad);
77
78/*----------------------------------------------------------------------------*/
89/*----------------------------------------------------------------------------*/
90
91void
93 int inc,
94 cs_field_bc_coeffs_t *bc_coeffs,
95 cs_real_t var[],
96 cs_real_3_t grad[]);
97
98/*----------------------------------------------------------------------------
99 * Compute cell gradient of scalar field or component of vector or
100 * tensor field.
101 *
102 * parameters:
103 * f <-- pointer to field
104 * use_previous_t <-- should we use values from the previous time step ?
105 * inc <-- if 0, solve on increment; 1 otherwise
106 * hyd_p_flag <-- flag for hydrostatic pressure
107 * f_ext <-- exterior force generating the hydrostatic pressure
108 * grad --> gradient
109 *----------------------------------------------------------------------------*/
110
111void
113 bool use_previous_t,
114 int inc,
115 int hyd_p_flag,
116 cs_real_3_t f_ext[],
117 cs_real_3_t *grad);
118
119/*----------------------------------------------------------------------------
120 * Compute cell gradient of scalar field or component of vector or
121 * tensor field.
122 *
123 * parameters:
124 * f <-- pointer to field
125 * use_previous_t <-- should we use values from the previous time step ?
126 * inc <-- if 0, solve on increment; 1 otherwise
127 * grad --> gradient
128 *----------------------------------------------------------------------------*/
129
130void
132 bool use_previous_t,
133 int inc,
134 cs_real_33_t *grad);
135
136/*----------------------------------------------------------------------------
137 * Compute cell gradient of tensor field.
138 *
139 * parameters:
140 * f <-- pointer to field
141 * use_previous_t <-- should we use values from the previous time step ?
142 * inc <-- if 0, solve on increment; 1 otherwise
143 * grad --> gradient
144 *----------------------------------------------------------------------------*/
145
146void
148 bool use_previous_t,
149 int inc,
150 cs_real_63_t *grad);
151
152/*----------------------------------------------------------------------------*/
162/*----------------------------------------------------------------------------*/
163
164void
166 bool use_previous_t,
167 cs_lnum_t n_faces,
168 const cs_lnum_t *face_ids,
169 cs_real_t var_iprime[]);
170
171/*----------------------------------------------------------------------------*/
181/*----------------------------------------------------------------------------*/
182
183void
185 bool use_previous_t,
186 cs_lnum_t n_faces,
187 const cs_lnum_t *face_ids,
188 cs_real_3_t var_iprime[]);
189
190/*----------------------------------------------------------------------------*/
201/*----------------------------------------------------------------------------*/
202
203void
205 bool use_previous_t,
206 cs_lnum_t n_faces,
207 const cs_lnum_t *face_ids,
208 cs_real_6_t var_iprime[]);
209
210/*----------------------------------------------------------------------------
211 * Interpolate field values at a given set of points.
212 *
213 * parameters:
214 * f <-- pointer to field
215 * interpolation_type <-- interpolation type
216 * n_points <-- number of points at which interpolation
217 * is required
218 * point_location <-- location of points in mesh elements
219 * (based on the field location)
220 * point_coords <-- point coordinates
221 * val --> interpolated values
222 *----------------------------------------------------------------------------*/
223
224void
226 cs_field_interpolate_t interpolation_type,
227 cs_lnum_t n_points,
228 const cs_lnum_t point_location[],
229 const cs_real_3_t point_coords[],
230 cs_real_t *val);
231
232/*----------------------------------------------------------------------------*/
243/*----------------------------------------------------------------------------*/
244
245void
247 cs_halo_type_t halo_type,
248 cs_real_t *local_max,
249 cs_real_t *local_min);
250
251/*----------------------------------------------------------------------------*/
259/*----------------------------------------------------------------------------*/
260
261void
263 const cs_real_t mean);
264
265/*----------------------------------------------------------------------------*/
274/*----------------------------------------------------------------------------*/
275
276void
278 cs_halo_type_t halo_type);
279
280/*----------------------------------------------------------------------------*/
290/*----------------------------------------------------------------------------*/
291
292void
294 cs_halo_type_t halo_type,
295 bool on_device);
296
297/*----------------------------------------------------------------------------*/
298
299#endif /* CS_FIELD_OPERATOR_H */
Field boundary condition descriptor (for variables)
Definition: cs_field.h:107
Field descriptor.
Definition: cs_field.h:275
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:349
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:351
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:358
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:366
void cs_field_local_extrema_scalar(int f_id, cs_halo_type_t halo_type, cs_real_t *local_max, cs_real_t *local_min)
Find local extrema of a given scalar field at each cell.
Definition: cs_field_operator.cpp:1359
cs_field_interpolate_t
Definition: cs_field_operator.h:50
@ CS_FIELD_INTERPOLATE_MEAN
Definition: cs_field_operator.h:52
@ CS_FIELD_INTERPOLATE_GRADIENT
Definition: cs_field_operator.h:53
void cs_field_gradient_boundary_iprime_scalar(const cs_field_t *f, bool use_previous_t, cs_lnum_t n_faces, const cs_lnum_t *face_ids, cs_real_t var_iprime[])
Compute the values of a scalar field at boundary face I' positions.
Definition: cs_field_operator.cpp:815
void cs_field_gradient_boundary_iprime_vector(const cs_field_t *f, bool use_previous_t, cs_lnum_t n_faces, const cs_lnum_t *face_ids, cs_real_3_t var_iprime[])
Compute the values of a vector field at boundary face I' positions.
Definition: cs_field_operator.cpp:990
void cs_field_gradient_tensor(const cs_field_t *f, bool use_previous_t, int inc, cs_real_63_t *grad)
void cs_field_synchronize(cs_field_t *f, cs_halo_type_t halo_type)
Synchronize current parallel and periodic field values.
Definition: cs_field_operator.cpp:1448
void cs_field_set_volume_average(cs_field_t *f, const cs_real_t mean)
Shift field values in order to set its spatial average to a given value.
Definition: cs_field_operator.cpp:1402
void cs_field_gradient_vector(const cs_field_t *f, bool use_previous_t, int inc, cs_real_33_t *grad)
void cs_field_gradient_scalar(const cs_field_t *f, bool use_previous_t, int inc, cs_real_3_t *grad)
void cs_field_gradient_potential(const cs_field_t *f, bool use_previous_t, int inc, int hyd_p_flag, cs_real_3_t f_ext[], cs_real_3_t *grad)
void cs_field_gradient_boundary_iprime_tensor(const cs_field_t *f, bool use_previous_t, cs_lnum_t n_faces, const cs_lnum_t *face_ids, cs_real_6_t var_iprime[])
Compute the values of a symmetric tensor field at boundary face I' positions.
Definition: cs_field_operator.cpp:1154
void cs_field_interpolate(cs_field_t *f, cs_field_interpolate_t interpolation_type, cs_lnum_t n_points, const cs_lnum_t point_location[], const cs_real_3_t point_coords[], cs_real_t *val)
Interpolate field values at a given set of points.
Definition: cs_field_operator.cpp:1315
void cs_field_gradient_scalar_array(int f_id, int inc, cs_field_bc_coeffs_t *bc_coeffs, cs_real_t var[], cs_real_3_t grad[])
Compute cell gradient of scalar array using parameters associated with a given field.
Definition: cs_field_operator.cpp:435
cs_halo_type_t
Definition: cs_halo.h:53