programmer's documentation
cs_fan.h
Go to the documentation of this file.
1 #ifndef __CS_FAN_H__
2 #define __CS_FAN_H__
3 
4 /*============================================================================
5  * Fan modeling through velocity source terms.
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 /*----------------------------------------------------------------------------
35  * Local headers
36  *----------------------------------------------------------------------------*/
37 
38 #include "cs_base.h"
39 
40 #include "cs_mesh.h"
41 #include "cs_mesh_quantities.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*============================================================================
48  * Structure definition
49  *============================================================================*/
50 
51 typedef struct _cs_fan_t cs_fan_t;
52 
53 /*============================================================================
54  * Public function prototypes for Fortran API
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------
58  * Get the number of fans.
59  *
60  * Fortran interface:
61  *
62  * subroutine tstvtl
63  * *****************
64  *
65  * integer nbrvtl : --> : number of fans
66  *----------------------------------------------------------------------------*/
67 
68 void CS_PROCF (tstvtl, TSTVTL)
69 (
70  cs_int_t *const nbrvtl
71 );
72 
73 /*----------------------------------------------------------------------------
74  * Adds a fan.
75  *
76  * Fortran interface:
77  *
78  * subroutine defvtl
79  * *****************
80  *
81  * integer dimmod : <-- : fan model dimension:
82  * : : 1: constant_f; 2: force_profile;
83  * : : 3: force_profile + tangential couple
84  * integer dimvtl : <-- : fan dimension:
85  * : : 2: pseudo-2D (extruded mesh)
86  * : : 3: 3D (standard)
87  * double precision xyzvt1(3) : <-- : coo. of the axis point in inlet face
88  * double precision xyzvt2(3) : <-- : coo. of the axis point in outlet face
89  * double precision rvvt : <-- : fan radius
90  * double precision rpvt : <-- : blades radius
91  * double precision rmvt : <-- : hub radius
92  * double precision ccarac(3) : <-- : coefficients of degre 0, 1 and 2
93  * : : of the characteristic curve
94  * double precision tauvt : <-- : fan axial couple
95  *----------------------------------------------------------------------------*/
96 
97 void CS_PROCF (defvtl, DEFVTL)
98 (
99  const cs_int_t *dimmod,
100  const cs_int_t *dimvtl,
101  const cs_real_t xyzvt1[3],
102  const cs_real_t xyzvt2[3],
103  const cs_real_t *rvvt,
104  const cs_real_t *rpvt,
105  const cs_real_t *rmvt,
106  const cs_real_t ccarac[3],
107  const cs_real_t *tauvt
108 );
109 
110 /*----------------------------------------------------------------------------
111  * Build the list of cells associated to the fans
112  *
113  * Fotrtran interface:
114  *
115  * subroutine inivtl
116  * *****************
117  *----------------------------------------------------------------------------*/
118 
119 void CS_PROCF (inivtl, INIVTL)
120 (
121  void
122 );
123 
124 /*----------------------------------------------------------------------------
125  * Mark the fans and associate the fan number to the cells belonging to
126  * thus fan, 0 otherwise.
127  *
128  * Fortran interface:
129  *
130  * SUBROUTINE NUMVTL (INDIC)
131  * *****************
132  *
133  * INTEGER INDIC(NCELET) : --> : Fan number (0 if outside the fan)
134  *----------------------------------------------------------------------------*/
135 
136 void CS_PROCF (numvtl, NUMVTL)
137 (
138  cs_int_t indic[]
139 );
140 
141 /*----------------------------------------------------------------------------
142  * Compute the flows through the fans
143  *
144  * Fortran interface:
145  *
146  * subroutine debvtl
147  * *****************
148  *
149  * double precision flumas(*) : <-- : interior faces mass flux
150  * double precision flumab(*) : <-- : boundary faces mass flux
151  * double precision rhofac(*) : <-- : density at cells
152  * double precision rhofab(*) : <-- : density at boundary faces
153  * double precision debent(nbrvtl) : --> : inlet flow through the fan
154  * double precision debsor(nbrvtl) : --> : Outlet flow through the fan
155  *----------------------------------------------------------------------------*/
156 
157 void CS_PROCF (debvtl, DEBVTL)
158 (
159  cs_real_t flumas[],
160  cs_real_t flumab[],
161  cs_real_t rhofac[],
162  cs_real_t rhofab[],
163  cs_real_t debent[],
164  cs_real_t debsor[]
165 );
166 
167 /*----------------------------------------------------------------------------
168  * Compute the force induced by the fans (needs a previous calculation
169  * of the flows through each fan).
170  *
171  * The induced force is added to the array crvxep (which can have other
172  * contributions).
173  *
174  * Fortran interface:
175  *
176  * subroutine tsvvtl
177  * *****************
178  *
179  * parameters:
180  * idimts <-- Dimension associated to the source
181  * term of velocity (1: X; 2: Y; 3: Z)
182  * crvexp <-> Explicit source term (velocity)
183  *----------------------------------------------------------------------------*/
184 
185 void CS_PROCF (tsvvtl, TSVVTL)
186 (
187  cs_int_t *idimts,
188  cs_real_t crvexp[]
189 );
190 
191 /*============================================================================
192  * Public function prototypes
193  *============================================================================*/
194 
195 /*----------------------------------------------------------------------------
196  * Fan definition (added to the ones previously defined)
197  *
198  * parameters:
199  * model_dim <-- fan model dimension:
200  * 1: constant_f
201  * 2: force_profile
202  * 3: force_profile + tangential couple
203  * fan_dim <-- fan dimension:
204  * 2: pseudo-2D (extruded mesh)
205  * 3: 3D (standard)
206  * inlet_axis_coords <-- intersection coords. of axis and inlet face
207  * outlet_axis_coords <-- intersection coords. od axis and outlet face
208  * fan_radius <-- fan radius
209  * blades_radius <-- blades radius
210  * hub_radius <-- hub radius
211  * curve_coeffs <-- coefficients of degre 0, 1 and 2 of
212  the characteristic curve
213  * axial_torque <-- fan axial torque
214  *----------------------------------------------------------------------------*/
215 
216 void
217 cs_fan_define(int model_dim,
218  int fan_dim,
219  const cs_real_t inlet_axis_coords[3],
220  const cs_real_t outlet_axis_coords[3],
221  cs_real_t fan_radius,
222  cs_real_t blades_radius,
223  cs_real_t hub_radius,
224  const cs_real_t curve_coeffs[3],
225  cs_real_t axial_torque);
226 
227 /*----------------------------------------------------------------------------
228  * Destroy the structures associated with fans.
229  *----------------------------------------------------------------------------*/
230 
231 void
232 cs_fan_destroy_all(void);
233 
234 /*----------------------------------------------------------------------------
235  * Define the cells belonging to the different fans.
236  *
237  * parameters:
238  * mesh <-- associated mesh structure
239  * mesh_quantities <-- mesh quantities
240  *----------------------------------------------------------------------------*/
241 
242 void
244  const cs_mesh_quantities_t *mesh_quantities);
245 
246 /*----------------------------------------------------------------------------
247  * Compute the flows through the fans.
248  *
249  * parameters:
250  * mesh <-- mesh structure
251  * mesh_quantities <-- mesh quantities
252  * i_mass_flux <-- interior faces mass flux
253  * b_mass_flux <-- boundary faces mass flux
254  * c_rho <-- density at cells
255  * b_rho <-- density at boundary faces
256  *----------------------------------------------------------------------------*/
257 
258 void
260  const cs_mesh_quantities_t *mesh_quantities,
261  const cs_real_t i_mass_flux[],
262  const cs_real_t b_mass_flux[],
263  const cs_real_t c_rho[],
264  const cs_real_t b_rho[]);
265 
266 /*----------------------------------------------------------------------------
267  * Compute the force induced by the fans (needs a previous calculation
268  * of the flows through each fan).
269  *
270  * The induced force is added to the array CRVXEP (which can have other
271  * other contributions).
272  *
273  * parameters:
274  * mesh_quantities <-- mesh quantities
275  * source_coo_id <-- coordinate associated to the source term of velocity
276  * (0: X; 0: Y; 0: Z)
277  * source_t <-> explicit source term for the velocity
278  *----------------------------------------------------------------------------*/
279 
280 void
281 cs_fan_compute_force(const cs_mesh_quantities_t *mesh_quantities,
282  int source_coo_id,
283  cs_real_t source_t[]);
284 
285 /*----------------------------------------------------------------------------*/
286 
288 
289 #endif /* __CS_FAN_H__ */
void cs_fan_build_all(const cs_mesh_t *mesh, const cs_mesh_quantities_t *mesh_quantities)
Define the cells belonging to the different fans.
Definition: cs_fan.c:494
struct _cs_fan_t cs_fan_t
Definition: cs_fan.h:51
#define BEGIN_C_DECLS
Definition: cs_defs.h:419
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
void numvtl(cs_int_t indic[])
Definition: cs_fan.c:281
void cs_fan_compute_force(const cs_mesh_quantities_t *mesh_quantities, int source_coo_id, cs_real_t source_t[])
Compute the force induced by the fans (needs a previous calculation of the flows through each fan)...
Definition: cs_fan.c:837
Definition: cs_mesh.h:62
void inivtl(void)
Definition: cs_fan.c:260
void tstvtl(cs_int_t *const nbrvtl)
Definition: cs_fan.c:195
Definition: cs_mesh_quantities.h:51
void cs_fan_compute_flows(const cs_mesh_t *mesh, const cs_mesh_quantities_t *mesh_quantities, const cs_real_t i_mass_flux[], const cs_real_t b_mass_flux[], const cs_real_t c_rho[], const cs_real_t b_rho[])
Compute the flows through the fans.
Definition: cs_fan.c:688
void defvtl(const cs_int_t *dimmod, const cs_int_t *dimvtl, const cs_real_t xyzvt1[3], const cs_real_t xyzvt2[3], const cs_real_t *rvvt, const cs_real_t *rpvt, const cs_real_t *rmvt, const cs_real_t ccarac[3], const cs_real_t *tauvt)
Definition: cs_fan.c:227
void cs_fan_define(int model_dim, int fan_dim, const cs_real_t inlet_axis_coords[3], const cs_real_t outlet_axis_coords[3], cs_real_t fan_radius, cs_real_t blades_radius, cs_real_t hub_radius, const cs_real_t curve_coeffs[3], cs_real_t axial_torque)
Fan definition (added to the ones previously defined)
Definition: cs_fan.c:383
#define END_C_DECLS
Definition: cs_defs.h:420
double cs_real_t
Definition: cs_defs.h:296
#define CS_PROCF(x, y)
Definition: cs_defs.h:433
void debvtl(cs_real_t flumas[], cs_real_t flumab[], cs_real_t rhofac[], cs_real_t rhofab[], cs_real_t debent[], cs_real_t debsor[])
Definition: cs_fan.c:305
void tsvvtl(cs_int_t *idimts, cs_real_t crvexp[])
Definition: cs_fan.c:346
void cs_fan_destroy_all(void)
Destroy the structures associated with fans.
Definition: cs_fan.c:462
Definition: mesh.f90:26