source: LMDZ6/trunk/libf/phylmd/cospv2/cosp_cloudsat_interface.F90 @ 4164

Last change on this file since 4164 was 3491, checked in by idelkadi, 6 years ago

Integration of version 2 of the COSP simulator in LMDZ
This line, and those below, will be ignored--

M makegcm
M makelmdz
M makelmdz_fcm
M libf/phylmd/physiq_mod.F90
A libf/phylmd/cospv2
A libf/phylmd/cospv2/mo_rng.F90
A libf/phylmd/cospv2/quickbeam_optics.F90
A libf/phylmd/cospv2/cosp_cloudsat_interface.F90
A libf/phylmd/cospv2/cosp_config.F90
A libf/phylmd/cospv2/lidar_simulator.F90
A libf/phylmd/cospv2/prec_scops.F90
A libf/phylmd/cospv2/mrgrnk.F90
A libf/phylmd/cospv2/lmdz_cosp_read_outputkeys.F90
A libf/phylmd/cospv2/cosp_atlid_interface.F90
A libf/phylmd/cospv2/lmdz_cosp_subsample_and_optics_mod.F90
A libf/phylmd/cospv2/cosp_math_constants.F90
A libf/phylmd/cospv2/MISR_simulator.F90
A libf/phylmd/cospv2/modis_simulator.F90
A libf/phylmd/cospv2/math_lib.F90
A libf/phylmd/cospv2/cosp_grLidar532_interface.F90
A libf/phylmd/cospv2/cosp_errorHandling.F90
A libf/phylmd/cospv2/cosp_stats.F90
A libf/phylmd/cospv2/lmdz_cosp_output_write_mod.F90
A libf/phylmd/cospv2/cosp_utils.F90
A libf/phylmd/cospv2/cosp_optics.F90
A libf/phylmd/cospv2/icarus.F90
A libf/phylmd/cospv2/scops.F90
A libf/phylmd/cospv2/optics_lib.F90
A libf/phylmd/cospv2/cosp_kinds.F90
A libf/phylmd/cospv2/cosp_calipso_interface.F90
A libf/phylmd/cospv2/quickbeam.F90
A libf/phylmd/cospv2/parasol.F90
A libf/phylmd/cospv2/cosp_phys_constants.F90
A libf/phylmd/cospv2/cosp.F90
A libf/phylmd/cospv2/array_lib.F90
A libf/phylmd/cospv2/cosp_isccp_interface.F90
A libf/phylmd/cospv2/cosp_parasol_interface.F90
A libf/phylmd/cospv2/lmdz_cosp_construct_destroy_mod.F90
A libf/phylmd/cospv2/lmdz_cosp_output_mod.F90
A libf/phylmd/cospv2/lmdz_cosp_interface.F90
A libf/phylmd/cospv2/cosp_misr_interface.F90
A libf/phylmd/cospv2/cosp_modis_interface.F90

File size: 6.0 KB
Line 
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! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32MODULE 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
59CONTAINS
60
61  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62  !                              SUBROUTINE cosp_cloudsat_in
63  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64  SUBROUTINE COSP_CLOUDSAT_INIT(radar_freq,k2,use_gas_abs,do_ray,undef,nhydro,   &
65                                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    if (present(load_LUT)) then
92       local_load_LUT = load_LUT
93    else
94       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         trim(cloudsat_micro_scheme)
100
101    ! Initialize for NEW radar-configurarion derived type (radar_cfg)
102    rcfg%freq                = radar_freq
103    rcfg%k2                  = k2
104    rcfg%use_gas_abs         = use_gas_abs
105    rcfg%do_ray              = do_ray
106    rcfg%nhclass             = nhydro
107    rcfg%load_scale_LUTs     = local_load_LUT
108    rcfg%update_scale_LUTs   = .false.
109    rcfg%scale_LUT_file_name = LUT_file_name
110    rcfg%N_scale_flag        = .false.
111    rcfg%fc                  = undef
112    rcfg%rho_eff             = undef
113    rcfg%Z_scale_flag        = .false.
114    rcfg%Ze_scaled           = 0._wp
115    rcfg%Zr_scaled           = 0._wp
116    rcfg%kr_scaled           = 0._wp
117
118    ! Set up Re bin "structure" for z_scaling
119    rcfg%base_list(1)=0
120    do j=1,Re_MAX_BIN
121       rcfg%step_list(j)=0.1_wp+0.1_wp*((j-1)**1.5)
122       if(rcfg%step_list(j)>Re_BIN_LENGTH) then
123          rcfg%step_list(j)=Re_BIN_LENGTH
124       endif
125       if(j>1) then
126          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    if (surface_radar == 1) then
132       rcfg%radar_at_layer_one = .false.
133    else
134       rcfg%radar_at_layer_one = .true.
135    endif
136
137  END SUBROUTINE COSP_CLOUDSAT_INIT
138
139  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
140  !                                       END MODULE
141  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142END MODULE MOD_COSP_CLOUDSAT_INTERFACE
Note: See TracBrowser for help on using the repository browser.