9.2
general documentation
cs_atmo_chemistry.h
Go to the documentation of this file.
1#ifndef CS_ATMO_CHEMISTRY_H
2#define CS_ATMO_CHEMISTRY_H
3
4/*============================================================================
5 * Main for atmospheric chemistry related functions
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 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_defs.h"
35
36/*============================================================================
37 * Local Macro definitions
38 *============================================================================*/
39
40/*============================================================================
41 * Type definitions
42 *============================================================================*/
43
44/*----------------------------------------------------------------------------
45 * Atmospheric aerosol external library
46 *----------------------------------------------------------------------------*/
47
48typedef enum {
49
52
54
55/*----------------------------------------------------------------------------
56 * Atmospheric chemistry options descriptor
57 *----------------------------------------------------------------------------*/
58
59typedef struct {
60
68 int model;
71
74
75 /* Flag to deactivate photolysis */
77
82
92 int n_size;
114
115 // option for chemestry profiles file
116
124
137
139
140/*----------------------------------------------------------------------------
141 * Useful constants for chemistry
142 *----------------------------------------------------------------------------*/
143
144/*============================================================================
145 * Static global variables
146 *============================================================================*/
147
150
151/*============================================================================
152 * Public function prototypes
153 *============================================================================*/
154
155/*----------------------------------------------------------------------------*/
156/*
157 * \brief This function initializes the external aerosol code
158 */
159/*----------------------------------------------------------------------------*/
160
161void
163
164/*----------------------------------------------------------------------------*/
165/*
166 * \brief This function finalizes the external aerosol code.
167 */
168/*----------------------------------------------------------------------------*/
169
170void
172
173/*----------------------------------------------------------------------------*/
174/*
175 * \brief This function fills the given array with gas concentrations from
176 * the external aerosol code.
177 *
178 * \param[out] array gas concentrations
179 */
180/*----------------------------------------------------------------------------*/
181
182void
184
185/*----------------------------------------------------------------------------*/
186/*
187 * \brief This function computes a time step of gaseous chemistry and aerosols
188 * dynamic using the external aerosol code.
189 */
190/*----------------------------------------------------------------------------*/
191
192void
194
195/*----------------------------------------------------------------------------*/
196/*
197 * \brief Deactivate chemistry initialization procedure
198 */
199/*----------------------------------------------------------------------------*/
200
201void
203
204/*----------------------------------------------------------------------------*/
205/*
206 * \brief initialize gaseous and particulate concentrations and aerosol number
207 */
208/*----------------------------------------------------------------------------*/
209
210void
212
213/*----------------------------------------------------------------------------*/
217/*----------------------------------------------------------------------------*/
218
219void
221
222/*----------------------------------------------------------------------------*/
223/*
224 * \brief Initialize chemistry cell kinetic rates arrays.
225 */
226/*----------------------------------------------------------------------------*/
227
228void
230
231/*----------------------------------------------------------------------------*/
235/*----------------------------------------------------------------------------*/
236
237void
239
240/*----------------------------------------------------------------------------*/
241/*
242 * \brief Print the atmospheric chemistry options to setup.log.
243 */
244/*----------------------------------------------------------------------------*/
245
246void
248
249/*----------------------------------------------------------------------------*/
250/*
251 * \brief Print the atmospheric aerosols options to setup.log.
252 */
253/*----------------------------------------------------------------------------*/
254
255void
257
258/*----------------------------------------------------------------------------*/
259/*
260 * \brief Check if the chemistry module needs initialization
261 *
262 * \return int value : 1 if needed, 0 if not
263 */
264/*----------------------------------------------------------------------------*/
265
266int
268
269/*----------------------------------------------------------------------------*/
270/*
271 * \brief This function sets the file name to initialize the aerosol library.
272 *
273 * \param[in] file_name name of the file.
274 */
275/*----------------------------------------------------------------------------*/
276
277void
278cs_atmo_chemistry_set_aerosol_file_name(const char *file_name);
279
280/*----------------------------------------------------------------------------*/
281/*
282 * \brief This function set the file name of the SPACK file.
283 *
284 * \param[in] file_name name of the file.
285 */
286/*----------------------------------------------------------------------------*/
287
288void
289cs_atmo_chemistry_set_spack_file_name(const char *file_name);
290
291/*----------------------------------------------------------------------------*/
292/*
293 * \brief This function declare additional transported variables for
294 * atmospheric module for the chemistry defined from SPACK.
295 */
296/*----------------------------------------------------------------------------*/
297
298void
300
301/*----------------------------------------------------------------------------*/
302/*
303 * \brief Initialize chemistry array.
304 */
305/*----------------------------------------------------------------------------*/
306
307void
309
310/*----------------------------------------------------------------------------*/
311/*
312 * \brief Reads initial aerosol concentration and number
313 */
314/*----------------------------------------------------------------------------*/
315
316void
318
319/*----------------------------------------------------------------------------*/
320/*
321 * \brief Reads the chemistry profile data for the atmospheric chemistry
322 *
323 * \param[in] mode if false reading of dimensions only else reading of data
324 */
325/*----------------------------------------------------------------------------*/
326
327void
329
330/*----------------------------------------------------------------------------*/
336/*----------------------------------------------------------------------------*/
337
338void
339cs_atmo_set_aero_conc_file_name(const char *file_name);
340
341/*----------------------------------------------------------------------------*/
342/*
343 * \brief This function set the file name of the chemistry concentration file.
344 *
345 * \param[in] file_name name of the file.
346 */
347/*----------------------------------------------------------------------------*/
348
349void
350cs_atmo_set_chem_conc_file_name(const char *file_name);
351
352/*----------------------------------------------------------------------------*/
353/*
354 * \brief Computes the explicit chemical source term for atmospheric
355 * chemistry in case of a semi-coupled resolution
356 *
357 * \param[in] f_id field id
358 * \param[out] st_exp explicit part of the source term
359 */
360/*----------------------------------------------------------------------------*/
361
362void
364 cs_real_t st_exp[]);
365
366/*----------------------------------------------------------------------------*/
367/*
368 * \brief Calls the rosenbrock resolution for atmospheric chemistry
369 */
370/*----------------------------------------------------------------------------*/
371
372void
374
375/*----------------------------------------------------------------------------*/
376
377#endif /* CS_ATMO_CHEMISTRY_H */
void cs_atmo_declare_chem_from_spack(void)
This function declares additional transported variables for atmospheric module for the chemistry defi...
Definition: cs_atmo_chemistry.cpp:1291
void cs_atmo_aerosol_time_advance(void)
This function computes a time step of gaseous chemistry and aerosols dynamic using the external aeros...
Definition: cs_atmo_chemistry.cpp:596
void cs_atmo_chem_exp_source_terms(int f_id, cs_real_t st_exp[])
Computes the explicit chemical source term for atmospheric chemistry in case of a semi-coupled resolu...
Definition: cs_atmo_chemistry.cpp:1623
void cs_atmo_aerosol_get_gas(cs_real_t *array)
This function fills the given array with gas concentrations from the external aerosol code.
Definition: cs_atmo_chemistry.cpp:580
void cs_atmo_aerosol_initialize(void)
This function initializes the external aerosol code.
Definition: cs_atmo_chemistry.cpp:545
int cs_atmo_chemistry_need_initialization(void)
Check if the chemistry module needs initialization.
Definition: cs_atmo_chemistry.cpp:1398
void cs_atmo_aerosol_log_setup(void)
Print the atmospheric aerosols options to setup.log.
Definition: cs_atmo_chemistry.cpp:1521
void cs_atmo_chemistry_initialization_deactivate(void)
Deactivate chemistry initialization procedure.
Definition: cs_atmo_chemistry.cpp:1384
void cs_atmo_set_aero_conc_file_name(const char *file_name)
This function set the file name of the aerosol concentration file.
Definition: cs_atmo_chemistry.cpp:960
void cs_atmo_read_aerosol(void)
Reads initial aerosol concentration and number.
Definition: cs_atmo_chemistry.cpp:611
void cs_atmo_chemistry_set_spack_file_name(const char *file_name)
This function set the file name of the SPACK file.
Definition: cs_atmo_chemistry.cpp:1242
cs_atmo_chemistry_t * cs_glob_atmo_chemistry
void cs_atmo_chemistry_finalize(void)
Finalize atmospheric chemistry structures.
Definition: cs_atmo_chemistry.cpp:1427
void cs_atmo_read_chemistry_profile(int mode)
Reads the chemistry profile data for the atmospheric chemistry.
Definition: cs_atmo_chemistry.cpp:697
void cs_atmo_chemistry_initialize_reacnum(void)
Initialize chemistry cell kinetic rates arrays.
Definition: cs_atmo_chemistry.cpp:1410
cs_atmo_aerosol_type_t
Definition: cs_atmo_chemistry.h:48
@ CS_ATMO_AEROSOL_SSH
Definition: cs_atmo_chemistry.h:51
@ CS_ATMO_AEROSOL_OFF
Definition: cs_atmo_chemistry.h:50
void cs_atmo_chem_initialize_dlconc0(void)
initialize gaseous and particulate concentrations and aerosol number
Definition: cs_atmo_chemistry.cpp:1567
void cs_atmo_set_chem_conc_file_name(const char *file_name)
This function set the file name of the chemistry file.
Definition: cs_atmo_chemistry.cpp:931
void cs_atmo_chemistry_log_setup(void)
Print the atmospheric chemistry options to setup.log.
Definition: cs_atmo_chemistry.cpp:1456
void cs_atmo_chemistry_set_aerosol_file_name(const char *file_name)
This function sets the file name to initialize the aerosol library.
Definition: cs_atmo_chemistry.cpp:1267
void cs_atmo_chemistry_initialize_conc_profiles(void)
initialize (allocate) chemistry concentrations profiles
Definition: cs_atmo_chemistry.cpp:1586
void cs_atmo_init_chemistry(void)
Initialize chemistry array.
Definition: cs_atmo_chemistry.cpp:990
void cs_atmo_aerosol_finalize(void)
This function finalizes the external aerosol code.
Definition: cs_atmo_chemistry.cpp:560
void cs_atmo_compute_gaseous_chemistry(void)
Calls the rosenbrock resolution for atmospheric chemistry.
Definition: cs_atmo_chemistry.cpp:1724
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
Definition: cs_atmo_chemistry.h:59
bool init_gas_with_lib
Definition: cs_atmo_chemistry.h:86
int model
Definition: cs_atmo_chemistry.h:68
cs_real_t * molar_mass
Definition: cs_atmo_chemistry.h:97
cs_real_t * dlconc0
Definition: cs_atmo_chemistry.h:105
int n_species
Definition: cs_atmo_chemistry.h:69
cs_atmo_aerosol_type_t aerosol_model
Definition: cs_atmo_chemistry.h:81
char * aero_file_name
Definition: cs_atmo_chemistry.h:107
cs_real_t * x_conc_profiles
Definition: cs_atmo_chemistry.h:132
bool chemistry_with_photolysis
Definition: cs_atmo_chemistry.h:76
bool frozen_gas_chem
Definition: cs_atmo_chemistry.h:84
int * species_to_field_id
Definition: cs_atmo_chemistry.h:94
cs_real_t * t_conc_profiles
Definition: cs_atmo_chemistry.h:130
cs_real_t * y_conc_profiles
Definition: cs_atmo_chemistry.h:134
int n_species_profiles
Definition: cs_atmo_chemistry.h:123
int n_reactions
Definition: cs_atmo_chemistry.h:70
int * species_profiles_to_field_id
Definition: cs_atmo_chemistry.h:95
cs_real_t * conc_profiles
Definition: cs_atmo_chemistry.h:126
bool init_aero_with_lib
Definition: cs_atmo_chemistry.h:88
char * aero_conc_file_name
Definition: cs_atmo_chemistry.h:113
cs_real_t * z_conc_profiles
Definition: cs_atmo_chemistry.h:128
char * chem_conc_file_name
Definition: cs_atmo_chemistry.h:110
int nt_step_profiles
Definition: cs_atmo_chemistry.h:118
int n_layer
Definition: cs_atmo_chemistry.h:90
int n_z_profiles
Definition: cs_atmo_chemistry.h:120
int chemistry_sep_mode
Definition: cs_atmo_chemistry.h:73
int * chempoint
Definition: cs_atmo_chemistry.h:98
int n_size
Definition: cs_atmo_chemistry.h:92
cs_real_t * conv_factor_jac
Definition: cs_atmo_chemistry.h:100
char * spack_file_name
Definition: cs_atmo_chemistry.h:93
cs_real_t * reacnum
Definition: cs_atmo_chemistry.h:102
cs_real_t dt_chemistry_max
Definition: cs_atmo_chemistry.h:136