Changeset 2435 for LMDZ5/branches/testing/libf/phylmd/cosp/cosp_radar.F90
- Timestamp:
- Jan 28, 2016, 5:02:13 PM (9 years ago)
- Location:
- LMDZ5/branches/testing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/branches/testing
- Property svn:mergeinfo changed
/LMDZ5/trunk merged: 2397-2403,2405-2407,2410-2413,2415-2424,2426-2429,2431-2432,2434
- Property svn:mergeinfo changed
-
LMDZ5/branches/testing/libf/phylmd/cosp/cosp_radar.F90
r2298 r2435 26 26 USE MOD_COSP_CONSTANTS 27 27 USE MOD_COSP_TYPES 28 USE MOD_COSP_UTILS 28 29 use radar_simulator_types 29 30 use array_lib … … 31 32 use format_input 32 33 IMPLICIT NONE 33 34 34 35 INTERFACE 35 subroutine radar_simulator(freq,k2,do_ray,use_gas_abs,use_mie_table,mt, & 36 nhclass,hp,nprof,ngate,nsizes,D,hgt_matrix,hm_matrix,re_matrix,p_matrix,t_matrix, & 37 rh_matrix,Ze_non,Ze_ray,h_atten_to_vol,g_atten_to_vol,dBZe, & 36 subroutine radar_simulator(hp,nprof,ngate,undef, & 37 hgt_matrix,hm_matrix,re_matrix,Np_matrix, & 38 p_matrix,t_matrix,rh_matrix, & 39 Ze_non,Ze_ray,g_to_vol,a_to_vol,dBZe, & 38 40 g_to_vol_in,g_to_vol_out) 39 40 use m_mrgrnk 41 42 use m_mrgrnk 41 43 use array_lib 42 44 use math_lib … … 44 46 use radar_simulator_types 45 47 implicit none 48 46 49 ! ----- INPUTS ----- 47 type(mie), intent(in) :: mt48 50 type(class_param) :: hp 49 real*8, intent(in) :: freq,k2 50 integer, intent(in) :: do_ray,use_gas_abs,use_mie_table, &51 nhclass,nprof,ngate,nsizes 52 real *8, dimension(nsizes), intent(in) :: D51 52 integer, intent(in) :: nprof,ngate 53 54 real undef 53 55 real*8, dimension(nprof,ngate), intent(in) :: hgt_matrix, p_matrix, & 54 56 t_matrix,rh_matrix 55 real*8, dimension(nhclass,nprof,ngate), intent(in) :: hm_matrix 56 real*8, dimension(nhclass,nprof,ngate), intent(inout) :: re_matrix 57 real*8, dimension(hp%nhclass,nprof,ngate), intent(in) :: hm_matrix 58 real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: re_matrix 59 real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: Np_matrix 60 57 61 ! ----- OUTPUTS ----- 58 62 real*8, dimension(nprof,ngate), intent(out) :: Ze_non,Ze_ray, & 59 g_ atten_to_vol,dBZe,h_atten_to_vol63 g_to_vol,dBZe,a_to_vol 60 64 ! ----- OPTIONAL ----- 61 real*8, optional, dimension(n gate,nprof) :: &65 real*8, optional, dimension(nprof,ngate) :: & 62 66 g_to_vol_in,g_to_vol_out 63 67 end subroutine radar_simulator … … 73 77 74 78 ! Arguments 75 type(cosp_gridbox),intent(in ) :: gbx ! Gridbox info79 type(cosp_gridbox),intent(inout) :: gbx ! Gridbox info 76 80 type(cosp_subgrid),intent(in) :: sgx ! Subgrid info 77 81 type(cosp_sghydro),intent(in) :: sghydro ! Subgrid info for hydrometeors … … 80 84 ! Local variables 81 85 integer :: & 82 nsizes 86 nsizes ! num of discrete drop sizes 83 87 84 real*8 :: &85 freq, & ! radar frequency (GHz)86 k2 ! |K|^2, -1=use frequency dependent default87 88 88 real*8, dimension(:,:), allocatable :: & 89 89 g_to_vol ! integrated atten due to gases, r>v (dB) 90 90 91 91 real*8, dimension(:,:), allocatable :: & 92 Ze_non, & 93 Ze_ray, & 94 h_atten_to_vol, & 95 g_atten_to_vol, & 96 dBZe, & 97 hgt_matrix, & 92 Ze_non, & ! radar reflectivity withOUT attenuation (dBZ) 93 Ze_ray, & ! Rayleigh reflectivity (dBZ) 94 h_atten_to_vol, & ! attenuation by hydromets, radar to vol (dB) 95 g_atten_to_vol, & ! gaseous atteunation, radar to vol (dB) 96 dBZe, & ! effective radar reflectivity factor (dBZ) 97 hgt_matrix, & ! height of hydrometeors (km) 98 98 t_matrix, & !temperature (k) 99 99 p_matrix, & !pressure (hPa) 100 100 rh_matrix !relative humidity (%) 101 101 102 102 real*8, dimension(:,:,:), allocatable :: & 103 hm_matrix, & ! hydrometeor mixing ratio (g kg^-1) 104 re_matrix 103 hm_matrix, & ! hydrometeor mixing ratio (g kg^-1) 104 re_matrix, & ! effective radius (microns). Optional. 0 ==> use Np_matrix or defaults 105 Np_matrix ! total number concentration (kg^-1). Optional 0==> use defaults 105 106 106 107 integer, parameter :: one = 1 107 logical :: hgt_reversed 108 integer :: pr,i,j,k,unt 108 ! logical :: hgt_reversed 109 logical :: hgt_descending 110 integer :: pr,i,j,k,unt,ngate 109 111 110 112 ! ----- main program settings ------ 111 112 freq = gbx%radar_freq113 k2 = gbx%k2114 115 !116 ! note: intitialization section that was here has been relocated to SUBROUTINE CONSTRUCT_COSP_GRIDBOX by roj, Feb 2008117 !118 mt_ttl=gbx%mt_ttl ! these variables really should be moved into the mt structure rather than kept as global arrays.119 mt_tti=gbx%mt_tti120 113 121 114 ! Inputs to Quickbeam 122 115 allocate(hgt_matrix(gbx%Npoints,gbx%Nlevels),p_matrix(gbx%Npoints,gbx%Nlevels), & 123 116 t_matrix(gbx%Npoints,gbx%Nlevels),rh_matrix(gbx%Npoints,gbx%Nlevels)) 124 allocate(hm_matrix(gbx%Nhydro,gbx%Npoints,gbx%Nlevels)) 117 allocate(hm_matrix(gbx%Nhydro,gbx%Npoints,gbx%Nlevels)) 125 118 allocate(re_matrix(gbx%Nhydro,gbx%Npoints,gbx%Nlevels)) 119 allocate(Np_matrix(gbx%Nhydro,gbx%Npoints,gbx%Nlevels)) 126 120 127 121 ! Outputs from Quickbeam … … 131 125 allocate(g_atten_to_vol(gbx%Npoints,gbx%Nlevels)) 132 126 allocate(dBZe(gbx%Npoints,gbx%Nlevels)) 133 127 134 128 ! Optional argument. It is computed and returned in the first call to 135 129 ! radar_simulator, and passed as input in the rest 136 allocate(g_to_vol(gbx%Nlevels,gbx%Npoints)) 137 130 allocate(g_to_vol(gbx%Npoints,gbx%Nlevels)) 131 132 ! Even if there is no unit conversion, they are needed for type conversion 138 133 p_matrix = gbx%p/100.0 ! From Pa to hPa 139 134 hgt_matrix = gbx%zlev/1000.0 ! From m to km 140 t_matrix = gbx%T -273.15 ! From K to C135 t_matrix = gbx%T 141 136 rh_matrix = gbx%q 142 137 re_matrix = 0.0 143 144 ! Quickbeam assumes the first row is closest to the radar 145 call order_data(hgt_matrix,hm_matrix,p_matrix,t_matrix, & 146 rh_matrix,gbx%surface_radar,hgt_reversed) 147 138 139 140 ! set flag denoting position of radar relative to hgt_matrix orientation 141 ngate = size(hgt_matrix,2) 142 143 hgt_descending = hgt_matrix(1,1) > hgt_matrix(1,ngate) 144 145 if ( & 146 (gbx%surface_radar == 1 .and. hgt_descending) .or. & 147 (gbx%surface_radar == 0 .and. (.not. hgt_descending)) & 148 ) & 149 then 150 gbx%hp%radar_at_layer_one = .false. 151 else 152 gbx%hp%radar_at_layer_one = .true. 153 endif 154 148 155 ! ----- loop over subcolumns ----- 149 156 do pr=1,sgx%Ncolumns 157 158 ! NOTE: 150 159 ! atmospheric profiles are the same within the same gridbox 151 ! only hydrometeor profiles will be different 152 if (hgt_reversed) then 153 do i=1,gbx%Nhydro 154 hm_matrix(i,:,:) = sghydro%mr_hydro(:,pr,gbx%Nlevels:1:-1,i)*1000.0 ! Units from kg/kg to g/kg 155 if (gbx%use_reff) then 156 re_matrix(i,:,:) = sghydro%Reff(:,pr,gbx%Nlevels:1:-1,i)*1.e6 ! Units from m to micron 157 endif 158 enddo 159 else 160 ! only hydrometeor profiles will be different for each subgridbox 161 160 162 do i=1,gbx%Nhydro 161 163 hm_matrix(i,:,:) = sghydro%mr_hydro(:,pr,:,i)*1000.0 ! Units from kg/kg to g/kg 162 164 if (gbx%use_reff) then 163 165 re_matrix(i,:,:) = sghydro%Reff(:,pr,:,i)*1.e6 ! Units from m to micron 166 Np_matrix(i,:,:) = sghydro%Np(:,pr,:,i) ! Units [#/kg] 164 167 endif 165 168 enddo 166 endif167 169 168 170 ! ----- call radar simulator ----- 169 171 if (pr == 1) then ! Compute gaseous attenuation for all profiles 170 j=0 171 if (gbx%Npoints == 53) then 172 unt=10 173 j=1 174 endif 175 if (gbx%Npoints == 153) then 176 unt=11 177 j=101 178 endif 179 call radar_simulator(freq,k2,gbx%do_ray,gbx%use_gas_abs,gbx%use_mie_tables,gbx%mt, & ! v0.2: mt changed to gbx%mt, roj 180 gbx%Nhydro,gbx%hp,gbx%Npoints,gbx%Nlevels,gbx%nsizes,gbx%D, & ! v0.2: hp->gbx%hp, D->gbx%d, nsizes->gbx%nsizes, roj 181 hgt_matrix,hm_matrix,re_matrix,p_matrix,t_matrix,rh_matrix, & 172 call radar_simulator(gbx%hp,gbx%Npoints,gbx%Nlevels,R_UNDEF, & 173 hgt_matrix,hm_matrix,re_matrix,Np_matrix, & 174 p_matrix,t_matrix,rh_matrix, & 182 175 Ze_non,Ze_ray,h_atten_to_vol,g_atten_to_vol,dBZe,g_to_vol_out=g_to_vol) 183 176 else ! Use gaseous atteunuation for pr = 1 184 call radar_simulator( freq,k2,gbx%do_ray,gbx%use_gas_abs,gbx%use_mie_tables,gbx%mt, &185 gbx%Nhydro,gbx%hp,gbx%Npoints,gbx%Nlevels,gbx%nsizes,gbx%D, &186 hgt_matrix,hm_matrix,re_matrix,p_matrix,t_matrix,rh_matrix, &177 call radar_simulator(gbx%hp,gbx%Npoints,gbx%Nlevels,R_UNDEF, & 178 hgt_matrix,hm_matrix,re_matrix,Np_matrix, & 179 p_matrix,t_matrix,rh_matrix, & 187 180 Ze_non,Ze_ray,h_atten_to_vol,g_atten_to_vol,dBZe,g_to_vol_in=g_to_vol) 188 181 endif 189 ! ----- BEGIN output section -----190 ! spaceborne radar : from TOA to SURFACE191 if (gbx%surface_radar == 1) then192 z%Ze_tot(:,pr,:)=dBZe(:,:)193 else if (gbx%surface_radar == 0) then ! Spaceborne194 z%Ze_tot(:,pr,:)=dBZe(:,gbx%Nlevels:1:-1)195 endif196 182 183 ! store caluculated dBZe values for later output/processing 184 z%Ze_tot(:,pr,:)=dBZe(:,:) 197 185 enddo !pr 198 199 ! Change undefined value to one defined in COSP200 where (z%Ze_tot == -999.0) z%Ze_tot = R_UNDEF201 186 202 187 deallocate(hgt_matrix,p_matrix,t_matrix,rh_matrix) … … 204 189 Ze_non,Ze_ray,h_atten_to_vol,g_atten_to_vol,dBZe) 205 190 deallocate(g_to_vol) 206 207 ! deallocate(mt_ttl,mt_tti) !v0.2: roj feb 2008 can not be done here,208 !these variables now part of gbx structure and dealocated later209 210 191 END SUBROUTINE COSP_RADAR 211 192
Note: See TracChangeset
for help on using the changeset viewer.