programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cs_turbomachinery.h
Go to the documentation of this file.
1 #ifndef __CS_TURBOMACHINERY_H__
2 #define __CS_TURBOMACHINERY_H__
3 
4 /*============================================================================
5  * Turbomachinery modeling features.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2017 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  * Standard C library headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Local Type Definitions
42  *============================================================================*/
43 
44 /*----------------------------------------------------------------------------
45  * Local Structure Definitions
46  *----------------------------------------------------------------------------*/
47 
48 /* Turbomachinery model type */
49 
50 typedef enum {
51 
52  CS_TURBOMACHINERY_NONE, /* No turbomachinery modeling */
53  CS_TURBOMACHINERY_FROZEN, /* Frozen rotor model */
54  CS_TURBOMACHINERY_TRANSIENT /* full transient simulation */
55 
57 
58 /*============================================================================
59  * Static global variables
60  *============================================================================*/
61 
62 /*============================================================================
63  * Public function prototypes
64  *============================================================================*/
65 
66 /*----------------------------------------------------------------------------
67  * Define rotor/stator model.
68  *----------------------------------------------------------------------------*/
69 
70 void
72 
73 /*----------------------------------------------------------------------------
74  * return rotor/stator model.
75  *----------------------------------------------------------------------------*/
76 
79 
80 /*----------------------------------------------------------------------------
81  * Define a rotor by its axis and cell selection criteria.
82  *
83  * parameters:
84  * cell_criteria <-- cell selection criteria string
85  * rotation_velocity <-- rotation velocity, in radians/second
86  * rotation_axis <-- rotation axis vector
87  * rotation_invariant <-- rotation invariant point
88  *----------------------------------------------------------------------------*/
89 
90 void
91 cs_turbomachinery_add_rotor(const char *cell_criteria,
92  double rotation_velocity,
93  const double rotation_axis[3],
94  const double rotation_invariant[3]);
95 
96 /*----------------------------------------------------------------------------
97  * Add a cs_join_t structure to the list of rotor/stator joinings.
98  *
99  * parameters:
100  * sel_criteria <-- boundary face selection criteria
101  * fraction <-- value of the fraction parameter
102  * plane <-- value of the plane parameter
103  * verbosity <-- level of verbosity required
104  * visualization <-- level of visualization required
105  *
106  * returns:
107  * number (1 to n) associated with new joining
108  *----------------------------------------------------------------------------*/
109 
110 int
111 cs_turbomachinery_join_add(const char *sel_criteria,
112  float fraction,
113  float plane,
114  int verbosity,
115  int visualization);
116 
117 /*----------------------------------------------------------------------------
118  * Add a cs_join_t structure to the list of rotor/stator couplings.
119  *
120  * parameters:
121  * sel_criteria <-- boundary face selection criteria
122  * tolerance <-- value of the search tolerance
123  * verbosity <-- level of verbosity required
124  *
125  * returns:
126  * number (1 to n) associated with new coupling
127  *----------------------------------------------------------------------------*/
128 
129 int
130 cs_turbomachinery_coupling_add(const char *sel_criteria,
131  float tolerance,
132  int verbosity);
133 
134 /*----------------------------------------------------------------------------
135  * Definitions for turbomachinery computation.
136  *----------------------------------------------------------------------------*/
137 
138 void
140 
141 /*----------------------------------------------------------------------------
142  * Initializations for turbomachinery computation
143  *
144  * Note: this function should be called before once the mesh is built,
145  * but before cs_post_init_meshes() so that postprocessing meshes are
146  * updated correctly in the transient case.
147  *----------------------------------------------------------------------------*/
148 
149 void
151 
152 /*----------------------------------------------------------------------------
153  * Free turbomachinery info
154  *----------------------------------------------------------------------------*/
155 
156 void
158 
159 /*----------------------------------------------------------------------------
160  * Update mesh for unsteady rotor/stator computation
161  *
162  * parameters:
163  * t_cur_mob <-- current rotor time
164  * t_elapsed --> elapsed computation time
165  *----------------------------------------------------------------------------*/
166 
167 void
168 cs_turbomachinery_update_mesh(double t_cur_mob,
169  double *t_elapsed);
170 
171 /*----------------------------------------------------------------------------
172  * Update mesh for unsteady rotor/stator computation in case of restart.
173  *
174  * Reads mesh from checkpoint when available.
175  *----------------------------------------------------------------------------*/
176 
177 void
179 
180 /*----------------------------------------------------------------------------
181  * Reinitialize interior face-based fields.
182  *----------------------------------------------------------------------------*/
183 
184 void
186 
187 /*----------------------------------------------------------------------------
188  * Resize cell-based fields.
189  *
190  * This function only handles fields owning their values.
191  *----------------------------------------------------------------------------*/
192 
193 void
195 
196 /*----------------------------------------------------------------------------
197  * Compute rotation matrix
198  *
199  * parameters:
200  * rotor_num <-- rotor number (1 to n numbering)
201  * theta <-- rotation angle, in radians
202  * matrix --> resulting rotation matrix
203  *----------------------------------------------------------------------------*/
204 
205 void
207  double theta,
208  cs_real_t matrix[3][4]);
209 
210 /*----------------------------------------------------------------------------
211  * Return cell rotor number.
212  *
213  * Each cell may be associated with a given rotor, or rotation, with 0
214  * indicating that that cell does not rotate.
215  *
216  * returns:
217  * array defining rotor number associated with each cell
218  * (0 for none, 1 to n otherwise)
219  *----------------------------------------------------------------------------*/
220 
221 const int *
223 
224 /*----------------------------------------------------------------------------
225  * Return rotation velocity
226  *
227  * parameters:
228  * rotor_num <-- rotor number (1 to n numbering)
229  *----------------------------------------------------------------------------*/
230 
231 double
233 
234 /*----------------------------------------------------------------------------
235  * Rotation of vector and tensor fields.
236  *
237  * parameters:
238  * dt <-- cell time step values
239  *----------------------------------------------------------------------------*/
240 
241 void
243 
244 /*----------------------------------------------------------------------------
245  * Compute velocity relative to fixed coordinates at a given point
246  *
247  * Deprecated:
248  * Use cs_rotation_velocity for more consistent naming of this reference
249  * frame velocity.
250  *
251  * parameters:
252  * rotor_num <-- associated rotor number (1 to n numbering)
253  * coords <-- point coordinates
254  * velocity --> velocity relative to fixed coordinates
255  *----------------------------------------------------------------------------*/
256 
257 void
259  const cs_real_t coords[3],
260  cs_real_t velocity[3]);
261 
262 /*----------------------------------------------------------------------------*/
263 
265 
266 #endif /* __CS_TURBOMACHINERY_H__ */
267 
cs_turbomachinery_model_t
Definition: cs_turbomachinery.h:50
Definition: cs_turbomachinery.h:54
void cs_turbomachinery_rotation_matrix(int rotor_num, double theta, cs_real_t matrix[3][4])
Compute rotation matrix.
Definition: cs_turbomachinery.c:1508
void cs_turbomachinery_set_model(cs_turbomachinery_model_t model)
Define rotor/stator model.
Definition: cs_turbomachinery.c:1115
void cs_turbomachinery_relative_velocity(int rotor_num, const cs_real_t coords[3], cs_real_t velocity[3])
Compute velocity relative to fixed coordinates at a given point.
Definition: cs_turbomachinery.c:1654
void cs_turbomachinery_rotate_fields(const cs_real_t dt[])
Rotation of vector and tensor fields.
Definition: cs_turbomachinery.c:1559
Definition: cs_turbomachinery.h:53
#define BEGIN_C_DECLS
Definition: cs_defs.h:453
void cs_turbomachinery_initialize(void)
Initializations for turbomachinery computation.
Definition: cs_turbomachinery.c:1336
int cs_turbomachinery_join_add(const char *sel_criteria, float fraction, float plane, int verbosity, int visualization)
Add a cs_join_t structure to the list of rotor/stator joinings.
Definition: cs_turbomachinery.c:1200
Definition: cs_turbomachinery.h:52
const int * cs_turbomachinery_get_cell_rotor_num(void)
Return cell rotor number.
Definition: cs_turbomachinery.c:1531
double cs_turbomachinery_get_rotation_velocity(int rotor_num)
Return rotation velocity.
Definition: cs_turbomachinery.c:1545
void cs_turbomachinery_update_mesh(double t_cur_mob, double *t_elapsed)
Update mesh for unsteady rotor/stator computation.
Definition: cs_turbomachinery.c:1268
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
void matrix(const int *iconvp, const int *idiffp, const int *ndircp, const int *isym, const cs_real_t *thetap, const int *imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t da[], cs_real_t xa[])
Definition: cs_matrix_building.c:111
cs_turbomachinery_model_t cs_turbomachinery_get_model(void)
Return rotor/stator model.
Definition: cs_turbomachinery.c:1136
void cs_turbomachinery_resize_cell_fields(void)
Resize cell-based fields.
Definition: cs_turbomachinery.c:1452
void cs_turbomachinery_add_rotor(const char *cell_criteria, double rotation_velocity, const double rotation_axis[3], const double rotation_invariant[3])
Define a rotor by its axis and cell selection criteria.
Definition: cs_turbomachinery.c:1156
Definition: cs_field_pointer.h:65
void cs_turbomachinery_restart_mesh(void)
Update mesh for unsteady rotor/stator computation in case of restart.
Definition: cs_turbomachinery.c:1283
void cs_turbomachinery_finalize(void)
Free turbomachinery structure.
Definition: cs_turbomachinery.c:1398
int cs_turbomachinery_coupling_add(const char *sel_criteria, float tolerance, int verbosity)
Add a cs_join_t structure to the list of rotor/stator couplings.
Definition: cs_turbomachinery.c:1240
void cs_turbomachinery_reinit_i_face_fields(void)
Reinitialize interior face-based fields.
Definition: cs_turbomachinery.c:1429
#define END_C_DECLS
Definition: cs_defs.h:454
void cs_turbomachinery_define(void)
Definitions for turbomachinery computation.
Definition: cs_turbomachinery.c:1304