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