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-2015 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  * gradient_type <-- gradient type
73  * halo_type <-- halo type
74  * inc <-- if 0, solve on increment; 1 otherwise
75  * recompute_cocg <-- should COCG FV quantities be recomputed ?
76  * grad --> gradient
77  *----------------------------------------------------------------------------*/
78 
79 void
81  bool use_previous_t,
82  cs_gradient_type_t gradient_type,
83  cs_halo_type_t halo_type,
84  int inc,
85  bool recompute_cocg,
86  cs_real_3_t *restrict grad);
87 
88 /*----------------------------------------------------------------------------
89  * Compute cell gradient of scalar field or component of vector or
90  * tensor field.
91  *
92  * parameters:
93  * f <-- pointer to field
94  * use_previous_t <-- should we use values from the previous time step ?
95  * gradient_type <-- gradient type
96  * halo_type <-- halo type
97  * inc <-- if 0, solve on increment; 1 otherwise
98  * recompute_cocg <-- should COCG FV quantities be recomputed ?
99  * hyd_p_flag <-- flag for hydrostatic pressure
100  * f_ext <-- exterior force generating the hydrostatic pressure
101  * grad --> gradient
102  *----------------------------------------------------------------------------*/
103 
104 void
106  bool use_previous_t,
107  cs_gradient_type_t gradient_type,
108  cs_halo_type_t halo_type,
109  int inc,
110  bool recompute_cocg,
111  int hyd_p_flag,
112  cs_real_3_t f_ext[],
113  cs_real_3_t *restrict grad);
114 
115 /*----------------------------------------------------------------------------
116  * Compute cell gradient of scalar field or component of vector or
117  * tensor field.
118  *
119  * parameters:
120  * f <-- pointer to field
121  * use_previous_t <-- should we use values from the previous time step ?
122  * gradient_type <-- gradient type
123  * halo_type <-- halo type
124  * inc <-- if 0, solve on increment; 1 otherwise
125  * grad --> gradient
126  *----------------------------------------------------------------------------*/
127 
128 void
130  bool use_previous_t,
131  cs_gradient_type_t gradient_type,
132  cs_halo_type_t halo_type,
133  int inc,
134  cs_real_33_t *restrict 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  * gradient_type <-- gradient type
143  * halo_type <-- halo type
144  * inc <-- if 0, solve on increment; 1 otherwise
145  * grad --> gradient
146  *----------------------------------------------------------------------------*/
147 
148 void
150  bool use_previous_t,
151  cs_gradient_type_t gradient_type,
152  cs_halo_type_t halo_type,
153  int inc,
154  cs_real_63_t *restrict grad);
155 
156 /*----------------------------------------------------------------------------
157  * Interpolate field values at a given set of points.
158  *
159  * parameters:
160  * f <-- pointer to field
161  * interpolation_type <-- interpolation type
162  * n_points <-- number of points at which interpolation
163  * is required
164  * point_location <-- location of points in mesh elements
165  * (based on the field location)
166  * point_coords <-- point coordinates
167  * val --> interpolated values
168  *----------------------------------------------------------------------------*/
169 
170 void
172  cs_field_interpolate_t interpolation_type,
173  cs_lnum_t n_points,
174  const cs_lnum_t point_location[],
175  const cs_real_3_t point_coords[],
176  cs_real_t *val);
177 
178 /*----------------------------------------------------------------------------*/
179 
181 
182 #endif /* __CS_FIELD_OPERATOR_H__ */
#define restrict
Definition: cs_defs.h:122
void cs_field_gradient_vector(const cs_field_t *f, bool use_previous_t, cs_gradient_type_t gradient_type, cs_halo_type_t halo_type, int inc, cs_real_33_t *restrict grad)
Compute cell gradient of scalar field or component of vector or tensor field.
Definition: cs_field_operator.c:614
Field descriptor.
Definition: cs_field.h:99
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
Definition: cs_field_operator.h:57
Definition: cs_field_operator.h:56
cs_field_interpolate_t
Field interpolation modes.
Definition: cs_field_operator.h:54
void cs_field_gradient_scalar(const cs_field_t *f, bool use_previous_t, cs_gradient_type_t gradient_type, cs_halo_type_t halo_type, 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:471
void cs_field_gradient_potential(const cs_field_t *f, bool use_previous_t, cs_gradient_type_t gradient_type, cs_halo_type_t halo_type, 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:545
cs_halo_type_t
Definition: cs_halo.h:49
cs_gradient_type_t
Definition: cs_gradient.h:53
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:307
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
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:743
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:311
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:316
void cs_field_gradient_tensor(const cs_field_t *f, bool use_previous_t, cs_gradient_type_t gradient_type, cs_halo_type_t halo_type, int inc, cs_real_63_t *restrict grad)
Compute cell gradient of tensor field.
Definition: cs_field_operator.c:678