source: LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/create_etat0_unstruct.F90 @ 3603

Last change on this file since 3603 was 3323, checked in by Laurent Fairhead, 7 years ago

Adding some new routines mainly dealing with unstructured grids to the physics

File size: 4.9 KB
Line 
1MODULE create_etat0_unstruct_mod
2
3
4
5
6
7
8CONTAINS
9
10  SUBROUTINE create_etat0_unstruct
11  USE dimphy
12#ifdef CPP_XIOS
13  USE xios
14  USE infotrac_phy
15  USE fonte_neige_mod
16  USE pbl_surface_mod
17  USE phys_state_var_mod
18  USE indice_sol_mod
19  USE mod_phys_lmdz_para
20  IMPLICIT NONE
21  INCLUDE 'dimsoil.h'
22
23    REAL,    DIMENSION(klon)                 :: tsol
24    REAL,    DIMENSION(klon)                 :: sn
25    REAL,    DIMENSION(klon)                 :: rugmer
26    REAL,    DIMENSION(klon)                 :: run_off_lic_0
27    REAL,    DIMENSION(klon)                 :: lic
28    REAL,    DIMENSION(klon)                 :: fder
29
30    REAL,    DIMENSION(klon,nbsrf)           :: qsolsrf, snsrf
31    REAL,    DIMENSION(klon,nsoilmx,nbsrf)   :: tsoil
32   
33    REAL,    DIMENSION(klon_mpi)             :: tsol_mpi, qsol_mpi, zmasq_mpi, lic_mpi
34    REAL,    DIMENSION(klon_mpi)             :: zmea_mpi, zstd_mpi, zsig_mpi, zgam_mpi, zthe_mpi
35
36    INTEGER :: ji,j,i
37 
38    IF (is_omp_master) THEN
39      CALL xios_recv_field("ts",tsol_mpi)
40      CALL xios_recv_field("qs",qsol_mpi)
41      CALL xios_recv_field("mask",zmasq_mpi)
42      CALL xios_recv_field("landice",lic_mpi)
43      CALL xios_recv_field("zmea",zmea_mpi)
44      CALL xios_recv_field("zstd",zstd_mpi)
45      CALL xios_recv_field("zsig",zsig_mpi)
46      CALL xios_recv_field("zgam",zgam_mpi)
47      CALL xios_recv_field("zthe",zthe_mpi)
48    ENDIF
49    CALL scatter_omp(tsol_mpi,tsol)
50    CALL scatter_omp(qsol_mpi,qsol)
51    CALL scatter_omp(zmasq_mpi,zmasq)
52    CALL scatter_omp(lic_mpi,lic)
53    CALL scatter_omp(zmea_mpi,zmea)
54    CALL scatter_omp(zstd_mpi,zstd)
55    CALL scatter_omp(zsig_mpi,zsig)
56    CALL scatter_omp(zgam_mpi,zgam)
57    CALL scatter_omp(zthe_mpi,zthe)
58
59    radsol(:)   = 0.0
60    rugmer(:) = 0.001
61    sn(:)     = 0
62
63    WHERE(qsol(:)<0) qsol(:)=0
64       
65    WHERE(   zmasq(:)<EPSFRA) zmasq(:)=0.
66    WHERE(1.-zmasq(:)<EPSFRA) zmasq(:)=1.
67
68    pctsrf(:,:) = 0
69    pctsrf(:,is_lic)=lic
70    WHERE(pctsrf(:,is_lic)<EPSFRA) pctsrf(:,is_lic)=0.
71    WHERE(zmasq(:)<EPSFRA)         pctsrf(:,is_lic)=0.
72
73    pctsrf(:,is_ter)=zmasq(:)
74
75!--- Adequation with soil/sea mask
76    DO ji=1,klon
77      IF(zmasq(ji)>EPSFRA) THEN
78        IF(pctsrf(ji,is_lic)>=zmasq(ji)) THEN
79          pctsrf(ji,is_lic)=zmasq(ji)
80          pctsrf(ji,is_ter)=0.
81        ELSE
82          pctsrf(ji,is_ter)=zmasq(ji)-pctsrf(ji,is_lic)
83          IF(pctsrf(ji,is_ter)<EPSFRA) THEN
84            pctsrf(ji,is_ter)=0.
85            pctsrf(ji,is_lic)=zmasq(ji)
86          END IF
87        END IF
88      END IF
89    END DO
90   
91! sub-surface ocean and sea ice (sea ice set to zero for start)
92!*******************************************************************************
93    pctsrf(:,is_oce)=(1.-zmasq(:))
94    WHERE(pctsrf(:,is_oce)<EPSFRA) pctsrf(:,is_oce)=0.
95   
96    zval(:)=max(0.,zmea-2*zstd(:))
97    zpic(:)=zmea+2*zstd(:)
98   
99!! WARNING    DON'T FORGET FOR LATER
100!!ym  IF(couple) pctsrf(:,is_oce)=ocemask_fi(:)
101!!
102   
103! Init: tsol, qsol, sn, evap, tsoil, rain_fall, snow_fall, solsw, sollw, frugs
104!*******************************************************************************
105    DO i=1,nbsrf
106     ftsol(:,i) = tsol
107    END DO
108 
109    DO i=1,nbsrf
110     snsrf(:,i) = sn
111    END DO
112!albedo SB >>>
113!ym error : the sub surface dimension is the third not second
114!    falb_dir(:,is_ter,:)=0.08; falb_dir(:,is_lic,:)=0.6
115!    falb_dir(:,is_oce,:)=0.5;  falb_dir(:,is_sic,:)=0.6
116    falb_dir(:,:,is_ter)=0.08; falb_dir(:,:,is_lic)=0.6
117    falb_dir(:,:,is_oce)=0.5;  falb_dir(:,:,is_sic)=0.6
118
119!ym falb_dif has been forgotten, initialize with defaukt value found in phyetat0 or 0 ?
120!ym probably the uninitialized value was 0 for standard (regular grid) case
121    falb_dif(:,:,:)=0
122
123!albedo SB <<<
124    fevap(:,:) = 0.
125    DO i=1,nbsrf
126     qsolsrf(:,i)=150.
127    END DO
128 
129    DO i=1,nbsrf
130      DO j=1,nsoilmx
131        tsoil(:,j,i) = tsol
132      END DO
133    END DO
134 
135    rain_fall = 0.; snow_fall = 0.
136    solsw = 165.;   sollw = -53.
137    t_ancien = 273.15
138    u_ancien=0
139    v_ancien=0
140    q_ancien = 0.
141    agesno = 0.
142
143    z0m(:,is_oce) = rugmer(:)
144
145   z0m(:,is_ter) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
146   z0m(:,is_lic) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
147
148   z0m(:,is_sic) = 0.001
149   z0h(:,:)=z0m(:,:)
150
151    fder = 0.0
152    clwcon = 0.0
153    rnebcon = 0.0
154    ratqs = 0.0
155    run_off_lic_0 = 0.0
156    rugoro = 0.0
157
158! Before phyredem calling, surface modules and values to be saved in startphy.nc
159! are initialized
160!*******************************************************************************
161    pbl_tke(:,:,:) = 1.e-8
162    zmax0(:) = 40.
163    f0(:) = 1.e-5
164    sig1(:,:) = 0.
165    w01(:,:) = 0.
166    wake_deltat(:,:) = 0.
167    wake_deltaq(:,:) = 0.
168    wake_s(:) = 0.
169    wake_cstar(:) = 0.
170    wake_fip(:) = 0.
171    wake_pe = 0.
172    fm_therm = 0.
173    entr_therm = 0.
174    detr_therm = 0.
175    ale_bl = 0.
176    ale_bl_trig =0.
177    alp_bl =0.
178    CALL fonte_neige_init(run_off_lic_0)
179    CALL pbl_surface_init( fder, snsrf, qsolsrf, tsoil )
180    CALL phyredem( "startphy.nc" )
181
182#endif
183  END SUBROUTINE create_etat0_unstruct
184
185
186END MODULE create_etat0_unstruct_mod
Note: See TracBrowser for help on using the repository browser.