8.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-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 
54 typedef 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 
76 void
78  bool use_previous_t,
79  int inc,
80  cs_real_3_t *restrict grad);
81 
82 /*----------------------------------------------------------------------------*/
93 /*----------------------------------------------------------------------------*/
94 
95 void
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 
115 void
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 *restrict 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 
134 void
136  bool use_previous_t,
137  int inc,
138  cs_real_33_t *restrict 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 
150 void
152  bool use_previous_t,
153  int inc,
154  cs_real_63_t *restrict grad);
155 
156 /*----------------------------------------------------------------------------*/
166 /*----------------------------------------------------------------------------*/
167 
168 void
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 
187 void
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 
207 void
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 
228 void
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 
249 void
251  cs_halo_type_t halo_type,
252  cs_real_t *local_max,
253  cs_real_t *local_min);
254 
255 /*----------------------------------------------------------------------------*/
263 /*----------------------------------------------------------------------------*/
264 
265 void
267  const cs_real_t mean);
268 
269 /*----------------------------------------------------------------------------*/
278 /*----------------------------------------------------------------------------*/
279 
280 void
282  cs_halo_type_t halo_type);
283 
284 /*----------------------------------------------------------------------------*/
285 
287 
288 #endif /* __CS_FIELD_OPERATOR_H__ */
#define restrict
Definition: cs_defs.h:141
#define BEGIN_C_DECLS
Definition: cs_defs.h:528
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:347
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:349
#define END_C_DECLS
Definition: cs_defs.h:529
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:356
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:364
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.c: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.c:1432
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_vector(const cs_field_t *f, bool use_previous_t, int inc, cs_real_33_t *restrict grad)
Compute cell gradient of vector field.
Definition: cs_field_operator.c:754
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.c: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.c:1087
void cs_field_gradient_scalar(const cs_field_t *f, bool use_previous_t, int inc, cs_real_3_t *restrict grad)
Compute cell gradient of scalar field or component of vector or tensor field.
Definition: cs_field_operator.c:470
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.c:1515
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.c:1475
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 *restrict grad)
Compute cell gradient of scalar field or component of vector or tensor field.
Definition: cs_field_operator.c:644
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.c:1245
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.c:1388
void cs_field_gradient_tensor(const cs_field_t *f, bool use_previous_t, int inc, cs_real_63_t *restrict grad)
Compute cell gradient of tensor field.
Definition: cs_field_operator.c:851
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