8.0
general documentation
cs_atmo.h
Go to the documentation of this file.
1 #ifndef __CS_ATMO_H__
2 #define __CS_ATMO_H__
3 
4 /*============================================================================
5  * Main for atmospheric related functions
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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 "cs_base.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*============================================================================
41  * Local Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 /*----------------------------------------------------------------------------
49  * Atmospheric models
50  *----------------------------------------------------------------------------*/
51 
52 typedef enum {
53 
58 
60 
61 /*----------------------------------------------------------------------------
62  * Atmospheric nucleation models
63  *----------------------------------------------------------------------------*/
64 
65 typedef enum {
66 
71 
73 
74 /*----------------------------------------------------------------------------
75  * Atmospheric aerosol external library
76  *----------------------------------------------------------------------------*/
77 
78 typedef enum {
79 
82 
84 
85 /*----------------------------------------------------------------------------
86  * Atmospheric universal functions
87  *----------------------------------------------------------------------------*/
88 
89 typedef enum {
90 
96 
98 
99 /*----------------------------------------------------------------------------
100  * Atmospheric soil model
101  *----------------------------------------------------------------------------*/
102 
103 typedef enum {
104 
113 
115 
116 /*============================================================================
117  * Type definitions
118  *============================================================================*/
119 
124 /*----------------------------------------------------------------------------
125  * Atmospheric model options descriptor
126  *----------------------------------------------------------------------------*/
127 
128 typedef struct {
129  /* Space and time reference of the run */
131  int syear;
133  int squant;
135  int shour;
137  int smin;
149  int nbmetd;
151  int nbmett;
154  int nbmetm;
155 
158  int nbmaxt;
162 
165 
167 
168  /* Model options */
202 
205 
244 
253 
262 
282 
284 
285 /*----------------------------------------------------------------------------
286  * Atmospheric model constants descriptor
287  *----------------------------------------------------------------------------*/
288 
289 typedef struct {
290  /* Space and time reference of the run */
293 
295 
296 /*----------------------------------------------------------------------------
297  * Atmospheric chemistry options descriptor
298  *----------------------------------------------------------------------------*/
299 
300 typedef struct {
301 
309  int model;
312 
315 
316  /* Flag to deactivate photolysis */
318 
323 
331  int n_layer;
333  int n_size;
335  int *species_to_scalar_id; // used only in Fortran
339  int *chempoint;
342 
351 
353 
354 /*============================================================================
355  * Static global variables
356  *============================================================================*/
357 
358 /* Pointer to atmo options structure */
360 
361 /* Pointer to atmo constants structure */
363 
364 /* Pointer to atmo chemistry structure */
366 
367 /*============================================================================
368  * Public function definitions
369  *============================================================================*/
370 
371 /*----------------------------------------------------------------------------*/
373 /*----------------------------------------------------------------------------*/
374 
375 void
377 
378 /*----------------------------------------------------------------------------*/
382 /*----------------------------------------------------------------------------*/
383 
384 void
386 
387 /*----------------------------------------------------------------------------*/
391 /*----------------------------------------------------------------------------*/
392 
393 void
395 
396 /*----------------------------------------------------------------------------*/
418 /*----------------------------------------------------------------------------*/
419 
420 void
422 
423 /*----------------------------------------------------------------------------*/
441 /*----------------------------------------------------------------------------*/
442 
443 void
445 
446 /*----------------------------------------------------------------------------*/
455 /*----------------------------------------------------------------------------*/
456 
457 cs_real_t
459  cs_real_t dlmo);
460 
461 /*----------------------------------------------------------------------------*/
470 /*----------------------------------------------------------------------------*/
471 
472 cs_real_t
474  cs_real_t dlmo);
475 
476 /*----------------------------------------------------------------------------*/
486 /*----------------------------------------------------------------------------*/
487 
488 cs_real_t
490  cs_real_t z0,
491  cs_real_t dlmo);
492 
493 /*----------------------------------------------------------------------------*/
503 /*----------------------------------------------------------------------------*/
504 
505 cs_real_t
507  cs_real_t z0,
508  cs_real_t dlmo);
509 
510 
511 /*----------------------------------------------------------------------------*/
517 /*----------------------------------------------------------------------------*/
518 
519 void
520 cs_atmo_set_meteo_file_name(const char *file_name);
521 
522 /*----------------------------------------------------------------------------*/
528 /*----------------------------------------------------------------------------*/
529 
530 void
531 cs_atmo_set_chem_conc_file_name(const char *file_name);
532 
533 /*----------------------------------------------------------------------------*/
539 /*----------------------------------------------------------------------------*/
540 
541 void
542 cs_atmo_set_aero_conc_file_name(const char *file_name);
543 
544 /*----------------------------------------------------------------------------*/
550 /*----------------------------------------------------------------------------*/
551 
552 void
553 cs_atmo_chemistry_set_spack_file_name(const char *file_name);
554 
555 /*----------------------------------------------------------------------------*/
561 /*----------------------------------------------------------------------------*/
562 
563 void
564 cs_atmo_chemistry_set_aerosol_file_name(const char *file_name);
565 
566 /*----------------------------------------------------------------------------*/
572 /*----------------------------------------------------------------------------*/
573 
574 void
576 
577 /*----------------------------------------------------------------------------*/
597 /*----------------------------------------------------------------------------*/
598 
599 void
601  cs_real_t xlong,
602  cs_real_t jour,
603  cs_real_t heurtu,
604  int imer,
605  cs_real_t *albe,
606  cs_real_t *muzero,
607  cs_real_t *omega,
608  cs_real_t *fo);
609 
610 /*----------------------------------------------------------------------------*/
614 /*----------------------------------------------------------------------------*/
615 
616 void
617 cs_atmo_log_setup(void);
618 
619 /*----------------------------------------------------------------------------*/
623 /*----------------------------------------------------------------------------*/
624 
625 void
627 
628 /*----------------------------------------------------------------------------*/
632 /*----------------------------------------------------------------------------*/
633 
634 void
636 
637 /*----------------------------------------------------------------------------*/
641 /*----------------------------------------------------------------------------*/
642 
643 void
644 cs_atmo_finalize(void);
645 
646 /*----------------------------------------------------------------------------*/
647 
649 
650 #endif /* __CS_ATMO_H__ */
cs_atmo_model_t
Definition: cs_atmo.h:52
@ CS_ATMO_DRY
Definition: cs_atmo.h:56
@ CS_ATMO_CONSTANT_DENSITY
Definition: cs_atmo.h:55
@ CS_ATMO_OFF
Definition: cs_atmo.h:54
@ CS_ATMO_HUMID
Definition: cs_atmo.h:57
void cs_atmo_declare_chem_from_spack(void)
This function declare additional transported variables for atmospheric module for the chemistry defin...
Definition: cs_atmo.c:2846
cs_atmo_soil_cat_t
Definition: cs_atmo.h:103
@ CS_ATMO_SOIL_23_CAT
Definition: cs_atmo.h:112
@ CS_ATMO_SOIL_5_CAT
Definition: cs_atmo.h:106
@ CS_ATMO_SOIL_7_CAT
Definition: cs_atmo.h:109
void cs_atmo_log_setup(void)
Print the atmospheric module options to setup.log.
Definition: cs_atmo.c:3049
void cs_atmo_add_property_fields(void)
Definition: cs_atmo.c:1688
void cs_atmo_compute_solar_angles(cs_real_t xlat, cs_real_t xlong, cs_real_t jour, cs_real_t heurtu, int imer, cs_real_t *albe, cs_real_t *muzero, cs_real_t *omega, cs_real_t *fo)
1D Radiative scheme - Solar data + zenithal angle)
Definition: cs_atmo.c:2958
cs_real_t cs_mo_psih(cs_real_t z, cs_real_t z0, cs_real_t dlmo)
Universal function psih for neutral, stable and unstable.
cs_atmo_nucleation_type_t
Definition: cs_atmo.h:65
@ CS_ATMO_NUC_OFF
Definition: cs_atmo.h:67
@ CS_ATMO_NUC_ABDUL_RAZZAK
Definition: cs_atmo.h:70
@ CS_ATMO_NUC_COHARD
Definition: cs_atmo.h:69
@ CS_ATMO_NUC_PRUPPACHER_KLETT
Definition: cs_atmo.h:68
void cs_atmo_aerosol_log_setup(void)
Print the atmospheric aerosols options to setup.log.
Definition: cs_atmo.c:3235
cs_real_t cs_mo_psim(cs_real_t z, cs_real_t z0, cs_real_t dlmo)
Universal function psim for neutral, stable and unstable.
void cs_atmo_z_ground_compute(void)
This function computes the ground elevation.
Definition: cs_atmo.c:2261
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.c:2765
cs_atmo_universal_functions_t
Definition: cs_atmo.h:89
@ CS_ATMO_UNIV_FN_BUSINGER
Definition: cs_atmo.h:93
@ CS_ATMO_UNIV_FN_CARL
Definition: cs_atmo.h:95
@ CS_ATMO_UNIV_FN_CHENG
Definition: cs_atmo.h:91
@ CS_ATMO_UNIV_FN_HARTOGENSIS
Definition: cs_atmo.h:94
@ CS_ATMO_UNIV_FN_HOGSTROM
Definition: cs_atmo.h:92
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.c:2797
cs_atmo_option_t * cs_glob_atmo_option
cs_atmo_chemistry_t * cs_glob_atmo_chemistry
void cs_atmo_finalize(void)
Deallocate arrays for atmo module.
Definition: cs_atmo.c:3281
cs_real_t cs_mo_phim(cs_real_t z, cs_real_t dlmo)
Universal function phim for neutral, stable and unstable.
cs_atmo_aerosol_type_t
Definition: cs_atmo.h:78
@ CS_ATMO_AEROSOL_SSH
Definition: cs_atmo.h:81
@ CS_ATMO_AEROSOL_OFF
Definition: cs_atmo.h:80
void cs_atmo_set_chem_conc_file_name(const char *file_name)
This function set the file name of the chemistry concentration file.
Definition: cs_atmo.c:2736
void cs_atmo_chemistry_log_setup(void)
Print the atmospheric chemistry options to setup.log.
Definition: cs_atmo.c:3170
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.c:2822
void cs_atmo_init_meteo_profiles(void)
Initialize meteo profiles if no meteo file is given.
Definition: cs_atmo.c:1880
void cs_atmo_compute_meteo_profiles(void)
Compute meteo profiles if no meteo file is given.
Definition: cs_atmo.c:2047
void cs_atmo_hydrostatic_profiles_compute(void)
Compute hydrostatic profiles of density and pressure.
Definition: cs_atmo.c:2474
void cs_atmo_set_meteo_file_name(const char *file_name)
This function set the file name of the meteo file.
Definition: cs_atmo.c:2707
cs_atmo_constants_t * cs_glob_atmo_constants
cs_real_t cs_mo_phih(cs_real_t z, cs_real_t dlmo)
Universal function phih for neutral, stable and unstable.
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:510
real(c_double), pointer, save xlat
latitude of the domain origin
Definition: atincl.f90:205
double precision, dimension(ncharm), save omega
Definition: cpincl.f90:99
Definition: cs_atmo.h:300
bool init_gas_with_lib
Definition: cs_atmo.h:327
int model
Definition: cs_atmo.h:309
int * species_to_scalar_id
Definition: cs_atmo.h:335
cs_real_t * molar_mass
Definition: cs_atmo.h:338
int n_species
Definition: cs_atmo.h:310
cs_atmo_aerosol_type_t aerosol_model
Definition: cs_atmo.h:322
char * aero_file_name
Definition: cs_atmo.h:344
bool chemistry_with_photolysis
Definition: cs_atmo.h:317
bool frozen_gas_chem
Definition: cs_atmo.h:325
int * species_to_field_id
Definition: cs_atmo.h:336
int n_reactions
Definition: cs_atmo.h:311
bool init_aero_with_lib
Definition: cs_atmo.h:329
char * aero_conc_file_name
Definition: cs_atmo.h:350
char * chem_conc_file_name
Definition: cs_atmo.h:347
int n_layer
Definition: cs_atmo.h:331
int chemistry_sep_mode
Definition: cs_atmo.h:314
int * chempoint
Definition: cs_atmo.h:339
int n_size
Definition: cs_atmo.h:333
char * spack_file_name
Definition: cs_atmo.h:334
cs_real_t * reacnum
Definition: cs_atmo.h:341
Definition: cs_atmo.h:289
cs_real_t ps
Definition: cs_atmo.h:292
Definition: cs_atmo.h:128
cs_real_t meteo_t1
Definition: cs_atmo.h:237
cs_real_t domain_orientation
Definition: cs_atmo.h:161
int nbmetm
Definition: cs_atmo.h:154
cs_real_t meteo_zi
Definition: cs_atmo.h:213
cs_real_t * z_dyn_met
Definition: cs_atmo.h:264
int squant
Definition: cs_atmo.h:133
cs_real_t meteo_dlmo
Definition: cs_atmo.h:207
cs_real_t * hyd_p_met
Definition: cs_atmo.h:270
int distribution_model
Definition: cs_atmo.h:194
int radiative_model_1d
Definition: cs_atmo.h:157
cs_real_t ssec
Definition: cs_atmo.h:139
int syear
Definition: cs_atmo.h:131
int sedimentation_model
Definition: cs_atmo.h:170
bool compute_z_ground
Definition: cs_atmo.h:164
int shour
Definition: cs_atmo.h:135
cs_real_t meteo_zt1
Definition: cs_atmo.h:219
cs_real_t meteo_t0
Definition: cs_atmo.h:235
int deposition_model
Definition: cs_atmo.h:172
int smin
Definition: cs_atmo.h:137
int nbmaxt
Definition: cs_atmo.h:158
cs_real_t * v_met
Definition: cs_atmo.h:257
cs_real_t meteo_u1
Definition: cs_atmo.h:225
cs_real_t y_l93
Definition: cs_atmo.h:147
int meteo_phih_s
Definition: cs_atmo.h:248
int subgrid_model
Definition: cs_atmo.h:189
cs_real_t * ek_met
Definition: cs_atmo.h:259
cs_real_t * u_met
Definition: cs_atmo.h:255
cs_real_t meteo_zu2
Definition: cs_atmo.h:217
cs_real_t meteo_uref
Definition: cs_atmo.h:223
cs_real_t meteo_ustar0
Definition: cs_atmo.h:229
int soil_zone_id
Definition: cs_atmo.h:281
cs_real_t meteo_z0
Definition: cs_atmo.h:209
int nbmetd
Definition: cs_atmo.h:149
char * meteo_file_name
Definition: cs_atmo.h:204
cs_real_t * z_temp_met
Definition: cs_atmo.h:266
cs_real_t latitude
Definition: cs_atmo.h:143
int meteo_phim_s
Definition: cs_atmo.h:246
cs_real_t meteo_wstar0
Definition: cs_atmo.h:231
int meteo_phih_u
Definition: cs_atmo.h:252
cs_real_t meteo_t2
Definition: cs_atmo.h:239
cs_real_t * time_met
Definition: cs_atmo.h:268
cs_real_t meteo_zu1
Definition: cs_atmo.h:215
cs_real_t meteo_tstar
Definition: cs_atmo.h:241
cs_real_t longitude
Definition: cs_atmo.h:141
cs_atmo_soil_cat_t soil_cat
Definition: cs_atmo.h:279
int nbmett
Definition: cs_atmo.h:151
int open_bcs_treatment
Definition: cs_atmo.h:166
int soil_model
Definition: cs_atmo.h:274
cs_real_t meteo_u2
Definition: cs_atmo.h:227
int meteo_profile
Definition: cs_atmo.h:201
int meteo_phim_u
Definition: cs_atmo.h:250
cs_real_t x_l93
Definition: cs_atmo.h:145
cs_real_t meteo_zref
Definition: cs_atmo.h:211
cs_real_t * ep_met
Definition: cs_atmo.h:261
int nucleation_model
Definition: cs_atmo.h:181
cs_real_t * pot_t_met
Definition: cs_atmo.h:272
cs_real_t meteo_zt2
Definition: cs_atmo.h:221
cs_real_t meteo_psea
Definition: cs_atmo.h:243
cs_real_t meteo_angle
Definition: cs_atmo.h:233