8.2
general documentation
Loading...
Searching...
No Matches
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-2024 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
51typedef 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
71void CS_PROCF (debvtl, DEBVTL)
72(
73 cs_real_t flumas[],
74 cs_real_t flumab[],
75 cs_real_t rhofac[],
76 cs_real_t rhofab[]
77);
78
79/*============================================================================
80 * Public function prototypes
81 *============================================================================*/
82
83/*----------------------------------------------------------------------------
84 * Fan definition (added to the ones previously defined)
85 *
86 * Fans are handled as explicit momentum source terms at the given location,
87 * based on the fan's axis and diameter.
88 * The fan's pressure characteristic curve is defined by 3 coefficients,
89 * such that:
90 * delta P = C_0 + C_1.flow + C_2.flow^2
91 * An axial torque may also be defined for the 3D model.
92 *
93 * parameters:
94 * fan_dim <-- fan dimension:
95 * 2: pseudo-2D (extruded mesh)
96 * 3: 3D (standard)
97 * mode <-- mode:
98 * 0: fan
99 * 1: wind turbine
100 * inlet_axis_coords <-- intersection coords. of axis and inlet face
101 * outlet_axis_coords <-- intersection coords. od axis and outlet face
102 * fan_radius <-- fan radius
103 * blades_radius <-- blades radius
104 * hub_radius <-- hub radius
105 * curve_coeffs <-- coefficients of degre 0, 1 and 2 of
106 * the pressure drop/flow rate
107 * characteristic curve
108 * axial_torque <-- fan axial torque
109 *----------------------------------------------------------------------------*/
110
111void
112cs_fan_define(int fan_dim,
113 int mode,
114 const cs_real_t inlet_axis_coords[3],
115 const cs_real_t outlet_axis_coords[3],
116 cs_real_t fan_radius,
117 cs_real_t blades_radius,
118 cs_real_t hub_radius,
119 const cs_real_t curve_coeffs[3],
120 cs_real_t axial_torque);
121
122/*----------------------------------------------------------------------------
123 * Destroy the structures associated with fans.
124 *----------------------------------------------------------------------------*/
125
126void
128
129/*----------------------------------------------------------------------------
130 * Return number of fans.
131 *
132 * returns:
133 * number of defined fans
134 *----------------------------------------------------------------------------*/
135
136int
137cs_fan_n_fans(void);
138
139/*----------------------------------------------------------------------------
140 * Log fans definition setup information.
141 *----------------------------------------------------------------------------*/
142
143void
144cs_fan_log_setup(void);
145
146/*----------------------------------------------------------------------------
147 * Log fan information for a given iteration.
148 *----------------------------------------------------------------------------*/
149
150void
152
153/*----------------------------------------------------------------------------
154 * Define the cells belonging to the different fans.
155 *
156 * parameters:
157 * mesh <-- associated mesh structure
158 * mesh_quantities <-- mesh quantities
159 *----------------------------------------------------------------------------*/
160
161void
163 const cs_mesh_quantities_t *mesh_quantities);
164
165/*----------------------------------------------------------------------------
166 * Compute the flows through the fans.
167 *
168 * parameters:
169 * mesh <-- mesh structure
170 * mesh_quantities <-- mesh quantities
171 * i_mass_flux <-- interior faces mass flux
172 * b_mass_flux <-- boundary faces mass flux
173 * c_rho <-- density at cells
174 * b_rho <-- density at boundary faces
175 *----------------------------------------------------------------------------*/
176
177void
179 const cs_mesh_quantities_t *mesh_quantities,
180 const cs_real_t i_mass_flux[],
181 const cs_real_t b_mass_flux[],
182 const cs_real_t c_rho[],
183 const cs_real_t b_rho[]);
184
185/*----------------------------------------------------------------------------
186 * Compute the force induced by the fans (needs a previous calculation
187 * of the flows through each fan).
188 *
189 * The induced force is added to the array CRVXEP (which can have other
190 * other contributions).
191 *
192 * parameters:
193 * mesh_quantities <-- mesh quantities
194 * source_t <-> explicit source term for the velocity
195 *----------------------------------------------------------------------------*/
196
197void
198cs_fan_compute_force(const cs_mesh_quantities_t *mesh_quantities,
199 cs_real_3_t source_t[]);
200
201/*----------------------------------------------------------------------------
202 * Flag the cells belonging to the different fans
203 * (by the fan id, -1 otherwise)
204 *
205 * parameters:
206 * mesh <-- associated mesh structure
207 * cell_fan_id --> indicator by cell
208 *----------------------------------------------------------------------------*/
209
210void
212 int cell_fan_id[]);
213
214/*----------------------------------------------------------------------------
215 * Selection function for cells belonging to fans.
216 *
217 * This function may be used for the definition of postprocessing meshes.
218 *
219 * param
220 * \param[in, out] input pointer to input (unused here)
221 * \param[out] n_cells number of selected cells
222 * \param[out] cell_ids array of selected cell ids (0 to n-1 numbering)
223 */
224/*----------------------------------------------------------------------------*/
225
226void
227cs_fan_cells_select(void *input,
228 cs_lnum_t *n_cells,
229 cs_lnum_t **cell_ids);
230
231/*----------------------------------------------------------------------------*/
232
234
235#endif /* __CS_FAN_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:528
double cs_real_t
Floating-point value.
Definition cs_defs.h:332
#define CS_PROCF(x, y)
Definition cs_defs.h:560
#define END_C_DECLS
Definition cs_defs.h:529
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:325
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition cs_defs.h:347
void debvtl(cs_real_t flumas[], cs_real_t flumab[], cs_real_t rho[], cs_real_t rhofab[])
Definition cs_fan.c:157
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:734
void cs_fan_log_setup(void)
Log fans definition setup information.
Definition cs_fan.c:323
struct _cs_fan_t cs_fan_t
Definition cs_fan.h:51
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:941
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:405
int cs_fan_n_fans(void)
Return number of fans.
Definition cs_fan.c:311
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:600
void cs_fan_destroy_all(void)
Destroy the structures associated with fans.
Definition cs_fan.c:289
void cs_fan_define(int fan_dim, int mode, 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:206
void cs_fan_log_iteration(void)
Log fan information for a given iteration.
Definition cs_fan.c:369
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:893
Definition mesh.f90:26
Definition cs_mesh_quantities.h:92
Definition cs_mesh.h:85