Line data Source code
1 : ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 : ! Copyright (c) 2015, Regents of the University of Colorado
3 : ! All rights reserved.
4 : !
5 : ! Redistribution and use in source and binary forms, with or without modification, are
6 : ! permitted provided that the following conditions are met:
7 : !
8 : ! 1. Redistributions of source code must retain the above copyright notice, this list of
9 : ! conditions and the following disclaimer.
10 : !
11 : ! 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 : ! of conditions and the following disclaimer in the documentation and/or other
13 : ! materials provided with the distribution.
14 : !
15 : ! 3. Neither the name of the copyright holder nor the names of its contributors may be
16 : ! used to endorse or promote products derived from this software without specific prior
17 : ! written permission.
18 : !
19 : ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 : ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 : ! MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 : ! THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 : ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 : ! OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 : ! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 : ! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 : ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 : !
29 : ! History
30 : ! May 2015 - D. Swales - Original version
31 : ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 : MODULE MOD_COSP_CLOUDSAT_INTERFACE
33 : USE COSP_KINDS, ONLY: wp
34 : USE quickbeam, ONLY: quickbeam_init,radar_cfg,Re_MAX_BIN,Re_BIN_LENGTH
35 : IMPLICIT NONE
36 :
37 : ! Directory where LUTs will be stored
38 : character(len=120) :: RADAR_SIM_LUT_DIRECTORY = './'
39 : logical :: RADAR_SIM_LOAD_scale_LUTs_flag = .false.
40 : logical :: RADAR_SIM_UPDATE_scale_LUTs_flag = .false.
41 :
42 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 : ! TYPE cloudsat_IN
44 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 : type cloudsat_IN
46 : integer,pointer :: &
47 : Npoints, & ! Number of horizontal grid-points
48 : Nlevels, & ! Number of vertical levels
49 : Ncolumns ! Number of subcolumns
50 : real(wp),pointer :: &
51 : hgt_matrix(:,:), & ! Height of hydrometeors (km)
52 : z_vol(:,:,:), & ! Effective reflectivity factor (mm^6/m^3)
53 : kr_vol(:,:,:), & ! Attenuation coefficient hydro (dB/km)
54 : g_vol(:,:,:), & ! Attenuation coefficient gases (dB/km)
55 : g_to_vol_in(:,:) ! Gaseous atteunation, radar to vol (dB)
56 : type(radar_cfg),pointer :: rcfg ! Radar simulator configuration
57 : end type cloudsat_IN
58 :
59 : CONTAINS
60 :
61 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 : ! SUBROUTINE cosp_cloudsat_in
63 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 1536 : SUBROUTINE COSP_CLOUDSAT_INIT(radar_freq,k2,use_gas_abs,do_ray,undef,nhydro, &
65 1536 : surface_radar,rcfg,cloudsat_micro_scheme,load_LUT)
66 : ! INPUTS
67 : real(wp),intent(in) :: &
68 : radar_freq, & ! Radar frequency (GHz)
69 : k2, & ! |K|^2, the dielectric constant
70 : undef ! Undefined
71 : integer,intent(in) :: &
72 : use_gas_abs, & ! 1 = do gaseous abs calcs, 0=no gasesous absorbtion calculated,
73 : ! 2 = calculate absorption for first profile on all profiles
74 : do_ray, & !
75 : nhydro, & !
76 : surface_radar
77 : logical,intent(in),optional :: &
78 : load_LUT
79 : character(len=64),intent(in) :: &
80 : cloudsat_micro_scheme
81 :
82 : ! OUTPUTS
83 : type(radar_cfg) :: &
84 : rcfg !
85 :
86 : ! LOCAL VARIABLES
87 : character(len=240) :: LUT_file_name
88 : logical :: local_load_LUT
89 : integer :: j
90 :
91 1536 : if (present(load_LUT)) then
92 0 : local_load_LUT = load_LUT
93 : else
94 1536 : local_load_LUT = RADAR_SIM_LOAD_scale_LUTs_flag
95 : endif
96 :
97 : ! LUT file name
98 : LUT_file_name = trim(RADAR_SIM_LUT_DIRECTORY) // &
99 1536 : trim(cloudsat_micro_scheme)
100 :
101 : ! Initialize for NEW radar-configurarion derived type (radar_cfg)
102 1536 : rcfg%freq = radar_freq
103 1536 : rcfg%k2 = k2
104 1536 : rcfg%use_gas_abs = use_gas_abs
105 1536 : rcfg%do_ray = do_ray
106 1536 : rcfg%nhclass = nhydro
107 1536 : rcfg%load_scale_LUTs = local_load_LUT
108 1536 : rcfg%update_scale_LUTs = .false.
109 1536 : rcfg%scale_LUT_file_name = LUT_file_name
110 17742336 : rcfg%N_scale_flag = .false.
111 1508814336 : rcfg%fc = undef
112 1508814336 : rcfg%rho_eff = undef
113 692737536 : rcfg%Z_scale_flag = .false.
114 692737536 : rcfg%Ze_scaled = 0._wp
115 692737536 : rcfg%Zr_scaled = 0._wp
116 692737536 : rcfg%kr_scaled = 0._wp
117 :
118 : ! Set up Re bin "structure" for z_scaling
119 1536 : rcfg%base_list(1)=0
120 385536 : do j=1,Re_MAX_BIN
121 384000 : rcfg%step_list(j)=0.1_wp+0.1_wp*((j-1)**1.5)
122 384000 : if(rcfg%step_list(j)>Re_BIN_LENGTH) then
123 350208 : rcfg%step_list(j)=Re_BIN_LENGTH
124 : endif
125 385536 : if(j>1) then
126 382464 : rcfg%base_list(j)=rcfg%base_list(j-1)+floor(Re_BIN_LENGTH/rcfg%step_list(j-1))
127 : endif
128 : enddo
129 :
130 : ! Set flag denoting position of radar
131 1536 : if (surface_radar == 1) then
132 0 : rcfg%radar_at_layer_one = .false.
133 : else
134 1536 : rcfg%radar_at_layer_one = .true.
135 : endif
136 :
137 1536 : END SUBROUTINE COSP_CLOUDSAT_INIT
138 :
139 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
140 : ! END MODULE
141 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142 0 : END MODULE MOD_COSP_CLOUDSAT_INTERFACE
|