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  * recompute_cocg <-- should COCG FV quantities be recomputed ?
126  * clip_coeff <-- clipping coefficient
127  * grad --> gradient
128  *----------------------------------------------------------------------------*/
129 
130 void
132  bool use_previous_t,
133  cs_gradient_type_t gradient_type,
134  cs_halo_type_t halo_type,
135  int inc,
136  cs_real_33_t *restrict grad);
137 
138 /*----------------------------------------------------------------------------
139  * Interpolate field values at a given set of points.
140  *
141  * parameters:
142  * f <-- pointer to field
143  * interpolation_type <-- interpolation type
144  * n_points <-- number of points at which interpolation
145  * is required
146  * point_location <-- location of points in mesh elements
147  * (based on the field location)
148  * point_coords <-- point coordinates
149  * val --> interpolated values
150  *----------------------------------------------------------------------------*/
151 
152 void
154  cs_field_interpolate_t interpolation_type,
155  cs_lnum_t n_points,
156  const cs_lnum_t point_location[],
157  const cs_real_3_t point_coords[],
158  cs_real_t *val);
159 
160 /*----------------------------------------------------------------------------*/
161 
163 
164 #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:566
Field descriptor.
Definition: cs_field.h:99
#define BEGIN_C_DECLS
Definition: cs_defs.h:419
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:429
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:500
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:631
#define END_C_DECLS
Definition: cs_defs.h:420
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