My Project
programmer's 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-2019 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  * recompute_cocg <-- should COCG FV quantities be recomputed ?
74  * grad --> gradient
75  *----------------------------------------------------------------------------*/
76 
77 void
79  bool use_previous_t,
80  int inc,
81  bool recompute_cocg,
83 
84 /*----------------------------------------------------------------------------
85  * Compute cell gradient of scalar field or component of vector or
86  * tensor field.
87  *
88  * parameters:
89  * f <-- pointer to field
90  * use_previous_t <-- should we use values from the previous time step ?
91  * inc <-- if 0, solve on increment; 1 otherwise
92  * recompute_cocg <-- should COCG FV quantities be recomputed ?
93  * hyd_p_flag <-- flag for hydrostatic pressure
94  * f_ext <-- exterior force generating the hydrostatic pressure
95  * grad --> gradient
96  *----------------------------------------------------------------------------*/
97 
98 void
100  bool use_previous_t,
101  int inc,
102  bool recompute_cocg,
103  int hyd_p_flag,
104  cs_real_3_t f_ext[],
106 
107 /*----------------------------------------------------------------------------
108  * Compute cell gradient of scalar field or component of vector or
109  * tensor field.
110  *
111  * parameters:
112  * f <-- pointer to field
113  * use_previous_t <-- should we use values from the previous time step ?
114  * inc <-- if 0, solve on increment; 1 otherwise
115  * grad --> gradient
116  *----------------------------------------------------------------------------*/
117 
118 void
120  bool use_previous_t,
121  int inc,
123 
124 /*----------------------------------------------------------------------------
125  * Compute cell gradient of 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,
139 
140 /*----------------------------------------------------------------------------
141  * Interpolate field values at a given set of points.
142  *
143  * parameters:
144  * f <-- pointer to field
145  * interpolation_type <-- interpolation type
146  * n_points <-- number of points at which interpolation
147  * is required
148  * point_location <-- location of points in mesh elements
149  * (based on the field location)
150  * point_coords <-- point coordinates
151  * val --> interpolated values
152  *----------------------------------------------------------------------------*/
153 
154 void
156  cs_field_interpolate_t interpolation_type,
157  cs_lnum_t n_points,
158  const cs_lnum_t point_location[],
159  const cs_real_3_t point_coords[],
160  cs_real_t *val);
161 
162 /*----------------------------------------------------------------------------*/
173 /*----------------------------------------------------------------------------*/
174 
175 void
177  cs_halo_type_t halo_type,
178  cs_real_t *local_max,
179  cs_real_t *local_min);
180 
181 /*----------------------------------------------------------------------------*/
189 /*----------------------------------------------------------------------------*/
190 
191 void
193  const cs_real_t mean);
194 
195 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void
208  cs_halo_type_t halo_type);
209 
210 /*----------------------------------------------------------------------------*/
211 
213 
214 #endif /* __CS_FIELD_OPERATOR_H__ */
f_id
void const int * f_id
Definition: cs_gui.h:292
f_ext
void const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_real_t *const const cs_real_t *const const cs_real_t *const cs_real_3_t f_ext[]
Definition: cs_gradient.h:93
cs_defs.h
cs_gradient.h
cs_field_gradient_potential
void cs_field_gradient_potential(const cs_field_t *f, bool use_previous_t, int inc, bool recompute_cocg, 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
restrict
#define restrict
Definition: cs_defs.h:127
cs_field_gradient_vector
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:713
cs_real_3_t
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:315
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
grad
void const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_int_t *const const cs_real_t *const const cs_real_t *const const cs_real_t *const cs_real_3_t const cs_real_t const cs_real_t cs_real_t cs_real_t cs_real_3_t grad[]
Definition: cs_gradient.h:93
cs_field_interpolate_t
cs_field_interpolate_t
Field interpolation modes.
Definition: cs_field_operator.h:54
cs_field_interpolate
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:844
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_field_synchronize
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:971
CS_FIELD_INTERPOLATE_GRADIENT
Definition: cs_field_operator.h:57
inc
void const cs_int_t *const const cs_int_t *const inc
Definition: cs_convection_diffusion.h:5386
cs_field.h
CS_FIELD_INTERPOLATE_MEAN
Definition: cs_field_operator.h:56
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_real_33_t
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:321
cs_field_gradient_tensor
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:791
cs_halo_type_t
cs_halo_type_t
Definition: cs_halo.h:50
cs_field_local_extrema_scalar
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:888
cs_field_gradient_scalar
void cs_field_gradient_scalar(const cs_field_t *f, bool use_previous_t, int inc, bool recompute_cocg, cs_real_3_t *restrict grad)
Compute cell gradient of scalar field or component of vector or tensor field.
Definition: cs_field_operator.c:529
cs_field_set_volume_average
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:931
cs_field_t
Field descriptor.
Definition: cs_field.h:124
cs_real_63_t
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:327