8.0
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-2023 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 /*----------------------------------------------------------------------------
83  * Compute cell gradient of scalar field or component of vector or
84  * tensor field.
85  *
86  * parameters:
87  * f <-- pointer to field
88  * use_previous_t <-- should we use values from the previous time step ?
89  * inc <-- if 0, solve on increment; 1 otherwise
90  * hyd_p_flag <-- flag for hydrostatic pressure
91  * f_ext <-- exterior force generating the hydrostatic pressure
92  * grad --> gradient
93  *----------------------------------------------------------------------------*/
94 
95 void
97  bool use_previous_t,
98  int inc,
99  int hyd_p_flag,
100  cs_real_3_t f_ext[],
101  cs_real_3_t *restrict grad);
102 
103 /*----------------------------------------------------------------------------
104  * Compute cell gradient of scalar field or component of vector or
105  * tensor field.
106  *
107  * parameters:
108  * f <-- pointer to field
109  * use_previous_t <-- should we use values from the previous time step ?
110  * inc <-- if 0, solve on increment; 1 otherwise
111  * grad --> gradient
112  *----------------------------------------------------------------------------*/
113 
114 void
116  bool use_previous_t,
117  int inc,
118  cs_real_33_t *restrict grad);
119 
120 /*----------------------------------------------------------------------------
121  * Compute cell gradient of 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 
130 void
132  bool use_previous_t,
133  int inc,
134  cs_real_63_t *restrict grad);
135 
136 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
148 void
150  bool use_previous_t,
151  cs_lnum_t n_faces,
152  const cs_lnum_t *face_ids,
153  cs_real_t var_iprime[]);
154 
155 /*----------------------------------------------------------------------------
156  * Interpolate field values at a given set of points.
157  *
158  * parameters:
159  * f <-- pointer to field
160  * interpolation_type <-- interpolation type
161  * n_points <-- number of points at which interpolation
162  * is required
163  * point_location <-- location of points in mesh elements
164  * (based on the field location)
165  * point_coords <-- point coordinates
166  * val --> interpolated values
167  *----------------------------------------------------------------------------*/
168 
169 void
171  cs_field_interpolate_t interpolation_type,
172  cs_lnum_t n_points,
173  const cs_lnum_t point_location[],
174  const cs_real_3_t point_coords[],
175  cs_real_t *val);
176 
177 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 void
192  cs_halo_type_t halo_type,
193  cs_real_t *local_max,
194  cs_real_t *local_min);
195 
196 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void
208  const cs_real_t mean);
209 
210 /*----------------------------------------------------------------------------*/
219 /*----------------------------------------------------------------------------*/
220 
221 void
223  cs_halo_type_t halo_type);
224 
225 /*----------------------------------------------------------------------------*/
226 
228 
229 #endif /* __CS_FIELD_OPERATOR_H__ */
#define restrict
Definition: cs_defs.h:139
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:332
#define END_C_DECLS
Definition: cs_defs.h:510
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:341
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:349
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:1123
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:736
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:907
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:512
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:1206
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:1166
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:624
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:1079
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:835
cs_halo_type_t
Definition: cs_halo.h:56
Field descriptor.
Definition: cs_field.h:130