programmer's documentation
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-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  * 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  * Initializations for turbomachinery computation
119  *
120  * Note: this function should be called before once the mesh is built,
121  * but before cs_post_init_meshes() so that postprocessing meshes are
122  * updated correctly in the transient case.
123  *----------------------------------------------------------------------------*/
124 
125 void
127 
128 /*----------------------------------------------------------------------------
129  * Free turbomachinery info
130  *----------------------------------------------------------------------------*/
131 
132 void
134 
135 /*----------------------------------------------------------------------------
136  * Update mesh for unsteady rotor/stator computation
137  *
138  * parameters:
139  * t_cur_mob <-- current rotor time
140  * t_elapsed --> elapsed computation time
141  *----------------------------------------------------------------------------*/
142 
143 void
144 cs_turbomachinery_update_mesh(double t_cur_mob,
145  double *t_elapsed);
146 
147 /*----------------------------------------------------------------------------
148  * Read mesh from checkpoint for unsteady rotor/stator computation
149  *
150  * parameters:
151  * t_cur_mob <-- current rotor time
152  * t_elapsed --> elapsed computation time
153  *----------------------------------------------------------------------------*/
154 
155 void
156 cs_turbomachinery_restart_mesh(double t_cur_mob,
157  double *t_elapsed);
158 
159 /*----------------------------------------------------------------------------
160  * Reinitialize interior face-based fields.
161  *----------------------------------------------------------------------------*/
162 
163 void
165 
166 /*----------------------------------------------------------------------------
167  * Resize cell-based fields.
168  *
169  * This function only handles fields owning their values.
170  *----------------------------------------------------------------------------*/
171 
172 void
174 
175 /*----------------------------------------------------------------------------
176  * Compute rotation matrix
177  *
178  * parameters:
179  * rotor_num <-- rotor number (1 to n numbering)
180  * theta <-- rotation angle, in radians
181  * matrix --> resulting rotation matrix
182  *----------------------------------------------------------------------------*/
183 
184 void
186  double theta,
187  cs_real_t matrix[3][4]);
188 
189 /*----------------------------------------------------------------------------
190  * Return cell rotor number.
191  *
192  * Each cell may be associated with a given rotor, or rotation, with 0
193  * indicating that that cell does not rotate.
194  *
195  * returns:
196  * array defining rotor number associated with each cell
197  * (0 for none, 1 to n otherwise)
198  *----------------------------------------------------------------------------*/
199 
200 const int *
202 
203 /*----------------------------------------------------------------------------
204  * Return rotation velocity
205  *
206  * parameters:
207  * rotor_num <-- rotor number (1 to n numbering)
208  *----------------------------------------------------------------------------*/
209 
210 double
212 
213 /*----------------------------------------------------------------------------
214  * Rotation of vector and tensor fields.
215  *
216  * parameters:
217  * dt <-- cell time step values
218  *----------------------------------------------------------------------------*/
219 
220 void
222 
223 /*----------------------------------------------------------------------------
224  * Compute velocity relative to fixed coordinates at a given point
225  *
226  * Deprecated:
227  * Use cs_rotation_velocity for more consistent naming of this reference
228  * frame velocity.
229  *
230  * parameters:
231  * rotor_num <-- associated rotor number (1 to n numbering)
232  * coords <-- point coordinates
233  * velocity --> velocity relative to fixed coordinates
234  *----------------------------------------------------------------------------*/
235 
236 void
238  const cs_real_t coords[3],
239  cs_real_t velocity[3]);
240 
241 /*----------------------------------------------------------------------------*/
242 
244 
245 #endif /* __CS_TURBOMACHINERY_H__ */
246 
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:1287
void cs_turbomachinery_set_model(cs_turbomachinery_model_t model)
Define rotor/stator model.
Definition: cs_turbomachinery.c:948
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:1433
void cs_turbomachinery_rotate_fields(const cs_real_t dt[])
Rotation of vector and tensor fields.
Definition: cs_turbomachinery.c:1338
Definition: cs_turbomachinery.h:53
#define BEGIN_C_DECLS
Definition: cs_defs.h:448
void cs_turbomachinery_initialize(void)
Initializations for turbomachinery computation.
Definition: cs_turbomachinery.c:1103
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:1033
Definition: cs_turbomachinery.h:52
const int * cs_turbomachinery_get_cell_rotor_num(void)
Return cell rotor number.
Definition: cs_turbomachinery.c:1310
double cs_turbomachinery_get_rotation_velocity(int rotor_num)
Return rotation velocity.
Definition: cs_turbomachinery.c:1324
void cs_turbomachinery_update_mesh(double t_cur_mob, double *t_elapsed)
Update mesh for unsteady rotor/stator computation.
Definition: cs_turbomachinery.c:1070
double cs_real_t
Floating-point value.
Definition: cs_defs.h:296
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:969
void cs_turbomachinery_resize_cell_fields(void)
Resize cell-based fields.
Definition: cs_turbomachinery.c:1231
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:989
Definition: cs_field_pointer.h:64
double precision, dimension(:,:,:), allocatable theta
Definition: atimbr.f90:123
void cs_turbomachinery_finalize(void)
Free turbomachinery structure.
Definition: cs_turbomachinery.c:1177
void cs_turbomachinery_reinit_i_face_fields(void)
Reinitialize interior face-based fields.
Definition: cs_turbomachinery.c:1208
#define END_C_DECLS
Definition: cs_defs.h:449
void cs_turbomachinery_restart_mesh(double t_cur_mob, double *t_elapsed)
Read mesh from checkpoint for unsteady rotor/stator computation.
Definition: cs_turbomachinery.c:1086