source: LMDZ6/trunk/libf/phylmd/ecrad.v1.5.1/setup_config_from_lmdz.F90 @ 5319

Last change on this file since 5319 was 4570, checked in by idelkadi, 17 months ago

Ecrad version update in LMDZ (SPARTACUS solver)

File size: 4.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
22
23 contains
24 procedure :: read => read_config_from_namelist
25
26  end type driver_config_type
27
28contains
29
30  !---------------------------------------------------------------------
31  subroutine read_config_from_namelist(this, file_name, is_success)
32
33    use radiation_io, only : nulerr, radiation_abort       
34
35    class(driver_config_type), intent(inout) :: this
36    character(*), intent(in)          :: file_name
37    logical, intent(out), optional    :: is_success
38    logical    :: ok_effective_size, ok_separation
39    integer    :: iosopen ! Status after calling open
40    real(jprb) :: high_inv_effective_size
41    real(jprb) :: middle_inv_effective_size
42    real(jprb) :: low_inv_effective_size
43    real(jprb) :: cloud_inhom_separation_factor
44    real(jprb) :: cloud_separation_scale_surface
45    real(jprb) :: cloud_separation_scale_toa
46    real(jprb) :: cloud_separation_scale_power
47    real(jprb) :: frac_std
48    real(jprb) :: overlap_decorr_length
49
50    namelist /radiation_driver/ ok_effective_size, ok_separation, &
51         &  frac_std, overlap_decorr_length, &
52         &  high_inv_effective_size, middle_inv_effective_size, low_inv_effective_size, &
53         &  cloud_inhom_separation_factor, cloud_separation_scale_surface, &
54         &  cloud_separation_scale_toa, cloud_separation_scale_power
55
56    ok_effective_size = .false.
57    ok_separation = .false.
58    high_inv_effective_size   = -1.0_jprb
59    middle_inv_effective_size = -1.0_jprb
60    low_inv_effective_size    = -1.0_jprb
61    cloud_inhom_separation_factor  = -1.0_jprb
62    cloud_separation_scale_surface = -1.0_jprb
63    cloud_separation_scale_toa     = -1.0_jprb
64    cloud_separation_scale_power   = -1.0_jprb
65    frac_std = 0.75_jprb
66    overlap_decorr_length = 2000.0_jprb
67
68    ! Open the namelist file and read the radiation_driver namelist
69    open(unit=10, iostat=iosopen, file=trim(file_name))
70    if (iosopen /= 0) then
71      ! An error occurred
72      if (present(is_success)) then
73        is_success = .false.
74        ! We now continue the subroutine so that the default values
75        ! are placed in the config structure
76      else
77        write(nulerr,'(a,a,a)') '*** Error: namelist file "', &
78             &                trim(file_name), '" not found'
79        call radiation_abort('Driver configuration error')
80      end if
81    else
82      ! Read the radiation_driver namelist, noting that it is not an
83      ! error if this namelist is not present, provided all the required
84      ! variables are present in the NetCDF data file instead
85      read(unit=10, nml=radiation_driver)
86      close(unit=10)
87    end if
88
89    ! Copy namelist data into configuration object
90    this%ok_effective_size = ok_effective_size
91    this%ok_separation = ok_separation
92    this%frac_std = frac_std
93    this%overlap_decorr_length = overlap_decorr_length
94    this%cloud_inhom_separation_factor = cloud_inhom_separation_factor
95    this%cloud_separation_scale_surface = cloud_separation_scale_surface
96    this%cloud_separation_scale_toa = cloud_separation_scale_toa
97    this%cloud_separation_scale_power = cloud_separation_scale_power
98    this%high_inv_effective_size = high_inv_effective_size
99    this%middle_inv_effective_size = middle_inv_effective_size
100    this%low_inv_effective_size = low_inv_effective_size
101
102  end subroutine read_config_from_namelist         
103
104end module setup_config_from_lmdz
Note: See TracBrowser for help on using the repository browser.