Changeset 3083 for trunk/LMDZ.TITAN/libf/muphytitan/mm_globals.f90
- Timestamp:
- Oct 12, 2023, 10:30:22 AM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.TITAN/libf/muphytitan/mm_globals.f90
r2242 r3083 1 ! Copyright 2013-2015,2017 Université de Reims Champagne-Ardenne1 ! Copyright 2013-2015,2017,2022 Université de Reims Champagne-Ardenne 2 2 ! Contributor: J. Burgalat (GSMA, URCA) 3 3 ! email of the author : jeremie.burgalat@univ-reims.fr 4 ! 4 ! 5 5 ! This software is a computer program whose purpose is to compute 6 6 ! microphysics processes using a two-moments scheme. 7 ! 7 ! 8 8 ! This library is governed by the CeCILL-B license under French law and 9 ! abiding by the rules of distribution of free software. You can use, 9 ! abiding by the rules of distribution of free software. You can use, 10 10 ! modify and/ or redistribute the software under the terms of the CeCILL-B 11 11 ! license as circulated by CEA, CNRS and INRIA at the following URL 12 ! "http://www.cecill.info". 13 ! 12 ! "http://www.cecill.info". 13 ! 14 14 ! As a counterpart to the access to the source code and rights to copy, 15 15 ! modify and redistribute granted by the license, users are provided only 16 16 ! with a limited warranty and the software's author, the holder of the 17 17 ! economic rights, and the successive licensors have only limited 18 ! liability. 19 ! 18 ! liability. 19 ! 20 20 ! In this respect, the user's attention is drawn to the risks associated 21 21 ! with loading, using, modifying and/or developing or reproducing the … … 25 25 ! professionals having in-depth computer knowledge. Users are therefore 26 26 ! encouraged to load and test the software's suitability as regards their 27 ! requirements in conditions enabling the security of their systems and/or 28 ! data to be ensured and, more generally, to use and operate it in the 29 ! same conditions as regards security. 30 ! 27 ! requirements in conditions enabling the security of their systems and/or 28 ! data to be ensured and, more generally, to use and operate it in the 29 ! same conditions as regards security. 30 ! 31 31 ! The fact that you are presently reading this means that you have had 32 32 ! knowledge of the CeCILL-B license and that you accept its terms. … … 35 35 !! summary: Parameters and global variables module. 36 36 !! author: J. Burgalat 37 !! date: 2013-2015,2017 37 !! date: 2013-2015,2017,2022 38 38 39 39 MODULE MM_GLOBALS 40 40 !! Parameters and global variables module. 41 !! 41 !! 42 42 !! # Module overview 43 43 !! 44 44 !! The module defines all the parameters and global variables that are common 45 45 !! to all other modules of the library. 46 !! 46 !! 47 47 !! It is separated in two parts : 48 48 !! … … 52 52 !! method. 53 53 !! - The second part defines a set of vectors that defines the vertical structure of the atmosphere. 54 !! Each time a new atmospheric column has to be computed (either on a new timestep or on a new couple 55 !! of longitude/latitude), these vectors should be intialized with new values by calling 56 !! [[mm_globals(module):mm_column_init(function)]] method. 57 !! This part is separated in two sets : 58 !! 59 !! - The atmospheric structure with temperature, pressure levels and altitude definitions. 60 !! - The vertical profiles of tracers with the moments of the two aerosols modes (both \(M_{0}\) 61 !! and \(M_{3}\) for a total of 4 vectors), the _clouds_ microphysics moments tracers (i.e. 54 !! Each time a new atmospheric column has to be computed (either on a new timestep or on a new couple 55 !! of longitude/latitude), these vectors should be intialized with new values by calling 56 !! [[mm_globals(module):mm_column_init(function)]] method. 57 !! This part is separated in two sets : 58 !! 59 !! - The atmospheric structure with temperature, pressure levels and altitude definitions. 60 !! - The vertical profiles of tracers with the moments of the two aerosols modes (both \(M_{0}\) 61 !! and \(M_{3}\) for a total of 4 vectors), the _clouds_ microphysics moments tracers (i.e. 62 62 !! \(M_{0}\) and \(M_{3}\) for the ccn and \(M_{3}\) for the ice components). 63 !! Additionally, the module also stores intermediates variables of interest such as the 64 !! characteristic radii of the aerosols modes, the mean drop radius and the drop density, 63 !! Additionally, the module also stores intermediates variables of interest such as the 64 !! characteristic radii of the aerosols modes, the mean drop radius and the drop density, 65 65 !! the molar fraction of each condensible species (related to ice components) and some 66 66 !! scalar variables that holds arrays sizes. 67 67 !! 68 68 !! @note 69 !! All the vectors that represent the vertical structure of the atmosphere (altitude, pressure and 69 !! All the vectors that represent the vertical structure of the atmosphere (altitude, pressure and 70 70 !! temperature...) are oriented from the __TOP__ of the atmosphere to the __GROUND__. 71 71 !! 72 !! @note 73 !! The module also imports errors module from __ FCCP__ library to get definitions of the error object72 !! @note 73 !! The module also imports errors module from __SWIFT__ library to get definitions of the error object 74 74 !! everywhere in the library ([[mm_globals(module)]] is always imported, except in [[mm_mprec(module)]]). 75 75 !! 76 !! # Global variables 76 !! # Global variables 77 77 !! 78 78 !! [[mm_globals(module)]] module contains the declaration of all global/common variable that are shared … … 82 82 !! the following sections list all the global variables by category. 83 83 !! 84 !! ## Control flags 85 !! 84 !! ## Control flags 85 !! 86 86 !! | Name | Description 87 87 !! | :----------------- | :----------------- … … 93 93 !! | mm_w_clouds_sed | Enable/Disable clouds microphysics sedimentation 94 94 !! | mm_w_clouds_nucond | Enable/Disable clouds microphysics nucleation/condensation 95 !! | mm_wsed_m0 | Force all aerosols moments to fall at M0 settling velocity 95 !! | mm_wsed_m0 | Force all aerosols moments to fall at M0 settling velocity 96 96 !! | mm_wsed_m3 | Force all aerosols moments to fall at M3 settling velocity 97 97 !! | mm_no_fiadero_w | Enable/Disable __Fiadero__ correction … … 101 101 !! | Name | Description 102 102 !! | :-------------- | :----------------- 103 !! | mm_fiadero_min | Minimum ratio for __Fiadero__'s correction 103 !! | mm_fiadero_min | Minimum ratio for __Fiadero__'s correction 104 104 !! | mm_fiadero_max | Maximum ratio for __Fiadero__'s correction 105 !! | mm_coag_choice | Coagulation interaction activation flag. It should be a combination of [[mm_globals(module):mm_coag_no(variable)]], [[mm_globals(module):mm_coag_ss(variable)]], [[mm_globals(module):mm_coag_sf(variable)]] and [[mm_globals(module):mm_coag_ff(variable)]]. 106 !! 107 !! ## Physical constants 105 !! | mm_coag_choice | Coagulation interaction activation flag. It should be a combination of [[mm_globals(module):mm_coag_no(variable)]], [[mm_globals(module):mm_coag_ss(variable)]], [[mm_globals(module):mm_coag_sf(variable)]] and [[mm_globals(module):mm_coag_ff(variable)]]. 106 !! 107 !! ## Physical constants 108 108 !! 109 109 !! | Name | Description … … 131 131 !! | mm_w_prod | Angular frequency of the time-dependent production rate. 132 132 !! | mm_ne | Electric charging of aerosols (\(e^{-}.m^{-1}\)) (unused) 133 !! | mm_rb2ra | Bulk to apparent radius conversion pre-factor (\(m^X\)) 133 !! | mm_rb2ra | Bulk to apparent radius conversion pre-factor (\(m^X\)) 134 134 !! | mm_rpla | Planet radius (m) 135 135 !! | mm_g0 | Planet acceleration due to gravity constant (ground) (\(m.s^{-2}\)) … … 152 152 ! the following variables are read-only outside this module. 153 153 ! One must call the afferent subroutine to update them. 154 154 155 155 ! initialization control flags (cannot be updated) 156 156 PROTECTED :: mm_ini,mm_ini_col,mm_ini_aer,mm_ini_cld … … 165 165 ! Moments parameters (derived, are updated with moments parameters) 166 166 PROTECTED :: mm_rcs, mm_rcf, mm_drad, mm_drho 167 168 LOGICAL, SAVE :: mm_debug = .true. !! Enable QnD debug mode (can be used for devel). 169 LOGICAL, SAVE :: mm_log = .false. !! Enable log mode (for configuration only). 167 ! Thresholds parameters 168 PROTECTED :: mm_m0as_min, mm_m3as_min, mm_rcs_min, mm_m0af_min, mm_m3af_min, mm_rcf_min, mm_m0n_min, mm_m3cld_min 169 170 LOGICAL, SAVE :: mm_debug = .false. !! Enable QnD debug mode (can be used for devel). 171 LOGICAL, SAVE :: mm_log = .false. !! Enable log mode (for configuration only). 170 172 171 173 LOGICAL, SAVE :: mm_w_haze_prod = .true. !! Enable/Disable haze production. … … 182 184 !> Enable/Disable __Fiadero__'s correction. 183 185 !! 184 !! This flag enables/disables the __Fiadero__ correction alogrithm for fractal mode settling velocity 185 !! computation. 186 !! This flag enables/disables the __Fiadero__ correction alogrithm for fractal mode settling velocity 187 !! computation. 186 188 !! 187 189 !! @bug 188 !! Currently, the Fiadero correction creates instatibilities on the vertical structure. It seems to be 190 !! Currently, the Fiadero correction creates instatibilities on the vertical structure. It seems to be 189 191 !! related to the coupling between the two moments. In order to reduce the instabilities, settling 190 192 !! velocity of moments are forced to be the same, see [[mm_globals(module):mm_wsed_m0(variable)]] and 191 193 !! [[mm_globals(module):mm_wsed_m3(variable)]]). 192 LOGICAL, SAVE :: mm_no_fiadero_w = .false. 194 LOGICAL, SAVE :: mm_no_fiadero_w = .false. 193 195 194 196 !> Minimum ratio for __Fiadero__ correction. 195 197 !! 196 !! When [[mm_globals(module):mm_no_fiadero_w(variable)]] is disabled, this variable defines the minimum 198 !! When [[mm_globals(module):mm_no_fiadero_w(variable)]] is disabled, this variable defines the minimum 197 199 !! value of the moment's ratio between two adjacents vertical cells to be used within the correction. 198 200 REAL(kind=mm_wp), SAVE :: mm_fiadero_min = 0.1_mm_wp … … 200 202 !> Maximum ratio for __Fiadero__ correction. 201 203 !! 202 !! When [[mm_globals(module):mm_no_fiadero_w(variable)]] is disabled, this variable defines the maximum 204 !! When [[mm_globals(module):mm_no_fiadero_w(variable)]] is disabled, this variable defines the maximum 203 205 !! value of the moment's ratio between two adjacents vertical cells to be used within the correction. 204 206 REAL(kind=mm_wp), SAVE :: mm_fiadero_max = 10._mm_wp … … 213 215 INTEGER, PARAMETER :: mm_coag_ff = 4 !! FF mode interaction for coagulation. 214 216 !> Default interactions to activate (all by default). 215 INTEGER, SAVE :: mm_coag_choice = mm_coag_ss+mm_coag_sf+mm_coag_ff 217 INTEGER, SAVE :: mm_coag_choice = mm_coag_ss+mm_coag_sf+mm_coag_ff 216 218 217 219 !> Pi number. 218 220 REAL(kind=mm_wp), PARAMETER :: mm_pi = 4._mm_wp*atan(1._mm_wp) 219 221 !> Avogadro number. 220 REAL(kind=mm_wp), PARAMETER :: mm_navo = 6.0221367e23_mm_wp 222 REAL(kind=mm_wp), PARAMETER :: mm_navo = 6.0221367e23_mm_wp 221 223 !> Boltzmann constant (\(J.K^{-1}\)). 222 224 REAL(kind=mm_wp), PARAMETER :: mm_kboltz = 1.3806488e-23_mm_wp … … 261 263 262 264 !> Bulk to apparent radius conversion pre-factor (\(m^{X}\)). 263 !! 264 !! It is initialized using [[mm_globals(module):mm_rm(variable)]] in 265 !! 266 !! It is initialized using [[mm_globals(module):mm_rm(variable)]] in 265 267 !! [[mm_globals(module):mm_global_init(interface)]] from the following equation: 266 268 !! 267 269 !! $$ r_{a} = r_{b}^{3/D_{f}}\times r_{m}^{\frac{D_{f}-3}{D_{f}}} $$ 268 270 !! 269 !! Where \(r_{a}\) is the apparent radius, \(r_{b}\) the bulk radius and 271 !! Where \(r_{a}\) is the apparent radius, \(r_{b}\) the bulk radius and 270 272 !! \(rb2ra = r_{m}^{\frac{D_{f}-3}{D_{f}}}\) is the returned pre-factor 271 REAL(kind=mm_wp), SAVE :: mm_rb2ra = 1._mm_wp 273 REAL(kind=mm_wp), SAVE :: mm_rb2ra = 1._mm_wp 274 275 ! Thresholds ! 276 277 !> (min.) Total number of aerosols minimum threshold for the spherical mode. 278 REAL(kind=mm_wp), SAVE :: mm_m0as_min = 1.e-10_mm_wp 279 280 !> (min.) Total volume of aerosols minimum threshold for the spherical mode. 281 REAL(kind=mm_wp), SAVE :: mm_m3as_min = 1.e-40_mm_wp 282 283 !> Characteristic radius minimum threshold for the spherical mode. 284 REAL(kind=mm_wp), SAVE :: mm_rcs_min = 1.e-9_mm_wp 285 286 !> (min.) Total number of aerosols minimum threshold for the fractal mode. 287 REAL(kind=mm_wp), SAVE :: mm_m0af_min = 1.e-10_mm_wp 288 289 !> (min.) Total volume of aerosols minimum threshold for the fractal mode. 290 REAL(kind=mm_wp), SAVE :: mm_m3af_min = 1.e-40_mm_wp 291 292 !> Characteristic radius minimum threshold for the fractal mode. 293 REAL(kind=mm_wp), SAVE :: mm_rcf_min = 1.e-9_mm_wp 294 295 !> (min.) Total number of cloud drop minimum threshold. 296 REAL(kind=mm_wp), SAVE :: mm_m0n_min = 1.e-10_mm_wp 297 298 !> (min.) Total volume of cloud drop minimum threshold. 299 REAL(kind=mm_wp), SAVE :: mm_m3cld_min = 1.e-40_mm_wp 272 300 273 301 !> Characteristic radius threshold. 274 302 REAL(kind=mm_wp), SAVE :: mm_rc_min = 1.e-200_mm_wp 303 304 !> Minimum cloud drop radius 305 REAL(kind=mm_wp), SAVE :: mm_drad_min = 1.e-9_mm_wp 306 307 !> Maximum cloud drop radius 308 REAL(kind=mm_wp), SAVE :: mm_drad_max = 1.e-3_mm_wp 275 309 276 310 !> Name of condensible species. … … 339 373 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_temp 340 374 !> Air density vertical profile (\(kg.m^{-3}\)). 341 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_rhoair 375 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_rhoair 342 376 !> Temperature vertical profil at interfaces (K). 343 377 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_btemp 344 378 345 379 !> Atmospheric levels thickness (m). 346 !! 347 !! Atmospheric thickness between two adjacent levels (\(m\)) from the 380 !! 381 !! Atmospheric thickness between two adjacent levels (\(m\)) from the 348 382 !! __TOP__ to the __GROUND__. 349 383 !! @note __mm_dzlev__ is defined on the total number of layers and actually … … 352 386 353 387 !> Atmospheric layers "thickness" (m). 354 !! 388 !! 355 389 !! Atmospheric thickness between the center of two adjacent layers (\(m\)) 356 390 !! from the __TOP__ to the __GROUND__. 357 !! @note 358 !! __mm_dzlay__ is defined on the total number of layers. The last 391 !! @note 392 !! __mm_dzlay__ is defined on the total number of layers. The last 359 393 !! value of __mm_dzlay__ is set to twice the altitude of the ground layer. 360 !! @note This value corresponds to the thickness between the center of the 394 !! @note This value corresponds to the thickness between the center of the 361 395 !! __GROUND__ layer and below the surface. It is arbitrary and not used. 362 396 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_dzlay … … 377 411 !> Ice components 3rd order moments (\(m^{3}.m^{-3}\)). 378 412 !! 379 !! It is a 2D array with the vertical layers in first dimension, and the number of ice 413 !! It is a 2D array with the vertical layers in first dimension, and the number of ice 380 414 !! components in the second. 381 !! @note 415 !! @note 382 416 !! Both [[mm_globals(module):mm_m3ice(variable)]] and [[mm_globals(module):mm_gazs(variable)]] 383 417 !! share the same indexing (related to species order). … … 387 421 !! 388 422 !! It is a 2D array with the vertical layers in first dimension, and 389 !! the number of condensible species in the second. 390 !! @note 423 !! the number of condensible species in the second. 424 !! @note 391 425 !! Both [[mm_globals(module):mm_m3ice(variable)]] and [[mm_globals(module):mm_gazs(variable)]] 392 426 !! share the same indexing (related to species order). … … 410 444 !> Spherical mode \(M_{0}\) settling velocity (\(m.s^{-1}\)). 411 445 !! 412 !! It is a vector with the vertical layers that contains the settling velocity for 446 !! It is a vector with the vertical layers that contains the settling velocity for 413 447 !! the \(0^{th}\) order moment of the spherical mode. 414 448 !! It is updated in [[mm_haze(module):mm_haze_sedimentation(subroutine)]]. 415 !! @note 449 !! @note 416 450 !! This variable is always negative. 417 451 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_m0as_vsed … … 419 453 !> Spherical mode \(M_{3}\) settling velocity (\(m.s^{-1}\)). 420 454 !! 421 !! It is a vector with the vertical layers that contains the settling velocity for the 455 !! It is a vector with the vertical layers that contains the settling velocity for the 422 456 !! \(3^{rd}\) order moment of the spherical mode. 423 457 !! It is updated in [[mm_haze(module):mm_haze_sedimentation(subroutine)]]. 424 !! @note 458 !! @note 425 459 !! This variable is always negative. 426 460 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_m3as_vsed … … 428 462 !> Fractal mode \(M_{0}\) settling velocity (\(m.s^{-1}\)). 429 463 !! 430 !! It is a vector with the vertical layers that contains the settling velocity for the 464 !! It is a vector with the vertical layers that contains the settling velocity for the 431 465 !! \(0^{th}\) order moment of the fractal mode. 432 466 !! It is updated in [[mm_haze(module):mm_haze_sedimentation(subroutine)]]. 433 !! @note 467 !! @note 434 468 !! This variable is always negative. 435 469 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_m0af_vsed … … 437 471 !> Fractal mode \(M_{3}\) settling velocity (\(m.s^{-1}\)). 438 472 !! 439 !! It is a vector with the vertical layers that contains the settling velocity for the 473 !! It is a vector with the vertical layers that contains the settling velocity for the 440 474 !! \(3^{rd}\) order moment of the fractal mode. 441 475 !! It is updated in [[mm_haze(module):mm_haze_sedimentation(subroutine)]]. 442 !! @note 476 !! @note 443 477 !! This variable is always negative. 444 478 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_m3af_vsed … … 448 482 !! It is a vector with the vertical layers that contains the mass fluxes for spherical aerosols. 449 483 !! It is updated in [[mm_haze(module):mm_haze_sedimentation(subroutine)]]. 450 !! @note 484 !! @note 451 485 !! This variable is always negative. 452 486 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_aer_s_flux … … 456 490 !! It is a vector with the vertical layers that contains the mass fluxes for fractal aerosols 457 491 !! It is updated in [[mm_haze(module):mm_haze_sedimentation(subroutine)]]. 458 !! @note 492 !! @note 459 493 !! This variable is always negative. 460 494 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_aer_f_flux … … 464 498 REAL(kind=mm_wp), SAVE :: mm_ccn_prec = 0._mm_wp 465 499 466 !> CCN mass fluxes (\(kg.m^{-2}.s^{-1}\)).467 !! 468 !! It is a vector with the vertical layers that contains the 469 !! mass fluxes for CCN.500 !> CCN settling velocity (\(m.s^{-1}\)). 501 !! 502 !! It is a vector with the vertical layers that contains the 503 !! settling velocity for CCN (and ices). 470 504 !! It is updated in [[mm_clouds(module):mm_cloud_microphysics(subroutine)]]. 471 505 !! @note 472 !! This variable is always negative. 506 !! This variable is always positive. 507 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_ccn_w 508 509 !> CCN mass fluxes (\(kg.m^{-2}.s^{-1}\)). 510 !! 511 !! It is a vector with the vertical layers that contains the 512 !! mass fluxes for CCN. 513 !! It is updated in [[mm_clouds(module):mm_cloud_microphysics(subroutine)]]. 514 !! @note 515 !! This variable is always positive. 473 516 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE, SAVE :: mm_ccn_flux 474 517 475 518 !> Ice components precipitations (m). 476 519 !! 477 !! It is a vector of [[mm_globals(module):mm_nesp(variable)]] values which share the same indexing 520 !! It is a vector of [[mm_globals(module):mm_nesp(variable)]] values which share the same indexing 478 521 !! than [[mm_globals(module):mm_m3ice(variable)]] and [[mm_globals(module):mm_gazs(variable)]]. 479 522 !! It is updated in [[mm_clouds(module):mm_cloud_microphysics(subroutine)]]. … … 484 527 !> Ice components sedimentation fluxes (\(kg.m^{-2}.s-1\)). 485 528 !! 486 !! It is a 2D-array with the vertical layers in first dimension and the number of ice components 529 !! It is a 2D-array with the vertical layers in first dimension and the number of ice components 487 530 !! in the second. It is updated in [[mm_clouds(module):mm_cloud_microphysics(subroutine)]]. 488 531 !! @note … … 492 535 !> Condensible species saturation ratio (--). 493 536 !! 494 !! It is a 2D-array with the vertical layers in first dimension and the number of condensible 537 !! It is a 2D-array with the vertical layers in first dimension and the number of condensible 495 538 !! species in the second. 496 539 !! It is updated in [[mm_clouds(module):mm_cloud_microphysics(subroutine)]]. … … 516 559 INTERFACE mm_cloud_properties 517 560 MODULE PROCEDURE cldprop_sc,cldprop_ve 518 END INTERFACE 561 END INTERFACE mm_cloud_properties 519 562 520 563 !> Interface to global initialization. … … 522 565 !! The method performs the global initialization of the model. 523 566 !! @warning 524 !! If OpenMP is activated, this subroutine must be called in an $OMP SINGLE statement as it 567 !! If OpenMP is activated, this subroutine must be called in an $OMP SINGLE statement as it 525 568 !! initializes global variable that are not thread private. 526 569 !! 527 !! ''' 528 !! !$OMP SINGLE 529 !! call mm_global_init(...) 530 !! !$OMP END SINGLE 570 !! !$OMP SINGLE 571 !! call mm_global_init(...) 572 !! !$OMP END SINGLE 531 573 INTERFACE mm_global_init 532 574 MODULE PROCEDURE mm_global_init_0,mm_global_init_1 533 END INTERFACE 575 END INTERFACE mm_global_init 534 576 535 577 !> Check an option from the configuration system. … … 538 580 !! set a default value if the option is not found. This is an overloaded method 539 581 !! that can take in input either a floating point, integer, logical or string 540 !! option value. 582 !! option value. 541 583 INTERFACE mm_check_opt 542 584 MODULE PROCEDURE check_r1,check_i1,check_l1,check_s1 543 END INTERFACE 585 END INTERFACE mm_check_opt 544 586 545 587 ! --- OPENMP --------------- 546 ! All variable related to column computations should be private to each thread588 ! All variables related to column computations should be private to each thread 547 589 ! 548 590 !$OMP THREADPRIVATE(mm_ini_col,mm_ini_aer,mm_ini_cld) … … 551 593 !$OMP THREADPRIVATE(mm_m0ccn,mm_m3ccn,mm_m3ice,mm_gazs) 552 594 !$OMP THREADPRIVATE(mm_rcs,mm_rcf,mm_drad,mm_drho) 553 !$OMP THREADPRIVATE(mm_aer_s_flux,mm_aer_f_flux,mm_ccn_ flux,mm_ice_prec,mm_ice_fluxes,mm_gazs_sat)595 !$OMP THREADPRIVATE(mm_aer_s_flux,mm_aer_f_flux,mm_ccn_w,mm_ccn_flux,mm_ice_prec,mm_ice_fluxes,mm_gazs_sat) 554 596 !$OMP THREADPRIVATE(mm_m0as_vsed,mm_m3as_vsed,mm_m0af_vsed,mm_m3af_vsed) 555 597 !$OMP THREADPRIVATE(mm_m0as_min,mm_m3as_min,mm_rcs_min,mm_m0af_min,mm_m3af_min,mm_rcf_min,mm_m0n_min,mm_m3cld_min) 556 598 !$OMP THREADPRIVATE(mm_nla,mm_nle) 557 599 … … 559 601 560 602 561 CONTAINS 603 CONTAINS 562 604 563 605 FUNCTION mm_global_init_0(dt,df,rm,rho_aer,p_prod,tx_prod,rc_prod,rplanet,g0, & 564 air_rad,air_mmol,coag_interactions,clouds,spcfile, & 565 w_haze_prod,w_haze_sed,w_haze_coag,w_cloud_nucond, & 566 w_cloud_sed,force_wsed_to_m0,force_wsed_to_m3, & 567 no_fiadero,fiadero_min,fiadero_max) RESULT(err) 606 air_rad,air_mmol,coag_interactions,clouds,spcfile, & 607 w_haze_prod,w_haze_sed,w_haze_coag,w_cloud_nucond, & 608 w_cloud_sed,force_wsed_to_m0,force_wsed_to_m3, & 609 no_fiadero,fiadero_min,fiadero_max, & 610 m0as_min,rcs_min,m0af_min,rcf_min,m0n_min,debug) RESULT(err) 568 611 !! Initialize global parameters of the model. 569 !! 612 !! 570 613 !! The function initializes all the global parameters of the model from direct input. 571 !! Boolean (and Fiadero) parameters are optional as they are rather testing parameters. Their572 !! default values are suitable for production runs.614 !! Boolean, Fiadero and thresholds parameters are optional as they are rather testing parameters. 615 !! Their default values are suitable for production runs. 573 616 !! @note 574 617 !! If the method fails to initialize parameters (i.e. returned error is not 0). Then the model 575 618 !! should probably be aborted as the global variables of the model will not be correctly setup. 576 619 !! @warning 577 !! If OpenMP is activated, this subroutine must be called in an $OMP SINGLE statement as it 578 !! initializes global variable that are not thread private. 579 !! 580 !! ''' 581 !! !$OMP SINGLE 582 !! call mm_global_init_0(...) 583 !! !$OMP END SINGLE 620 !! If OpenMP is activated, this subroutine must be called in an $OMP SINGLE statement as it 621 !! initializes (only) global variables that are not thread private. 622 !! 623 !! !$OMP SINGLE 624 !! call mm_global_init_0(...) 625 !! !$OMP END SINGLE 584 626 REAL(kind=mm_wp), INTENT(in) :: dt 585 627 !! Microphysics timestep in seconds. 586 628 REAL(kind=mm_wp), INTENT(in) :: df 587 629 !! Fractal dimension of fractal aerosol. 588 630 REAL(kind=mm_wp), INTENT(in) :: rm 589 631 !! Monomer radius in meter. 590 632 REAL(kind=mm_wp), INTENT(in) :: rho_aer 591 633 !! Aerosol density in \(kg.m^{-3}\). 592 634 REAL(kind=mm_wp), INTENT(in) :: p_prod 593 635 !! Aerosol production pressure level in Pa. 594 636 REAL(kind=mm_wp), INTENT(in) :: tx_prod 595 637 !! Spherical aerosol mode production rate in \(kg.m^{-2}.s^{-1}\). 596 638 REAL(kind=mm_wp), INTENT(in) :: rc_prod 597 639 !! Spherical mode characteristic radius for production in meter. 598 640 REAL(kind=mm_wp), INTENT(in) :: rplanet 599 641 !! Planet radius in meter 600 642 REAL(kind=mm_wp), INTENT(in) :: g0 601 643 !! Planet gravity acceleration at ground level in \(m.s^{-2}\). 602 644 REAL(kind=mm_wp), INTENT(in) :: air_rad 603 645 !! Air molecules mean radius in meter. 604 646 REAL(kind=mm_wp), INTENT(in) :: air_mmol 605 647 !! Air molecules mean molar mass in \(kg.mol^{-1}\). 606 648 INTEGER, INTENT(in) :: coag_interactions 607 649 !! Coagulation interactions process control flag. 608 650 LOGICAL, INTENT(in) :: clouds 609 651 !! Clouds microphysics control flag. 610 652 CHARACTER(len=*), INTENT(in) :: spcfile 611 653 !! Clouds microphysics condensible species properties file. 612 654 REAL(kind=mm_wp), INTENT(in), OPTIONAL :: fiadero_max 613 655 !! Maximum moment ratio threshold for Fiadero correction (default: 10.) . 614 656 REAL(kind=mm_wp), INTENT(in), OPTIONAL :: fiadero_min 615 657 !! Minimum moment ratio threshold for Fiadero correction (default: 0.1). 616 658 LOGICAL, INTENT(in), OPTIONAL :: w_haze_prod 617 659 !! Haze microphysics production process control flag (default: T). 618 660 LOGICAL, INTENT(in), OPTIONAL :: w_haze_sed 619 661 !! Haze microphysics sedimentation process control flag (default: T). 620 662 LOGICAL, INTENT(in), OPTIONAL :: w_haze_coag 621 663 !! Haze microphysics coagulation process control flag (default: T). 622 664 LOGICAL, INTENT(in), OPTIONAL :: w_cloud_sed 623 665 !! Cloud microphysics nucleation/conensation process control flag (default: __clouds__ value). 624 666 LOGICAL, INTENT(in), OPTIONAL :: w_cloud_nucond 625 667 !! Cloud microphysics production process control flag (default: __clouds__ value). 626 668 LOGICAL, INTENT(in), OPTIONAL :: no_fiadero 627 669 !! Disable Fiadero correction for haze sedimentation process (default: F). 628 670 LOGICAL, INTENT(in), OPTIONAL :: force_wsed_to_m0 629 !! force __all__ aerosols moments to fall at M0 settling velocity (default: T). 630 LOGICAL, INTENT(in), OPTIONAL :: force_wsed_to_m3 631 !! Force __all__ aerosols moments to fall at M3 settling velocity (default: F). 671 !! force __all__ aerosols moments to fall at M0 settling velocity (default: T). 672 LOGICAL, INTENT(in), OPTIONAL :: force_wsed_to_m3 673 !! Force __all__ aerosols moments to fall at M3 settling velocity (default: F). 674 REAL(kind=mm_wp), INTENT(in), OPTIONAL :: m0as_min 675 !! Minimum threshold for M0 of the spherical mode (default: 1e-10). 676 REAL(kind=mm_wp), INTENT(in), OPTIONAL :: rcs_min 677 !! Minimum threshold for the characteristic radius of the spherical mode in meter (default: 1e-9). 678 REAL(kind=mm_wp), INTENT(in), OPTIONAL :: m0af_min 679 !! Minimum threshold for M0 of the factal mode (default: 1e-10). 680 REAL(kind=mm_wp), INTENT(in), OPTIONAL :: rcf_min 681 !! Minimum threshold for the characteristic radius of the fractal mode in meter (default: _monomer radius_). 682 REAL(kind=mm_wp), INTENT(in), OPTIONAL :: m0n_min 683 !! Minimum threshold for M0 of cloud drop (default: 1e-10). 684 LOGICAL, INTENT(in), OPTIONAL :: debug 685 !! Debug mode control flag (may print lot of stuff if enabled) 632 686 TYPE(error) :: err 633 687 !! Error status of the function. 634 688 INTEGER :: i 635 689 TYPE(cfgparser) :: cp 636 CHARACTER(len=st_slen) :: spcpath637 CHARACTER(len=:), ALLOCATABLE :: defmsg638 690 CHARACTER(len=st_slen), DIMENSION(:), ALLOCATABLE :: species 639 691 REAL(kind=mm_wp) :: zfiamin,zfiamax 640 692 LOGICAL :: zwhp,zwhs,zwhc,zwcs,zwcn,znofia, & 641 693 zwstom0,zwstom3 642 643 694 zwhp = .true. ; zwhs = .true. ; zwhc = .true. 644 zwcs = clouds ; zwcn = clouds 695 zwcs = clouds ; zwcn = clouds 645 696 znofia = .false. ; zfiamin = 0.1_mm_wp ; zfiamax = 10._mm_wp 646 697 zwstom0 = .true. ; zwstom3 = .false. … … 652 703 653 704 ! Store options values in global variables... 654 mm_df = df 655 mm_rm = rm 705 mm_df = df 706 mm_rm = rm 656 707 mm_rb2ra = mm_rm**((mm_df-3._mm_wp)/mm_df) ! conversion factor for bulk -> fractal radius 657 mm_rhoaer = rho_aer 708 mm_rhoaer = rho_aer 658 709 mm_p_prod = p_prod 659 710 mm_tx_prod = tx_prod … … 662 713 mm_g0 = g0 663 714 mm_dt = dt 664 mm_air_rad = mm_air_rad715 mm_air_rad = air_rad 665 716 mm_air_mmol = air_mmol 666 717 mm_coag_choice = coag_interactions … … 670 721 RETURN 671 722 ENDIF 723 724 ! force fractal radius minimum threshold to monomer radius ^^ 725 mm_rcf_min = mm_rm 672 726 673 727 mm_w_clouds = clouds … … 680 734 RETURN 681 735 ENDIF 682 ! Reads species properties configuration file 736 ! Reads species properties configuration file 683 737 err = cfg_read_config(cp,TRIM(spcfile)) ; IF (err /= 0) RETURN 684 err = cfg_get_value(cp,"used_species",species) 738 err = cfg_get_value(cp,"used_species",species) 685 739 IF (err /= 0) THEN 686 740 err = error("mm_global_init: cannot retrieve 'used_species' values",-1) … … 691 745 ALLOCATE(mm_spcname(mm_nesp),mm_xESPS(mm_nesp)) 692 746 DO i=1,mm_nesp 693 mm_spcname(i) = to_lower(species(i))747 mm_spcname(i) = TRIM(species(i)) 694 748 IF(.NOT.cfg_has_section(cp,TRIM(mm_spcname(i)))) THEN 695 749 err = error("mm_global_init: Cannot find "//TRIM(mm_spcname(i))//" properties",-1) … … 708 762 709 763 ! optional flags 764 ! debug mode 765 IF (PRESENT(debug)) THEN 766 mm_debug = debug 767 ELSE 768 mm_debug = .false. 769 call printw("mm_debug",to_string(mm_debug)) 770 ENDIF 710 771 ! haze control flags 711 IF (PRESENT(w_haze_prod)) THEN 772 IF (PRESENT(w_haze_prod)) THEN 712 773 mm_w_haze_prod = w_haze_prod 713 ELSE 714 mm_w_haze_prod = zwhp 774 ELSE 775 mm_w_haze_prod = zwhp 715 776 call printw("mm_haze_production",to_string(mm_w_haze_prod)) 716 777 ENDIF 717 IF (PRESENT(w_haze_sed)) THEN 778 IF (PRESENT(w_haze_sed)) THEN 718 779 mm_w_haze_sed = w_haze_sed 719 ELSE 720 mm_w_haze_sed = zwhs 780 ELSE 781 mm_w_haze_sed = zwhs 721 782 call printw("mm_haze_sedimentation",to_string(mm_w_haze_sed)) 722 783 ENDIF 723 IF (PRESENT(w_haze_coag)) THEN 784 IF (PRESENT(w_haze_coag)) THEN 724 785 mm_w_haze_coag = w_haze_coag 725 ELSE 786 ELSE 726 787 mm_w_haze_coag = zwhc 727 788 call printw("mm_haze_coagulation",to_string(mm_w_haze_coag)) 728 789 ENDIF 729 IF (PRESENT(force_wsed_to_m0)) THEN 790 IF (PRESENT(force_wsed_to_m0)) THEN 730 791 mm_wsed_m0 = force_wsed_to_m0 731 ELSE 792 ELSE 732 793 mm_wsed_m0 = zwstom0 733 794 call printw("mm_wsed_m0",to_string(mm_wsed_m0)) 734 795 ENDIF 735 IF (PRESENT(force_wsed_to_m3)) THEN 796 IF (PRESENT(force_wsed_to_m3)) THEN 736 797 mm_wsed_m3 = force_wsed_to_m3 737 ELSE 798 ELSE 738 799 mm_wsed_m3 = zwstom3 739 800 call printw("mm_wsed_m3",to_string(mm_wsed_m3)) 740 801 ENDIF 741 IF (PRESENT(no_fiadero)) THEN 802 IF (PRESENT(no_fiadero)) THEN 742 803 mm_no_fiadero_w = no_fiadero 743 ELSE 744 mm_no_fiadero_w = znofia 804 ELSE 805 mm_no_fiadero_w = znofia 745 806 call printw("mm_no_fiadero",to_string(mm_no_fiadero_w)) 746 807 ENDIF 747 IF (PRESENT(fiadero_min)) THEN 808 IF (PRESENT(fiadero_min)) THEN 748 809 mm_fiadero_min = fiadero_min 749 ELSE 810 ELSE 750 811 mm_fiadero_min = zfiamin 751 812 call printw("mm_fiadero_min",to_string(mm_fiadero_min)) 752 813 ENDIF 753 IF (PRESENT(fiadero_max)) THEN 814 IF (PRESENT(fiadero_max)) THEN 754 815 mm_fiadero_max = fiadero_max 755 ELSE 816 ELSE 756 817 mm_fiadero_max = zfiamax 757 818 call printw("mm_fiadero_max",to_string(mm_fiadero_max)) 758 819 ENDIF 820 821 ! moments threshold flags 822 IF (PRESENT(m0as_min)) THEN 823 mm_m0as_min = MAX(0._mm_wp,m0as_min) 824 ELSE 825 call printw("mm_m0as_min",to_string(mm_m0as_min)) 826 ENDIF 827 IF (PRESENT(rcs_min)) THEN 828 mm_rcs_min = MAX(1.e-9_mm_wp,rcs_min) 829 ELSE 830 call printw("mm_rcs_min",to_string(mm_rcs_min)) 831 ENDIF 832 IF (PRESENT(m0af_min)) THEN 833 mm_m0af_min = MAX(0._mm_wp,m0af_min) 834 ELSE 835 call printw("mm_m0af_min",to_string(mm_m0af_min)) 836 ENDIF 837 IF (PRESENT(rcf_min)) THEN 838 mm_rcf_min = MAX(rcf_min,mm_rm) 839 ELSE 840 mm_rcf_min = mm_rm 841 call printw("mm_rcf_min",to_string(mm_rcf_min)) 842 ENDIF 843 IF (PRESENT(m0n_min)) THEN 844 mm_m0n_min = MAX(0._mm_wp,m0n_min) 845 ELSE 846 call printw("mm_m0n_min",to_string(mm_m0n_min)) 847 ENDIF 848 849 ! compute m3 thresholds from user-defined thresholds. 850 mm_m3as_min = mm_m0as_min*mm_alpha_s(3._mm_wp) * mm_rcs_min**3._mm_wp 851 mm_m3af_min = mm_m0af_min*mm_alpha_f(3._mm_wp) * mm_rcf_min**3._mm_wp 852 mm_m3cld_min = mm_m0n_min * (4._mm_wp * mm_pi / 3._mm_wp) * mm_drad_min**3._mm_wp 853 759 854 ! clouds control flags 760 855 IF (mm_w_clouds) THEN 761 IF (PRESENT(w_cloud_sed)) THEN 856 IF (PRESENT(w_cloud_sed)) THEN 762 857 mm_w_cloud_sed = w_cloud_sed 763 ELSE 764 mm_w_cloud_sed = zwcs 765 call printw("mm_cloud_sed",to_string(mm_w_cloud_sed)) 858 ELSE 859 mm_w_cloud_sed = zwcs 860 call printw("mm_cloud_sed",to_string(mm_w_cloud_sed)) 766 861 ENDIF 767 IF (PRESENT(w_cloud_nucond)) THEN 862 IF (PRESENT(w_cloud_nucond)) THEN 768 863 mm_w_cloud_nucond = w_cloud_nucond 769 ELSE 864 ELSE 770 865 mm_w_cloud_nucond = zwcs 771 call printw("mm_cloud_nucond",to_string(mm_w_cloud_nucond)) 866 call printw("mm_cloud_nucond",to_string(mm_w_cloud_nucond)) 772 867 ENDIF 773 868 ENDIF … … 781 876 mm_ini = err == noerror 782 877 783 878 CONTAINS 784 879 785 880 SUBROUTINE printw(string,value) … … 788 883 CHARACTER(len=*), INTENT(in) :: value !! (string) Value of the option. 789 884 IF (mm_log) & 790 WRITE(*,'(a,a,a)') "warning: Parameter "//string//"not given... Using default value: "//value791 END SUBROUTINE printw 885 WRITE(*,'(a,a,a)') "warning: Parameter "//string//"not given... Using default value: "//value 886 END SUBROUTINE printw 792 887 END FUNCTION mm_global_init_0 793 888 … … 796 891 !! 797 892 !! See [[mm_globals(module):mm_global_init_0(function)]]. 798 TYPE(cfgparser), INTENT(in) :: cfg !! Configuration file path. 799 TYPE(error) :: err !! Error status of the function. 893 TYPE(cfgparser), INTENT(in) :: cfg 894 !! Configuration file path. 895 TYPE(error) :: err 896 !! Error status of the function. 800 897 INTEGER :: i 801 898 TYPE(cfgparser) :: spccfg 802 899 CHARACTER(len=st_slen) :: spcpath 803 CHARACTER(len=:), ALLOCATABLE :: defmsg804 900 CHARACTER(len=st_slen), DIMENSION(:), ALLOCATABLE :: species 805 901 REAL(kind=mm_wp) :: zfiamin,zfiamax 806 902 LOGICAL :: zwhp,zwhs,zwhc,zwcs,zwcn,znofia, & 807 903 zwstom0,zwstom3 808 904 809 905 err = noerror … … 856 952 ! Gets species property file path 857 953 err = cfg_get_value(cfg,'specie_cfg',spcpath) ; IF (err /= 0) RETURN 858 ! Reads species properties configuration file 954 ! Reads species properties configuration file 859 955 err = cfg_read_config(spccfg,trim(spcpath)) ; IF (err /= 0) RETURN 860 err = cfg_get_value(spccfg,"used_species",species) 956 err = cfg_get_value(spccfg,"used_species",species) 861 957 IF (err /= 0) THEN 862 958 err = error("mm_global_init: cannot retrieve 'used_species' values",-1) … … 868 964 !mm_spcname(1:mm_nesp) = species(:) 869 965 DO i=1,mm_nesp 870 mm_spcname(i) = to_lower(species(i))966 mm_spcname(i) = TRIM(species(i)) 871 967 IF (.NOT.cfg_has_section(spccfg,TRIM(mm_spcname(i)))) THEN 872 968 err = error("mm_global_init: Cannot find "//TRIM(mm_spcname(i))//" properties",-1) … … 890 986 891 987 ! MP2M Optional parameters 988 err = mm_check_opt(cfg_get_value(cfg,"debug",mm_debug),mm_debug,.false.,wlog=mm_log) 892 989 err = mm_check_opt(cfg_get_value(cfg,"haze_production",mm_w_haze_prod),mm_w_haze_prod,zwhp,wlog=mm_log) 893 990 err = mm_check_opt(cfg_get_value(cfg,"haze_sedimentation",mm_w_haze_sed),mm_w_haze_sed,zwhs,wlog=mm_log) … … 901 998 err = mm_check_opt(cfg_get_value(cfg,"fiadero_max_ratio",mm_fiadero_max),mm_fiadero_max,zfiamax,wlog=mm_log) 902 999 1000 err = mm_check_opt(cfg_get_value(cfg,"m0as_min",mm_m0as_min),mm_m0as_min,1e-10_mm_wp,wlog=mm_log) 1001 err = mm_check_opt(cfg_get_value(cfg,"rcs_min",mm_rcs_min),mm_rcs_min,1e-9_mm_wp,wlog=mm_log) 1002 err = mm_check_opt(cfg_get_value(cfg,"m0af_min",mm_m0af_min),mm_m0af_min,1e-10_mm_wp,wlog=mm_log) 1003 err = mm_check_opt(cfg_get_value(cfg,"rcf_min",mm_rcf_min),mm_rcf_min,mm_rm,wlog=mm_log) 1004 err = mm_check_opt(cfg_get_value(cfg,"m0n_min",mm_m0n_min),mm_m0n_min,1e-10_mm_wp,wlog=mm_log) 1005 1006 1007 ! force fractal radius minimum threshold to monomer radius ^^ 1008 mm_rcf_min = MAX(mm_rm,mm_rcf_min) 1009 1010 ! compute m3 thresholds from user-defined thresholds. 1011 mm_m3as_min = mm_m0as_min*mm_alpha_s(3._mm_wp) * mm_rcs_min**3._mm_wp 1012 mm_m3af_min = mm_m0af_min*mm_alpha_f(3._mm_wp) * mm_rcf_min**3._mm_wp 1013 mm_m3cld_min = mm_m0n_min * (4._mm_wp * mm_pi / 3._mm_wp) * mm_drad_min**3._mm_wp 1014 903 1015 err = noerror 904 1016 ! special check for settling velocity … … 911 1023 FUNCTION mm_column_init(plev,zlev,play,zlay,temp) RESULT(err) 912 1024 !! Initialize vertical atmospheric fields. 913 !! 1025 !! 914 1026 !! This subroutine initializes vertical fields needed by the microphysics: 915 1027 !! 916 !! 1. Save reversed input field into "local" array 1028 !! 1. Save reversed input field into "local" array 917 1029 !! 2. Compute thicknesses layers and levels 918 1030 !! 3. Interpolate temperature at levels … … 922 1034 !! @attention 923 1035 !! All the input vectors should be defined from __GROUND__ to __TOP__ of the atmosphere, 924 !! otherwise nasty things will occur in computations. 1036 !! otherwise nasty things will occur in computations. 925 1037 REAL(kind=mm_wp), DIMENSION(:), INTENT(in) :: plev !! Pressure levels (Pa). 926 1038 REAL(kind=mm_wp), DIMENSION(:), INTENT(in) :: zlev !! Altitude levels (m). … … 930 1042 TYPE(error) :: err !! Error status of the function. 931 1043 INTEGER :: i 932 mm_ini_col = .false. 1044 mm_ini_col = .false. 933 1045 err = noerror 934 1046 IF (.NOT.mm_ini) THEN … … 980 1092 ! Hydrostatic equilibrium 981 1093 mm_rhoair(1:mm_nla) = (mm_plev(2:mm_nle)-mm_plev(1:mm_nla)) / & 982 983 mm_ini_col = .true. 1094 (mm_effg(mm_zlay)*mm_dzlev) 1095 mm_ini_col = .true. 984 1096 ! write out profiles (only if BOTH debug and log are enabled). 985 1097 IF (mm_log.AND.mm_debug) THEN … … 1003 1115 FUNCTION mm_aerosols_init(m0aer_s,m3aer_s,m0aer_f,m3aer_f) RESULT(err) 1004 1116 !! Initialize clouds tracers vertical grid. 1005 !! 1006 !! The subroutine initializes aerosols microphysics tracers columns. It allocates variables if 1007 !! required and stores input vectors in reversed order. It also computes the characteristic radii 1008 !! of each mode. 1117 !! 1118 !! The subroutine initializes aerosols microphysics tracers columns. It allocates variables if 1119 !! required and stores input vectors in reversed order. It also computes the characteristic radii 1120 !! of each mode. 1009 1121 !! @note 1010 !! All the input arguments should be defined from ground to top. 1122 !! All the input arguments should be defined from ground to top. 1011 1123 !! 1012 1124 !! @attention 1013 1125 !! [[mm_globals(module):mm_global_init(interface)]] and [[mm_globals(module):mm_column_init(function)]] 1014 1126 !! must have been called at least once before this method is called. Moreover, this method should be 1015 !! after each call of [[mm_globals(module):mm_column_init(function)]] to reflect changes in the 1127 !! after each call of [[mm_globals(module):mm_column_init(function)]] to reflect changes in the 1016 1128 !! vertical atmospheric structure. 1017 1129 REAL(kind=mm_wp), DIMENSION(:), INTENT(in) :: m0aer_s !! \(0^{th}\) order moment of the spherical mode (\(m^{-2}\)). … … 1063 1175 mm_m0aer_f = m0aer_f(mm_nla:1:-1)/mm_dzlev(:) 1064 1176 mm_m3aer_f = m3aer_f(mm_nla:1:-1)/mm_dzlev(:) 1177 1178 ! Setup threshold: 1179 call mm_set_moments_thresholds() 1180 1065 1181 ! aerosols characteristic radii 1066 ! il faudrait peut etre revoir la gestion des zeros ici et la1067 ! remplacer par une valeur seuil des moments.1068 !1069 !-> JVO 19 : Done. Zero threshold set at espilon from dynamics on the1070 ! input moments in calmufi (safer than here). Might still be some unphysical1071 ! values after the dynamics near the threshold. Could be a could idea to add1072 ! a sanity check filtering too high values of radii.1073 !1074 ! TBD : Add a sanity check for high radii ????1075 1182 WHERE(mm_m3aer_s > 0._mm_wp .AND. mm_m0aer_s > 0._mm_wp) 1076 1183 mm_rcs = mm_get_rcs(mm_m0aer_s,mm_m3aer_s) … … 1088 1195 FUNCTION mm_clouds_init(m0ccn,m3ccn,m3ice,gazs) RESULT(err) 1089 1196 !! Initialize clouds tracers vertical grid. 1090 !! 1091 !! The subroutine initializes cloud microphysics tracers columns. It allocates variables if 1092 !! required and stores input vectors in reversed order. It also computes the mean drop radius 1197 !! 1198 !! The subroutine initializes cloud microphysics tracers columns. It allocates variables if 1199 !! required and stores input vectors in reversed order. It also computes the mean drop radius 1093 1200 !! and density and allocates diagnostic vectors. 1094 1201 !! @note 1095 !! All the input arguments should be defined from ground to top. 1202 !! All the input arguments should be defined from ground to top. 1096 1203 !! 1097 1204 !! @attention 1098 1205 !! [[mm_globals(module):mm_global_init(interface)]] and [[mm_globals(module):mm_column_init(function)]] 1099 1206 !! must have been called at least once before this method is called. Moreover, this method should be 1100 !! after each call of [[mm_globals(module):mm_column_init(function)]] to reflect changes in the 1207 !! after each call of [[mm_globals(module):mm_column_init(function)]] to reflect changes in the 1101 1208 !! vertical atmospheric structure. 1102 1209 REAL(kind=mm_wp), DIMENSION(:), INTENT(in) :: m0ccn !! 0th order moment of the CCN distribution (\(m^{-2}\)). … … 1121 1228 ! Actually, mm_nla should always initialized the first time mm_column_init is called, NOT HERE. 1122 1229 IF (mm_nla < 0) mm_nla = SIZE(gazs,DIM=1) 1123 ! Note: 1230 ! Note: 1124 1231 ! here we could check that mm_nesp is the same size of gazs(DIM=2) 1125 1232 ! Actually, mm_nesp should be always initialized in mm_global_init, NOT HERE. … … 1134 1241 IF (.NOT.ALLOCATED(mm_drho)) ALLOCATE(mm_drho(mm_nla)) 1135 1242 ! Allocate memory for diagnostics 1243 IF (.NOT.ALLOCATED(mm_ccn_w)) THEN 1244 ALLOCATE(mm_ccn_w(mm_nla)) ; mm_ccn_w(:) = 0._mm_wp 1245 ENDIF 1136 1246 IF (.NOT.ALLOCATED(mm_ccn_flux)) THEN 1137 1247 ALLOCATE(mm_ccn_flux(mm_nla)) ; mm_ccn_flux(:) = 0._mm_wp … … 1154 1264 mm_gazs(:,i) = gazs(mm_nla:1:-1,i) 1155 1265 ENDDO 1266 1267 ! Setup threshold : 1268 call mm_set_moments_cld_thresholds() 1269 1156 1270 ! drop mean radius 1157 1271 call mm_cloud_properties(mm_m0ccn,mm_m3ccn,mm_m3ice,mm_drad,mm_drho) … … 1162 1276 !! Dump model global parameters on stdout. 1163 1277 WRITE(*,'(a)') "========= YAMMS PARAMETERS ============" 1278 WRITE(*,'(a,a)') "mm_fp_precision : ", mm_wp_s 1279 WRITE(*,'(a,L2)') "mm_debug : ", mm_debug 1164 1280 WRITE(*,'(a,L2)') "mm_w_haze_prod : ", mm_w_haze_prod 1165 1281 WRITE(*,'(a,ES14.7)') " mm_p_prod : ", mm_p_prod … … 1168 1284 WRITE(*,'(a,L2)') "mm_w_haze_coag : ", mm_w_haze_coag 1169 1285 WRITE(*,'(a,I2.2)') " mm_coag_interactions: ", mm_coag_choice 1170 WRITE(*,'(a,L2)') "mm_w_haze_sed : ", mm_w_haze_sed 1286 WRITE(*,'(a,L2)') "mm_w_haze_sed : ", mm_w_haze_sed 1171 1287 WRITE(*,'(a,L2)') " mm_wsed_m0 : ", mm_wsed_m0 1172 1288 WRITE(*,'(a,L2)') " mm_wsed_m3 : ", mm_wsed_m3 … … 1178 1294 WRITE(*,'(a,L2)') " mm_w_cloud_nucond : ", mm_w_cloud_nucond 1179 1295 WRITE(*,'(a)') "---------------------------------------" 1296 WRITE(*,'(a)') "Thresholds spherical mode" 1297 WRITE(*,'(a,ES14.7)') " mm_m0as_min : ", mm_m0as_min 1298 WRITE(*,'(a,ES14.7)') " mm_rcs_min : ", mm_rcs_min 1299 WRITE(*,'(a)') "Thresholds fractal mode" 1300 WRITE(*,'(a,ES14.7)') " mm_m0af_min : ", mm_m0af_min 1301 WRITE(*,'(a,ES14.7)') " mm_rcf_min : ", mm_rcf_min 1302 WRITE(*,'(a)') "Thresholds clouds drop" 1303 WRITE(*,'(a,ES14.7)') " mm_m0n_min : ", mm_m0n_min 1304 WRITE(*,'(a,ES14.7)') " mm_drad_min : ", mm_drad_min 1305 WRITE(*,'(a,ES14.7)') " mm_drad_max : ", mm_drad_max 1306 WRITE(*,'(a)') "---------------------------------------" 1180 1307 WRITE(*,'(a,ES14.7)') "mm_dt : ", mm_dt 1181 1308 IF (mm_nla > -1) THEN … … 1191 1318 END SUBROUTINE mm_dump_parameters 1192 1319 1320 SUBROUTINE mm_set_moments_thresholds() 1321 !! Apply minimum threshold for the aerosols moments. 1322 !! 1323 !! The method resets moments (for both modes and orders, 0 and 3) values to zero if 1324 !! their current value is below the minimum threholds. 1325 !! 1326 !! See also [[mm_globals(module):mm_m0as_min(variable)]], [[mm_globals(module):mm_rcs_min(variable)]], 1327 !! [[mm_globals(module):mm_rcf_min(variable)]] and [[mm_globals(module):mm_m0as_min(variable)]]. 1328 INTEGER :: i 1329 DO i=1,mm_nla 1330 IF ((mm_m0aer_s(i) < mm_m0as_min) .OR. (mm_m3aer_s(i) < mm_m3as_min)) THEN 1331 mm_m0aer_s(i) = 0._mm_wp ! mm_m0as_min 1332 mm_m3aer_s(i) = 0._mm_wp ! mm_m0as_min * mm_rcs_min**3._mm_wp * mm_alpha_s(3._mm_wp) 1333 ENDIF 1334 IF ((mm_m0aer_f(i) < mm_m0af_min) .OR. (mm_m3aer_f(i) < mm_m3af_min)) THEN 1335 mm_m0aer_f(i) = 0._mm_wp ! mm_m0af_min 1336 mm_m3aer_f(i) = 0._mm_wp ! mm_m0af_min * mm_rcf_min**3._mm_wp * mm_alpha_f(3._mm_wp) 1337 ENDIF 1338 ENDDO 1339 END SUBROUTINE mm_set_moments_thresholds 1340 1341 SUBROUTINE mm_set_moments_cld_thresholds() 1342 !! Apply minimum threshold for the cloud drop moments. 1343 !! 1344 !! The method resets moments (for both modes and orders, 0 and 3) values to zero if 1345 !! their current value is below the minimum threholds. 1346 INTEGER :: i, j 1347 REAL(kind=mm_wp) :: m3cld 1348 1349 DO i = 1, mm_nla 1350 m3cld = mm_m3ccn(i) 1351 DO j = 1, mm_nesp 1352 m3cld = m3cld + mm_m3ice(i,j) 1353 ENDDO 1354 1355 IF ((mm_m0ccn(i) < mm_m0n_min) .OR. (m3cld < mm_m3cld_min)) THEN 1356 mm_m0ccn(i) = 0._mm_wp 1357 mm_m3ccn(i) = 0._mm_wp 1358 DO j = 1, mm_nesp 1359 mm_m3ice(i,j) = 0._mm_wp 1360 ENDDO 1361 ENDIF 1362 ENDDO 1363 END SUBROUTINE mm_set_moments_cld_thresholds 1364 1365 ELEMENTAL SUBROUTINE mm_check_tendencies(v,dv) 1366 !! Check that tendencies is not greater than value. 1367 !! 1368 !! the purpose of the subroutine is to update dvalue so that v+dv is not negative. 1369 REAL(kind=mm_wp), INTENT(in) :: v !! Value to check. 1370 REAL(kind=mm_wp), INTENT(inout) :: dv !! Value tendencies to check and update consequently. 1371 REAL(kind=mm_wp), PARAMETER :: a = (epsilon(1._mm_wp)-1._mm_wp) 1372 IF (v+dv < 0._mm_wp) THEN 1373 dv = a*v 1374 ENDIF 1375 END SUBROUTINE mm_check_tendencies 1376 1193 1377 ELEMENTAL FUNCTION mm_get_rcs(m0,m3) RESULT(res) 1194 1378 !! Get the characteristic radius for the spherical aerosols size distribution. 1195 !! 1379 !! 1196 1380 !! The method computes the characteristic radius of the size distribution law 1197 1381 !! of the spherical aerosols mode according to its moments and its inter-moments 1198 1382 !! relation. 1199 REAL(kind=mm_wp), INTENT(in) :: m0 !! \(0^{th}\) order moment 1383 REAL(kind=mm_wp), INTENT(in) :: m0 !! \(0^{th}\) order moment 1200 1384 REAL(kind=mm_wp), INTENT(in) :: m3 !! \(3^{rd}\) order moment 1201 1385 REAL(kind=mm_wp) :: res !! Radius 1202 ! arbitrary: if there is no way to compute radius1203 IF (m3 <= 0._mm_wp .OR. m0 <= 0._mm_wp) res = 1._mm_wp1204 1386 res = (m3/m0/mm_alpha_s(3._mm_wp))**(1._mm_wp/3._mm_wp) 1205 1387 END FUNCTION mm_get_rcs … … 1207 1389 ELEMENTAL FUNCTION mm_get_rcf(m0,m3) RESULT(res) 1208 1390 !! Get the characteristic radius for the fractal aerosols size distribution. 1209 !! 1391 !! 1210 1392 !! The method computes the characteristic radius of the size distribution law 1211 1393 !! of the fractal aerosols mode according to its moments and its inter-moments 1212 1394 !! relation. 1213 REAL(kind=mm_wp), INTENT(in) :: m0 !! \(0^{th}\) order moment 1395 REAL(kind=mm_wp), INTENT(in) :: m0 !! \(0^{th}\) order moment 1214 1396 REAL(kind=mm_wp), INTENT(in) :: m3 !! \(3^{rd}\) order moment 1215 1397 REAL(kind=mm_wp) :: res !! Radius 1216 ! arbitrary: if there is no way to compute radius1217 IF (m3 <= 0._mm_wp .OR. m0 <= 0._mm_wp) res = 1._mm_wp1218 1398 res = (m3/m0/mm_alpha_f(3._mm_wp))**(1._mm_wp/3._mm_wp) 1219 1399 END FUNCTION mm_get_rcf 1220 1400 1221 ELEMENTAL FUNCTION mm_effg(z) RESULT(effg) 1401 ELEMENTAL FUNCTION mm_effg(z) RESULT(effg) 1222 1402 !! Compute effective gravitational acceleration. 1223 1403 REAL(kind=mm_wp), INTENT(in) :: z !! Altitude in meters … … 1226 1406 IF (mm_use_effg) effg = effg * (mm_rpla/(mm_rpla+z))**2 1227 1407 RETURN 1228 END FUNCTION mm_effg 1408 END FUNCTION mm_effg 1229 1409 1230 1410 !================================== … … 1237 1417 !! The method computes the mean radius and mean density of cloud drops. 1238 1418 !! 1239 !! @bug 1240 !! A possible bug can happen because of threshold snippet. If __drad__ is greater than 1241 !! __drmax__ (== 1 00 microns) it is automatically set to __drmax__, but computation of1419 !! @bug 1420 !! A possible bug can happen because of threshold snippet. If __drad__ is greater than 1421 !! __drmax__ (== 1e3 microns) it is automatically set to __drmax__, but computation of 1242 1422 !! __drho__ remains unmodified. So __drho__ is not correct in that case. 1243 1423 !! 1244 !! @todo 1245 !! Fix the bug of the subroutine, but it is rather minor, since theoretically we do not 1424 !! @todo 1425 !! Fix the bug of the subroutine, but it is rather minor, since theoretically we do not 1246 1426 !! need the density of the drop. 1247 1427 !! 1248 !! @todo 1249 !! Think about a better implementation of thresholds, and get sure of their consequences in 1250 !! the other parts of the model. 1251 REAL(kind=mm_wp), INTENT(in) :: m0ccn !! \(0^{th}\) order moment of the ccn 1252 REAL(kind=mm_wp), INTENT(in) :: m3ccn !! \(3^{rd}\) order moment of the ccn 1428 !! @todo 1429 !! Think about a better implementation of thresholds, and get sure of their consequences in 1430 !! the other parts of the model. 1431 REAL(kind=mm_wp), INTENT(in) :: m0ccn !! \(0^{th}\) order moment of the ccn 1432 REAL(kind=mm_wp), INTENT(in) :: m3ccn !! \(3^{rd}\) order moment of the ccn 1253 1433 REAL(kind=mm_wp), INTENT(in), DIMENSION(:) :: m3ice !! \(3^{rd}\) order moments of each ice component 1254 REAL(kind=mm_wp), INTENT(out) :: drad !! Output mean drop radius 1434 REAL(kind=mm_wp), INTENT(out) :: drad !! Output mean drop radius 1255 1435 REAL(kind=mm_wp), INTENT(out), OPTIONAL :: drho !! Optional output mean drop density 1256 REAL(kind=mm_wp) :: vtot, wtot, ntot 1257 REAL(kind=mm_wp), PARAMETER :: threshold = 1.e-25_mm_wp, & 1258 drmin = 1.e-10_mm_wp, & 1259 drmax = 1.e-4_mm_wp, & 1260 athird = 1._mm_wp/3._mm_wp, & 1261 pifac = 4._mm_wp/3._mm_wp*mm_pi 1436 REAL(kind=mm_wp) :: Ntot, Vtot, Wtot 1437 REAL(kind=mm_wp), PARAMETER :: athird = 1._mm_wp / 3._mm_wp 1438 REAL(kind=mm_wp), PARAMETER :: pifac = (4._mm_wp * mm_pi) / 3._mm_wp 1439 1440 ! Set to zero : 1262 1441 drad = 0._mm_wp 1263 ntot = m0ccn 1264 vtot = pifac*m3ccn+SUM(m3ice) 1265 wtot = pifac*m3ccn*mm_rhoaer+SUM(m3ice*mm_xESPS(:)%rho) 1266 IF (ntot <= threshold .OR. vtot <= 0._mm_wp) THEN 1267 drad = drmin 1268 IF (PRESENT(drho)) drho = mm_rhoaer 1269 ELSE 1270 drad = (vtot/ntot/pifac)**athird 1271 drad = MAX(MIN(drad,drmax),drmin) 1272 IF (PRESENT(drho)) drho = wtot/vtot 1273 ENDIF 1442 IF (PRESENT(drho)) drho = 0._mm_wp 1443 1444 ! Initialization : 1445 Ntot = m0ccn 1446 Vtot = pifac * m3ccn + SUM(m3ice) 1447 Wtot = pifac * ((m3ccn*mm_rhoaer) + SUM(m3ice*mm_xESPS(:)%rho)) 1448 1449 IF (Ntot <= mm_m0n_min .OR. Vtot <= mm_m3cld_min) THEN 1450 drad = mm_drad_min 1451 IF (PRESENT(drho)) drho = mm_rhoaer 1452 ELSE 1453 drad = (Vtot / (pifac*Ntot))**athird 1454 drad = MAX(MIN(drad,mm_drad_max),mm_drad_min) 1455 IF (PRESENT(drho)) drho = Wtot / Vtot 1456 ENDIF 1457 1274 1458 RETURN 1275 1459 END SUBROUTINE cldprop_sc … … 1286 1470 REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: drad !! Output mean drop radius. 1287 1471 REAL(kind=mm_wp), INTENT(out), DIMENSION(:), OPTIONAL :: drho !! Optional output mean drop density. 1288 INTEGER :: i,ns 1289 REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: vtot,wtot,ntot,rho 1290 REAL(kind=mm_wp), PARAMETER :: threshold = 1.e-25_mm_wp, & 1291 drmin = 1.e-10_mm_wp, & 1292 drmax = 1.e-4_mm_wp, & 1293 athird = 1._mm_wp/3._mm_wp, & 1294 pifac = 4._mm_wp/3._mm_wp*mm_pi 1295 1296 ns = SIZE(m0ccn) ; ALLOCATE(vtot(ns),wtot(ns),ntot(ns),rho(ns)) 1297 drad = 0._mm_wp 1298 ntot = m0ccn 1299 vtot = pifac*m3ccn+SUM(m3ice,DIM=2) 1300 wtot = pifac*m3ccn*mm_rhoaer 1301 DO i=1,SIZE(m3ice,DIM=2) 1302 wtot = wtot+m3ice(:,i)*mm_xESPS(i)%rho 1303 ENDDO 1304 WHERE(ntot <= threshold .OR. vtot <= 0._mm_wp) 1305 drad = drmin 1306 rho = mm_rhoaer 1307 ELSEWHERE 1308 drad = (vtot/ntot/pifac)**athird 1309 drad = MAX(MIN(drad,drmax),drmin) 1310 rho = wtot/vtot 1311 END WHERE 1312 IF (PRESENT(drho)) drho = rho 1472 INTEGER :: i 1473 IF (PRESENT(drho)) THEN 1474 DO i = 1, SIZE(m0ccn) ; call cldprop_sc(m0ccn(i),m3ccn(i),m3ice(i,:),drad(i),drho(i)) ; ENDDO 1475 ELSE 1476 DO i = 1, SIZE(m0ccn) ; call cldprop_sc(m0ccn(i),m3ccn(i),m3ice(i,:),drad(i)) ; ENDDO 1477 ENDIF 1313 1478 RETURN 1314 1479 END SUBROUTINE cldprop_ve 1315 1480 1316 ! For configuration file (requires fccplibrary).1481 ! For configuration file (requires swift library). 1317 1482 1318 1483 FUNCTION read_esp(parser,sec,pp) RESULT (err) … … 1322 1487 TYPE(mm_esp), INTENT(out) :: pp !! [[mm_globals(module):mm_esp(type)]] object that stores the parameters. 1323 1488 TYPE(error) :: err !! Error status of the function. 1324 err = cfg_get_value(parser,TRIM(sec)//' name',pp%name) ; IF (err /= 0) RETURN1325 err = cfg_get_value(parser,TRIM(sec)//' mas',pp%mas) ; IF (err /= 0) RETURN1326 err = cfg_get_value(parser,TRIM(sec)//' vol',pp%vol) ; IF (err /= 0) RETURN1327 err = cfg_get_value(parser,TRIM(sec)//' ray',pp%ray) ; IF (err /= 0) RETURN1328 err = cfg_get_value(parser,TRIM(sec)//' mas',pp%mas) ; IF (err /= 0) RETURN1329 err = cfg_get_value(parser,TRIM(sec)//' vol',pp%vol) ; IF (err /= 0) RETURN1330 err = cfg_get_value(parser,TRIM(sec)//' ray',pp%ray) ; IF (err /= 0) RETURN1331 err = cfg_get_value(parser,TRIM(sec)//' masmol',pp%masmol) ; IF (err /= 0) RETURN1332 err = cfg_get_value(parser,TRIM(sec)//' rho',pp%rho) ; IF (err /= 0) RETURN1333 err = cfg_get_value(parser,TRIM(sec)//' tc',pp%tc) ; IF (err /= 0) RETURN1334 err = cfg_get_value(parser,TRIM(sec)//' pc',pp%pc) ; IF (err /= 0) RETURN1335 err = cfg_get_value(parser,TRIM(sec)//' tb',pp%tb) ; IF (err /= 0) RETURN1336 err = cfg_get_value(parser,TRIM(sec)//' w',pp%w) ; IF (err /= 0) RETURN1337 err = cfg_get_value(parser,TRIM(sec)//' a_sat',pp%a_sat) ; IF (err /= 0) RETURN1338 err = cfg_get_value(parser,TRIM(sec)//' b_sat',pp%b_sat) ; IF (err /= 0) RETURN1339 err = cfg_get_value(parser,TRIM(sec)//' c_sat',pp%c_sat) ; IF (err /= 0) RETURN1340 err = cfg_get_value(parser,TRIM(sec)//' d_sat',pp%d_sat) ; IF (err /= 0) RETURN1341 err = cfg_get_value(parser,TRIM(sec)//' mteta',pp%mteta) ; IF (err /= 0) RETURN1342 err = cfg_get_value(parser,TRIM(sec)//' tx_prod',pp%tx_prod) ; IF (err /= 0) RETURN1489 err = cfg_get_value(parser,TRIM(sec)//'/name',pp%name) ; IF (err /= 0) RETURN 1490 err = cfg_get_value(parser,TRIM(sec)//'/mas',pp%mas) ; IF (err /= 0) RETURN 1491 err = cfg_get_value(parser,TRIM(sec)//'/vol',pp%vol) ; IF (err /= 0) RETURN 1492 err = cfg_get_value(parser,TRIM(sec)//'/ray',pp%ray) ; IF (err /= 0) RETURN 1493 err = cfg_get_value(parser,TRIM(sec)//'/mas',pp%mas) ; IF (err /= 0) RETURN 1494 err = cfg_get_value(parser,TRIM(sec)//'/vol',pp%vol) ; IF (err /= 0) RETURN 1495 err = cfg_get_value(parser,TRIM(sec)//'/ray',pp%ray) ; IF (err /= 0) RETURN 1496 err = cfg_get_value(parser,TRIM(sec)//'/masmol',pp%masmol) ; IF (err /= 0) RETURN 1497 err = cfg_get_value(parser,TRIM(sec)//'/rho',pp%rho) ; IF (err /= 0) RETURN 1498 err = cfg_get_value(parser,TRIM(sec)//'/tc',pp%tc) ; IF (err /= 0) RETURN 1499 err = cfg_get_value(parser,TRIM(sec)//'/pc',pp%pc) ; IF (err /= 0) RETURN 1500 err = cfg_get_value(parser,TRIM(sec)//'/tb',pp%tb) ; IF (err /= 0) RETURN 1501 err = cfg_get_value(parser,TRIM(sec)//'/w',pp%w) ; IF (err /= 0) RETURN 1502 err = cfg_get_value(parser,TRIM(sec)//'/a_sat',pp%a_sat) ; IF (err /= 0) RETURN 1503 err = cfg_get_value(parser,TRIM(sec)//'/b_sat',pp%b_sat) ; IF (err /= 0) RETURN 1504 err = cfg_get_value(parser,TRIM(sec)//'/c_sat',pp%c_sat) ; IF (err /= 0) RETURN 1505 err = cfg_get_value(parser,TRIM(sec)//'/d_sat',pp%d_sat) ; IF (err /= 0) RETURN 1506 err = cfg_get_value(parser,TRIM(sec)//'/mteta',pp%mteta) ; IF (err /= 0) RETURN 1507 err = cfg_get_value(parser,TRIM(sec)//'/tx_prod',pp%tx_prod) ; IF (err /= 0) RETURN 1343 1508 RETURN 1344 1509 END FUNCTION read_esp … … 1346 1511 ! ========================================================================= 1347 1512 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1348 ! CONFIGURATION PARSER checking methods 1513 ! CONFIGURATION PARSER checking methods 1349 1514 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1350 1515 ! ========================================================================= … … 1352 1517 FUNCTION check_r1(err,var,def,wlog) RESULT(ret) 1353 1518 !! Check an option value (float). 1354 !! 1355 !! The method checks an option value and optionally set a default value, __def__ to initialize 1519 !! 1520 !! The method checks an option value and optionally set a default value, __def__ to initialize 1356 1521 !! __var__ on error if given. 1357 1522 TYPE(error), INTENT(in) :: err !! Error object from value getter. … … 1360 1525 LOGICAL, INTENT(in), OPTIONAL :: wlog !! .true. to print warning/error message. 1361 1526 TYPE(error) :: ret !! Input error. 1362 CHARACTER(len=*), PARAMETER :: defmsg = '... Using default value: ' 1527 CHARACTER(len=*), PARAMETER :: defmsg = '... Using default value: ' 1363 1528 LOGICAL :: zlog 1364 1529 ret = err … … 1376 1541 FUNCTION check_l1(err,var,def,wlog) RESULT(ret) 1377 1542 !! Check an option value (logical). 1378 !! 1379 !! The method checks an option value and optionally set a default value, __def__ to initialize 1543 !! 1544 !! The method checks an option value and optionally set a default value, __def__ to initialize 1380 1545 !! __var__ on error if given. 1381 1546 TYPE(error), INTENT(in) :: err !! Error object from value getter. … … 1384 1549 LOGICAL, INTENT(in), OPTIONAL :: wlog !! .true. to print warning/error message. 1385 1550 TYPE(error) :: ret !! Input error. 1386 CHARACTER(len=*), PARAMETER :: defmsg = '... Using default value: ' 1551 CHARACTER(len=*), PARAMETER :: defmsg = '... Using default value: ' 1387 1552 LOGICAL :: zlog 1388 1553 ret = err 1389 1554 zlog = .false. ; IF (PRESENT(wlog)) zlog = wlog 1390 1555 IF (err == 0) RETURN 1391 1556 IF (PRESENT(def)) THEN … … 1400 1565 FUNCTION check_i1(err,var,def,wlog) RESULT(ret) 1401 1566 !! Check an option value (integer). 1402 !! 1403 !! The method checks an option value and optionally set a default value, __def__ to initialize 1567 !! 1568 !! The method checks an option value and optionally set a default value, __def__ to initialize 1404 1569 !! __var__ on error if given. 1405 1570 TYPE(error), INTENT(in) :: err !! Error object from value getter. … … 1411 1576 LOGICAL :: zlog 1412 1577 ret = err 1413 1578 zlog = .false. ; IF (PRESENT(wlog)) zlog = wlog 1414 1579 IF (err == 0) RETURN 1415 1580 IF (PRESENT(def)) THEN … … 1424 1589 FUNCTION check_s1(err,var,def,wlog) RESULT(ret) 1425 1590 !! Check an option value (string). 1426 !! 1427 !! The method checks an option value and optionally set a default value, __def__ to initialize 1591 !! 1592 !! The method checks an option value and optionally set a default value, __def__ to initialize 1428 1593 !! __var__ on error if given. 1429 1594 TYPE(error), INTENT(in) :: err !! Error object from value getter. … … 1432 1597 LOGICAL, INTENT(in), OPTIONAL :: wlog !! .true. to print warning/error message. 1433 1598 TYPE(error) :: ret !! Input error. 1434 CHARACTER(len=*), PARAMETER :: defmsg = '... Using default value: ' 1599 CHARACTER(len=*), PARAMETER :: defmsg = '... Using default value: ' 1435 1600 LOGICAL :: zlog 1436 ret = err 1601 ret = err 1437 1602 zlog = .false. ; IF (PRESENT(wlog)) zlog = wlog 1438 1603 IF (err == 0) RETURN
Note: See TracChangeset
for help on using the changeset viewer.