8.2
general documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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-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  * 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  * Atmospheric soil micro-scale options
118  *----------------------------------------------------------------------------*/
119 
120 typedef enum {
121 
128 
130 
131 /*============================================================================
132  * Type definitions
133  *============================================================================*/
134 
139 /*----------------------------------------------------------------------------
140  * Atmospheric model options descriptor
141  *----------------------------------------------------------------------------*/
142 
143 typedef struct {
144  /* Space and time reference of the run */
146  int syear;
148  int squant;
150  int shour;
152  int smin;
164  union {
166  int nbmetd; /* deprecated */
167  };
169  union {
171  int nbmett; /* deprecated */
172  };
174  union {
176  int nbmetm;
177  };
178 
180  union {
182  int nbmaxt;
183  };
193 
196 
232 
245 
249 
252 
255 
256  /* Model options */
291 
294 
333 
356 
367 
392 
394 
395 /*----------------------------------------------------------------------------
396  * Atmospheric model constants descriptor
397  *----------------------------------------------------------------------------*/
398 
399 typedef struct {
400  /* Space and time reference of the run */
403 
405 
406 /*----------------------------------------------------------------------------
407  * Atmospheric chemistry options descriptor
408  *----------------------------------------------------------------------------*/
409 
410 typedef struct {
411 
419  int model;
422 
425 
426  /* Flag to deactivate photolysis */
428 
433 
441  int n_layer;
443  int n_size;
445  int *species_to_scalar_id; // used only in Fortran
449  int *chempoint;
452 
461 
463 
464 /*----------------------------------------------------------------------------
465  * Atmospheric imbrication option
466  *----------------------------------------------------------------------------*/
467 
468 typedef struct {
469 
473 
483 
487 
489  int id_u;
490  int id_v;
491  int id_qw;
492  int id_nc;
493  int id_tke;
494  int id_eps;
495  int id_theta;
496 
498 
499 /*============================================================================
500  * Static global variables
501  *============================================================================*/
502 
503 /* Pointer to atmo options structure */
505 
506 /* Pointer to atmo constants structure */
508 
509 /* Pointer to atmo chemistry structure */
511 
512 /* Pointer to atmo imbrication structure */
514 
515 /*============================================================================
516  * Public function definitions
517  *============================================================================*/
518 
519 /*----------------------------------------------------------------------------*/
521 /*----------------------------------------------------------------------------*/
522 
523 void
525 
526 /*----------------------------------------------------------------------------*/
530 /*----------------------------------------------------------------------------*/
531 
532 void
534 
535 /*----------------------------------------------------------------------------*/
539 /*----------------------------------------------------------------------------*/
540 
541 void
543 
544 /*----------------------------------------------------------------------------*/
566 /*----------------------------------------------------------------------------*/
567 
568 void
570 
571 /*----------------------------------------------------------------------------*/
589 /*----------------------------------------------------------------------------*/
590 
591 void
593 
594 /*----------------------------------------------------------------------------*/
603 /*----------------------------------------------------------------------------*/
604 
605 cs_real_t
607  cs_real_t dlmo);
608 
609 /*----------------------------------------------------------------------------*/
618 /*----------------------------------------------------------------------------*/
619 
620 cs_real_t
622  cs_real_t dlmo);
623 
624 /*----------------------------------------------------------------------------*/
634 /*----------------------------------------------------------------------------*/
635 
636 cs_real_t
638  cs_real_t z0,
639  cs_real_t dlmo);
640 
641 /*----------------------------------------------------------------------------*/
651 /*----------------------------------------------------------------------------*/
652 
653 cs_real_t
655  cs_real_t z0,
656  cs_real_t dlmo);
657 
658 /*----------------------------------------------------------------------------*/
664 /*----------------------------------------------------------------------------*/
665 
666 void
667 cs_atmo_set_meteo_file_name(const char *file_name);
668 
669 /*----------------------------------------------------------------------------*/
675 /*----------------------------------------------------------------------------*/
676 
677 void
678 cs_atmo_set_chem_conc_file_name(const char *file_name);
679 
680 /*----------------------------------------------------------------------------*/
686 /*----------------------------------------------------------------------------*/
687 
688 void
689 cs_atmo_set_aero_conc_file_name(const char *file_name);
690 
691 /*----------------------------------------------------------------------------*/
697 /*----------------------------------------------------------------------------*/
698 
699 void
700 cs_atmo_chemistry_set_spack_file_name(const char *file_name);
701 
702 /*----------------------------------------------------------------------------*/
708 /*----------------------------------------------------------------------------*/
709 
710 void
711 cs_atmo_chemistry_set_aerosol_file_name(const char *file_name);
712 
713 /*----------------------------------------------------------------------------*/
719 /*----------------------------------------------------------------------------*/
720 
721 void
723 
724 /*----------------------------------------------------------------------------*/
746 /*----------------------------------------------------------------------------*/
747 
748 void
750  cs_real_t xlong,
751  cs_real_t jour,
752  cs_real_t heurtu,
753  int imer,
754  cs_real_t *albe,
755  cs_real_t *za,
756  cs_real_t *muzero,
757  cs_real_t *omega,
758  cs_real_t *fo);
759 
760 /*----------------------------------------------------------------------------*/
764 /*----------------------------------------------------------------------------*/
765 
766 void
768 
769 /*----------------------------------------------------------------------------*/
775 /*----------------------------------------------------------------------------*/
776 
777 int
779 
780 /*----------------------------------------------------------------------------*/
784 /*----------------------------------------------------------------------------*/
785 
786 void
787 cs_atmo_log_setup(void);
788 
789 /*----------------------------------------------------------------------------*/
793 /*----------------------------------------------------------------------------*/
794 
795 void
797 
798 /*----------------------------------------------------------------------------*/
802 /*----------------------------------------------------------------------------*/
803 
804 void
806 
807 /*----------------------------------------------------------------------------*/
811 /*----------------------------------------------------------------------------*/
812 
813 void
814 cs_atmo_finalize(void);
815 
816 /*----------------------------------------------------------------------------*/
820 /*----------------------------------------------------------------------------*/
821 
822 void
824 
825 /*----------------------------------------------------------------------------*/
829 /*----------------------------------------------------------------------------*/
830 
831 void
832 cs_soil_model(void);
833 
834 /*----------------------------------------------------------------------------*/
835 
837 
838 #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:3803
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:4045
cs_atmo_soil_meb_model_t
Definition: cs_atmo.h:120
@ CS_ATMO_SOIL_GENUINE
Definition: cs_atmo.h:123
@ CS_ATMO_SOIL_VEGETATION
Definition: cs_atmo.h:127
@ CS_ATMO_SOIL_PHOTOVOLTAICS
Definition: cs_atmo.h:125
void cs_atmo_add_property_fields(void)
Definition: cs_atmo.c:2032
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
int cs_atmo_chemistry_need_initialization(void)
Check if the chemistry module needs initialization.
Definition: cs_atmo.c:4034
void cs_atmo_aerosol_log_setup(void)
Print the atmospheric aerosols options to setup.log.
Definition: cs_atmo.c:4231
void cs_atmo_chemistry_initialization_deactivate(void)
Deactivate chemistry initialization procedure.
Definition: cs_atmo.c:4020
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:3220
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:3722
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:3754
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:4277
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_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 *za, cs_real_t *muzero, cs_real_t *omega, cs_real_t *fo)
1D Radiative scheme - Solar data + zenithal angle)
Definition: cs_atmo.c:3916
void cs_soil_model(void)
Compute soil and interface values using Deardorff force restore method.
Definition: cs_atmo.c:2326
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:3693
void cs_atmo_chemistry_log_setup(void)
Print the atmospheric chemistry options to setup.log.
Definition: cs_atmo.c:4166
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:3779
void cs_atmo_init_meteo_profiles(void)
Initialize meteo profiles if no meteo file is given.
Definition: cs_atmo.c:2689
void cs_user_soil_model(void)
Allow call of cs_user fonctions during soil model computation.
cs_atmo_imbrication_t * cs_glob_atmo_imbrication
void cs_atmo_compute_meteo_profiles(void)
Compute meteo profiles if no meteo file is given.
Definition: cs_atmo.c:2990
void cs_atmo_hydrostatic_profiles_compute(void)
Compute hydrostatic profiles of density and pressure.
Definition: cs_atmo.c:3428
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:3664
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:528
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
#define END_C_DECLS
Definition: cs_defs.h:529
real(c_double), pointer, save xlat
latitude of the domain origin
Definition: atincl.f90:202
Definition: cs_atmo.h:410
bool init_gas_with_lib
Definition: cs_atmo.h:437
int model
Definition: cs_atmo.h:419
int * species_to_scalar_id
Definition: cs_atmo.h:445
cs_real_t * molar_mass
Definition: cs_atmo.h:448
int n_species
Definition: cs_atmo.h:420
cs_atmo_aerosol_type_t aerosol_model
Definition: cs_atmo.h:432
char * aero_file_name
Definition: cs_atmo.h:454
bool chemistry_with_photolysis
Definition: cs_atmo.h:427
bool frozen_gas_chem
Definition: cs_atmo.h:435
int * species_to_field_id
Definition: cs_atmo.h:446
int n_reactions
Definition: cs_atmo.h:421
bool init_aero_with_lib
Definition: cs_atmo.h:439
char * aero_conc_file_name
Definition: cs_atmo.h:460
char * chem_conc_file_name
Definition: cs_atmo.h:457
int n_layer
Definition: cs_atmo.h:441
int chemistry_sep_mode
Definition: cs_atmo.h:424
int * chempoint
Definition: cs_atmo.h:449
int n_size
Definition: cs_atmo.h:443
char * spack_file_name
Definition: cs_atmo.h:444
cs_real_t * reacnum
Definition: cs_atmo.h:451
Definition: cs_atmo.h:399
cs_real_t ps
Definition: cs_atmo.h:402
Definition: cs_atmo.h:468
bool cressman_theta
Definition: cs_atmo.h:482
int id_tke
Definition: cs_atmo.h:493
int id_qw
Definition: cs_atmo.h:491
int id_v
Definition: cs_atmo.h:490
cs_real_t horizontal_influence_radius
Definition: cs_atmo.h:486
bool cressman_u
Definition: cs_atmo.h:476
bool cressman_eps
Definition: cs_atmo.h:481
int id_u
Definition: cs_atmo.h:489
bool cressman_v
Definition: cs_atmo.h:477
bool cressman_qw
Definition: cs_atmo.h:478
cs_real_t vertical_influence_radius
Definition: cs_atmo.h:485
int id_nc
Definition: cs_atmo.h:492
int id_eps
Definition: cs_atmo.h:494
bool imbrication_verbose
Definition: cs_atmo.h:472
bool cressman_nc
Definition: cs_atmo.h:479
bool imbrication_flag
Definition: cs_atmo.h:471
bool cressman_tke
Definition: cs_atmo.h:480
int id_theta
Definition: cs_atmo.h:495
Definition: cs_atmo.h:143
cs_real_t meteo_t1
Definition: cs_atmo.h:326
cs_real_t domain_orientation
Definition: cs_atmo.h:248
int nbmetm
Definition: cs_atmo.h:176
cs_real_t meteo_zi
Definition: cs_atmo.h:302
cs_real_t * z_dyn_met
Definition: cs_atmo.h:369
cs_real_t * rad_1d_zray
Definition: cs_atmo.h:221
int squant
Definition: cs_atmo.h:148
cs_real_t meteo_dlmo
Definition: cs_atmo.h:296
cs_real_t * hyd_p_met
Definition: cs_atmo.h:375
int distribution_model
Definition: cs_atmo.h:283
cs_real_t * rad_1d_dacinfe
Definition: cs_atmo.h:202
int radiative_model_1d
Definition: cs_atmo.h:185
cs_real_t ssec
Definition: cs_atmo.h:154
cs_real_t * rad_1d_tauzq
Definition: cs_atmo.h:215
cs_real_t * rad_1d_aco2
Definition: cs_atmo.h:204
cs_real_t * rad_1d_ql
Definition: cs_atmo.h:236
int syear
Definition: cs_atmo.h:146
int sedimentation_model
Definition: cs_atmo.h:258
cs_atmo_soil_meb_model_t soil_meb_model
Definition: cs_atmo.h:391
bool compute_z_ground
Definition: cs_atmo.h:251
cs_real_t * rad_1d_sol_div
Definition: cs_atmo.h:225
cs_real_t * rad_1d_ird
Definition: cs_atmo.h:229
int shour
Definition: cs_atmo.h:150
cs_real_t meteo_qwstar
Definition: cs_atmo.h:337
cs_real_t meteo_zt1
Definition: cs_atmo.h:308
cs_real_t meteo_t0
Definition: cs_atmo.h:324
int deposition_model
Definition: cs_atmo.h:260
cs_real_t * rad_1d_daco2
Definition: cs_atmo.h:207
int smin
Definition: cs_atmo.h:152
cs_real_t * rad_1d_acsups
Definition: cs_atmo.h:211
cs_real_t meteo_qw1
Definition: cs_atmo.h:339
cs_real_t * rad_1d_qw
Definition: cs_atmo.h:234
int nbmaxt
Definition: cs_atmo.h:182
cs_real_t * rad_1d_tauz
Definition: cs_atmo.h:217
cs_real_t * v_met
Definition: cs_atmo.h:360
cs_real_t meteo_u1
Definition: cs_atmo.h:314
cs_real_t y_l93
Definition: cs_atmo.h:162
int meteo_phih_s
Definition: cs_atmo.h:351
cs_real_t * rad_1d_ir_div
Definition: cs_atmo.h:223
int subgrid_model
Definition: cs_atmo.h:278
cs_real_t * rad_1d_acsup
Definition: cs_atmo.h:210
cs_real_t * ek_met
Definition: cs_atmo.h:364
cs_real_t * u_met
Definition: cs_atmo.h:358
cs_real_t meteo_zu2
Definition: cs_atmo.h:306
cs_real_t meteo_uref
Definition: cs_atmo.h:312
cs_real_t meteo_ustar0
Definition: cs_atmo.h:318
int soil_zone_id
Definition: cs_atmo.h:386
cs_real_t meteo_z0
Definition: cs_atmo.h:298
int rad_1d_nlevels_max
Definition: cs_atmo.h:192
int nbmetd
Definition: cs_atmo.h:166
cs_real_t * rad_1d_dacsups
Definition: cs_atmo.h:213
char * meteo_file_name
Definition: cs_atmo.h:293
cs_real_t * rad_1d_sold
Definition: cs_atmo.h:231
cs_real_t * z_temp_met
Definition: cs_atmo.h:371
cs_real_t latitude
Definition: cs_atmo.h:158
int meteo_phim_s
Definition: cs_atmo.h:349
cs_real_t meteo_wstar0
Definition: cs_atmo.h:320
int met_1d_nlevels_t
Definition: cs_atmo.h:170
int met_1d_nlevels_d
Definition: cs_atmo.h:165
cs_real_t meteo_sensi
Definition: cs_atmo.h:347
int meteo_phih_u
Definition: cs_atmo.h:355
cs_real_t meteo_t2
Definition: cs_atmo.h:328
cs_real_t * rad_1d_solu
Definition: cs_atmo.h:230
int met_1d_nlevels_max_t
Definition: cs_atmo.h:181
cs_real_t * w_met
Definition: cs_atmo.h:362
cs_real_t * time_met
Definition: cs_atmo.h:373
cs_real_t meteo_zu1
Definition: cs_atmo.h:304
cs_real_t meteo_tstar
Definition: cs_atmo.h:330
int theo_interp
Definition: cs_atmo.h:254
cs_real_t longitude
Definition: cs_atmo.h:156
cs_atmo_soil_cat_t soil_cat
Definition: cs_atmo.h:384
cs_real_t meteo_qw2
Definition: cs_atmo.h:341
int met_1d_ntimes
Definition: cs_atmo.h:175
int nbmett
Definition: cs_atmo.h:171
cs_real_t meteo_evapor
Definition: cs_atmo.h:345
int open_bcs_treatment
Definition: cs_atmo.h:253
int soil_model
Definition: cs_atmo.h:379
cs_real_t meteo_u2
Definition: cs_atmo.h:316
cs_real_t * rad_1d_iru
Definition: cs_atmo.h:228
cs_real_t * rad_1d_z
Definition: cs_atmo.h:198
cs_real_t * rad_1d_aco2s
Definition: cs_atmo.h:205
int meteo_profile
Definition: cs_atmo.h:290
cs_real_t * rad_1d_dacsup
Definition: cs_atmo.h:212
int meteo_phim_u
Definition: cs_atmo.h:353
cs_real_t * rad_1d_xy
Definition: cs_atmo.h:195
cs_real_t x_l93
Definition: cs_atmo.h:160
cs_real_t meteo_zref
Definition: cs_atmo.h:300
cs_real_t * ep_met
Definition: cs_atmo.h:366
cs_real_t * rad_1d_aerosols
Definition: cs_atmo.h:244
int rad_1d_nvert
Definition: cs_atmo.h:187
cs_real_t meteo_ql0
Definition: cs_atmo.h:343
int nucleation_model
Definition: cs_atmo.h:270
cs_real_t meteo_qw0
Definition: cs_atmo.h:335
cs_real_t * rad_1d_fn
Definition: cs_atmo.h:242
int rad_1d_nlevels
Definition: cs_atmo.h:189
cs_real_t * rad_1d_zq
Definition: cs_atmo.h:219
cs_real_t * rad_1d_daco2s
Definition: cs_atmo.h:208
cs_real_t * pot_t_met
Definition: cs_atmo.h:377
cs_real_t * rad_1d_acinfe
Definition: cs_atmo.h:200
cs_real_t meteo_zt2
Definition: cs_atmo.h:310
cs_real_t * rad_1d_nc
Definition: cs_atmo.h:240
cs_real_t * rad_1d_qv
Definition: cs_atmo.h:238
cs_real_t meteo_psea
Definition: cs_atmo.h:332
cs_real_t meteo_angle
Definition: cs_atmo.h:322