source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/setup_config_from_lmdz.F90 @ 4544

Last change on this file since 4544 was 4544, checked in by idelkadi, 13 months ago

Configuration of the parameters for the SPARTACUS solver so that they can be modified in the namelist file:

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