source: LMDZ5/trunk/libf/dynphy_lonlat/phylmd/etat0phys_netcdf.F90 @ 2601

Last change on this file since 2601 was 2601, checked in by Ehouarn Millour, 8 years ago

Cleanup in the dynamics: turn temps.h into module temps_mod.F90
EM

File size: 20.5 KB
Line 
1MODULE etat0phys
2!
3!*******************************************************************************
4! Purpose: Create physical initial state using atmospheric fields from a
5!          database of atmospheric to initialize the model.
6!-------------------------------------------------------------------------------
7! Comments:
8!
9!    *  This module is designed to work for Earth (and with ioipsl)
10!
11!    *  etat0phys_netcdf routine can access to NetCDF data through subroutines:
12!         "start_init_phys" for variables contained in file "ECPHY.nc":
13!            'ST'     : Surface temperature
14!            'CDSW'   : Soil moisture
15!         "start_init_orog" for variables contained in file "Relief.nc":
16!            'RELIEF' : High resolution orography
17!
18!    * The land mask and corresponding weights can be:
19!      1) computed using the ocean mask from the ocean model (to ensure ocean
20!         fractions are the same for atmosphere and ocean) for coupled runs.
21!         File name: "o2a.nc"  ;  variable name: "OceMask"
22!      2) computed from topography file "Relief.nc" for forced runs.
23!
24!    * Allowed values for read_climoz flag are 0, 1 and 2:
25!      0: do not read an ozone climatology
26!      1: read a single ozone climatology that will be used day and night
27!      2: read two ozone climatologies, the average day and night climatology
28!         and the daylight climatology
29!-------------------------------------------------------------------------------
30!    * There is a big mess with the longitude size. Should it be iml or iml+1 ?
31!  I have chosen to use the iml+1 as an argument to this routine and we declare
32!  internaly smaller fields when needed. This needs to be cleared once and for
33!  all in LMDZ. A convention is required.
34!-------------------------------------------------------------------------------
35
36  USE ioipsl,             ONLY: flininfo, flinopen, flinget, flinclo
37  USE assert_eq_m,        ONLY: assert_eq
38  USE dimphy,             ONLY: klon
39  USE conf_dat_m,         ONLY: conf_dat2d
40  USE phys_state_var_mod, ONLY: zmea, zstd, zsig, zgam, zthe, zpic, zval, z0m, &
41          solsw, radsol, t_ancien, wake_deltat, wake_s,  rain_fall, qsol, z0h, &
42          sollw, rugoro, q_ancien, wake_deltaq, wake_pe, snow_fall, ratqs,w01, &
43    sig1, ftsol, clwcon, fm_therm, wake_Cstar,  pctsrf,  entr_therm,radpas, f0,&
44    zmax0,fevap, rnebcon,falb_dir, wake_fip,    agesno,  detr_therm, pbl_tke,  &
45    phys_state_var_init
46  USE comconst_mod, ONLY: pi, dtvr
47
48  PRIVATE
49  PUBLIC :: etat0phys_netcdf
50
51  include "iniprint.h"
52  include "dimensions.h"
53  include "paramet.h"
54  include "comgeom2.h"
55  include "dimsoil.h"
56  include "clesphys.h"
57  REAL, SAVE :: deg2rad
58  REAL, SAVE, ALLOCATABLE :: tsol(:)
59  INTEGER,            SAVE      :: iml_phys, jml_phys, llm_phys, ttm_phys, fid_phys
60  REAL, ALLOCATABLE,  SAVE      :: lon_phys(:,:), lat_phys(:,:), levphys_ini(:)
61  CHARACTER(LEN=256), PARAMETER :: orofname="Relief.nc", orogvar="RELIEF"
62  CHARACTER(LEN=256), PARAMETER :: phyfname="ECPHY.nc",  psrfvar="SP"
63  CHARACTER(LEN=256), PARAMETER :: qsolvar="CDSW",       tsrfvar="ST"
64
65
66CONTAINS
67
68
69!-------------------------------------------------------------------------------
70!
71SUBROUTINE etat0phys_netcdf(masque, phis)
72!
73!-------------------------------------------------------------------------------
74! Purpose: Creates initial states
75!-------------------------------------------------------------------------------
76! Notes:  1) This routine is designed to work for Earth
77!         2) If masque(:,:)/=-99999., masque and phis are already known.
78!         Otherwise: compute it.
79!-------------------------------------------------------------------------------
80  USE control_mod
81  USE fonte_neige_mod
82  USE pbl_surface_mod
83  USE regr_lat_time_climoz_m, ONLY: regr_lat_time_climoz
84  USE indice_sol_mod
85  USE conf_phys_m, ONLY: conf_phys
86  USE init_ssrf_m, ONLY: start_init_subsurf
87  !use ioipsl_getincom
88  IMPLICIT NONE
89!-------------------------------------------------------------------------------
90! Arguments:
91  REAL,    INTENT(INOUT) :: masque(:,:) !--- Land mask           dim(iip1,jjp1)
92  REAL,    INTENT(INOUT) :: phis  (:,:) !--- Ground geopotential dim(iip1,jjp1)
93!-------------------------------------------------------------------------------
94! Local variables:
95  CHARACTER(LEN=256) :: modname="etat0phys_netcdf", fmt
96  INTEGER            :: i, j, l, ji, iml, jml
97  LOGICAL            :: read_mask
98  REAL               :: phystep, dummy
99  REAL, DIMENSION(SIZE(masque,1),SIZE(masque,2)) :: masque_tmp,phiso
100  REAL, DIMENSION(klon)               :: sn, rugmer, run_off_lic_0, fder
101  REAL, DIMENSION(klon,nbsrf)         :: qsolsrf, snsrf
102  REAL, DIMENSION(klon,nsoilmx,nbsrf) :: tsoil
103
104!--- Arguments for conf_phys
105  LOGICAL :: ok_journe, ok_mensuel, ok_instan, ok_hf, ok_LES, callstats
106  REAL    :: solarlong0, seuil_inversion, fact_cldcon, facttemps
107  LOGICAL :: ok_newmicro
108  INTEGER :: iflag_radia, iflag_cldcon, iflag_ratqs
109  REAL    :: ratqsbas, ratqshaut, tau_ratqs
110  LOGICAL :: ok_ade, ok_aie, ok_cdnc, aerosol_couple
111  INTEGER :: flag_aerosol
112  INTEGER :: flag_aerosol_strat
113  LOGICAL :: new_aod
114  REAL    :: bl95_b0, bl95_b1
115  INTEGER :: read_climoz                        !--- Read ozone climatology
116  REAL    :: alp_offset
117  LOGICAL :: filtre_oro=.false.
118
119  deg2rad= pi/180.0
120  iml=assert_eq(SIZE(masque,1),SIZE(phis,1),TRIM(modname)//" iml")
121  jml=assert_eq(SIZE(masque,2),SIZE(phis,2),TRIM(modname)//" jml")
122
123! Physics configuration
124!*******************************************************************************
125  CALL conf_phys(  ok_journe, ok_mensuel, ok_instan, ok_hf, ok_LES,     &
126                   callstats,                                           &
127                   solarlong0,seuil_inversion,                          &
128                   fact_cldcon, facttemps,ok_newmicro,iflag_radia,      &
129                   iflag_cldcon,                                        &
130                   iflag_ratqs,ratqsbas,ratqshaut,tau_ratqs,            &
131                   ok_ade, ok_aie, ok_cdnc, aerosol_couple,             &
132                   flag_aerosol, flag_aerosol_strat, new_aod,           &
133                   bl95_b0, bl95_b1,                                    &
134                   read_climoz,                                         &
135                   alp_offset)
136  CALL phys_state_var_init(read_climoz)
137
138!--- Initial atmospheric CO2 conc. from .def file
139  co2_ppm0 = co2_ppm
140
141! Compute ground geopotential, sub-cells quantities and possibly the mask.
142!*******************************************************************************
143  read_mask=ANY(masque/=-99999.); masque_tmp=masque
144  CALL start_init_orog(rlonv, rlatu, phis, masque_tmp)
145
146  CALL getin('filtre_oro',filtre_oro)
147  IF (filtre_oro) CALL filtreoro(size(phis,1),size(phis,2),phis,masque_tmp,rlatu)
148
149  WRITE(fmt,"(i4,'i1)')")iml ; fmt='('//ADJUSTL(fmt)
150  IF(.NOT.read_mask) THEN                       !--- Keep mask form orography
151    masque=masque_tmp
152    IF(prt_level>=1) THEN
153      WRITE(lunout,*)'BUILT MASK :'
154      WRITE(lunout,fmt) NINT(masque)
155    END IF
156    WHERE(   masque(:,:)<EPSFRA) masque(:,:)=0.
157    WHERE(1.-masque(:,:)<EPSFRA) masque(:,:)=1.
158  END IF
159  CALL gr_dyn_fi(1,iml,jml,klon,masque,zmasq) !--- Land mask to physical grid
160
161! Compute tsol and qsol on physical grid, knowing phis on 2D grid.
162!*******************************************************************************
163  CALL start_init_phys(rlonu, rlatv, phis)
164
165! Some initializations.
166!*******************************************************************************
167  sn    (:) = 0.0                               !--- Snow
168  radsol(:) = 0.0                               !--- Net radiation at ground
169  rugmer(:) = 0.001                             !--- Ocean rugosity
170  IF(read_climoz>=1) &                          !--- Ozone climatology
171    CALL regr_lat_time_climoz(read_climoz)
172
173! Sub-surfaces initialization.
174!*******************************************************************************
175  CALL start_init_subsurf(read_mask)
176
177! Write physical initial state
178!*******************************************************************************
179  WRITE(lunout,*)'phystep ',dtvr,iphysiq,nbapp_rad
180  phystep = dtvr * FLOAT(iphysiq)
181  radpas  = NINT (86400./phystep/ FLOAT(nbapp_rad) )
182  WRITE(lunout,*)'phystep =', phystep, radpas
183
184! Init: ftsol, snsrf, qsolsrf, tsoil, rain_fall, snow_fall, solsw, sollw, z0
185!*******************************************************************************
186  DO i=1,nbsrf; ftsol(:,i) = tsol; END DO
187  DO i=1,nbsrf; snsrf(:,i) = sn;   END DO
188  falb_dir(:, :, is_ter) = 0.08
189  falb_dir(:, :, is_lic) = 0.6
190  falb_dir(:, :, is_oce) = 0.5
191  falb_dir(:, :, is_sic) = 0.6
192  fevap(:,:) = 0.
193  DO i=1,nbsrf; qsolsrf(:,i)=150.; END DO
194  DO i=1,nbsrf; DO j=1,nsoilmx; tsoil(:,j,i) = tsol; END DO; END DO
195  rain_fall  = 0.
196  snow_fall  = 0.
197  solsw      = 165.
198  sollw      = -53.
199  t_ancien   = 273.15
200  q_ancien   = 0.
201  agesno     = 0.
202
203  z0m(:,is_oce) = rugmer(:)
204  z0m(:,is_ter) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
205  z0m(:,is_lic) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
206  z0m(:,is_sic) = 0.001
207  z0h(:,:)=z0m(:,:)
208
209  fder    = 0.0
210  clwcon  = 0.0
211  rnebcon = 0.0
212  ratqs   = 0.0
213  run_off_lic_0 = 0.0
214  rugoro  = 0.0
215
216! Before phyredem calling, surface modules and values to be saved in startphy.nc
217! are initialized
218!*******************************************************************************
219  dummy            = 1.0
220  pbl_tke(:,:,:)   = 1.e-8
221  zmax0(:)         = 40.
222  f0(:)            = 1.e-5
223  sig1(:,:)        = 0.
224  w01(:,:)         = 0.
225  wake_deltat(:,:) = 0.
226  wake_deltaq(:,:) = 0.
227  wake_s(:)        = 0.
228  wake_cstar(:)    = 0.
229  wake_fip(:)      = 0.
230  wake_pe          = 0.
231  fm_therm         = 0.
232  entr_therm       = 0.
233  detr_therm       = 0.
234
235  CALL fonte_neige_init(run_off_lic_0)
236  CALL pbl_surface_init( fder, snsrf, qsolsrf, tsoil )
237  CALL phyredem( "startphy.nc" )
238
239!  WRITE(lunout,*)'CCCCCCCCCCCCCCCCCC REACTIVER SORTIE VISU DANS ETAT0'
240!  WRITE(lunout,*)'entree histclo'
241  CALL histclo()
242
243END SUBROUTINE etat0phys_netcdf
244!
245!-------------------------------------------------------------------------------
246
247
248!-------------------------------------------------------------------------------
249!
250SUBROUTINE start_init_orog(lon_in,lat_in,phis,masque)
251!
252!===============================================================================
253! Comment:
254!   This routine launch grid_noro, which computes parameters for SSO scheme as
255!   described in LOTT & MILLER (1997) and LOTT(1999).
256!===============================================================================
257  USE grid_noro_m, ONLY: grid_noro
258  IMPLICIT NONE
259!-------------------------------------------------------------------------------
260! Arguments:
261  REAL,    INTENT(IN)    :: lon_in(:), lat_in(:)   ! dim (iml) (jml)
262  REAL,    INTENT(INOUT) :: phis(:,:), masque(:,:) ! dim (iml,jml)
263!-------------------------------------------------------------------------------
264! Local variables:
265  CHARACTER(LEN=256) :: modname
266  INTEGER            :: fid, llm_tmp,ttm_tmp, iml,jml, iml_rel,jml_rel, itau(1)
267  REAL               :: lev(1), date, dt
268  REAL, ALLOCATABLE  :: lon_rad(:), lon_ini(:), lon_rel(:,:), relief_hi(:,:)
269  REAL, ALLOCATABLE  :: lat_rad(:), lat_ini(:), lat_rel(:,:), tmp_var  (:,:)
270  REAL, ALLOCATABLE  :: zmea0(:,:), zstd0(:,:), zsig0(:,:)
271  REAL, ALLOCATABLE  :: zgam0(:,:), zthe0(:,:), zpic0(:,:), zval0(:,:)
272!-------------------------------------------------------------------------------
273  modname="start_init_orog"
274  iml=assert_eq(SIZE(lon_in),SIZE(phis,1),SIZE(masque,1),TRIM(modname)//" iml")
275  jml=assert_eq(SIZE(lat_in),SIZE(phis,2),SIZE(masque,2),TRIM(modname)//" jml")
276
277!--- HIGH RESOLUTION OROGRAPHY
278  CALL flininfo(orofname, iml_rel, jml_rel, llm_tmp, ttm_tmp, fid)
279
280  ALLOCATE(lat_rel(iml_rel,jml_rel),lon_rel(iml_rel,jml_rel))
281  CALL flinopen(orofname, .FALSE., iml_rel, jml_rel, llm_tmp, lon_rel, lat_rel,&
282                lev, ttm_tmp, itau, date, dt, fid)
283  ALLOCATE(relief_hi(iml_rel,jml_rel))
284  CALL flinget(fid, orogvar, iml_rel, jml_rel, llm_tmp, ttm_tmp, 1,1, relief_hi)
285  CALL flinclo(fid)
286
287!--- IF ANGLES ARE IN DEGREES, THEY ARE CONVERTED INTO RADIANS
288  ALLOCATE(lon_ini(iml_rel),lat_ini(jml_rel))
289  lon_ini(:)=lon_rel(:,1); IF(MAXVAL(lon_rel)>pi) lon_ini=lon_ini*deg2rad
290  lat_ini(:)=lat_rel(1,:); IF(MAXVAL(lat_rel)>pi) lat_ini=lat_ini*deg2rad
291
292!--- FIELDS ARE PROCESSED TO BE ON STANDARD ANGULAR DOMAINS
293  ALLOCATE(lon_rad(iml_rel),lat_rad(jml_rel))
294  CALL conf_dat2d(orogvar, lon_ini, lat_ini, lon_rad, lat_rad, relief_hi,.FALSE.)
295  DEALLOCATE(lon_ini,lat_ini)
296
297!--- COMPUTING THE REQUIRED FIELDS USING ROUTINE grid_noro
298  WRITE(lunout,*)
299  WRITE(lunout,*)'*** Compute parameters needed for gravity wave drag code ***'
300
301!--- ALLOCATIONS OF SUB-CELL SCALES QUANTITIES
302  ALLOCATE(zmea0(iml,jml),zstd0(iml,jml)) !--- Mean orography and std deviation
303  ALLOCATE(zsig0(iml,jml),zgam0(iml,jml)) !--- Slope and nisotropy
304  ALLOCATE(zthe0(iml,jml))                !--- Highest slope orientation
305  ALLOCATE(zpic0(iml,jml),zval0(iml,jml)) !--- Peaks and valley heights
306
307!--- CALL OROGRAPHY MODULE TO COMPUTE FIELDS
308  CALL grid_noro(lon_rad,lat_rad,relief_hi,lon_in,lat_in,phis,zmea0,zstd0,     &
309                                      zsig0,zgam0,zthe0,zpic0,zval0,masque)
310  phis = phis * 9.81
311  phis(iml,:) = phis(1,:)
312  DEALLOCATE(relief_hi,lon_rad,lat_rad)
313
314!--- PUT QUANTITIES TO PHYSICAL GRID
315  CALL gr_dyn_fi(1,iml,jml,klon,zmea0,zmea); DEALLOCATE(zmea0)
316  CALL gr_dyn_fi(1,iml,jml,klon,zstd0,zstd); DEALLOCATE(zstd0)
317  CALL gr_dyn_fi(1,iml,jml,klon,zsig0,zsig); DEALLOCATE(zsig0)
318  CALL gr_dyn_fi(1,iml,jml,klon,zgam0,zgam); DEALLOCATE(zgam0)
319  CALL gr_dyn_fi(1,iml,jml,klon,zthe0,zthe); DEALLOCATE(zthe0)
320  CALL gr_dyn_fi(1,iml,jml,klon,zpic0,zpic); DEALLOCATE(zpic0)
321  CALL gr_dyn_fi(1,iml,jml,klon,zval0,zval); DEALLOCATE(zval0)
322
323
324END SUBROUTINE start_init_orog
325!
326!-------------------------------------------------------------------------------
327
328
329!-------------------------------------------------------------------------------
330!
331SUBROUTINE start_init_phys(lon_in,lat_in,phis)
332!
333!===============================================================================
334! Purpose:   Compute tsol and qsol, knowing phis.
335!===============================================================================
336  IMPLICIT NONE
337!-------------------------------------------------------------------------------
338! Arguments:
339  REAL,    INTENT(IN) :: lon_in(:),  lat_in(:)       ! dim (iml) (jml2)
340  REAL,    INTENT(IN) :: phis(:,:)                   ! dim (iml,jml)
341!-------------------------------------------------------------------------------
342! Local variables:
343  CHARACTER(LEN=256) :: modname
344  REAL               :: date, dt
345  INTEGER            :: iml, jml, jml2, itau(1)
346  REAL, ALLOCATABLE  :: lon_rad(:), lon_ini(:), var_ana(:,:)
347  REAL, ALLOCATABLE  :: lat_rad(:), lat_ini(:)
348  REAL, ALLOCATABLE  :: ts(:,:), qs(:,:)
349!-------------------------------------------------------------------------------
350  modname="start_init_phys"
351  iml=assert_eq(SIZE(lon_in),SIZE(phis,1),TRIM(modname)//" iml")
352  jml=SIZE(phis,2); jml2=SIZE(lat_in)
353
354  WRITE(lunout,*)'Opening the surface analysis'
355  CALL flininfo(phyfname, iml_phys, jml_phys, llm_phys, ttm_phys, fid_phys)
356  WRITE(lunout,*) 'Values read: ',  iml_phys, jml_phys, llm_phys, ttm_phys
357
358  ALLOCATE(lat_phys(iml_phys,jml_phys),lon_phys(iml_phys,jml_phys))
359  ALLOCATE(levphys_ini(llm_phys))
360  CALL flinopen(phyfname, .FALSE., iml_phys, jml_phys, llm_phys,              &
361                lon_phys,lat_phys,levphys_ini,ttm_phys,itau,date,dt,fid_phys)
362
363!--- IF ANGLES ARE IN DEGREES, THEY ARE CONVERTED INTO RADIANS
364  ALLOCATE(lon_ini(iml_phys),lat_ini(jml_phys))
365  lon_ini(:)=lon_phys(:,1); IF(MAXVAL(lon_phys)>pi) lon_ini=lon_ini*deg2rad
366  lat_ini(:)=lat_phys(1,:); IF(MAXVAL(lat_phys)>pi) lat_ini=lat_ini*deg2rad
367
368  ALLOCATE(var_ana(iml_phys,jml_phys),lon_rad(iml_phys),lat_rad(jml_phys))
369  CALL get_var_phys(tsrfvar,ts)                   !--- SURFACE TEMPERATURE
370  CALL get_var_phys(qsolvar,qs)                   !--- SOIL MOISTURE
371  CALL flinclo(fid_phys)
372  DEALLOCATE(var_ana,lon_rad,lat_rad,lon_ini,lat_ini)
373
374!--- TSOL AND QSOL ON PHYSICAL GRID
375  ALLOCATE(tsol(klon))
376  CALL gr_dyn_fi(1,iml,jml,klon,ts,tsol)
377  CALL gr_dyn_fi(1,iml,jml,klon,qs,qsol)
378  DEALLOCATE(ts,qs)
379
380CONTAINS
381
382!-------------------------------------------------------------------------------
383!
384SUBROUTINE get_var_phys(title,field)
385!
386!-------------------------------------------------------------------------------
387  IMPLICIT NONE
388!-------------------------------------------------------------------------------
389! Arguments:
390  CHARACTER(LEN=*),  INTENT(IN)    :: title
391  REAL, ALLOCATABLE, INTENT(INOUT) :: field(:,:)
392!-------------------------------------------------------------------------------
393! Local variables:
394  INTEGER :: tllm
395!-------------------------------------------------------------------------------
396  SELECT CASE(title)
397    CASE(psrfvar);         tllm=0
398    CASE(tsrfvar,qsolvar); tllm=llm_phys
399  END SELECT
400  IF(ALLOCATED(field)) RETURN
401  ALLOCATE(field(iml,jml)); field(:,:)=0.
402  CALL flinget(fid_phys,title,iml_phys,jml_phys,tllm,ttm_phys,1,1,var_ana)
403  CALL conf_dat2d(title, lon_ini, lat_ini, lon_rad, lat_rad, var_ana, .TRUE.)
404  CALL interp_startvar(title, .TRUE., lon_rad, lat_rad, var_ana,               &
405                                      lon_in,  lat_in,  field)
406
407END SUBROUTINE get_var_phys
408!
409!-------------------------------------------------------------------------------
410!
411END SUBROUTINE start_init_phys
412!
413!-------------------------------------------------------------------------------
414
415
416!-------------------------------------------------------------------------------
417!
418SUBROUTINE interp_startvar(nam,ibeg,lon,lat,vari,lon2,lat2,varo)
419!
420!-------------------------------------------------------------------------------
421  USE inter_barxy_m, ONLY: inter_barxy
422  IMPLICIT NONE
423!-------------------------------------------------------------------------------
424! Arguments:
425  CHARACTER(LEN=*), INTENT(IN)  :: nam
426  LOGICAL,          INTENT(IN)  :: ibeg
427  REAL,             INTENT(IN)  :: lon(:), lat(:)   ! dim (ii) (jj)
428  REAL,             INTENT(IN)  :: vari(:,:)        ! dim (ii,jj)
429  REAL,             INTENT(IN)  :: lon2(:), lat2(:) ! dim (i1) (j2)
430  REAL,             INTENT(OUT) :: varo(:,:)        ! dim (i1) (j1)
431!-------------------------------------------------------------------------------
432! Local variables:
433  CHARACTER(LEN=256) :: modname
434  INTEGER            :: ii, jj, i1, j1, j2
435  REAL, ALLOCATABLE  :: vtmp(:,:)
436!-------------------------------------------------------------------------------
437  modname="interp_startvar"
438  ii=assert_eq(SIZE(lon), SIZE(vari,1),TRIM(modname)//" ii")
439  jj=assert_eq(SIZE(lat), SIZE(vari,2),TRIM(modname)//" jj")
440  i1=assert_eq(SIZE(lon2),SIZE(varo,1),TRIM(modname)//" i1")
441  j1=SIZE(varo,2); j2=SIZE(lat2)
442  ALLOCATE(vtmp(i1-1,j1))
443  IF(ibeg.AND.prt_level>1) THEN
444    WRITE(lunout,*)"--------------------------------------------------------"
445    WRITE(lunout,*)"$$$ Interpolation barycentrique pour "//TRIM(nam)//" $$$"
446    WRITE(lunout,*)"--------------------------------------------------------"
447  END IF
448  CALL inter_barxy(lon, lat(:jj-1), vari, lon2(:i1-1), lat2, vtmp)
449  CALL gr_int_dyn(vtmp, varo, i1-1, j1)
450
451END SUBROUTINE interp_startvar
452!
453!-------------------------------------------------------------------------------
454!
455!*******************************************************************************
456
457SUBROUTINE filtreoro(imp1,jmp1,phis,masque,rlatu)
458
459IMPLICIT NONE
460
461  INTEGER imp1,jmp1
462  REAL, DIMENSION(imp1,jmp1) :: phis,masque
463  REAL, DIMENSION(jmp1) :: rlatu
464  REAL, DIMENSION(imp1) :: wwf
465  REAL, DIMENSION(imp1,jmp1) :: phiso
466  INTEGER :: ifiltre,ifi,ii,i,j
467  REAL :: coslat0,ssz
468
469  coslat0=0.5
470  phiso=phis
471  do j=2,jmp1-1
472     print*,'avant if ',cos(rlatu(j)),coslat0
473     if (cos(rlatu(j))<coslat0) then
474         ! nb de pts affectes par le filtrage de part et d'autre du pt
475         ifiltre=(coslat0/cos(rlatu(j))-1.)/2.
476         wwf=0.
477         do i=1,ifiltre
478            wwf(i)=1.
479         enddo
480         wwf(ifiltre+1)=(coslat0/cos(rlatu(j))-1.)/2.-ifiltre
481         do i=1,imp1-1
482            if (masque(i,j)>0.9) then
483               ssz=phis(i,j)
484               do ifi=1,ifiltre+1
485                  ii=i+ifi
486                  if (ii>imp1-1) ii=ii-imp1+1
487                  ssz=ssz+wwf(ifi)*phis(ii,j)
488                  ii=i-ifi
489                  if (ii<1) ii=ii+imp1-1
490                  ssz=ssz+wwf(ifi)*phis(ii,j)
491               enddo
492               phis(i,j)=ssz*cos(rlatu(j))/coslat0
493            endif
494         enddo
495         print*,'j=',j,coslat0/cos(rlatu(j)), (1.+2.*sum(wwf))*cos(rlatu(j))/coslat0
496     endif
497  enddo
498  call dump2d(imp1,jmp1,phis,'phis ')
499  call dump2d(imp1,jmp1,masque,'masque ')
500  call dump2d(imp1,jmp1,phis-phiso,'dphis ')
501
502END SUBROUTINE filtreoro
503
504
505END MODULE etat0phys
Note: See TracBrowser for help on using the repository browser.