programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups 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-2014 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  *----------------------------------------------------------------------------*/
88 
89 void
90 cs_turbomachinery_add_rotor(const char *cell_criteria,
91  double rotation_velocity,
92  const double rotation_axis[3]);
93 
94 /*----------------------------------------------------------------------------
95  * Add a cs_join_t structure to the list of rotor/stator joinings.
96  *
97  * parameters:
98  * sel_criteria <-- boundary face selection criteria
99  * fraction <-- value of the fraction parameter
100  * plane <-- value of the plane parameter
101  * verbosity <-- level of verbosity required
102  * visualization <-- level of visualization required
103  *
104  * returns:
105  * number (1 to n) associated with new joining
106  *----------------------------------------------------------------------------*/
107 
108 int
109 cs_turbomachinery_join_add(const char *sel_criteria,
110  float fraction,
111  float plane,
112  int verbosity,
113  int visualization);
114 
115 /*----------------------------------------------------------------------------
116  * Initializations for turbomachinery computation
117  *
118  * Note: this function should be called before once the mesh is built,
119  * but before cs_post_init_meshes() so that postprocessing meshes are
120  * updated correctly in the transient case.
121  *----------------------------------------------------------------------------*/
122 
123 void
125 
126 /*----------------------------------------------------------------------------
127  * Free turbomachinery info
128  *----------------------------------------------------------------------------*/
129 
130 void
132 
133 /*----------------------------------------------------------------------------
134  * Update mesh for unsteady rotor/stator computation
135  *
136  * parameters:
137  * t_cur_mob <-- current rotor time
138  * t_elapsed --> elapsed computation time
139  *----------------------------------------------------------------------------*/
140 
141 void
142 cs_turbomachinery_update_mesh(double t_cur_mob,
143  double *t_elapsed);
144 
145 /*----------------------------------------------------------------------------
146  * Reinitialize interior face-based fields.
147  *----------------------------------------------------------------------------*/
148 
149 void
151 
152 /*----------------------------------------------------------------------------
153  * Resize cell-based fields.
154  *
155  * This function only handles fields owning their values.
156  *----------------------------------------------------------------------------*/
157 
158 void
160 
161 /*----------------------------------------------------------------------------
162  * Compute rotation matrix
163  *
164  * parameters:
165  * rotor_num <-- rotor number (1 to n numbering)
166  * theta <-- rotation angle, in radians
167  * matrix --> resulting rotation matrix
168  *----------------------------------------------------------------------------*/
169 
170 void
172  double theta,
173  cs_real_t matrix[3][4]);
174 
175 /*----------------------------------------------------------------------------
176  * Return cell rotor number.
177  *
178  * Each cell may be associated with a given rotor, or rotation, with 0
179  * indicating that that cell does not rotate.
180  *
181  * returns:
182  * array defining rotor number associated with each cell
183  * (0 for none, 1 to n otherwise)
184  *----------------------------------------------------------------------------*/
185 
186 const int *
188 
189 /*----------------------------------------------------------------------------
190  * Return rotation velocity
191  *
192  * parameters:
193  * rotor_num <-- rotor number (1 to n numbering)
194  *----------------------------------------------------------------------------*/
195 
196 double
198 
199 /*----------------------------------------------------------------------------
200  * Rotation of vector and tensor fields.
201  *
202  * parameters:
203  * dt <-- cell time step values
204  *----------------------------------------------------------------------------*/
205 
206 void
208 
209 /*----------------------------------------------------------------------------
210  * Compute velocity relative to fixed coordinates at a given point
211  *
212  * parameters:
213  * rotor_num <-- associated rotor number (1 to n numbering)
214  * coords <-- point coordinates
215  * velocity --> velocity relative to fixed coordinates
216  *----------------------------------------------------------------------------*/
217 
218 void
220  const cs_real_t coords[3],
221  cs_real_t velocity[3]);
222 
223 /*----------------------------------------------------------------------------*/
224 
226 
227 #endif /* __CS_TURBOMACHINERY_H__ */
228 
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:1245
void cs_turbomachinery_set_model(cs_turbomachinery_model_t model)
Define rotor/stator model.
Definition: cs_turbomachinery.c:753
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:1405
void cs_turbomachinery_rotate_fields(const cs_real_t dt[])
Rotation of vector and tensor fields.
Definition: cs_turbomachinery.c:1306
Definition: cs_turbomachinery.h:53
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
void cs_turbomachinery_initialize(void)
Initializations for turbomachinery computation.
Definition: cs_turbomachinery.c:1067
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:839
Definition: cs_turbomachinery.h:52
const int * cs_turbomachinery_get_cell_rotor_num(void)
Return cell rotor number.
Definition: cs_turbomachinery.c:1275
double cs_turbomachinery_get_rotation_velocity(int rotor_num)
Return rotation velocity.
Definition: cs_turbomachinery.c:1289
void cs_turbomachinery_update_mesh(double t_cur_mob, double *t_elapsed)
Update mesh for unsteady rotor/stator computation.
Definition: cs_turbomachinery.c:876
cs_turbomachinery_model_t cs_turbomachinery_get_model(void)
Return rotor/stator model.
Definition: cs_turbomachinery.c:774
void cs_turbomachinery_resize_cell_fields(void)
Resize cell-based fields.
Definition: cs_turbomachinery.c:1183
void matrix(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *const ndircp, const cs_int_t *const isym, const cs_real_t *const thetap, const cs_int_t *const 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:113
void cs_turbomachinery_finalize(void)
Free turbomachinery structure.
Definition: cs_turbomachinery.c:1132
void cs_turbomachinery_reinit_i_face_fields(void)
Reinitialize interior face-based fields.
Definition: cs_turbomachinery.c:1160
#define END_C_DECLS
Definition: cs_defs.h:406
double cs_real_t
Definition: cs_defs.h:296
void cs_turbomachinery_add_rotor(const char *cell_criteria, double rotation_velocity, const double rotation_axis[3])
Define a rotor by its axis and cell selection criteria.
Definition: cs_turbomachinery.c:793