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-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  * 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  * Reinitialize interior face-based fields.
149  *----------------------------------------------------------------------------*/
150 
151 void
153 
154 /*----------------------------------------------------------------------------
155  * Resize cell-based fields.
156  *
157  * This function only handles fields owning their values.
158  *----------------------------------------------------------------------------*/
159 
160 void
162 
163 /*----------------------------------------------------------------------------
164  * Compute rotation matrix
165  *
166  * parameters:
167  * rotor_num <-- rotor number (1 to n numbering)
168  * theta <-- rotation angle, in radians
169  * matrix --> resulting rotation matrix
170  *----------------------------------------------------------------------------*/
171 
172 void
174  double theta,
175  cs_real_t matrix[3][4]);
176 
177 /*----------------------------------------------------------------------------
178  * Return cell rotor number.
179  *
180  * Each cell may be associated with a given rotor, or rotation, with 0
181  * indicating that that cell does not rotate.
182  *
183  * returns:
184  * array defining rotor number associated with each cell
185  * (0 for none, 1 to n otherwise)
186  *----------------------------------------------------------------------------*/
187 
188 const int *
190 
191 /*----------------------------------------------------------------------------
192  * Return rotation velocity
193  *
194  * parameters:
195  * rotor_num <-- rotor number (1 to n numbering)
196  *----------------------------------------------------------------------------*/
197 
198 double
200 
201 /*----------------------------------------------------------------------------
202  * Rotation of vector and tensor fields.
203  *
204  * parameters:
205  * dt <-- cell time step values
206  *----------------------------------------------------------------------------*/
207 
208 void
210 
211 /*----------------------------------------------------------------------------
212  * Compute velocity relative to fixed coordinates at a given point
213  *
214  * Deprecated:
215  * Use cs_rotation_velocity for more consistent naming of this reference
216  * frame velocity.
217  *
218  * parameters:
219  * rotor_num <-- associated rotor number (1 to n numbering)
220  * coords <-- point coordinates
221  * velocity --> velocity relative to fixed coordinates
222  *----------------------------------------------------------------------------*/
223 
224 void
226  const cs_real_t coords[3],
227  cs_real_t velocity[3]);
228 
229 /*----------------------------------------------------------------------------*/
230 
232 
233 #endif /* __CS_TURBOMACHINERY_H__ */
234 
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:1208
void cs_turbomachinery_set_model(cs_turbomachinery_model_t model)
Define rotor/stator model.
Definition: cs_turbomachinery.c:702
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:1369
void cs_turbomachinery_rotate_fields(const cs_real_t dt[])
Rotation of vector and tensor fields.
Definition: cs_turbomachinery.c:1259
Definition: cs_turbomachinery.h:53
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
void cs_turbomachinery_initialize(void)
Initializations for turbomachinery computation.
Definition: cs_turbomachinery.c:1030
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:787
Definition: cs_turbomachinery.h:52
const int * cs_turbomachinery_get_cell_rotor_num(void)
Return cell rotor number.
Definition: cs_turbomachinery.c:1231
double cs_turbomachinery_get_rotation_velocity(int rotor_num)
Return rotation velocity.
Definition: cs_turbomachinery.c:1245
void cs_turbomachinery_update_mesh(double t_cur_mob, double *t_elapsed)
Update mesh for unsteady rotor/stator computation.
Definition: cs_turbomachinery.c:824
cs_turbomachinery_model_t cs_turbomachinery_get_model(void)
Return rotor/stator model.
Definition: cs_turbomachinery.c:723
void cs_turbomachinery_resize_cell_fields(void)
Resize cell-based fields.
Definition: cs_turbomachinery.c:1146
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:743
Definition: cs_field_pointer.h:64
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:111
double precision, dimension(:,:,:), allocatable theta
Definition: atimbr.f90:123
void cs_turbomachinery_finalize(void)
Free turbomachinery structure.
Definition: cs_turbomachinery.c:1092
void cs_turbomachinery_reinit_i_face_fields(void)
Reinitialize interior face-based fields.
Definition: cs_turbomachinery.c:1123
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296