9.1
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-2025 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_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
52typedef enum {
53
58
60
61/*----------------------------------------------------------------------------
62 * Atmospheric nucleation models
63 *----------------------------------------------------------------------------*/
64
65typedef enum {
66
71
73
74/*----------------------------------------------------------------------------
75 * Atmospheric universal functions
76 *----------------------------------------------------------------------------*/
77
78typedef enum {
79
85
87
88/*----------------------------------------------------------------------------
89 * Atmospheric ground model
90 *----------------------------------------------------------------------------*/
91
92typedef enum {
93
102
104
105/*----------------------------------------------------------------------------
106 * Atmospheric ground micro-scale options
107 *----------------------------------------------------------------------------*/
108
109typedef enum {
110
117
119
120/*----------------------------------------------------------------------------
121 * Atmospheric ground micro-scale options
122 *----------------------------------------------------------------------------*/
123
124typedef enum {
125
128 /* Lambert93 projection type */
130 /* Universal transverse mercator, zone needs to be indicated*/
132 /* Tangantial */
134
136
137/*============================================================================
138 * Type definitions
139 *============================================================================*/
140
145/*----------------------------------------------------------------------------
146 * Atmospheric model options descriptor
147 *----------------------------------------------------------------------------*/
148
149typedef struct {
150 /* Space and time reference of the run */
152 int syear;
156 int shour;
158 int smin;
168 cs_real_t x_l93; // conserved for retrocompatibility
174 cs_real_t x_origin; // similar to l93 but more general
176
179 int utm_zone; // If using utm, a zone needs to be specified
180
181 union {
183 int nbmetd; /* deprecated */
184 };
186 union {
188 int nbmett; /* deprecated */
189 };
191 union {
194 };
195
197 union {
200 };
201
205
208
211
212 /* Model options */
247
250
289
312
313 /* 1D meteo profiles */
362
377
378 bool rain;
387
428
430
432
434
435/*----------------------------------------------------------------------------
436 * Atmospheric model constants descriptor
437 *----------------------------------------------------------------------------*/
438
439typedef struct {
440 /* Space and time reference of the run */
443
445
446/*============================================================================
447 * Static global variables
448 *============================================================================*/
449
450/* Pointer to atmo options structure */
452
453/* Pointer to atmo constants structure */
455
456/*============================================================================
457 * Public function definitions
458 *============================================================================*/
459
460void
462
463/*----------------------------------------------------------------------------
464 * initialize fields, stage 0
465 *----------------------------------------------------------------------------*/
466
467void
469
470/*----------------------------------------------------------------------------
471 * Automatic boundary condition for cooling towers
472 *----------------------------------------------------------------------------*/
473
474void
475cs_atmo_bcond(void);
476
477/*----------------------------------------------------------------------------*/
481/*----------------------------------------------------------------------------*/
482
483void
485
486/*----------------------------------------------------------------------------*/
490/*----------------------------------------------------------------------------*/
491
492void
494
495/*----------------------------------------------------------------------------*/
517/*----------------------------------------------------------------------------*/
518
519void
521
522/*----------------------------------------------------------------------------*/
540/*----------------------------------------------------------------------------*/
541
542void
544
545/*----------------------------------------------------------------------------*/
552/*----------------------------------------------------------------------------*/
553
554void
556
557/*----------------------------------------------------------------------------*/
566/*----------------------------------------------------------------------------*/
567
570 cs_real_t dlmo);
571
572/*----------------------------------------------------------------------------*/
582/*----------------------------------------------------------------------------*/
583
586 cs_real_t dlmo,
587 cs_real_t prt);
588
589/*----------------------------------------------------------------------------*/
599/*----------------------------------------------------------------------------*/
600
603 cs_real_t z0,
604 cs_real_t dlmo);
605
606/*----------------------------------------------------------------------------*/
617/*----------------------------------------------------------------------------*/
618
621 cs_real_t z0,
622 cs_real_t dlmo,
623 cs_real_t prt);
624
625/*----------------------------------------------------------------------------*/
638/*----------------------------------------------------------------------------*/
639
640void
642 cs_real_t z0,
643 cs_real_t du,
644 cs_real_t buoyant_param,
646 cs_real_t *dlmo,
647 cs_real_t *ustar);
648
649/*----------------------------------------------------------------------------*/
662/*----------------------------------------------------------------------------*/
663
664void
666 cs_real_t z0,
667 cs_real_t du,
668 cs_real_t buoyant_param,
669 cs_real_t flux,
670 cs_real_t *dlmo,
671 cs_real_t *ustar);
672
673/*----------------------------------------------------------------------------*/
679/*----------------------------------------------------------------------------*/
680
681void
682cs_atmo_set_meteo_file_name(const char *file_name);
683
684/*----------------------------------------------------------------------------*/
706/*----------------------------------------------------------------------------*/
707
708void
710 cs_real_t xlong,
711 cs_real_t jour,
712 cs_real_t heurtu,
713 int imer,
714 cs_real_t *albe,
715 cs_real_t *za,
716 cs_real_t *muzero,
717 cs_real_t *omega,
718 cs_real_t *fo);
719
720/*----------------------------------------------------------------------------*/
724/*----------------------------------------------------------------------------*/
725
726void
728
729/*----------------------------------------------------------------------------*/
733/*----------------------------------------------------------------------------*/
734
735void
736cs_atmo_finalize(void);
737
738/*----------------------------------------------------------------------------*/
742/*----------------------------------------------------------------------------*/
743
744void
746
747/*----------------------------------------------------------------------------*/
748
749void
751 int *n_ground_cat,
752 const cs_lnum_t **elt_ids);
753
754/*----------------------------------------------------------------------------*/
755
756void
758 cs_real_t **csol,
759 cs_real_t **rugdyn,
760 cs_real_t **rugthe,
761 cs_real_t **albedo,
762 cs_real_t **emissi,
763 cs_real_t **vegeta,
764 cs_real_t **c1w,
765 cs_real_t **c2w,
766 cs_real_t **r1,
767 cs_real_t **r2);
768
769/*----------------------------------------------------------------------------*/
770
771void
773(
774 cs_atmo_projection_t origin_projection,
775 cs_atmo_projection_t target_projection,
776 cs_real_t x_origin,
777 cs_real_t y_origin,
778 cs_real_t* x_target,
779 cs_real_t* y_target,
780 int utm_fixed_zone
781);
782
783/*----------------------------------------------------------------------------*/
784
786
787#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
cs_real_t cs_mo_phih(cs_real_t z, cs_real_t dlmo, cs_real_t prt)
Universal function phih for neutral, stable and unstable.
Definition: cs_atmo.cpp:1802
void cs_atmo_phyvar_update(void)
void cs_atmo_log_setup(void)
Print the atmospheric module options to setup.log.
Definition: cs_atmo.cpp:4417
void cs_atmo_get_ground_zone(cs_lnum_t *n_elts, int *n_ground_cat, const cs_lnum_t **elt_ids)
cs_atmo_ground_meb_model_t
Definition: cs_atmo.h:109
@ CS_ATMO_GROUND_PHOTOVOLTAICS
Definition: cs_atmo.h:114
@ CS_ATMO_GROUND_GENUINE
Definition: cs_atmo.h:112
@ CS_ATMO_GROUND_VEGETATION
Definition: cs_atmo.h:116
void cs_mo_compute_from_thermal_diff(cs_real_t z, cs_real_t z0, cs_real_t du, cs_real_t buoyant_param, cs_real_t dt, cs_real_t *dlmo, cs_real_t *ustar)
Compute LMO, friction velocity ustar, friction temperature tstar from a thermal difference using Moni...
Definition: cs_atmo.cpp:1897
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
cs_atmo_ground_cat_t
Definition: cs_atmo.h:92
@ CS_ATMO_GROUND_23_CAT
Definition: cs_atmo.h:101
@ CS_ATMO_GROUND_5_CAT
Definition: cs_atmo.h:95
@ CS_ATMO_GROUND_7_CAT
Definition: cs_atmo.h:98
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.
Definition: cs_atmo.cpp:1832
void cs_atmo_fields_init0(void)
Definition: cs_atmo.cpp:2050
void cs_atmo_z_ground_compute(void)
This function computes the ground elevation.
Definition: cs_atmo.cpp:3770
void cs_user_ground_model(void)
Allow call of cs_user fonctions during ground model computation.
cs_atmo_universal_functions_t
Definition: cs_atmo.h:78
@ CS_ATMO_UNIV_FN_BUSINGER
Definition: cs_atmo.h:82
@ CS_ATMO_UNIV_FN_CARL
Definition: cs_atmo.h:84
@ CS_ATMO_UNIV_FN_CHENG
Definition: cs_atmo.h:80
@ CS_ATMO_UNIV_FN_HARTOGENSIS
Definition: cs_atmo.h:83
@ CS_ATMO_UNIV_FN_HOGSTROM
Definition: cs_atmo.h:81
void cs_atmo_ground_init_arrays(int *n_ground_cat, cs_real_t **csol, cs_real_t **rugdyn, cs_real_t **rugthe, cs_real_t **albedo, cs_real_t **emissi, cs_real_t **vegeta, cs_real_t **c1w, cs_real_t **c2w, cs_real_t **r1, cs_real_t **r2)
cs_atmo_option_t * cs_glob_atmo_option
void cs_atmo_finalize(void)
Deallocate arrays for atmo module.
Definition: cs_atmo.cpp:4911
cs_real_t cs_mo_phim(cs_real_t z, cs_real_t dlmo)
Universal function phim for neutral, stable and unstable.
Definition: cs_atmo.cpp:1773
void cs_atmo_read_meteo_profile(int mode)
Reads the meteo profile data for the atmospheric.
Definition: cs_atmo.cpp:4544
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.cpp:4311
void cs_atmo_bcond(void)
Definition: cs_atmo.cpp:2436
void cs_atmo_init_meteo_profiles(void)
Initialize meteo profiles if no meteo file is given.
Definition: cs_atmo.cpp:3090
void cs_atmo_projection(cs_atmo_projection_t origin_projection, cs_atmo_projection_t target_projection, cs_real_t x_origin, cs_real_t y_origin, cs_real_t *x_target, cs_real_t *y_target, int utm_fixed_zone)
Reproject coordinates between supported atmosphere projections.
Definition: cs_atmo.cpp:5367
cs_real_t cs_mo_psih(cs_real_t z, cs_real_t z0, cs_real_t dlmo, cs_real_t prt)
Universal function psih for neutral, stable and unstable.
Definition: cs_atmo.cpp:1863
cs_atmo_projection_t
Definition: cs_atmo.h:124
@ CS_ATMO_PROJ_LAMBERT_93
Definition: cs_atmo.h:129
@ CS_ATMO_PROJ_TAN
Definition: cs_atmo.h:133
@ CS_ATMO_PROJ_UNDEF
Definition: cs_atmo.h:126
@ CS_ATMO_PROJ_WGS84
Definition: cs_atmo.h:127
@ CS_ATMO_PROJ_UTM
Definition: cs_atmo.h:131
void cs_atmo_compute_meteo_profiles(void)
Compute meteo profiles if no meteo file is given.
Definition: cs_atmo.cpp:3495
void cs_atmo_hydrostatic_profiles_compute(void)
Compute hydrostatic profiles of density and pressure.
Definition: cs_atmo.cpp:4037
void cs_atmo_set_meteo_file_name(const char *file_name)
This function set the file name of the meteo file.
Definition: cs_atmo.cpp:4274
cs_atmo_constants_t * cs_glob_atmo_constants
void cs_mo_compute_from_thermal_flux(cs_real_t z, cs_real_t z0, cs_real_t du, cs_real_t buoyant_param, cs_real_t flux, cs_real_t *dlmo, cs_real_t *ustar)
Compute LMO, friction velocity ustar, friction temperature tstar from a thermal flux using Monin Obuk...
Definition: cs_atmo.cpp:1984
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
double cs_real_t
Floating-point value.
Definition: cs_defs.h:357
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:374
#define END_C_DECLS
Definition: cs_defs.h:555
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:350
@ dt
Definition: cs_field_pointer.h:65
real(c_double), pointer, save xlat
latitude of the domain origin
Definition: atincl.f90:153
Definition: cs_atmo.h:439
cs_real_t ps
Definition: cs_atmo.h:442
Definition: cs_atmo.h:149
cs_real_t meteo_t1
Definition: cs_atmo.h:282
cs_real_t domain_orientation
Definition: cs_atmo.h:204
int nbmetm
Definition: cs_atmo.h:193
cs_real_t meteo_zi
Definition: cs_atmo.h:258
cs_real_t * z_dyn_met
Definition: cs_atmo.h:341
int squant
Definition: cs_atmo.h:154
cs_real_t * rho_met
Definition: cs_atmo.h:329
cs_real_t meteo_dlmo
Definition: cs_atmo.h:252
int qv_profile
Definition: cs_atmo.h:361
cs_real_t * hyd_p_met
Definition: cs_atmo.h:347
cs_real_t ground_humidity
Definition: cs_atmo.h:394
int infrared_1D_profile
Definition: cs_atmo.h:423
int distribution_model
Definition: cs_atmo.h:239
cs_atmo_ground_cat_t ground_cat
Definition: cs_atmo.h:369
cs_real_t ground_surf_temp
Definition: cs_atmo.h:390
int hydrostatic_pressure_model
Definition: cs_atmo.h:357
cs_real_t ssec
Definition: cs_atmo.h:160
cs_real_t * ground_cat_w2
Definition: cs_atmo.h:415
bool rupture
Definition: cs_atmo.h:386
int syear
Definition: cs_atmo.h:152
int sedimentation_model
Definition: cs_atmo.h:214
cs_real_t aod_h2o_tot
Definition: cs_atmo.h:431
bool accretion
Definition: cs_atmo.h:380
cs_real_t x_origin
Definition: cs_atmo.h:174
bool compute_z_ground
Definition: cs_atmo.h:207
int shour
Definition: cs_atmo.h:156
cs_real_t meteo_qwstar
Definition: cs_atmo.h:293
cs_real_t meteo_zt1
Definition: cs_atmo.h:264
bool autocollection_cloud
Definition: cs_atmo.h:382
cs_real_t meteo_t0
Definition: cs_atmo.h:280
int deposition_model
Definition: cs_atmo.h:216
int profiles_grid_id
Definition: cs_atmo.h:427
int smin
Definition: cs_atmo.h:158
cs_real_t meteo_qw1
Definition: cs_atmo.h:295
bool autocollection_rain
Definition: cs_atmo.h:383
int nbmaxt
Definition: cs_atmo.h:199
cs_real_t * ndrop_met
Definition: cs_atmo.h:333
int cloud_type
Definition: cs_atmo.h:379
cs_real_t * v_met
Definition: cs_atmo.h:319
cs_real_t meteo_u1
Definition: cs_atmo.h:270
cs_real_t y_l93
Definition: cs_atmo.h:170
int meteo_phih_s
Definition: cs_atmo.h:307
int subgrid_model
Definition: cs_atmo.h:234
cs_real_t * ground_cat_w1
Definition: cs_atmo.h:412
cs_atmo_projection_t projection_type
Definition: cs_atmo.h:178
int ground_model
Definition: cs_atmo.h:364
cs_real_t * ek_met
Definition: cs_atmo.h:323
int ground_zone_id
Definition: cs_atmo.h:371
cs_real_t * u_met
Definition: cs_atmo.h:317
cs_real_t meteo_zu2
Definition: cs_atmo.h:262
cs_real_t meteo_uref
Definition: cs_atmo.h:268
cs_real_t * ground_cat_r1
Definition: cs_atmo.h:417
cs_real_t meteo_ustar0
Definition: cs_atmo.h:274
cs_real_t meteo_z0
Definition: cs_atmo.h:254
int nbmetd
Definition: cs_atmo.h:183
char * meteo_file_name
Definition: cs_atmo.h:249
cs_real_t * z_temp_met
Definition: cs_atmo.h:343
cs_real_t * xyp_met
Definition: cs_atmo.h:315
cs_real_t * ground_cat_roughness
Definition: cs_atmo.h:402
cs_real_t latitude
Definition: cs_atmo.h:164
bool autoconversion
Definition: cs_atmo.h:381
int meteo_phim_s
Definition: cs_atmo.h:305
cs_real_t meteo_wstar0
Definition: cs_atmo.h:276
int met_1d_nlevels_t
Definition: cs_atmo.h:187
cs_real_t ground_w2_ini
Definition: cs_atmo.h:398
int met_1d_nlevels_d
Definition: cs_atmo.h:182
cs_real_t meteo_sensi
Definition: cs_atmo.h:303
int meteo_phih_u
Definition: cs_atmo.h:311
cs_real_t * ground_cat_thermal_roughness
Definition: cs_atmo.h:404
cs_real_t meteo_t2
Definition: cs_atmo.h:284
int met_1d_nlevels_max_t
Definition: cs_atmo.h:198
cs_real_t * w_met
Definition: cs_atmo.h:321
cs_real_t * time_met
Definition: cs_atmo.h:345
cs_real_t meteo_zu1
Definition: cs_atmo.h:260
cs_real_t meteo_tstar
Definition: cs_atmo.h:286
int theo_interp
Definition: cs_atmo.h:210
cs_real_t longitude
Definition: cs_atmo.h:162
cs_real_t meteo_qw2
Definition: cs_atmo.h:297
cs_real_t aod_o3_tot
Definition: cs_atmo.h:429
int utm_zone
Definition: cs_atmo.h:179
cs_real_t ground_temperature
Definition: cs_atmo.h:392
int met_1d_ntimes
Definition: cs_atmo.h:192
int nbmett
Definition: cs_atmo.h:188
cs_real_t meteo_evapor
Definition: cs_atmo.h:301
int open_bcs_treatment
Definition: cs_atmo.h:209
int solar_1D_profile
Definition: cs_atmo.h:425
cs_real_t meteo_u2
Definition: cs_atmo.h:272
cs_real_t * temp_met
Definition: cs_atmo.h:327
cs_real_t * ground_cat_vegeta
Definition: cs_atmo.h:410
int meteo_profile
Definition: cs_atmo.h:246
cs_real_t * ground_cat_r2
Definition: cs_atmo.h:419
int meteo_phim_u
Definition: cs_atmo.h:309
cs_real_t * qw_met
Definition: cs_atmo.h:331
cs_real_t sigc
Definition: cs_atmo.h:421
cs_real_t * ground_cat_emissi
Definition: cs_atmo.h:408
cs_real_t x_l93
Definition: cs_atmo.h:168
cs_real_t * ground_cat_thermal_inertia
Definition: cs_atmo.h:400
cs_real_t altitude
Definition: cs_atmo.h:166
cs_real_t meteo_zref
Definition: cs_atmo.h:256
cs_real_t * ep_met
Definition: cs_atmo.h:325
cs_real_t meteo_ql0
Definition: cs_atmo.h:299
bool precipitation
Definition: cs_atmo.h:384
int nucleation_model
Definition: cs_atmo.h:226
cs_real_t meteo_qw0
Definition: cs_atmo.h:291
cs_atmo_ground_meb_model_t ground_meb_model
Definition: cs_atmo.h:376
cs_real_t ground_w1_ini
Definition: cs_atmo.h:396
cs_real_t * dpdt_met
Definition: cs_atmo.h:352
cs_real_t y_origin
Definition: cs_atmo.h:175
cs_real_t * ground_cat_albedo
Definition: cs_atmo.h:406
cs_real_t * pot_t_met
Definition: cs_atmo.h:349
bool rain
Definition: cs_atmo.h:378
bool evaporation
Definition: cs_atmo.h:385
cs_real_t meteo_zt2
Definition: cs_atmo.h:266
cs_real_t meteo_psea
Definition: cs_atmo.h:288
cs_real_t meteo_angle
Definition: cs_atmo.h:278
cs_real_3_t * mom_met
Definition: cs_atmo.h:354
cs_real_3_t * mom_cs
Definition: cs_atmo.h:356