source: LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/cosp2/cosp_cloudsat_interface.F90 @ 3698

Last change on this file since 3698 was 3358, checked in by idelkadi, 6 years ago

Implementation de la nouvelle version COSPv2 dans LMDZ.
Pour compiler avec makelmdz_fcma utiliser l'option "-cosp2 true"

File size: 6.2 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 MOD_COSP_CONFIG, ONLY: DBZE_BINS,CFAD_ZE_MIN,CFAD_ZE_WIDTH,SR_BINS,DBZE_MAX,       &
34                             DBZE_MIN
35  USE COSP_KINDS,      ONLY: wp
36  USE quickbeam,       ONLY: quickbeam_init,radar_cfg,Re_MAX_BIN,Re_BIN_LENGTH
37  IMPLICIT NONE
38         
39  ! Directory where LUTs will be stored
40  character(len=120) :: RADAR_SIM_LUT_DIRECTORY = './'
41  logical :: RADAR_SIM_LOAD_scale_LUTs_flag   = .false.
42  logical :: RADAR_SIM_UPDATE_scale_LUTs_flag = .false.
43
44  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45  ! TYPE cloudsat_IN
46  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47  type cloudsat_IN
48     integer,pointer ::            &
49          Npoints,         & ! Number of horizontal grid-points
50          Nlevels,         & ! Number of vertical levels
51          Ncolumns           ! Number of subcolumns
52     real(wp),pointer ::   &
53          hgt_matrix(:,:),   & ! Height of hydrometeors (km)
54          z_vol(:,:,:),      & ! Effective reflectivity factor (mm^6/m^3)
55          kr_vol(:,:,:),     & ! Attenuation coefficient hydro (dB/km)
56          g_vol(:,:,:),      & ! Attenuation coefficient gases (dB/km)
57          g_to_vol_in(:,:)     ! Gaseous atteunation, radar to vol (dB)
58     type(radar_cfg),pointer :: rcfg   ! Radar simulator configuration
59  end type cloudsat_IN
60
61CONTAINS
62
63  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64  !                              SUBROUTINE cosp_cloudsat_in
65  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66  SUBROUTINE COSP_CLOUDSAT_INIT(radar_freq,k2,use_gas_abs,do_ray,undef,nhydro,   &
67                                surface_radar,rcfg,cloudsat_micro_scheme,load_LUT)
68    ! INPUTS
69    real(wp),intent(in) :: &
70         radar_freq,  & ! Radar frequency (GHz)
71         k2,          & ! |K|^2, the dielectric constant
72         undef          ! Undefined
73    integer,intent(in) :: &
74         use_gas_abs, & ! 1 = do gaseous abs calcs, 0=no gasesous absorbtion calculated,
75                        ! 2 = calculate absorption for first profile on all profiles
76         do_ray,      & !
77         nhydro,      & !
78         surface_radar
79    logical,intent(in),optional :: &
80         load_LUT
81    character(len=64),intent(in) :: &
82       cloudsat_micro_scheme
83   
84    ! OUTPUTS
85    type(radar_cfg) :: &
86         rcfg           !
87   
88    ! LOCAL VARIABLES
89    character(len=240) :: LUT_file_name
90    logical       :: local_load_LUT
91    integer       :: j
92   
93    if (present(load_LUT)) then
94       local_load_LUT = load_LUT
95    else
96       local_load_LUT = RADAR_SIM_LOAD_scale_LUTs_flag
97    endif
98   
99    write(*,*) 'RADAR_SIM microphysics scheme is set to: ',&
100                trim(cloudsat_micro_scheme)
101   
102    ! LUT file name
103    LUT_file_name = trim(RADAR_SIM_LUT_DIRECTORY) // &
104         trim(cloudsat_micro_scheme)
105   
106    ! Initialize for NEW radar-configurarion derived type (radar_cfg)
107    rcfg%freq                = radar_freq
108    rcfg%k2                  = k2
109    rcfg%use_gas_abs         = use_gas_abs
110    rcfg%do_ray              = do_ray
111    rcfg%nhclass             = nhydro
112    rcfg%load_scale_LUTs     = local_load_LUT
113    rcfg%update_scale_LUTs   = .false.
114    rcfg%scale_LUT_file_name = LUT_file_name
115    rcfg%N_scale_flag        = .false.
116    rcfg%fc                  = undef
117    rcfg%rho_eff             = undef
118    rcfg%Z_scale_flag        = .false.
119    rcfg%Ze_scaled           = 0._wp
120    rcfg%Zr_scaled           = 0._wp
121    rcfg%kr_scaled           = 0._wp
122   
123    ! Set up Re bin "structure" for z_scaling
124    rcfg%base_list(1)=0
125    do j=1,Re_MAX_BIN
126       rcfg%step_list(j)=0.1_wp+0.1_wp*((j-1)**1.5)
127       if(rcfg%step_list(j)>Re_BIN_LENGTH) then
128          rcfg%step_list(j)=Re_BIN_LENGTH
129       endif
130       if(j>1) then
131          rcfg%base_list(j)=rcfg%base_list(j-1)+floor(Re_BIN_LENGTH/rcfg%step_list(j-1))
132       endif
133    enddo
134   
135    ! Set flag denoting position of radar
136    if (surface_radar == 1) then
137       rcfg%radar_at_layer_one = .false.
138    else
139       rcfg%radar_at_layer_one = .true.
140    endif
141
142  END SUBROUTINE COSP_CLOUDSAT_INIT
143
144  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
145  !                                       END MODULE
146  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147END MODULE MOD_COSP_CLOUDSAT_INTERFACE
Note: See TracBrowser for help on using the repository browser.