source: LMDZ6/trunk/libf/phylmd/cosp/phys_cosp.F90 @ 3817

Last change on this file since 3817 was 3435, checked in by Laurent Fairhead, 6 years ago

"Historic" :-) commit merging the physics branch used for DYNAMICO with the LMDZ trunk.
The same physics branch can now be used seamlessly with the traditional lon-lat LMDZ
dynamical core and DYNAMICO.
Testing consisted in running a lon-lat LMDZ bucket simulation with the NPv6.1 physics package
with the original trunk sources and the merged sources. Tests were succesful in the sense that
numeric continuity was preserved in the restart files from both simulation. Further tests
included running both versions of the physics codes for one year in a LMDZOR setting in which
the restart files also came out identical.

Caution:

  • as the physics package now manages unstructured grids, grid information needs to be transmitted

to the surface scheme ORCHIDEE. This means that the interface defined in surf_land_orchidee_mod.F90
is only compatible with ORCHIDEE version orchidee2.1 and later versions. If previous versions of
ORCHIDEE need to be used, the CPP key ORCHIDEE_NOUNSTRUCT needs to be set at compilation time.
This is done automatically if makelmdz/makelmdz_fcm are called with the veget orchidee2.0 switch

  • due to a limitation in XIOS, the time at which limit conditions will be read in by DYNAMICO will be

delayed by one physic timestep with respect to the time it is read in by the lon-lat model. This is caused
by the line

IF (MOD(itime-1, lmt_pas) == 0 .OR. (jour_lu /= jour .AND. grid_type /= unstructured)) THEN ! time to read

in limit_read_mod.F90

Work still needed on COSP integration and XML files for DYNAMICO

EM, YM, LF

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 19.2 KB
RevLine 
[1262]1! Simulateur COSP : Cfmip Observation Simulator Package
[1526]2
[1262]3! ISCCP, Radar (QuickBeam), Lidar et Parasol (ACTSIM), MISR, RTTOVS
[2428]4!Idelkadi Abderrahmane Aout-Septembre 2009 First Version
5!Idelkadi Abderrahmane Nov 2015 version v1.4.0
[1262]6
[1368]7  subroutine phys_cosp( itap,dtime,freq_cosp, &
8                        ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, &
[2794]9                        ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, missing_val, &
[1925]10                        Nptslmdz,Nlevlmdz,lon,lat, presnivs,overlaplmdz,sunlit, &
[1526]11                        ref_liq,ref_ice,fracTerLic,u_wind,v_wind,phis,phi,ph,p,skt,t, &
[1262]12                        sh,rh,tca,cca,mr_lsliq,mr_lsice,fl_lsrainI,fl_lssnowI, &
13                        fl_ccrainI,fl_ccsnowI,mr_ozone,dtau_s,dem_s)
14
15!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16!!!! Inputs :
17! itap,                                 !Increment de la physiq
18! dtime,                                !Pas de temps physiq
19! overlap,                              !Overlap type in SCOPS
20! Npoints,                              !Nb de points de la grille physiq
21! Nlevels,                              !Nb de niveaux verticaux
22! Ncolumns,                             !Number of subcolumns
23! lon,lat,                              !Longitudes et latitudes de la grille LMDZ
24! ref_liq,ref_ice,                      !Rayons effectifs des particules liq et ice (en microm)
[1925]25! fracTerLic,                           !Fraction terre a convertir en masque
[1262]26! u_wind,v_wind,                        !Vents a 10m ???
27! phi,                                  !Geopotentiel
[1925]28! phis,                                 !Geopotentiel sol
[1262]29! ph,                                   !pression pour chaque inter-couche
30! p,                                    !Pression aux milieux des couches
31! skt,t,                                !Temp au sol et temp 3D
32! sh,                                   !Humidite specifique
33! rh,                                   !Humidite relatif
34! tca,                                  !Fraction nuageuse
35! cca                                   !Fraction nuageuse convective
36! mr_lsliq,                             !Liq Cloud water content
37! mr_lsice,                             !Ice Cloud water content
38! mr_ccliq,                             !Convective Cloud Liquid water content 
39! mr_ccice,                             !Cloud ice water content
40! fl_lsrain,                            !Large scale precipitation lic
41! fl_lssnow,                            !Large scale precipitation ice
42! fl_ccrain,                            !Convective precipitation lic
43! fl_ccsnow,                            !Convective precipitation ice
44! mr_ozone,                             !Concentration ozone (Kg/Kg)
45! dem_s                                 !Cloud optical emissivity
46! dtau_s                                !Cloud optical thickness
47! emsfc_lw = 1.                         !Surface emissivity dans radlwsw.F90
48
49!!! Outputs :
50! calipso2D,                            !Lidar Low/heigh/Mean/Total-level Cloud Fraction
51! calipso3D,                            !Lidar Cloud Fraction (532 nm)
52! cfadlidar,                            !Lidar Scattering Ratio CFAD (532 nm)
53! parasolrefl,                          !PARASOL-like mono-directional reflectance
54! atb,                                  !Lidar Attenuated Total Backscatter (532 nm)
55! betamol,                              !Lidar Molecular Backscatter (532 nm)
56! cfaddbze,                             !Radar Reflectivity Factor CFAD (94 GHz)
57! clcalipso2,                           !Cloud frequency of occurrence as seen by CALIPSO but not CloudSat
58! dbze,                                 !Efective_reflectivity_factor
59! cltlidarradar,                        !Lidar and Radar Total Cloud Fraction
60! clMISR,                               !Cloud Fraction as Calculated by the MISR Simulator
61! clisccp2,                             !Cloud Fraction as Calculated by the ISCCP Simulator
62! boxtauisccp,                          !Optical Depth in Each Column as Calculated by the ISCCP Simulator
63! boxptopisccp,                         !Cloud Top Pressure in Each Column as Calculated by the ISCCP Simulator
64! tclisccp,                             !Total Cloud Fraction as Calculated by the ISCCP Simulator
65! ctpisccp,                             !Mean Cloud Top Pressure as Calculated by the ISCCP Simulator
66! tauisccp,                             !Mean Optical Depth as Calculated by the ISCCP Simulator
67! albisccp,                             !Mean Cloud Albedo as Calculated by the ISCCP Simulator
68! meantbisccp,                          !Mean all-sky 10.5 micron brightness temperature as calculated by the ISCCP Simulator
69! meantbclrisccp                        !Mean clear-sky 10.5 micron brightness temperature as calculated by the ISCCP Simulator
[2428]70
71!!! AI rajouter les nouvelles sorties
[1262]72!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
73
[2428]74!! AI rajouter
[2571]75#include "cosp_defs.h"
[1262]76  USE MOD_COSP_CONSTANTS
77  USE MOD_COSP_TYPES
78  USE MOD_COSP
79  USE mod_phys_lmdz_para
[1327]80  USE mod_grid_phy_lmdz
[1262]81  use ioipsl
82  use iophy
[1925]83  use cosp_output_mod
84  use cosp_output_write_mod
[2428]85!  use MOD_COSP_Modis_Simulator, only : cosp_modis
[3172]86#ifdef CPP_XIOS
87    USE xios, ONLY: xios_field_is_active
88#endif
[3247]89  use cosp_read_otputkeys
[2428]90
[1262]91  IMPLICIT NONE
92
93  ! Local variables
[1327]94  character(len=64),PARAMETER  :: cosp_input_nl='cosp_input_nl.txt'
95  character(len=64),PARAMETER  :: cosp_output_nl='cosp_output_nl.txt'
[1262]96  integer, save :: isccp_topheight,isccp_topheight_direction,overlap
97  integer,save  :: Ncolumns     ! Number of subcolumns in SCOPS
98  integer, save :: Npoints      ! Number of gridpoints
[1327]99!$OMP THREADPRIVATE(Npoints)
[1262]100  integer, save :: Nlevels      ! Number of levels
101  Integer :: Nptslmdz,Nlevlmdz ! Nb de points issus de physiq.F
102  integer, save :: Nlr          ! Number of levels in statistical outputs
103  integer, save :: Npoints_it   ! Max number of gridpoints to be processed in one iteration
104  integer :: i
105  type(cosp_config),save :: cfg   ! Configuration options
[1327]106!$OMP THREADPRIVATE(cfg)
[1262]107  type(cosp_gridbox) :: gbx ! Gridbox information. Input for COSP
108  type(cosp_subgrid) :: sgx     ! Subgrid outputs
109  type(cosp_sgradar) :: sgradar ! Output from radar simulator
110  type(cosp_sglidar) :: sglidar ! Output from lidar simulator
111  type(cosp_isccp)   :: isccp   ! Output from ISCCP simulator
[2428]112!! AI rajout modis
113  type(cosp_modis)   :: modis   ! Output from MODIS simulator
114!!
[1262]115  type(cosp_misr)    :: misr    ! Output from MISR simulator
[2428]116!! AI rajout rttovs
117!  type(cosp_rttov)   :: rttov   ! Output from RTTOV
118!!
[1262]119  type(cosp_vgrid)   :: vgrid   ! Information on vertical grid of stats
120  type(cosp_radarstats) :: stradar ! Summary statistics from radar simulator
121  type(cosp_lidarstats) :: stlidar ! Summary statistics from lidar simulator
122
123  integer :: t0,t1,count_rate,count_max
[2428]124  integer :: Nlon,Nlat
[1262]125  real,save :: radar_freq,k2,ZenAng,co2,ch4,n2o,co,emsfc_lw
[1327]126!$OMP THREADPRIVATE(emsfc_lw)
[1262]127  integer,dimension(RTTOV_MAX_CHANNELS),save :: Channels
128  real,dimension(RTTOV_MAX_CHANNELS),save :: Surfem
129  integer, save :: surface_radar,use_mie_tables,use_gas_abs,do_ray,melt_lay
130  integer, save :: Nprmts_max_hydro,Naero,Nprmts_max_aero,lidar_ice_type
131  integer, save :: platform,satellite,Instrument,Nchannels
132  logical, save :: use_vgrid,csat_vgrid,use_precipitation_fluxes,use_reff
133
134! Declaration necessaires pour les sorties IOIPSL
[1925]135  integer :: ii
[2794]136  real    :: ecrit_day,ecrit_hf,ecrit_mth, missing_val
[2137]137  logical :: ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, ok_all_xml
[1925]138
[1262]139  logical, save :: debut_cosp=.true.
[1327]140!$OMP THREADPRIVATE(debut_cosp)
[1526]141
[3172]142  logical, save :: first_write=.true.
143!$OMP THREADPRIVATE(first_write)
144
[1262]145!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Input variables from LMDZ-GCM
146  integer                         :: overlaplmdz   !  overlap type: 1=max, 2=rand, 3=max/rand ! cosp input (output lmdz)
147  real,dimension(Nptslmdz,Nlevlmdz) :: height,phi,p,ph,T,sh,rh,tca,cca,mr_lsliq,mr_lsice,mr_ccliq,mr_ccice, &
148                                     fl_lsrain,fl_lssnow,fl_ccrain,fl_ccsnow,fl_lsgrpl, &
[1526]149                                     zlev,zlev_half,mr_ozone,radliq,radice,dtau_s,dem_s,ref_liq,ref_ice
[1262]150  real,dimension(Nptslmdz,Nlevlmdz) ::  fl_lsrainI,fl_lssnowI,fl_ccrainI,fl_ccsnowI
[1925]151  real,dimension(Nptslmdz)        :: lon,lat,skt,fracTerLic,u_wind,v_wind,phis,sunlit         
[1262]152  real,dimension(Nlevlmdz)        :: presnivs
153  integer                         :: itap,k,ip
154  real                            :: dtime,freq_cosp
[2428]155  real,dimension(2)               :: time_bnds
[3233]156
157  double precision                            :: d_dtime
158  double precision,dimension(2)               :: d_time_bnds
[1925]159 
[3247]160  real,dimension(2,SR_BINS) :: sratio_bounds
161  real,dimension(SR_BINS)   ::  sratio_ax
162
[2080]163   namelist/COSP_INPUT/overlap,isccp_topheight,isccp_topheight_direction, &
164              npoints_it,ncolumns,use_vgrid,nlr,csat_vgrid, &
[1262]165              radar_freq,surface_radar,use_mie_tables, &
166              use_gas_abs,do_ray,melt_lay,k2,Nprmts_max_hydro,Naero,Nprmts_max_aero, &
167              lidar_ice_type,use_precipitation_fluxes,use_reff, &
168              platform,satellite,Instrument,Nchannels, &
169              Channels,Surfem,ZenAng,co2,ch4,n2o,co
170
171!---------------- End of declaration of variables --------------
172
173!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
174! Read namelist with COSP inputs
175!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
176
177 if (debut_cosp) then
[1327]178  NPoints=Nptslmdz
[1526]179  Nlevels=Nlevlmdz
180 
[1262]181! Lecture du namelist input
[1327]182  CALL read_cosp_input
183
[3247]184! Clefs Outputs initialisation
[3374]185#ifdef CPP_XIOS
[3247]186  call cosp_outputkeys_init(cfg)
[3374]187#else
188  call read_cosp_output_nl(itap,cosp_output_nl,cfg)
189#endif
[3247]190!!!   call cosp_outputkeys_test(cfg)
191  print*,' Cles des differents simulateurs cosp a itap :',itap
192  print*,'Lradar_sim,Llidar_sim,Lisccp_sim,Lmisr_sim,Lmodis_sim,Lrttov_sim,Lstats', &
193          cfg%Lradar_sim,cfg%Llidar_sim,cfg%Lisccp_sim,cfg%Lmisr_sim,cfg%Lmodis_sim, &
194          cfg%Lrttov_sim,cfg%Lstats
[1262]195
196    if (overlaplmdz.ne.overlap) then
197       print*,'Attention overlaplmdz different de overlap lu dans namelist '
198    endif
199   print*,'Fin lecture Namelists, debut_cosp =',debut_cosp
200
201  endif ! debut_cosp
202
[3247]203!!! Ici on modifie les cles logiques pour les outputs selon les champs actives dans les .xml
204  if ((itap.gt.1).and.(first_write))then
[3172]205#ifdef CPP_XIOS
[3247]206    call read_xiosfieldactive(cfg)
[3172]207#endif
[3247]208    first_write=.false.
[3172]209
[3247]210    print*,' Cles des differents simulateurs cosp a itap :',itap
211    print*,'Lradar_sim,Llidar_sim,Lisccp_sim,Lmisr_sim,Lmodis_sim,Lrttov_sim,Lstats', &
212          cfg%Lradar_sim,cfg%Llidar_sim,cfg%Lisccp_sim,cfg%Lmisr_sim,cfg%Lmodis_sim, &
213          cfg%Lrttov_sim,cfg%Lstats
214  endif
[3172]215
[2428]216  time_bnds(1) = dtime-dtime/2.
217  time_bnds(2) = dtime+dtime/2.
218
[3233]219  d_time_bnds=time_bnds
220  d_dtime=dtime
221
[1262]222!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
223! Allocate memory for gridbox type
224!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[2835]225! AI mars 2017
226!        print *, 'Allocating memory for gridbox type...'
227
[2428]228! Surafce emissivity
229        emsfc_lw = 1.
[1262]230
[3233]231        call construct_cosp_gridbox(d_dtime,d_time_bnds,radar_freq,surface_radar,use_mie_tables,use_gas_abs, &
[2428]232                                    do_ray,melt_lay,k2, &
[1262]233                                    Npoints,Nlevels,Ncolumns,N_HYDRO,Nprmts_max_hydro,Naero,Nprmts_max_aero,Npoints_it, &
234                                    lidar_ice_type,isccp_topheight,isccp_topheight_direction,overlap,emsfc_lw, &
235                                    use_precipitation_fluxes,use_reff, &
236                                    Platform,Satellite,Instrument,Nchannels,ZenAng, &
237                                    channels(1:Nchannels),surfem(1:Nchannels),co2,ch4,n2o,co,gbx)
238       
239!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
240! Here code to populate input structure
241!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
242
[2835]243!        print *, 'Populating input structure...'
[1262]244        gbx%longitude = lon
245        gbx%latitude = lat
246
247        gbx%p = p !
248        gbx%ph = ph
[1526]249        gbx%zlev = phi/9.81
[1262]250
[1526]251        zlev_half(:,1) = phis(:)/9.81
252        do k = 2, Nlevels
253          do ip = 1, Npoints
254           zlev_half(ip,k) = phi(ip,k)/9.81 + &
255               (phi(ip,k)-phi(ip,k-1))/9.81 * (ph(ip,k)-p(ip,k)) / (p(ip,k)-p(ip,k-1))
256          enddo
257        enddo
258        gbx%zlev_half = zlev_half
[1262]259
260        gbx%T = T
261        gbx%q = rh*100.
262        gbx%sh = sh
[1925]263! On ne veut pas que cosp distingue les nuages stratiformes et convectifs
264! on passe les contenus totaux (conv+strat)
265        gbx%cca = 0. !convective_cloud_amount (1)
[1262]266        gbx%tca = tca ! total_cloud_amount (1)
267        gbx%psfc = ph(:,1) !pression de surface
268        gbx%skt  = skt !Skin temperature (K)
269
270        do ip = 1, Npoints
271          if (fracTerLic(ip).ge.0.5) then
272             gbx%land(ip) = 1.
273          else
274             gbx%land(ip) = 0.
275          endif
276        enddo
277        gbx%mr_ozone  = mr_ozone !mass_fraction_of_ozone_in_air (kg/kg)
278! A voir l equivalent LMDZ (u10m et v10m)
279        gbx%u_wind  = u_wind !eastward_wind (m s-1)
280        gbx%v_wind  = v_wind !northward_wind
281
[1925]282! sunlit calcule a partir de la fraction d ensoleillement par jour
[2428]283!      do ip = 1, Npoints
284!        if (sunlit(ip).le.0.) then
285!           gbx%sunlit(ip)=0.
286!        else
287!           gbx%sunlit(ip)=1.
288!        endif
289!      enddo
290       gbx%sunlit=sunlit
[1925]291
[1262]292! A voir l equivalent LMDZ
293  mr_ccliq = 0.0
294  mr_ccice = 0.0
295        gbx%mr_hydro(:,:,I_LSCLIQ) = mr_lsliq !mixing_ratio_large_scale_cloud_liquid (kg/kg)
296        gbx%mr_hydro(:,:,I_LSCICE) = mr_lsice !mixing_ratio_large_scale_cloud_ic
297        gbx%mr_hydro(:,:,I_CVCLIQ) = mr_ccliq !mixing_ratio_convective_cloud_liquid
298        gbx%mr_hydro(:,:,I_CVCICE) = mr_ccice !mixing_ratio_convective_cloud_ice
299! A revoir
300        fl_lsrain = fl_lsrainI + fl_ccrainI
301        fl_lssnow = fl_lssnowI + fl_ccsnowI
302        gbx%rain_ls = fl_lsrain !flux_large_scale_cloud_rain (kg m^-2 s^-1)
303        gbx%snow_ls = fl_lssnow !flux_large_scale_cloud_snow
304!  A voir l equivalent LMDZ
305        fl_lsgrpl=0.
306        fl_ccsnow = 0.
307        fl_ccrain = 0.
308        gbx%grpl_ls = fl_lsgrpl  !flux_large_scale_cloud_graupel
309        gbx%rain_cv = fl_ccrain  !flux_convective_cloud_rain
310        gbx%snow_cv = fl_ccsnow  !flux_convective_cloud_snow
311
312     gbx%Reff(:,:,I_LSCLIQ) = ref_liq*1e-6
313     gbx%Reff(:,:,I_LSCICE) = ref_ice*1e-6
[2428]314!! AI A revoir
[1262]315     gbx%Reff(:,:,I_CVCLIQ) = ref_liq*1e-6
316     gbx%Reff(:,:,I_CVCICE) = ref_ice*1e-6
317
318        ! ISCCP simulator
319        gbx%dtau_s   = dtau_s
320        gbx%dtau_c   = 0.
321        gbx%dem_s    = dem_s
322        gbx%dem_c    = 0.
323
324!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
325        ! Define new vertical grid
326!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[2835]327!        print *, 'Defining new vertical grid...'
[1262]328        call construct_cosp_vgrid(gbx,Nlr,use_vgrid,csat_vgrid,vgrid)
329
330!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
331       ! Allocate memory for other types
332!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[2835]333!        print *, 'Allocating memory for other types...'
[1262]334        call construct_cosp_subgrid(Npoints, Ncolumns, Nlevels, sgx)
335        call construct_cosp_sgradar(cfg,Npoints,Ncolumns,Nlevels,N_HYDRO,sgradar)
336        call construct_cosp_radarstats(cfg,Npoints,Ncolumns,vgrid%Nlvgrid,N_HYDRO,stradar)
337        call construct_cosp_sglidar(cfg,Npoints,Ncolumns,Nlevels,N_HYDRO,PARASOL_NREFL,sglidar)
338        call construct_cosp_lidarstats(cfg,Npoints,Ncolumns,vgrid%Nlvgrid,N_HYDRO,PARASOL_NREFL,stlidar)
339        call construct_cosp_isccp(cfg,Npoints,Ncolumns,Nlevels,isccp)
[2428]340!! AI rajout
341        call construct_cosp_modis(cfg,Npoints,modis)
342!!
[1262]343        call construct_cosp_misr(cfg,Npoints,misr)
[2428]344!        call construct_cosp_rttov(cfg,Npoints,Nchannels,rttov)
[1925]345
346!+++++++++++++ Open output files and define output files axis !+++++++++++++
[3347]347    if (debut_cosp) then
[1925]348
[2080]349      !$OMP MASTER
[3247]350!        print *, ' Open outpts files and define axis'
[1925]351        call cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, &
[2137]352                              ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml, &
[2822]353                              ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid, stlidar)
[2080]354      !$OMP END MASTER
355      !$OMP BARRIER
[3347]356      endif ! debut_cosp
[3308]357!    else
[1262]358!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
359        ! Call simulator
360!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[2835]361!        print *, 'Calling simulator...'
[2428]362!! AI
363!        call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,stradar,stlidar)
364!#ifdef RTTOV
365!        call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,modis,rttov,stradar,stlidar)
366!#else
[3435]367     if (.NOT. debut_cosp) call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,modis,stradar,stlidar)
[2428]368!#endif
369!!
[1262]370!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
371
[1925]372!!!!!!!!!!!!!!!!!! Ecreture des sorties Cosp !!!!!!!!!!!!!!r!!!!!!:!!!!!
[2428]373
[2835]374!       print *, 'Calling write output'
[3435]375     if (.NOT. debut_cosp) call cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_val, &
[2428]376                               cfg, gbx, vgrid, sglidar, sgradar, stlidar, stradar, &
377                               isccp, misr, modis)
[3308]378!    endif !debut_cosp
[1262]379!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
380        ! Deallocate memory in derived types
381!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[3403]382!        print *, 'Deallocating memory...'
[1262]383        call free_cosp_gridbox(gbx)
384        call free_cosp_subgrid(sgx)
385        call free_cosp_sgradar(sgradar)
386        call free_cosp_radarstats(stradar)
387        call free_cosp_sglidar(sglidar)
388        call free_cosp_lidarstats(stlidar)
389        call free_cosp_isccp(isccp)
390        call free_cosp_misr(misr)
[2428]391!! AI
392        call free_cosp_modis(modis)
393!        call free_cosp_rttov(rttov)
394!!
[1262]395        call free_cosp_vgrid(vgrid) 
396 
397!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
398  ! Time in s. Only for testing purposes
399!  call system_clock(t1,count_rate,count_max)
400!  print *,(t1-t0)*1.0/count_rate
[3435]401    if (debut_cosp) then
402      debut_cosp=.false.
403    endif
[1327]404 
405  CONTAINS
406 
407  SUBROUTINE read_cosp_input
[1262]408   
[1327]409    IF (is_master) THEN
410      OPEN(10,file=cosp_input_nl,status='old')
411      READ(10,nml=cosp_input)
412      CLOSE(10)
413    ENDIF
[3347]414!$OMP BARRIER
[1327]415    CALL bcast(overlap)
416    CALL bcast(isccp_topheight)
417    CALL bcast(isccp_topheight_direction)
418    CALL bcast(npoints_it)
419    CALL bcast(ncolumns)
420    CALL bcast(use_vgrid)
421    CALL bcast(nlr)
422    CALL bcast(csat_vgrid)
423    CALL bcast(radar_freq)
424    CALL bcast(surface_radar)
425    CALL bcast(use_mie_tables)
426    CALL bcast(use_gas_abs)
427    CALL bcast(do_ray)
428    CALL bcast(melt_lay)
429    CALL bcast(k2)
430    CALL bcast(Nprmts_max_hydro)
431    CALL bcast(Naero)
432    CALL bcast(Nprmts_max_aero)
433    CALL bcast(lidar_ice_type)
434    CALL bcast(use_precipitation_fluxes)
435    CALL bcast(use_reff)
436    CALL bcast(platform)
437    CALL bcast(satellite)
438    CALL bcast(Instrument)
439    CALL bcast(Nchannels)
440    CALL bcast(Channels)
441    CALL bcast(Surfem)
442    CALL bcast(ZenAng)
443    CALL bcast(co2)
444    CALL bcast(ch4)
445    CALL bcast(n2o)
446    CALL bcast(co)
[3347]447
[1327]448  END SUBROUTINE read_cosp_input
449
[1262]450end subroutine phys_cosp
Note: See TracBrowser for help on using the repository browser.