6.2
general documentation
cs_les_inflow.h
Go to the documentation of this file.
1 
2 #ifndef __CS_LES_INFLOW_H__
3 #define __CS_LES_INFLOW_H__
4 
5 /*============================================================================
6  * Turbulent inflow generation
7  *============================================================================*/
8 
9 /*
10  This file is part of Code_Saturne, a general-purpose CFD tool.
11 
12  Copyright (C) 1998-2020 EDF S.A.
13 
14  This program is free software; you can redistribute it and/or modify it under
15  the terms of the GNU General Public License as published by the Free Software
16  Foundation; either version 2 of the License, or (at your option) any later
17  version.
18 
19  This program is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22  details.
23 
24  You should have received a copy of the GNU General Public License along with
25  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26  Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 */
28 
29 /*----------------------------------------------------------------------------*/
30 
31 #include "cs_defs.h"
32 
33 /*----------------------------------------------------------------------------
34  * Local headers
35  *----------------------------------------------------------------------------*/
36 
37 #include "cs_base.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*============================================================================
44  * Macro definitions
45  *============================================================================*/
46 
47 /*============================================================================
48  * Type definitions
49  *============================================================================*/
50 
51 /*----------------------------------------------------------------------------
52  * Type of synthetic turbulence generation
53  *----------------------------------------------------------------------------*/
54 
55 typedef enum {
56 
57  CS_INFLOW_LAMINAR, /* Laminar fluctuations (i.e no fluctuation) */
58  CS_INFLOW_RANDOM, /* Gaussian random fluctuation */
59  CS_INFLOW_BATTEN, /* Fluctuations generated by the Batten method */
60  CS_INFLOW_SEM /* Fluctuations generated by the Synthetic Eddy Method */
61 
63 
64 /*=============================================================================
65  * Local Structure Definitions
66  *============================================================================*/
67 
68 /* Inlet definition */
69 /*------------------*/
70 
71 typedef struct _cs_inlet_t cs_inlet_t;
72 
73 typedef struct {
74 
75  int n_structures; /* Number of coherent structures */
76  int volume_mode; /* Indicator to use classic inlet SEM (0)
77  or volumic SEM over the domain */
78  cs_real_t *position; /* Position of the structures */
79  cs_real_t *energy; /* Anisotropic energy of the structures */
80 
82 
83 /*=============================================================================
84  * Public function prototypes for Fortran API
85  *============================================================================*/
86 
87 /*----------------------------------------------------------------------------
88  * Creation of a structure for the inlets
89  *----------------------------------------------------------------------------*/
90 
91 void CS_PROCF(defsyn, DEFSYN)
92 (
93  int *n_inlets, /* <-- number of inlets */
94  int *n_structures, /* <-- number of structures */
95  int *volume_mode /* <-- Variable to use classic SEM or
96  volume SEM */
97 );
98 
99 /*----------------------------------------------------------------------------
100  * General synthetic turbulence generation
101  *----------------------------------------------------------------------------*/
102 
103 void CS_PROCF(synthe, SYNTHE)
104 (
105  const int *const nvar, /* --> number of variables */
106  const int *const nscal, /* --> number of scalars */
107  const int *const iu, /* --> index of velocity component */
108  const int *const iv, /* --> index of velocity component */
109  const int *const iw, /* --> index of velocity component */
110  const cs_real_t *const ttcabs, /* --> current physical time */
111  const cs_real_t dt[], /* --> time step */
112  cs_real_t rcodcl[] /* <-> boundary conditions array */
113 );
114 
115 void CS_PROCF(cs_user_les_inflow_init, CS_USER_LES_INFLOW_INIT)(
116  int *nent, /* <-- number of LES inlets */
117  int *nstruct, /* <-- numb. of entities of the inflow meth*/
118  int *volmode /* <-- volumic SEM mode or normal one */
119 );
120 
121 void CS_PROCF(cs_user_les_inflow_define, CS_USER_LES_INFLOW_DEFINE)(
122  const int *const nument, /* --> id of the inlet */
123  int *typent, /* <-- type of inflow method at the inlet */
124  int *iverbo, /* <-- verbosity level */
125  cs_lnum_t *nfbent, /* <-- numb. of bound. faces of the inlet */
126  cs_lnum_t lfbent[], /* <-- list of bound. faces of the inlet */
127  cs_real_t vitent[], /* <-- ref. mean velocity at the inlet */
128  cs_real_t *enrent, /* <-- ref. turb. kin. ener. at the inlet */
129  cs_real_t *dspent /* <-- ref. turb. dissipation at the inlet */
130 );
131 
132 void CS_PROCF(cs_user_les_inflow_advanced, CS_USER_LES_INFLOW_ADVANCED)(
133  const int *const nument, /* --> id of the inlet */
134  const cs_lnum_t *const nfbent, /* --> numb. of bound. faces of the inlet */
135  const int *const nvar, /* --> number of variables */
136  const int *const nscal, /* --> number of scalars */
137  const cs_lnum_t lfbent[], /* --> list of bound. faces of the inlet */
138  const cs_real_t dt[], /* --> time step */
139  cs_real_t uent[], /* <-- mean velocity at the inlet faces */
140  cs_real_t rijent[], /* <-- turb. kin. ener. at the inlet faces */
141  cs_real_t epsent[] /* <-- turb. dissipation at the inlet faces*/
142 );
143 
144 /*----------------------------------------------------------------------------
145  * Read the restart file of the LES inflow module
146  *
147  * Fortran interface:
148  *
149  * SUBROUTINE LECSYN
150  * *****************
151  *
152  * character(kind=c_char) filename : <-- : Name of the restart file
153  *----------------------------------------------------------------------------*/
154 
155 void CS_PROCF(lecsyn, LECSYN)
156 (
157  const char *filename
158 );
159 
160 /*----------------------------------------------------------------------------
161  * Write the restart file of les inflow module
162  *
163  * Fortran interface:
164  *
165  * SUBROUTINE ECRSYN
166  * *****************
167  *
168  * character(kind=c_char) filename : <-- : Name of the restart file
169  *----------------------------------------------------------------------------*/
170 
171 void CS_PROCF(ecrsyn, ECRSYN)
172 (
173  const char *filename
174 );
175 
176 /*=============================================================================
177  * Public function prototypes
178  *============================================================================*/
179 
180 /*----------------------------------------------------------------------------
181  * Finalize turbulent inflow generation API.
182  *----------------------------------------------------------------------------*/
183 
184 void
185 cs_inflow_finalize(void);
186 
187 /*----------------------------------------------------------------------------
188  * Generation of synthetic turbulence via the Synthetic Eddy Method (SEM).
189  *
190  * parameters:
191  * n_points --> Local number of points where turbulence is generated
192  * num_face --> Local id of inlet boundary faces
193  * point_coordinates --> Coordinates of the points
194  * point_ponderation --> Ponderation of the points (surface, volume or NULL)
195  * initialize --> Indicator of initialization
196  * verbosity --> Indicator of verbosity level
197  * inflow --> Specific structure for Batten method
198  * time_step --> Time step at the present iteration
199  * velocity --> Velocity at each point
200  * reynolds_stresses --> Reynolds stresses at each point
201  * dissipation_rate --> Dissipation rate at each point
202  * fluctuations <-- Velocity fluctuations generated at each point
203  *----------------------------------------------------------------------------*/
204 
205 void
207  const cs_lnum_t *num_face,
208  const cs_real_t *point_coordinates,
209  const cs_real_t *point_ponderation,
210  int initialize,
211  int verbosity,
212  cs_inflow_sem_t *inflow,
213  cs_real_t time_step,
214  const cs_real_t *velocity,
215  const cs_real_t *reynolds_stresses,
216  const cs_real_t *dissipation_rate,
217  cs_real_t *fluctuations);
218 
219 /*----------------------------------------------------------------------------
220  * Rescaling of the fluctuations by the statistics following the Lund method.
221  *
222  * One assumes that the statistics are interlaced and ordered as follow :
223  * <u'u'> <v'v'> <w'w'> <u'v'> <u'w'> <v'w'>
224  *
225  * parameters:
226  * n_points --> Local number of points where turbulence is generated
227  * statistics --> Statistics (i.e. Reynolds stresses)
228  * fluctuations <-- Velocity fluctuations generated
229  *----------------------------------------------------------------------------*/
230 
231 void
233  cs_real_t *statistics,
234  cs_real_t *fluctuations);
235 
236 /*----------------------------------------------------------------------------*/
237 
239 
240 #endif /* __CS_LES_INFLOW_H__ */
void cs_user_les_inflow_advanced(const int *const nument, const cs_lnum_t *const nfbent, const int *const nvar, const int *const nscal, const cs_lnum_t lfbent[], const cs_real_t dt[], cs_real_t uent[], cs_real_t rijent[], cs_real_t epsent[])
Definition: cs_les_inflow.h:59
int volume_mode
Definition: cs_les_inflow.h:76
cs_inflow_type_t
Definition: cs_les_inflow.h:55
integer, save iv
Definition: numvar.f90:63
void lecsyn(const char *filename)
Definition: cs_les_inflow.c:1058
integer, save iu
Definition: numvar.f90:59
void cs_inflow_finalize(void)
Definition: cs_les_inflow.c:1602
void ecrsyn(const char *filename)
Definition: cs_les_inflow.c:1401
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
cs_real_t * energy
Definition: cs_les_inflow.h:79
Definition: cs_les_inflow.h:57
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
real(c_double), pointer, save ttcabs
Current absolute time.
Definition: optcal.f90:359
integer, save iw
Definition: numvar.f90:67
void synthe(const int *const nvar, const int *const nscal, const int *const iu, const int *const iv, const int *const iw, const cs_real_t *const ttcabs, const cs_real_t dt[], cs_real_t rcodcl[])
Definition: cs_les_inflow.c:792
Definition: cs_field_pointer.h:65
void cs_les_synthetic_eddy_method(cs_lnum_t n_points, const cs_lnum_t *num_face, const cs_real_t *point_coordinates, const cs_real_t *point_ponderation, int initialize, int verbosity, cs_inflow_sem_t *inflow, cs_real_t time_step, const cs_real_t *velocity, const cs_real_t *reynolds_stresses, const cs_real_t *dissipation_rate, cs_real_t *fluctuations)
Definition: cs_les_inflow.c:1757
void cs_user_les_inflow_define(const int *const nument, int *typent, int *iverbo, cs_lnum_t *nfbent, cs_lnum_t lfbent[], cs_real_t vitent[], cs_real_t *enrent, cs_real_t *dspent)
void defsyn(int *n_inlets, int *n_structures, int *volume_mode)
Definition: cs_les_inflow.c:693
void cs_les_rescale_fluctuations(cs_lnum_t n_points, cs_real_t *statistics, cs_real_t *fluctuations)
Definition: cs_les_inflow.c:2242
integer, save nvar
number of solved variables (must be lower than nvarmx)
Definition: dimens.f90:42
int n_structures
Definition: cs_les_inflow.h:75
Definition: cs_les_inflow.h:73
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
struct _cs_inlet_t cs_inlet_t
Definition: cs_les_inflow.h:71
#define END_C_DECLS
Definition: cs_defs.h:496
cs_real_t * position
Definition: cs_les_inflow.h:78
integer, save nscal
number of solved user scalars effective number of scalars solutions of an advection equation...
Definition: dimens.f90:55
#define CS_PROCF(x, y)
Definition: cs_defs.h:509
Definition: cs_les_inflow.h:60
void cs_user_les_inflow_init(int *nent, int *nstruct, int *volmode)
Definition: cs_les_inflow.h:58