My Project
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-2019 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  * Compute the flows through the fans
59  *
60  * Fortran interface:
61  *
62  * subroutine debvtl
63  * *****************
64  *
65  * double precision flumas(*) : <-- : interior faces mass flux
66  * double precision flumab(*) : <-- : boundary faces mass flux
67  * double precision rhofac(*) : <-- : density at cells
68  * double precision rhofab(*) : <-- : density at boundary faces
69  *----------------------------------------------------------------------------*/
70 
71 void CS_PROCF (debvtl, DEBVTL)
72 (
73  cs_real_t flumas[],
75  cs_real_t rhofac[],
77 );
78 
79 /*----------------------------------------------------------------------------
80  * Compute the force induced by the fans (needs a previous calculation
81  * of the flows through each fan).
82  *
83  * The induced force is added to the array crvxep (which can have other
84  * contributions).
85  *
86  * Fortran interface:
87  *
88  * subroutine tsvvtl
89  * *****************
90  *
91  * parameters:
92  * crvexp <-> Explicit source term (velocity)
93  *----------------------------------------------------------------------------*/
94 
95 void CS_PROCF (tsvvtl, TSVVTL)
96 (
98 );
99 
100 /*============================================================================
101  * Public function prototypes
102  *============================================================================*/
103 
104 /*----------------------------------------------------------------------------
105  * Fan definition (added to the ones previously defined)
106  *
107  * Fans are handled as explicit momentum source terms at the given location,
108  * based on the fan's axis and diameter.
109  * The fan's pressure characteristic curve is defined by 3 coefficients,
110  * such that:
111  * delta P = C_0 + C_1.flow + C_2.flow^2
112  * An axial torque may also be defined for the 3D model.
113  *
114  * parameters:
115  * fan_dim <-- fan dimension:
116  * 2: pseudo-2D (extruded mesh)
117  * 3: 3D (standard)
118  * inlet_axis_coords <-- intersection coords. of axis and inlet face
119  * outlet_axis_coords <-- intersection coords. od axis and outlet face
120  * fan_radius <-- fan radius
121  * blades_radius <-- blades radius
122  * hub_radius <-- hub radius
123  * curve_coeffs <-- coefficients of degre 0, 1 and 2 of
124  * the pressure drop/flow rate
125  * characteristic curve
126  * axial_torque <-- fan axial torque
127  *----------------------------------------------------------------------------*/
128 
129 void
130 cs_fan_define(int fan_dim,
131  const cs_real_t inlet_axis_coords[3],
132  const cs_real_t outlet_axis_coords[3],
133  cs_real_t fan_radius,
134  cs_real_t blades_radius,
135  cs_real_t hub_radius,
136  const cs_real_t curve_coeffs[3],
137  cs_real_t axial_torque);
138 
139 /*----------------------------------------------------------------------------
140  * Destroy the structures associated with fans.
141  *----------------------------------------------------------------------------*/
142 
143 void
144 cs_fan_destroy_all(void);
145 
146 /*----------------------------------------------------------------------------
147  * Return number of fans.
148  *
149  * returns:
150  * number of defined fans
151  *----------------------------------------------------------------------------*/
152 
153 int
154 cs_fan_n_fans(void);
155 
156 /*----------------------------------------------------------------------------
157  * Log fans definition setup information.
158  *----------------------------------------------------------------------------*/
159 
160 void
161 cs_fan_log_setup(void);
162 
163 /*----------------------------------------------------------------------------
164  * Log fan information for a given iteration.
165  *----------------------------------------------------------------------------*/
166 
167 void
169 
170 /*----------------------------------------------------------------------------
171  * Define the cells belonging to the different fans.
172  *
173  * parameters:
174  * mesh <-- associated mesh structure
175  * mesh_quantities <-- mesh quantities
176  *----------------------------------------------------------------------------*/
177 
178 void
180  const cs_mesh_quantities_t *mesh_quantities);
181 
182 /*----------------------------------------------------------------------------
183  * Compute the flows through the fans.
184  *
185  * parameters:
186  * mesh <-- mesh structure
187  * mesh_quantities <-- mesh quantities
188  * i_mass_flux <-- interior faces mass flux
189  * b_mass_flux <-- boundary faces mass flux
190  * c_rho <-- density at cells
191  * b_rho <-- density at boundary faces
192  *----------------------------------------------------------------------------*/
193 
194 void
196  const cs_mesh_quantities_t *mesh_quantities,
197  const cs_real_t i_mass_flux[],
198  const cs_real_t b_mass_flux[],
199  const cs_real_t c_rho[],
200  const cs_real_t b_rho[]);
201 
202 /*----------------------------------------------------------------------------
203  * Compute the force induced by the fans (needs a previous calculation
204  * of the flows through each fan).
205  *
206  * The induced force is added to the array CRVXEP (which can have other
207  * other contributions).
208  *
209  * parameters:
210  * mesh_quantities <-- mesh quantities
211  * source_t <-> explicit source term for the velocity
212  *----------------------------------------------------------------------------*/
213 
214 void
215 cs_fan_compute_force(const cs_mesh_quantities_t *mesh_quantities,
216  cs_real_3_t source_t[]);
217 
218 /*----------------------------------------------------------------------------
219  * Flag the cells belonging to the different fans
220  * (by the fan id, -1 otherwise)
221  *
222  * parameters:
223  * mesh <-- associated mesh structure
224  * cell_fan_id --> indicator by cell
225  *----------------------------------------------------------------------------*/
226 
227 void
229  int cell_fan_id[]);
230 
231 /*----------------------------------------------------------------------------
232  * Selection function for cells belonging to fans.
233  *
234  * This function may be used for the definition of postprocessing meshes.
235  *
236  * param
237  * \param[in, out] input pointer to input (unused here)
238  * \param[out] n_cells number of selected cells
239  * \param[out] cell_ids array of selected cell ids (0 to n-1 numbering)
240  */
241 /*----------------------------------------------------------------------------*/
242 
243 void
245  cs_lnum_t *n_cells,
246  cs_lnum_t **cell_ids);
247 
248 /*----------------------------------------------------------------------------*/
249 
251 
252 #endif /* __CS_FAN_H__ */
input
static int input(void)
cs_fan_log_iteration
void cs_fan_log_iteration(void)
Log fan information for a given iteration.
Definition: cs_fan.c:383
cs_fan_destroy_all
void cs_fan_destroy_all(void)
Destroy the structures associated with fans.
Definition: cs_fan.c:304
cs_real_3_t
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:315
cs_fan_build_all
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:417
cs_fan_n_fans
int cs_fan_n_fans(void)
Return number of fans.
Definition: cs_fan.c:326
cs_fan_log_setup
void cs_fan_log_setup(void)
Log fans definition setup information.
Definition: cs_fan.c:338
rhofac
void cs_real_t cs_real_t rhofac[]
Definition: cs_fan.h:74
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
crvexp
void cs_real_t cs_real_t cs_real_t crvexp[]
Definition: cs_lagr_precipitation_model.h:42
cs_fan_t
struct _cs_fan_t cs_fan_t
Definition: cs_fan.h:51
cs_fan_cells_select
void cs_fan_cells_select(void *input, cs_lnum_t *n_cells, cs_lnum_t **cell_ids)
Selection function for cells belonging to fans.
Definition: cs_fan.c:956
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_fan_define
void cs_fan_define(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:226
cs_mesh_quantities.h
cs_mesh_quantities_t
Definition: cs_mesh_quantities.h:90
mesh
Definition: mesh.f90:26
cs_mesh.h
rhofab
void cs_real_t cs_real_t cs_real_t rhofab[]
Definition: cs_fan.h:74
cs_fan_compute_flows
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:610
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_fan_compute_force
void cs_fan_compute_force(const cs_mesh_quantities_t *mesh_quantities, cs_real_3_t source_t[])
Compute the force induced by the fans (needs a previous calculation of the flows through each fan).
Definition: cs_fan.c:750
cs_fan_flag_cells
void cs_fan_flag_cells(const cs_mesh_t *mesh, int cell_fan_id[])
Flag the cells belonging to the different fans (by the fan id, -1 otherwise)
Definition: cs_fan.c:904
flumab
void cs_real_t flumab[]
Definition: cs_fan.h:74
cs_mesh_t
Definition: cs_mesh.h:63
cs_base.h
CS_PROCF
void CS_PROCF(debvtl, DEBVTL)(cs_real_t flumas[]