| 1 | ! radiation_cloud_optics_data.F90 - Type to store cloud optical properties |
|---|
| 2 | ! |
|---|
| 3 | ! (C) Copyright 2014- ECMWF. |
|---|
| 4 | ! |
|---|
| 5 | ! This software is licensed under the terms of the Apache Licence Version 2.0 |
|---|
| 6 | ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
|---|
| 7 | ! |
|---|
| 8 | ! In applying this licence, ECMWF does not waive the privileges and immunities |
|---|
| 9 | ! granted to it by virtue of its status as an intergovernmental organisation |
|---|
| 10 | ! nor does it submit to any jurisdiction. |
|---|
| 11 | ! |
|---|
| 12 | ! Author: Robin Hogan |
|---|
| 13 | ! Email: r.j.hogan@ecmwf.int |
|---|
| 14 | ! |
|---|
| 15 | |
|---|
| 16 | module radiation_cloud_optics_data |
|---|
| 17 | |
|---|
| 18 | use parkind1, only : jprb |
|---|
| 19 | |
|---|
| 20 | implicit none |
|---|
| 21 | public |
|---|
| 22 | |
|---|
| 23 | !--------------------------------------------------------------------- |
|---|
| 24 | ! This type holds the configuration information to compute |
|---|
| 25 | ! cloud optical properties |
|---|
| 26 | type cloud_optics_type |
|---|
| 27 | ! Band-specific coefficients are provided separately in the |
|---|
| 28 | ! shortwave and longwave, and are dimensioned (nband,ncoeff), |
|---|
| 29 | ! where ncoeff depends on the nature of the parameterization |
|---|
| 30 | real(jprb), allocatable, dimension(:,:) :: & |
|---|
| 31 | & liq_coeff_lw, liq_coeff_sw, & |
|---|
| 32 | & ice_coeff_lw, ice_coeff_sw |
|---|
| 33 | ! General coefficients are vectors of length ncoeffgen, which |
|---|
| 34 | ! depends on the nature of the parameterization; note that most |
|---|
| 35 | ! parameterizations use only band-specific coefficients |
|---|
| 36 | real(jprb), allocatable, dimension(:) :: & |
|---|
| 37 | & liq_coeff_gen, ice_coeff_gen |
|---|
| 38 | |
|---|
| 39 | contains |
|---|
| 40 | procedure :: setup => setup_cloud_optics |
|---|
| 41 | |
|---|
| 42 | end type cloud_optics_type |
|---|
| 43 | |
|---|
| 44 | contains |
|---|
| 45 | |
|---|
| 46 | !--------------------------------------------------------------------- |
|---|
| 47 | ! Setup cloud optics coefficients by reading them from a file |
|---|
| 48 | subroutine setup_cloud_optics(this, liq_file_name, ice_file_name, & |
|---|
| 49 | & iverbose) |
|---|
| 50 | |
|---|
| 51 | use yomhook, only : lhook, dr_hook |
|---|
| 52 | use easy_netcdf, only : netcdf_file |
|---|
| 53 | |
|---|
| 54 | class(cloud_optics_type), intent(inout) :: this |
|---|
| 55 | character(len=*), intent(in) :: liq_file_name, ice_file_name |
|---|
| 56 | integer, intent(in), optional :: iverbose |
|---|
| 57 | |
|---|
| 58 | ! The NetCDF file containing the coefficients |
|---|
| 59 | type(netcdf_file) :: file |
|---|
| 60 | integer :: iverb |
|---|
| 61 | real(jprb) :: hook_handle |
|---|
| 62 | |
|---|
| 63 | if (lhook) call dr_hook('radiation_cloud_optics_data:setup',0,hook_handle) |
|---|
| 64 | |
|---|
| 65 | if (present(iverbose)) then |
|---|
| 66 | iverb = iverbose |
|---|
| 67 | else |
|---|
| 68 | iverb = 2 |
|---|
| 69 | end if |
|---|
| 70 | |
|---|
| 71 | ! Open the droplet scattering file and configure the way it is |
|---|
| 72 | ! read |
|---|
| 73 | call file%open(trim(liq_file_name), iverbose=iverb) |
|---|
| 74 | call file%transpose_matrices() |
|---|
| 75 | |
|---|
| 76 | ! Read the band-specific coefficients |
|---|
| 77 | call file%get('coeff_lw',this%liq_coeff_lw) |
|---|
| 78 | call file%get('coeff_sw',this%liq_coeff_sw) |
|---|
| 79 | |
|---|
| 80 | ! Read the general coefficients |
|---|
| 81 | if (file%exists('coeff_gen')) then |
|---|
| 82 | call file%get('coeff_gen',this%liq_coeff_gen) |
|---|
| 83 | end if |
|---|
| 84 | |
|---|
| 85 | ! Close droplet scattering file |
|---|
| 86 | call file%close() |
|---|
| 87 | |
|---|
| 88 | ! Open the ice scattering file and configure the way it is read |
|---|
| 89 | call file%open(trim(ice_file_name), iverbose=iverb) |
|---|
| 90 | call file%transpose_matrices() |
|---|
| 91 | |
|---|
| 92 | ! Read the band-specific coefficients |
|---|
| 93 | call file%get('coeff_lw',this%ice_coeff_lw) |
|---|
| 94 | call file%get('coeff_sw',this%ice_coeff_sw) |
|---|
| 95 | |
|---|
| 96 | ! Read the general coefficients |
|---|
| 97 | if (file%exists('coeff_gen')) then |
|---|
| 98 | call file%get('coeff_gen',this%ice_coeff_gen) |
|---|
| 99 | end if |
|---|
| 100 | |
|---|
| 101 | ! Close ice scattering file |
|---|
| 102 | call file%close() |
|---|
| 103 | |
|---|
| 104 | if (lhook) call dr_hook('radiation_cloud_optics_data:setup',1,hook_handle) |
|---|
| 105 | |
|---|
| 106 | end subroutine setup_cloud_optics |
|---|
| 107 | |
|---|
| 108 | end module radiation_cloud_optics_data |
|---|