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-2016 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 
80  bool use_previous_t,
81  cs_gradient_type_t gradient_type,
82  cs_halo_type_t halo_type,
83  int inc,
84  bool recompute_cocg,
85  cs_real_3_t *restrict grad);
86 
87 /*----------------------------------------------------------------------------
88  * Compute cell gradient of scalar field or component of vector or
89  * tensor field.
90  *
91  * parameters:
92  * f <-- pointer to field
93  * use_previous_t <-- should we use values from the previous time step ?
94  * gradient_type <-- gradient type
95  * halo_type <-- halo type
96  * inc <-- if 0, solve on increment; 1 otherwise
97  * recompute_cocg <-- should COCG FV quantities be recomputed ?
98  * hyd_p_flag <-- flag for hydrostatic pressure
99  * f_ext <-- exterior force generating the hydrostatic pressure
100  * grad --> gradient
101  *----------------------------------------------------------------------------*/
102 
104  bool use_previous_t,
105  cs_gradient_type_t gradient_type,
106  cs_halo_type_t halo_type,
107  int inc,
108  bool recompute_cocg,
109  int hyd_p_flag,
110  cs_real_3_t f_ext[],
111  cs_real_3_t *restrict grad);
112 
113 /*----------------------------------------------------------------------------
114  * Compute cell gradient of scalar field or component of vector or
115  * tensor field.
116  *
117  * parameters:
118  * f <-- pointer to field
119  * use_previous_t <-- should we use values from the previous time step ?
120  * gradient_type <-- gradient type
121  * halo_type <-- halo type
122  * inc <-- if 0, solve on increment; 1 otherwise
123  * recompute_cocg <-- should COCG FV quantities be recomputed ?
124  * clip_coeff <-- clipping coefficient
125  * grad --> gradient
126  *----------------------------------------------------------------------------*/
127 
129  bool use_previous_t,
130  cs_gradient_type_t gradient_type,
131  cs_halo_type_t halo_type,
132  int inc,
133  cs_real_33_t *restrict grad);
134 
135 /*----------------------------------------------------------------------------
136  * Interpolate field values at a given set of points.
137  *
138  * parameters:
139  * f <-- pointer to field
140  * interpolation_type <-- interpolation type
141  * n_points <-- number of points at which interpolation
142  * is required
143  * point_location <-- location of points in mesh elements
144  * (based on the field location)
145  * point_coords <-- point coordinates
146  * val --> interpolated values
147  *----------------------------------------------------------------------------*/
148 
149 void
151  cs_field_interpolate_t interpolation_type,
152  cs_lnum_t n_points,
153  const cs_lnum_t point_location[],
154  const cs_real_3_t point_coords[],
155  cs_real_t *val);
156 
157 /*----------------------------------------------------------------------------*/
158 
160 
161 #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:557
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:422
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:492
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:622
#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