1 | ! Simulateur COSP : Cfmip Observation Simulator Package |
---|
2 | |
---|
3 | ! ISCCP, Radar (QuickBeam), Lidar et Parasol (ACTSIM), MISR, RTTOVS |
---|
4 | !Idelkadi Abderrahmane Aout-Septembre 2009 First Version |
---|
5 | !Idelkadi Abderrahmane Nov 2015 version v1.4.0 |
---|
6 | |
---|
7 | subroutine phys_cosp( itap,dtime,freq_cosp, & |
---|
8 | ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, & |
---|
9 | ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, missing_val, & |
---|
10 | Nptslmdz,Nlevlmdz,lon,lat, presnivs,overlaplmdz,sunlit, & |
---|
11 | ref_liq,ref_ice,fracTerLic,u_wind,v_wind,phis,phi,ph,p,skt,t, & |
---|
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) |
---|
25 | ! fracTerLic, !Fraction terre a convertir en masque |
---|
26 | ! u_wind,v_wind, !Vents a 10m ??? |
---|
27 | ! phi, !Geopotentiel |
---|
28 | ! phis, !Geopotentiel sol |
---|
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 |
---|
70 | |
---|
71 | !!! AI rajouter les nouvelles sorties |
---|
72 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
73 | |
---|
74 | !! AI rajouter |
---|
75 | #include "cosp_defs.h" |
---|
76 | USE MOD_COSP_CONSTANTS |
---|
77 | USE MOD_COSP_TYPES |
---|
78 | USE MOD_COSP |
---|
79 | USE mod_phys_lmdz_para |
---|
80 | USE mod_grid_phy_lmdz |
---|
81 | use ioipsl |
---|
82 | use iophy |
---|
83 | use cosp_output_mod |
---|
84 | use cosp_output_write_mod |
---|
85 | ! use MOD_COSP_Modis_Simulator, only : cosp_modis |
---|
86 | #ifdef CPP_XIOS |
---|
87 | USE xios, ONLY: xios_field_is_active |
---|
88 | #endif |
---|
89 | |
---|
90 | IMPLICIT NONE |
---|
91 | |
---|
92 | ! Local variables |
---|
93 | character(len=64),PARAMETER :: cosp_input_nl='cosp_input_nl.txt' |
---|
94 | character(len=64),PARAMETER :: cosp_output_nl='cosp_output_nl.txt' |
---|
95 | integer, save :: isccp_topheight,isccp_topheight_direction,overlap |
---|
96 | integer,save :: Ncolumns ! Number of subcolumns in SCOPS |
---|
97 | integer, save :: Npoints ! Number of gridpoints |
---|
98 | !$OMP THREADPRIVATE(Npoints) |
---|
99 | integer, save :: Nlevels ! Number of levels |
---|
100 | Integer :: Nptslmdz,Nlevlmdz ! Nb de points issus de physiq.F |
---|
101 | integer, save :: Nlr ! Number of levels in statistical outputs |
---|
102 | integer, save :: Npoints_it ! Max number of gridpoints to be processed in one iteration |
---|
103 | integer :: i |
---|
104 | type(cosp_config),save :: cfg ! Configuration options |
---|
105 | !$OMP THREADPRIVATE(cfg) |
---|
106 | type(cosp_gridbox) :: gbx ! Gridbox information. Input for COSP |
---|
107 | type(cosp_subgrid) :: sgx ! Subgrid outputs |
---|
108 | type(cosp_sgradar) :: sgradar ! Output from radar simulator |
---|
109 | type(cosp_sglidar) :: sglidar ! Output from lidar simulator |
---|
110 | type(cosp_isccp) :: isccp ! Output from ISCCP simulator |
---|
111 | !! AI rajout modis |
---|
112 | type(cosp_modis) :: modis ! Output from MODIS simulator |
---|
113 | !! |
---|
114 | type(cosp_misr) :: misr ! Output from MISR simulator |
---|
115 | !! AI rajout rttovs |
---|
116 | ! type(cosp_rttov) :: rttov ! Output from RTTOV |
---|
117 | !! |
---|
118 | type(cosp_vgrid) :: vgrid ! Information on vertical grid of stats |
---|
119 | type(cosp_radarstats) :: stradar ! Summary statistics from radar simulator |
---|
120 | type(cosp_lidarstats) :: stlidar ! Summary statistics from lidar simulator |
---|
121 | |
---|
122 | integer :: t0,t1,count_rate,count_max |
---|
123 | integer :: Nlon,Nlat |
---|
124 | real,save :: radar_freq,k2,ZenAng,co2,ch4,n2o,co,emsfc_lw |
---|
125 | !$OMP THREADPRIVATE(emsfc_lw) |
---|
126 | integer,dimension(RTTOV_MAX_CHANNELS),save :: Channels |
---|
127 | real,dimension(RTTOV_MAX_CHANNELS),save :: Surfem |
---|
128 | integer, save :: surface_radar,use_mie_tables,use_gas_abs,do_ray,melt_lay |
---|
129 | integer, save :: Nprmts_max_hydro,Naero,Nprmts_max_aero,lidar_ice_type |
---|
130 | integer, save :: platform,satellite,Instrument,Nchannels |
---|
131 | logical, save :: use_vgrid,csat_vgrid,use_precipitation_fluxes,use_reff |
---|
132 | |
---|
133 | ! Declaration necessaires pour les sorties IOIPSL |
---|
134 | integer :: ii |
---|
135 | real :: ecrit_day,ecrit_hf,ecrit_mth, missing_val |
---|
136 | logical :: ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, ok_all_xml |
---|
137 | |
---|
138 | logical, save :: debut_cosp=.true. |
---|
139 | !$OMP THREADPRIVATE(debut_cosp) |
---|
140 | |
---|
141 | logical, save :: first_write=.true. |
---|
142 | !$OMP THREADPRIVATE(first_write) |
---|
143 | |
---|
144 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Input variables from LMDZ-GCM |
---|
145 | integer :: overlaplmdz ! overlap type: 1=max, 2=rand, 3=max/rand ! cosp input (output lmdz) |
---|
146 | real,dimension(Nptslmdz,Nlevlmdz) :: height,phi,p,ph,T,sh,rh,tca,cca,mr_lsliq,mr_lsice,mr_ccliq,mr_ccice, & |
---|
147 | fl_lsrain,fl_lssnow,fl_ccrain,fl_ccsnow,fl_lsgrpl, & |
---|
148 | zlev,zlev_half,mr_ozone,radliq,radice,dtau_s,dem_s,ref_liq,ref_ice |
---|
149 | real,dimension(Nptslmdz,Nlevlmdz) :: fl_lsrainI,fl_lssnowI,fl_ccrainI,fl_ccsnowI |
---|
150 | real,dimension(Nptslmdz) :: lon,lat,skt,fracTerLic,u_wind,v_wind,phis,sunlit |
---|
151 | real,dimension(Nlevlmdz) :: presnivs |
---|
152 | integer :: itap,k,ip |
---|
153 | real :: dtime,freq_cosp |
---|
154 | real,dimension(2) :: time_bnds |
---|
155 | |
---|
156 | namelist/COSP_INPUT/overlap,isccp_topheight,isccp_topheight_direction, & |
---|
157 | npoints_it,ncolumns,use_vgrid,nlr,csat_vgrid, & |
---|
158 | radar_freq,surface_radar,use_mie_tables, & |
---|
159 | use_gas_abs,do_ray,melt_lay,k2,Nprmts_max_hydro,Naero,Nprmts_max_aero, & |
---|
160 | lidar_ice_type,use_precipitation_fluxes,use_reff, & |
---|
161 | platform,satellite,Instrument,Nchannels, & |
---|
162 | Channels,Surfem,ZenAng,co2,ch4,n2o,co |
---|
163 | |
---|
164 | !---------------- End of declaration of variables -------------- |
---|
165 | |
---|
166 | |
---|
167 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
168 | ! Read namelist with COSP inputs |
---|
169 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
170 | |
---|
171 | if (debut_cosp) then |
---|
172 | NPoints=Nptslmdz |
---|
173 | Nlevels=Nlevlmdz |
---|
174 | |
---|
175 | ! Lecture du namelist input |
---|
176 | CALL read_cosp_input |
---|
177 | |
---|
178 | ! Clefs Outputs |
---|
179 | call read_cosp_output_nl(itap,cosp_output_nl,cfg) |
---|
180 | |
---|
181 | if (overlaplmdz.ne.overlap) then |
---|
182 | print*,'Attention overlaplmdz different de overlap lu dans namelist ' |
---|
183 | endif |
---|
184 | print*,'Fin lecture Namelists, debut_cosp =',debut_cosp |
---|
185 | |
---|
186 | print*,' Cles des differents simulateurs cosp 1er appel Cosp :' |
---|
187 | print*,'Lradar_sim,Llidar_sim,Lisccp_sim,Lmisr_sim,Lmodis_sim,Lrttov_sim', & |
---|
188 | cfg%Lradar_sim,cfg%Llidar_sim,cfg%Lisccp_sim,cfg%Lmisr_sim,cfg%Lmodis_sim,cfg%Lrttov_sim |
---|
189 | |
---|
190 | endif ! debut_cosp |
---|
191 | |
---|
192 | !!! Ici on modifie les cles logiques selon les champs actives dans les .xml |
---|
193 | #ifdef CPP_XIOS |
---|
194 | if ((itap.gt.1).and.(first_write))then |
---|
195 | ! call read_xiosfieldactive(cfg) |
---|
196 | call read_cosp_output_nl(itap,cosp_output_nl,cfg) |
---|
197 | ! print*,' Dans cosp_write itap first_writ LcfadLidarsr532 =', & |
---|
198 | ! itap, first_write, cfg%LcfadLidarsr532 |
---|
199 | first_write=.false. |
---|
200 | endif |
---|
201 | ! print*,' Dans cosp_write itap LcfadLidarsr532 =', & |
---|
202 | ! itap, cfg%LcfadLidarsr532 |
---|
203 | #endif |
---|
204 | |
---|
205 | |
---|
206 | time_bnds(1) = dtime-dtime/2. |
---|
207 | time_bnds(2) = dtime+dtime/2. |
---|
208 | |
---|
209 | ! print*,'Debut phys_cosp itap,dtime,freq_cosp,ecrit_mth,ecrit_day,ecrit_hf ', & |
---|
210 | ! itap,dtime,freq_cosp,ecrit_mth,ecrit_day,ecrit_hf |
---|
211 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
212 | ! Allocate memory for gridbox type |
---|
213 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
214 | ! AI mars 2017 |
---|
215 | ! print *, 'Allocating memory for gridbox type...' |
---|
216 | |
---|
217 | !! AI |
---|
218 | ! call construct_cosp_gridbox(dble(itap),radar_freq,surface_radar,use_mie_tables,use_gas_abs,do_ray,melt_lay,k2, & |
---|
219 | ! Npoints,Nlevels,Ncolumns,N_HYDRO,Nprmts_max_hydro,Naero,Nprmts_max_aero,Npoints_it, & |
---|
220 | ! lidar_ice_type,isccp_topheight,isccp_topheight_direction,overlap,emsfc_lw, & |
---|
221 | ! use_precipitation_fluxes,use_reff, & |
---|
222 | ! Platform,Satellite,Instrument,Nchannels,ZenAng, & |
---|
223 | ! channels(1:Nchannels),surfem(1:Nchannels),co2,ch4,n2o,co,gbx) |
---|
224 | ! Surafce emissivity |
---|
225 | emsfc_lw = 1. |
---|
226 | |
---|
227 | call construct_cosp_gridbox(dtime,time_bnds,radar_freq,surface_radar,use_mie_tables,use_gas_abs, & |
---|
228 | do_ray,melt_lay,k2, & |
---|
229 | Npoints,Nlevels,Ncolumns,N_HYDRO,Nprmts_max_hydro,Naero,Nprmts_max_aero,Npoints_it, & |
---|
230 | lidar_ice_type,isccp_topheight,isccp_topheight_direction,overlap,emsfc_lw, & |
---|
231 | use_precipitation_fluxes,use_reff, & |
---|
232 | Platform,Satellite,Instrument,Nchannels,ZenAng, & |
---|
233 | channels(1:Nchannels),surfem(1:Nchannels),co2,ch4,n2o,co,gbx) |
---|
234 | |
---|
235 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
236 | ! Here code to populate input structure |
---|
237 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
238 | |
---|
239 | ! print *, 'Populating input structure...' |
---|
240 | gbx%longitude = lon |
---|
241 | gbx%latitude = lat |
---|
242 | |
---|
243 | gbx%p = p ! |
---|
244 | gbx%ph = ph |
---|
245 | gbx%zlev = phi/9.81 |
---|
246 | |
---|
247 | zlev_half(:,1) = phis(:)/9.81 |
---|
248 | do k = 2, Nlevels |
---|
249 | do ip = 1, Npoints |
---|
250 | zlev_half(ip,k) = phi(ip,k)/9.81 + & |
---|
251 | (phi(ip,k)-phi(ip,k-1))/9.81 * (ph(ip,k)-p(ip,k)) / (p(ip,k)-p(ip,k-1)) |
---|
252 | enddo |
---|
253 | enddo |
---|
254 | gbx%zlev_half = zlev_half |
---|
255 | |
---|
256 | gbx%T = T |
---|
257 | gbx%q = rh*100. |
---|
258 | gbx%sh = sh |
---|
259 | ! On ne veut pas que cosp distingue les nuages stratiformes et convectifs |
---|
260 | ! on passe les contenus totaux (conv+strat) |
---|
261 | gbx%cca = 0. !convective_cloud_amount (1) |
---|
262 | gbx%tca = tca ! total_cloud_amount (1) |
---|
263 | gbx%psfc = ph(:,1) !pression de surface |
---|
264 | gbx%skt = skt !Skin temperature (K) |
---|
265 | |
---|
266 | do ip = 1, Npoints |
---|
267 | if (fracTerLic(ip).ge.0.5) then |
---|
268 | gbx%land(ip) = 1. |
---|
269 | else |
---|
270 | gbx%land(ip) = 0. |
---|
271 | endif |
---|
272 | enddo |
---|
273 | gbx%mr_ozone = mr_ozone !mass_fraction_of_ozone_in_air (kg/kg) |
---|
274 | ! A voir l equivalent LMDZ (u10m et v10m) |
---|
275 | gbx%u_wind = u_wind !eastward_wind (m s-1) |
---|
276 | gbx%v_wind = v_wind !northward_wind |
---|
277 | |
---|
278 | ! sunlit calcule a partir de la fraction d ensoleillement par jour |
---|
279 | ! do ip = 1, Npoints |
---|
280 | ! if (sunlit(ip).le.0.) then |
---|
281 | ! gbx%sunlit(ip)=0. |
---|
282 | ! else |
---|
283 | ! gbx%sunlit(ip)=1. |
---|
284 | ! endif |
---|
285 | ! enddo |
---|
286 | gbx%sunlit=sunlit |
---|
287 | |
---|
288 | ! A voir l equivalent LMDZ |
---|
289 | mr_ccliq = 0.0 |
---|
290 | mr_ccice = 0.0 |
---|
291 | gbx%mr_hydro(:,:,I_LSCLIQ) = mr_lsliq !mixing_ratio_large_scale_cloud_liquid (kg/kg) |
---|
292 | gbx%mr_hydro(:,:,I_LSCICE) = mr_lsice !mixing_ratio_large_scale_cloud_ic |
---|
293 | gbx%mr_hydro(:,:,I_CVCLIQ) = mr_ccliq !mixing_ratio_convective_cloud_liquid |
---|
294 | gbx%mr_hydro(:,:,I_CVCICE) = mr_ccice !mixing_ratio_convective_cloud_ice |
---|
295 | ! A revoir |
---|
296 | fl_lsrain = fl_lsrainI + fl_ccrainI |
---|
297 | fl_lssnow = fl_lssnowI + fl_ccsnowI |
---|
298 | gbx%rain_ls = fl_lsrain !flux_large_scale_cloud_rain (kg m^-2 s^-1) |
---|
299 | gbx%snow_ls = fl_lssnow !flux_large_scale_cloud_snow |
---|
300 | ! A voir l equivalent LMDZ |
---|
301 | fl_lsgrpl=0. |
---|
302 | fl_ccsnow = 0. |
---|
303 | fl_ccrain = 0. |
---|
304 | gbx%grpl_ls = fl_lsgrpl !flux_large_scale_cloud_graupel |
---|
305 | gbx%rain_cv = fl_ccrain !flux_convective_cloud_rain |
---|
306 | gbx%snow_cv = fl_ccsnow !flux_convective_cloud_snow |
---|
307 | |
---|
308 | gbx%Reff(:,:,I_LSCLIQ) = ref_liq*1e-6 |
---|
309 | gbx%Reff(:,:,I_LSCICE) = ref_ice*1e-6 |
---|
310 | !! AI A revoir |
---|
311 | gbx%Reff(:,:,I_CVCLIQ) = ref_liq*1e-6 |
---|
312 | gbx%Reff(:,:,I_CVCICE) = ref_ice*1e-6 |
---|
313 | |
---|
314 | ! ISCCP simulator |
---|
315 | gbx%dtau_s = dtau_s |
---|
316 | gbx%dtau_c = 0. |
---|
317 | gbx%dem_s = dem_s |
---|
318 | gbx%dem_c = 0. |
---|
319 | |
---|
320 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
321 | ! Define new vertical grid |
---|
322 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
323 | ! print *, 'Defining new vertical grid...' |
---|
324 | call construct_cosp_vgrid(gbx,Nlr,use_vgrid,csat_vgrid,vgrid) |
---|
325 | |
---|
326 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
327 | ! Allocate memory for other types |
---|
328 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
329 | ! print *, 'Allocating memory for other types...' |
---|
330 | call construct_cosp_subgrid(Npoints, Ncolumns, Nlevels, sgx) |
---|
331 | call construct_cosp_sgradar(cfg,Npoints,Ncolumns,Nlevels,N_HYDRO,sgradar) |
---|
332 | call construct_cosp_radarstats(cfg,Npoints,Ncolumns,vgrid%Nlvgrid,N_HYDRO,stradar) |
---|
333 | call construct_cosp_sglidar(cfg,Npoints,Ncolumns,Nlevels,N_HYDRO,PARASOL_NREFL,sglidar) |
---|
334 | call construct_cosp_lidarstats(cfg,Npoints,Ncolumns,vgrid%Nlvgrid,N_HYDRO,PARASOL_NREFL,stlidar) |
---|
335 | call construct_cosp_isccp(cfg,Npoints,Ncolumns,Nlevels,isccp) |
---|
336 | !! AI rajout |
---|
337 | call construct_cosp_modis(cfg,Npoints,modis) |
---|
338 | !! |
---|
339 | call construct_cosp_misr(cfg,Npoints,misr) |
---|
340 | ! call construct_cosp_rttov(cfg,Npoints,Nchannels,rttov) |
---|
341 | |
---|
342 | !+++++++++++++ Open output files and define output files axis !+++++++++++++ |
---|
343 | if (debut_cosp) then |
---|
344 | |
---|
345 | !$OMP MASTER |
---|
346 | print *, ' Open outpts files and define axis' |
---|
347 | call cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, & |
---|
348 | ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml, & |
---|
349 | ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid, stlidar) |
---|
350 | !$OMP END MASTER |
---|
351 | !$OMP BARRIER |
---|
352 | debut_cosp=.false. |
---|
353 | endif ! debut_cosp |
---|
354 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
355 | ! Call simulator |
---|
356 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
357 | ! print *, 'Calling simulator...' |
---|
358 | !! AI |
---|
359 | ! call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,stradar,stlidar) |
---|
360 | !#ifdef RTTOV |
---|
361 | ! call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,modis,rttov,stradar,stlidar) |
---|
362 | !#else |
---|
363 | call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,modis,stradar,stlidar) |
---|
364 | !#endif |
---|
365 | !! |
---|
366 | |
---|
367 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
368 | |
---|
369 | !!!!!!!!!!!!!!!!!! Ecreture des sorties Cosp !!!!!!!!!!!!!!r!!!!!!:!!!!! |
---|
370 | |
---|
371 | ! print *, 'Calling write output' |
---|
372 | call cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_val, & |
---|
373 | cfg, gbx, vgrid, sglidar, sgradar, stlidar, stradar, & |
---|
374 | isccp, misr, modis) |
---|
375 | |
---|
376 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
377 | ! Deallocate memory in derived types |
---|
378 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
379 | ! print *, 'Deallocating memory...' |
---|
380 | call free_cosp_gridbox(gbx) |
---|
381 | call free_cosp_subgrid(sgx) |
---|
382 | call free_cosp_sgradar(sgradar) |
---|
383 | call free_cosp_radarstats(stradar) |
---|
384 | call free_cosp_sglidar(sglidar) |
---|
385 | call free_cosp_lidarstats(stlidar) |
---|
386 | call free_cosp_isccp(isccp) |
---|
387 | call free_cosp_misr(misr) |
---|
388 | !! AI |
---|
389 | call free_cosp_modis(modis) |
---|
390 | ! call free_cosp_rttov(rttov) |
---|
391 | !! |
---|
392 | call free_cosp_vgrid(vgrid) |
---|
393 | |
---|
394 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
395 | ! Time in s. Only for testing purposes |
---|
396 | ! call system_clock(t1,count_rate,count_max) |
---|
397 | ! print *,(t1-t0)*1.0/count_rate |
---|
398 | |
---|
399 | CONTAINS |
---|
400 | |
---|
401 | SUBROUTINE read_cosp_input |
---|
402 | |
---|
403 | IF (is_master) THEN |
---|
404 | OPEN(10,file=cosp_input_nl,status='old') |
---|
405 | READ(10,nml=cosp_input) |
---|
406 | CLOSE(10) |
---|
407 | ENDIF |
---|
408 | CALL bcast(overlap) |
---|
409 | CALL bcast(isccp_topheight) |
---|
410 | CALL bcast(isccp_topheight_direction) |
---|
411 | CALL bcast(npoints_it) |
---|
412 | CALL bcast(ncolumns) |
---|
413 | CALL bcast(use_vgrid) |
---|
414 | CALL bcast(nlr) |
---|
415 | CALL bcast(csat_vgrid) |
---|
416 | CALL bcast(radar_freq) |
---|
417 | CALL bcast(surface_radar) |
---|
418 | CALL bcast(use_mie_tables) |
---|
419 | CALL bcast(use_gas_abs) |
---|
420 | CALL bcast(do_ray) |
---|
421 | CALL bcast(melt_lay) |
---|
422 | CALL bcast(k2) |
---|
423 | CALL bcast(Nprmts_max_hydro) |
---|
424 | CALL bcast(Naero) |
---|
425 | CALL bcast(Nprmts_max_aero) |
---|
426 | CALL bcast(lidar_ice_type) |
---|
427 | CALL bcast(use_precipitation_fluxes) |
---|
428 | CALL bcast(use_reff) |
---|
429 | CALL bcast(platform) |
---|
430 | CALL bcast(satellite) |
---|
431 | CALL bcast(Instrument) |
---|
432 | CALL bcast(Nchannels) |
---|
433 | CALL bcast(Channels) |
---|
434 | CALL bcast(Surfem) |
---|
435 | CALL bcast(ZenAng) |
---|
436 | CALL bcast(co2) |
---|
437 | CALL bcast(ch4) |
---|
438 | CALL bcast(n2o) |
---|
439 | CALL bcast(co) |
---|
440 | !$OMP BARRIER |
---|
441 | END SUBROUTINE read_cosp_input |
---|
442 | |
---|
443 | SUBROUTINE read_xiosfieldactive(cfg) |
---|
444 | |
---|
445 | USE MOD_COSP_TYPES |
---|
446 | #ifdef CPP_XIOS |
---|
447 | USE xios, ONLY: xios_field_is_active |
---|
448 | #endif |
---|
449 | type(cosp_config),intent(out) :: cfg |
---|
450 | |
---|
451 | ! VEREFIER LES CHAMPS DEMANDES DANS .XML |
---|
452 | ! 2. Si champs active dans .xml alors mettre la cles de sortie en true |
---|
453 | IF (xios_field_is_active("cllcalipso")) cfg%Lcllcalipso=.TRUE. |
---|
454 | IF (xios_field_is_active("clmcalipso")) cfg%Lclmcalipso=.TRUE. |
---|
455 | IF (xios_field_is_active("clhcalipso")) cfg%Lclhcalipso=.TRUE. |
---|
456 | IF (xios_field_is_active("cltcalipso")) cfg%Lcltcalipso=.TRUE. |
---|
457 | ! IF (xios_field_is_active("pcllcalipso")) cfg%Lcllcalipso=.TRUE. |
---|
458 | ! IF (xios_field_is_active("pclmcalipso")) cfg%Lclmcalipso=.TRUE. |
---|
459 | ! IF (xios_field_is_active("pclhcalipso")) cfg%Lclhcalipso=.TRUE. |
---|
460 | ! IF (xios_field_is_active("pcltcalipso")) cfg%Lcltcalipso=.TRUE. |
---|
461 | IF (xios_field_is_active("cllcalipsoice")) cfg%Lcllcalipsoice=.TRUE. |
---|
462 | IF (xios_field_is_active("clmcalipsoice")) cfg%Lclmcalipsoice=.TRUE. |
---|
463 | IF (xios_field_is_active("clhcalipsoice")) cfg%Lclhcalipsoice=.TRUE. |
---|
464 | IF (xios_field_is_active("cltcalipsoice")) cfg%Lcltcalipsoice=.TRUE. |
---|
465 | IF (xios_field_is_active("cllcalipsoliq")) cfg%Lcllcalipsoliq=.TRUE. |
---|
466 | IF (xios_field_is_active("clmcalipsoliq")) cfg%Lclmcalipsoliq=.TRUE. |
---|
467 | IF (xios_field_is_active("clhcalipsoliq")) cfg%Lclhcalipsoliq=.TRUE. |
---|
468 | IF (xios_field_is_active("cltcalipsoliq")) cfg%Lcltcalipsoliq=.TRUE. |
---|
469 | IF (xios_field_is_active("cllcalipsoun")) cfg%Lcllcalipsoun=.TRUE. |
---|
470 | IF (xios_field_is_active("clmcalipsoun")) cfg%Lclmcalipsoun=.TRUE. |
---|
471 | IF (xios_field_is_active("clhcalipsoun")) cfg%Lclhcalipsoun=.TRUE. |
---|
472 | IF (xios_field_is_active("cltcalipsoun")) cfg%Lcltcalipsoun=.TRUE. |
---|
473 | IF (xios_field_is_active("clcalipso")) cfg%Lclcalipso=.TRUE. |
---|
474 | ! IF (xios_field_is_active("pclcalipso")) cfg%Lclcalipso=.TRUE. |
---|
475 | IF (xios_field_is_active("clcalipsoice")) cfg%Lclcalipsoice=.TRUE. |
---|
476 | IF (xios_field_is_active("clcalipsoliq")) cfg%Lclcalipsoliq=.TRUE. |
---|
477 | IF (xios_field_is_active("clcalipsoun")) cfg%Lclcalipsoun=.TRUE. |
---|
478 | IF (xios_field_is_active("clcalipsotmp")) cfg%Lclcalipsotmp=.TRUE. |
---|
479 | IF (xios_field_is_active("clcalipsotmpice")) cfg%Lclcalipsotmpice=.TRUE. |
---|
480 | IF (xios_field_is_active("clcalipsotmpliq")) cfg%Lclcalipsotmpliq=.TRUE. |
---|
481 | IF (xios_field_is_active("clcalipsotmpun")) cfg%Lclcalipsotmpun=.TRUE. |
---|
482 | IF (xios_field_is_active("parasol_refl")) cfg%LparasolRefl=.TRUE. |
---|
483 | IF (xios_field_is_active("parasol_crefl")) cfg%LparasolRefl=.TRUE. |
---|
484 | IF (xios_field_is_active("Ncrefl")) cfg%LparasolRefl=.TRUE. |
---|
485 | IF (xios_field_is_active("cfad_lidarsr532")) cfg%LcfadLidarsr532=.TRUE. |
---|
486 | IF (xios_field_is_active("atb532")) cfg%Latb532=.TRUE. |
---|
487 | IF (xios_field_is_active("beta_mol532")) cfg%LlidarBetaMol532=.TRUE. |
---|
488 | IF (xios_field_is_active("clopaquecalipso")) cfg%Lclopaquecalipso=.TRUE. |
---|
489 | IF (xios_field_is_active("clthincalipso")) cfg%Lclthincalipso=.TRUE. |
---|
490 | IF (xios_field_is_active("clzopaquecalipso")) cfg%Lclzopaquecalipso=.TRUE. |
---|
491 | IF (xios_field_is_active("clcalipsoopaque")) cfg%Lclcalipsoopaque=.TRUE. |
---|
492 | IF (xios_field_is_active("clcalipsothin")) cfg%Lclcalipsothin=.TRUE. |
---|
493 | IF (xios_field_is_active("clcalipsozopaque")) cfg%Lclcalipsozopaque=.TRUE. |
---|
494 | IF (xios_field_is_active("clcalipsoopacity")) cfg%Lclcalipsoopacity=.TRUE. |
---|
495 | IF (xios_field_is_active("proftemp")) cfg%Lproftemp=.TRUE. |
---|
496 | IF (xios_field_is_active("profSR")) cfg%LprofSR=.TRUE. |
---|
497 | |
---|
498 | IF (xios_field_is_active("cfadDbze94")) cfg%LcfadDbze94=.TRUE. |
---|
499 | IF (xios_field_is_active("dbze94")) cfg%Ldbze94=.TRUE. |
---|
500 | IF (xios_field_is_active("cltlidarradar")) cfg%Lcltlidarradar=.TRUE. |
---|
501 | IF (xios_field_is_active("clcalipso2")) cfg%Lclcalipso2=.TRUE. |
---|
502 | |
---|
503 | IF (xios_field_is_active("clisccp2")) cfg%Lclisccp=.TRUE. |
---|
504 | IF (xios_field_is_active("boxtauisccp")) cfg%Lboxtauisccp=.TRUE. |
---|
505 | IF (xios_field_is_active("boxptopisccp")) cfg%Lboxptopisccp=.TRUE. |
---|
506 | IF (xios_field_is_active("tclisccp")) cfg%Lcltisccp=.TRUE. |
---|
507 | IF (xios_field_is_active("ctpisccp")) cfg%Lpctisccp=.TRUE. |
---|
508 | IF (xios_field_is_active("tauisccp")) cfg%Ltauisccp=.TRUE. |
---|
509 | IF (xios_field_is_active("albisccp")) cfg%Lalbisccp=.TRUE. |
---|
510 | IF (xios_field_is_active("meantbisccp")) cfg%Lmeantbisccp=.TRUE. |
---|
511 | IF (xios_field_is_active("meantbclrisccp")) cfg%Lmeantbclrisccp=.TRUE. |
---|
512 | |
---|
513 | IF (xios_field_is_active("clMISR")) cfg%LclMISR=.TRUE. |
---|
514 | |
---|
515 | IF (xios_field_is_active("cllmodis")) cfg%Lcllmodis=.TRUE. |
---|
516 | IF (xios_field_is_active("clmmodis")) cfg%Lclmmodis=.TRUE. |
---|
517 | IF (xios_field_is_active("clhmodis")) cfg%Lclhmodis=.TRUE. |
---|
518 | IF (xios_field_is_active("cltmodis")) cfg%Lcltmodis=.TRUE. |
---|
519 | IF (xios_field_is_active("clwmodis")) cfg%Lclwmodis=.TRUE. |
---|
520 | IF (xios_field_is_active("climodis")) cfg%Lclimodis=.TRUE. |
---|
521 | IF (xios_field_is_active("tautmodis")) cfg%Ltautmodis=.TRUE. |
---|
522 | IF (xios_field_is_active("tauwmodis")) cfg%Ltauwmodis=.TRUE. |
---|
523 | IF (xios_field_is_active("tauimodis")) cfg%Ltauimodis=.TRUE. |
---|
524 | IF (xios_field_is_active("tautlogmodis")) cfg%Ltautlogmodis=.TRUE. |
---|
525 | IF (xios_field_is_active("tauilogmodis")) cfg%Ltauilogmodis=.TRUE. |
---|
526 | IF (xios_field_is_active("tauwlogmodis")) cfg%Ltauwlogmodis=.TRUE. |
---|
527 | IF (xios_field_is_active("reffclwmodis")) cfg%Lreffclwmodis=.TRUE. |
---|
528 | IF (xios_field_is_active("reffclimodis")) cfg%Lreffclimodis=.TRUE. |
---|
529 | IF (xios_field_is_active("pctmodis")) cfg%Lpctmodis=.TRUE. |
---|
530 | IF (xios_field_is_active("lwpmodis")) cfg%Llwpmodis=.TRUE. |
---|
531 | IF (xios_field_is_active("iwpmodis")) cfg%Liwpmodis=.TRUE. |
---|
532 | IF (xios_field_is_active("clmodis")) cfg%Lclmodis=.TRUE. |
---|
533 | IF (xios_field_is_active("crimodis")) cfg%Lcrimodis=.TRUE. |
---|
534 | IF (xios_field_is_active("crlmodis")) cfg%Lcrlmodis=.TRUE. |
---|
535 | |
---|
536 | ! 2. si champs demande alors activer le simulateur correspondant |
---|
537 | IF (xios_field_is_active("cllcalipso").OR. & |
---|
538 | xios_field_is_active("clmcalipso").OR. & |
---|
539 | xios_field_is_active("clhcalipso").OR. & |
---|
540 | xios_field_is_active("cltcalipso").OR. & |
---|
541 | ! xios_field_is_active("pcllcalipso").OR. & |
---|
542 | ! xios_field_is_active("pclmcalipso").OR. & |
---|
543 | ! xios_field_is_active("pclhcalipso").OR. & |
---|
544 | ! xios_field_is_active("pcltcalipso").OR. & |
---|
545 | xios_field_is_active("cllcalipsoice").OR. & |
---|
546 | xios_field_is_active("clmcalipsoice").OR. & |
---|
547 | xios_field_is_active("clhcalipsoice").OR. & |
---|
548 | xios_field_is_active("cltcalipsoice").OR. & |
---|
549 | xios_field_is_active("cllcalipsoliq").OR. & |
---|
550 | xios_field_is_active("clmcalipsoliq").OR. & |
---|
551 | xios_field_is_active("clhcalipsoliq").OR. & |
---|
552 | xios_field_is_active("cltcalipsoliq").OR. & |
---|
553 | xios_field_is_active("cllcalipsoun").OR. & |
---|
554 | xios_field_is_active("clmcalipsoun").OR. & |
---|
555 | xios_field_is_active("clhcalipsoun").OR. & |
---|
556 | xios_field_is_active("cltcalipsoun").OR. & |
---|
557 | xios_field_is_active("clcalipso").OR. & |
---|
558 | ! xios_field_is_active("pclcalipso").OR. & |
---|
559 | xios_field_is_active("clcalipsoice").OR. & |
---|
560 | xios_field_is_active("clcalipsoliq").OR. & |
---|
561 | xios_field_is_active("clcalipsoun").OR. & |
---|
562 | xios_field_is_active("clcalipsotmp").OR. & |
---|
563 | xios_field_is_active("clcalipsotmpice").OR. & |
---|
564 | xios_field_is_active("clcalipsotmpliq").OR. & |
---|
565 | xios_field_is_active("clcalipsotmpun").OR. & |
---|
566 | xios_field_is_active("parasol_refl").OR. & |
---|
567 | xios_field_is_active("parasol_crefl").OR. & |
---|
568 | xios_field_is_active("Ncrefl").OR. & |
---|
569 | xios_field_is_active("cfad_lidarsr532").OR. & |
---|
570 | xios_field_is_active("atb532").OR. & |
---|
571 | xios_field_is_active("beta_mol532").OR. & |
---|
572 | xios_field_is_active("clopaquecalipso").OR. & |
---|
573 | xios_field_is_active("clthincalipso").OR. & |
---|
574 | xios_field_is_active("clzopaquecalipso").OR. & |
---|
575 | xios_field_is_active("clcalipsoopaque").OR. & |
---|
576 | xios_field_is_active("clcalipsothin").OR. & |
---|
577 | xios_field_is_active("clcalipsozopaque").OR. & |
---|
578 | xios_field_is_active("clcalipsoopacity").OR. & |
---|
579 | xios_field_is_active("proftemp").OR. & |
---|
580 | xios_field_is_active("profSR")) cfg%Llidar_sim=.TRUE. |
---|
581 | |
---|
582 | IF (xios_field_is_active("cfadDbze94").OR. & |
---|
583 | xios_field_is_active("dbze94")) & |
---|
584 | cfg%Lradar_sim=.TRUE. |
---|
585 | |
---|
586 | IF (xios_field_is_active("cltlidarradar").OR. & |
---|
587 | xios_field_is_active("clcalipso2")) THEN |
---|
588 | cfg%Lradar_sim=.TRUE. |
---|
589 | cfg%Llidar_sim=.TRUE. |
---|
590 | ENDIF |
---|
591 | |
---|
592 | IF (xios_field_is_active("clisccp2").OR. & |
---|
593 | xios_field_is_active("boxtauisccp").OR. & |
---|
594 | xios_field_is_active("boxptopisccp").OR. & |
---|
595 | xios_field_is_active("tclisccp").OR. & |
---|
596 | xios_field_is_active("ctpisccp").OR. & |
---|
597 | xios_field_is_active("tauisccp").OR. & |
---|
598 | xios_field_is_active("albisccp").OR. & |
---|
599 | xios_field_is_active("meantbisccp").OR. & |
---|
600 | xios_field_is_active("meantbclrisccp")) cfg%Lisccp_sim=.TRUE. |
---|
601 | |
---|
602 | IF (xios_field_is_active("clMISR")) cfg%Lmisr_sim=.TRUE. |
---|
603 | |
---|
604 | IF (xios_field_is_active("cllmodis").OR. & |
---|
605 | xios_field_is_active("clmmodis").OR. & |
---|
606 | xios_field_is_active("clhmodis").OR. & |
---|
607 | xios_field_is_active("cltmodis").OR. & |
---|
608 | xios_field_is_active("clwmodis").OR. & |
---|
609 | xios_field_is_active("climodis").OR. & |
---|
610 | xios_field_is_active("tautmodis").OR. & |
---|
611 | xios_field_is_active("tauwmodis").OR. & |
---|
612 | xios_field_is_active("tauimodis").OR. & |
---|
613 | xios_field_is_active("tautlogmodis").OR. & |
---|
614 | xios_field_is_active("tauilogmodis").OR. & |
---|
615 | xios_field_is_active("tauwlogmodis").OR. & |
---|
616 | xios_field_is_active("reffclwmodis").OR. & |
---|
617 | xios_field_is_active("reffclimodis").OR. & |
---|
618 | xios_field_is_active("pctmodis").OR. & |
---|
619 | xios_field_is_active("lwpmodis").OR. & |
---|
620 | xios_field_is_active("iwpmodis").OR. & |
---|
621 | xios_field_is_active("clmodis").OR. & |
---|
622 | xios_field_is_active("crimodis").OR. & |
---|
623 | xios_field_is_active("crlmodis")) cfg%Lmodis_sim=.TRUE. |
---|
624 | END SUBROUTINE read_xiosfieldactive |
---|
625 | |
---|
626 | |
---|
627 | end subroutine phys_cosp |
---|