source: LMDZ6/trunk/libf/phylmd/ecrad/lmdz/setup_config_from_lmdz.F90 @ 4948

Last change on this file since 4948 was 4911, checked in by idelkadi, 7 months ago

Introduction of 2 routines for LMDZ-ECRAD :

  • One for LMDZ (calcul_cloud_overlap_decorr_len.F90) to calculate the decorrelation length (Ld) in the case of "Exp-Ran" cloud overlap.
    1. Ld=constant
    2. Ld=linear function of the absolute value of latitude (Shonk and Hogan 2010)
    3. Ld=function of vertical level
  • One for Ecrad (set_overlap_param_var2D in radiation_cloud.F90) : Compute and store the overlap parameter from the provided overlap decorrelation length, which depends on vertical level.

Translated with DeepL.com (free version)

File size: 5.0 KB
Line 
1module setup_config_from_lmdz
2
3  use parkind1, only : jprb
4
5  implicit none
6
7  public
8
9  type driver_config_type
10     logical    :: ok_effective_size  = .true.
11     logical    :: ok_separation = .false.   
12     real(jprb) :: high_inv_effective_size   = -1.0_jprb ! m-1
13     real(jprb) :: middle_inv_effective_size = -1.0_jprb ! m-1
14     real(jprb) :: low_inv_effective_size    = -1.0_jprb ! m-1
15     real(jprb) :: cloud_inhom_separation_factor  = -1.0_jprb
16     real(jprb) :: cloud_separation_scale_surface = -1.0_jprb
17     real(jprb) :: cloud_separation_scale_toa     = -1.0_jprb
18     real(jprb) :: cloud_separation_scale_power   = -1.0_jprb
19     real(jprb) :: frac_std = 0.75_jprb
20     real(jprb) :: overlap_decorr_length = 2000.0_jprb
21     ! KDECOLAT : 0 > cste, 1 > Shonk et al. (2010) 2 > 1 lisse a l'equateur
22     !            3 : 1+variation sur la verticale
23     !            4 : 2+variation sur la verticale
24     integer    :: kdecolat = 0
25     real(jprb) :: low_decorrelation_length = 2000.0_jprb
26     real(jprb) :: mid_decorrelation_length = 2000.0_jprb
27     real(jprb) :: high_decorrelation_length = 2000.0_jprb
28
29 contains
30 procedure :: read => read_config_from_namelist
31
32  end type driver_config_type
33
34contains
35
36  !---------------------------------------------------------------------
37  subroutine read_config_from_namelist(this, file_name, is_success)
38
39    use radiation_io, only : nulerr, radiation_abort       
40
41    class(driver_config_type), intent(inout) :: this
42    character(*), intent(in)          :: file_name
43    logical, intent(out), optional    :: is_success
44    logical    :: ok_effective_size, ok_separation
45    integer    :: iosopen ! Status after calling open
46    real(jprb) :: high_inv_effective_size
47    real(jprb) :: middle_inv_effective_size
48    real(jprb) :: low_inv_effective_size
49    real(jprb) :: cloud_inhom_separation_factor
50    real(jprb) :: cloud_separation_scale_surface
51    real(jprb) :: cloud_separation_scale_toa
52    real(jprb) :: cloud_separation_scale_power
53    real(jprb) :: frac_std
54    real(jprb) :: overlap_decorr_length
55    integer    :: kdecolat
56    real(jprb) :: low_decorrelation_length
57    real(jprb) :: mid_decorrelation_length
58    real(jprb) :: high_decorrelation_length
59
60    namelist /radiation_driver/ ok_effective_size, ok_separation, &
61         &  frac_std, overlap_decorr_length, kdecolat, &
62         &  low_decorrelation_length, mid_decorrelation_length, high_decorrelation_length, &
63         &  high_inv_effective_size, middle_inv_effective_size, low_inv_effective_size, &
64         &  cloud_inhom_separation_factor, cloud_separation_scale_surface, &
65         &  cloud_separation_scale_toa, cloud_separation_scale_power
66
67    ok_effective_size = .false.
68    ok_separation = .false.
69    high_inv_effective_size   = -1.0_jprb
70    middle_inv_effective_size = -1.0_jprb
71    low_inv_effective_size    = -1.0_jprb
72    cloud_inhom_separation_factor  = -1.0_jprb
73    cloud_separation_scale_surface = -1.0_jprb
74    cloud_separation_scale_toa     = -1.0_jprb
75    cloud_separation_scale_power   = -1.0_jprb
76    frac_std = 0.75_jprb
77    overlap_decorr_length = 2000.0_jprb
78    kdecolat = 0
79    low_decorrelation_length = 2000.0_jprb
80    mid_decorrelation_length = 2000.0_jprb
81    high_decorrelation_length = 2000.0_jprb
82
83    ! Open the namelist file and read the radiation_driver namelist
84    open(unit=10, iostat=iosopen, file=trim(file_name))
85    if (iosopen /= 0) then
86      ! An error occurred
87      if (present(is_success)) then
88        is_success = .false.
89        ! We now continue the subroutine so that the default values
90        ! are placed in the config structure
91      else
92        write(nulerr,'(a,a,a)') '*** Error: namelist file "', &
93             &                trim(file_name), '" not found'
94        call radiation_abort('Driver configuration error')
95      end if
96    else
97      ! Read the radiation_driver namelist, noting that it is not an
98      ! error if this namelist is not present, provided all the required
99      ! variables are present in the NetCDF data file instead
100      read(unit=10, nml=radiation_driver)
101      close(unit=10)
102    end if
103
104    ! Copy namelist data into configuration object
105    this%ok_effective_size = ok_effective_size
106    this%ok_separation = ok_separation
107    this%frac_std = frac_std
108    this%overlap_decorr_length = overlap_decorr_length
109    this%kdecolat = kdecolat
110    this%low_decorrelation_length = low_decorrelation_length
111    this%mid_decorrelation_length = mid_decorrelation_length
112    this%high_decorrelation_length = high_decorrelation_length
113    this%cloud_inhom_separation_factor = cloud_inhom_separation_factor
114    this%cloud_separation_scale_surface = cloud_separation_scale_surface
115    this%cloud_separation_scale_toa = cloud_separation_scale_toa
116    this%cloud_separation_scale_power = cloud_separation_scale_power
117    this%high_inv_effective_size = high_inv_effective_size
118    this%middle_inv_effective_size = middle_inv_effective_size
119    this%low_inv_effective_size = low_inv_effective_size
120
121  end subroutine read_config_from_namelist         
122
123end module setup_config_from_lmdz
Note: See TracBrowser for help on using the repository browser.