9.2
general 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-2026 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 "base/cs_base.h"
39
40#include "mesh/cs_mesh.h"
42
43/*============================================================================
44 * Structure definition
45 *============================================================================*/
46
47typedef struct _cs_fan_t cs_fan_t;
48
49/*============================================================================
50 * Public function prototypes
51 *============================================================================*/
52
53/*----------------------------------------------------------------------------
54 * Fan definition (added to the ones previously defined)
55 *
56 * Fans are handled as explicit momentum source terms at the given location,
57 * based on the fan's axis and diameter.
58 * The fan's pressure characteristic curve is defined by 3 coefficients,
59 * such that:
60 * delta P = C_0 + C_1.flow + C_2.flow^2
61 * An axial torque may also be defined for the 3D model.
62 *
63 * parameters:
64 * fan_dim <-- fan dimension:
65 * 2: pseudo-2D (extruded mesh)
66 * 3: 3D (standard)
67 * mode <-- mode:
68 * 0: fan
69 * 1: wind turbine
70 * inlet_axis_coords <-- intersection coords. of axis and inlet face
71 * outlet_axis_coords <-- intersection coords. od axis and outlet face
72 * fan_radius <-- fan radius
73 * blades_radius <-- blades radius
74 * hub_radius <-- hub radius
75 * curve_coeffs <-- coefficients of degre 0, 1 and 2 of
76 * the pressure drop/flow rate
77 * characteristic curve
78 * axial_torque <-- fan axial torque
79 *----------------------------------------------------------------------------*/
80
81void
82cs_fan_define(int fan_dim,
83 int mode,
84 const cs_real_t inlet_axis_coords[3],
85 const cs_real_t outlet_axis_coords[3],
86 cs_real_t fan_radius,
87 cs_real_t blades_radius,
88 cs_real_t hub_radius,
89 const cs_real_t curve_coeffs[3],
90 cs_real_t axial_torque);
91
92/*----------------------------------------------------------------------------
93 * Destroy the structures associated with fans.
94 *----------------------------------------------------------------------------*/
95
96void
98
99/*----------------------------------------------------------------------------
100 * Return number of fans.
101 *
102 * returns:
103 * number of defined fans
104 *----------------------------------------------------------------------------*/
105
106int
107cs_fan_n_fans(void);
108
109/*----------------------------------------------------------------------------
110 * Create fans field.
111 *----------------------------------------------------------------------------*/
112
113void
115
116/*----------------------------------------------------------------------------
117 * Log fans definition setup information.
118 *----------------------------------------------------------------------------*/
119
120void
121cs_fan_log_setup(void);
122
123/*----------------------------------------------------------------------------
124 * Log fan information for a given iteration.
125 *----------------------------------------------------------------------------*/
126
127void
129
130/*----------------------------------------------------------------------------
131 * Define the cells belonging to the different fans.
132 *
133 * parameters:
134 * mesh <-- associated mesh structure
135 * mesh_quantities <-- mesh quantities
136 *----------------------------------------------------------------------------*/
137
138void
140 const cs_mesh_quantities_t *mesh_quantities);
141
142/*----------------------------------------------------------------------------
143 * Compute the flows through the fans.
144 *
145 * parameters:
146 * mesh <-- mesh structure
147 * mesh_quantities <-- mesh quantities
148 * i_mass_flux <-- interior faces mass flux
149 * b_mass_flux <-- boundary faces mass flux
150 * c_rho <-- density at cells
151 * b_rho <-- density at boundary faces
152 *----------------------------------------------------------------------------*/
153
154void
156 const cs_mesh_quantities_t *mesh_quantities,
157 const cs_real_t i_mass_flux[],
158 const cs_real_t b_mass_flux[],
159 const cs_real_t c_rho[],
160 const cs_real_t b_rho[]);
161
162/*----------------------------------------------------------------------------
163 * Compute the force induced by the fans (needs a previous calculation
164 * of the flows through each fan).
165 *
166 * The induced force is added to the array CRVXEP (which can have other
167 * other contributions).
168 *
169 * parameters:
170 * mesh_quantities <-- mesh quantities
171 * source_t <-> explicit source term for the velocity
172 *----------------------------------------------------------------------------*/
173
174void
175cs_fan_compute_force(const cs_mesh_quantities_t *mesh_quantities,
176 cs_real_3_t source_t[]);
177
178/*----------------------------------------------------------------------------
179 * Flag the cells belonging to the different fans
180 * (by the fan id, -1 otherwise)
181 *
182 * parameters:
183 * mesh <-- associated mesh structure
184 * cell_fan_id --> indicator by cell
185 *----------------------------------------------------------------------------*/
186
187void
189 int cell_fan_id[]);
190
191/*----------------------------------------------------------------------------
192 * Selection function for cells belonging to fans.
193 *
194 * This function may be used for the definition of postprocessing meshes.
195 *
196 * param
197 * \param[in, out] input pointer to input (unused here)
198 * \param[out] n_cells number of selected cells
199 * \param[out] cell_ids array of selected cell ids (0 to n-1 numbering)
200 */
201/*----------------------------------------------------------------------------*/
202
203void
204cs_fan_cells_select(void *input,
205 cs_lnum_t *n_cells,
206 cs_lnum_t **cell_ids);
207
208/*----------------------------------------------------------------------------*/
209
210#endif /* CS_FAN_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:349
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
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.cpp:717
void cs_fan_log_setup(void)
Log fans definition setup information.
Definition: cs_fan.cpp:309
struct _cs_fan_t cs_fan_t
Definition: cs_fan.h:47
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.cpp:923
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.cpp:391
int cs_fan_n_fans(void)
Return number of fans.
Definition: cs_fan.cpp:274
void cs_fan_field_create(void)
Definition: cs_fan.cpp:284
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.cpp:583
void cs_fan_destroy_all(void)
Destroy the structures associated with fans.
Definition: cs_fan.cpp:252
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.cpp:169
void cs_fan_log_iteration(void)
Log fan information for a given iteration.
Definition: cs_fan.cpp:355
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.cpp:875
Definition: mesh.f90:26
Definition: cs_mesh_quantities.h:88
Definition: cs_mesh.h:85