8.3
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-2024 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_defs.h"
35#include "cs_field.h"
36#include "cs_gradient.h"
37
38/*----------------------------------------------------------------------------*/
39
41
42/*=============================================================================
43 * Macro definitions
44 *============================================================================*/
45
46/*============================================================================
47 * Type definitions
48 *============================================================================*/
49
50/*----------------------------------------------------------------------------
51 * Field values interpolation type
52 *----------------------------------------------------------------------------*/
53
54typedef enum {
55
56 CS_FIELD_INTERPOLATE_MEAN, /* mean element value (P0 interpolation) */
57 CS_FIELD_INTERPOLATE_GRADIENT /* mean + gradient correction (pseudo-P1) */
58
60
61/*=============================================================================
62 * Public function prototypes
63 *============================================================================*/
64
65/*----------------------------------------------------------------------------
66 * Compute cell gradient of scalar field or component of vector or
67 * tensor field.
68 *
69 * parameters:
70 * f <-- pointer to field
71 * use_previous_t <-- should we use values from the previous time step ?
72 * inc <-- if 0, solve on increment; 1 otherwise
73 * grad --> gradient
74 *----------------------------------------------------------------------------*/
75
76void
78 bool use_previous_t,
79 int inc,
80 cs_real_3_t *grad);
81
82/*----------------------------------------------------------------------------*/
93/*----------------------------------------------------------------------------*/
94
95void
97 int inc,
98 const cs_field_bc_coeffs_t *bc_coeffs,
99 cs_real_t var[],
100 cs_real_3_t grad[]);
101
102/*----------------------------------------------------------------------------
103 * Compute cell gradient of scalar field or component of vector or
104 * tensor field.
105 *
106 * parameters:
107 * f <-- pointer to field
108 * use_previous_t <-- should we use values from the previous time step ?
109 * inc <-- if 0, solve on increment; 1 otherwise
110 * hyd_p_flag <-- flag for hydrostatic pressure
111 * f_ext <-- exterior force generating the hydrostatic pressure
112 * grad --> gradient
113 *----------------------------------------------------------------------------*/
114
115void
117 bool use_previous_t,
118 int inc,
119 int hyd_p_flag,
120 cs_real_3_t f_ext[],
121 cs_real_3_t *grad);
122
123/*----------------------------------------------------------------------------
124 * Compute cell gradient of scalar field or component of vector or
125 * tensor field.
126 *
127 * parameters:
128 * f <-- pointer to field
129 * use_previous_t <-- should we use values from the previous time step ?
130 * inc <-- if 0, solve on increment; 1 otherwise
131 * grad --> gradient
132 *----------------------------------------------------------------------------*/
133
134void
136 bool use_previous_t,
137 int inc,
138 cs_real_33_t *grad);
139
140/*----------------------------------------------------------------------------
141 * Compute cell gradient of tensor field.
142 *
143 * parameters:
144 * f <-- pointer to field
145 * use_previous_t <-- should we use values from the previous time step ?
146 * inc <-- if 0, solve on increment; 1 otherwise
147 * grad --> gradient
148 *----------------------------------------------------------------------------*/
149
150void
152 bool use_previous_t,
153 int inc,
154 cs_real_63_t *grad);
155
156/*----------------------------------------------------------------------------*/
166/*----------------------------------------------------------------------------*/
167
168void
170 bool use_previous_t,
171 cs_lnum_t n_faces,
172 const cs_lnum_t *face_ids,
173 cs_real_t var_iprime[]);
174
175/*----------------------------------------------------------------------------*/
185/*----------------------------------------------------------------------------*/
186
187void
189 bool use_previous_t,
190 cs_lnum_t n_faces,
191 const cs_lnum_t *face_ids,
192 cs_real_3_t var_iprime[]);
193
194/*----------------------------------------------------------------------------*/
205/*----------------------------------------------------------------------------*/
206
207void
209 bool use_previous_t,
210 cs_lnum_t n_faces,
211 const cs_lnum_t *face_ids,
212 cs_real_6_t var_iprime[]);
213
214/*----------------------------------------------------------------------------
215 * Interpolate field values at a given set of points.
216 *
217 * parameters:
218 * f <-- pointer to field
219 * interpolation_type <-- interpolation type
220 * n_points <-- number of points at which interpolation
221 * is required
222 * point_location <-- location of points in mesh elements
223 * (based on the field location)
224 * point_coords <-- point coordinates
225 * val --> interpolated values
226 *----------------------------------------------------------------------------*/
227
228void
230 cs_field_interpolate_t interpolation_type,
231 cs_lnum_t n_points,
232 const cs_lnum_t point_location[],
233 const cs_real_3_t point_coords[],
234 cs_real_t *val);
235
236/*----------------------------------------------------------------------------*/
247/*----------------------------------------------------------------------------*/
248
249void
251 cs_halo_type_t halo_type,
252 cs_real_t *local_max,
253 cs_real_t *local_min);
254
255/*----------------------------------------------------------------------------*/
263/*----------------------------------------------------------------------------*/
264
265void
267 const cs_real_t mean);
268
269/*----------------------------------------------------------------------------*/
278/*----------------------------------------------------------------------------*/
279
280void
282 cs_halo_type_t halo_type);
283
284/*----------------------------------------------------------------------------*/
285
287
288#endif /* __CS_FIELD_OPERATOR_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:359
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:361
#define END_C_DECLS
Definition: cs_defs.h:543
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:368
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:376
void cs_field_gradient_scalar_array(int f_id, int inc, const 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:577
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:1429
cs_field_interpolate_t
Definition: cs_field_operator.h:54
@ CS_FIELD_INTERPOLATE_MEAN
Definition: cs_field_operator.h:56
@ CS_FIELD_INTERPOLATE_GRADIENT
Definition: cs_field_operator.h:57
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:920
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:1086
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:1512
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:1472
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:1243
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:1385
cs_halo_type_t
Definition: cs_halo.h:56
Field boundary condition descriptor (for variables)
Definition: cs_field.h:104
Field descriptor.
Definition: cs_field.h:131