1 | MODULE paramLMDZ_phy_mod |
---|
2 | |
---|
3 | ! Olivier 13/07/2016 |
---|
4 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
5 | |
---|
6 | CONTAINS |
---|
7 | |
---|
8 | SUBROUTINE ini_paramLMDZ_phy(dtime,nid_ctesGCM) |
---|
9 | |
---|
10 | USE iophy |
---|
11 | USE dimphy |
---|
12 | USE ioipsl, ONLY: histbeg, histvert, histdef, histend, ymds2ju |
---|
13 | USE lmdz_phys_mpi_data, ONLY: is_mpi_root |
---|
14 | USE lmdz_geometry, ONLY: longitude_deg, latitude_deg |
---|
15 | USE lmdz_grid_phy, ONLY: nbp_lon, nbp_lat, klon_glo |
---|
16 | USE time_phylmdz_mod, ONLY: annee_ref, day_ref, itau_phy, pdtphys |
---|
17 | USE lmdz_phys_transfert_para, ONLY: gather, bcast |
---|
18 | USE lmdz_clesphys |
---|
19 | USE lmdz_yomcst |
---|
20 | |
---|
21 | IMPLICIT NONE |
---|
22 | |
---|
23 | REAL, INTENT(OUT) :: dtime |
---|
24 | INTEGER, INTENT(OUT) :: nid_ctesGCM |
---|
25 | |
---|
26 | REAL,DIMENSION(klon_glo) :: rlat_glo |
---|
27 | REAL,DIMENSION(klon_glo) :: rlon_glo |
---|
28 | INTEGER i, idayref, ISW, itau_w |
---|
29 | REAL zstophy, zout |
---|
30 | REAL zx_lon(nbp_lon,nbp_lat) |
---|
31 | REAL zx_lat(nbp_lon,nbp_lat) |
---|
32 | |
---|
33 | CHARACTER*1 ch1 |
---|
34 | INTEGER nhori |
---|
35 | INTEGER, PARAMETER :: np=1 |
---|
36 | |
---|
37 | REAL zjulian |
---|
38 | SAVE zjulian |
---|
39 | !$OMP THREADPRIVATE(zjulian) |
---|
40 | |
---|
41 | !IM Implemente en modes sequentiel et parallele |
---|
42 | |
---|
43 | CALL gather(latitude_deg,rlat_glo) |
---|
44 | CALL bcast(rlat_glo) |
---|
45 | CALL gather(longitude_deg,rlon_glo) |
---|
46 | CALL bcast(rlon_glo) |
---|
47 | |
---|
48 | !$OMP MASTER |
---|
49 | IF (is_mpi_root) THEN |
---|
50 | |
---|
51 | ! zstophy = pdtphys |
---|
52 | ! zout = -1 |
---|
53 | !--OB modified for daily output |
---|
54 | zstophy = 86400. |
---|
55 | zout = 86400. |
---|
56 | |
---|
57 | idayref = day_ref |
---|
58 | CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian) |
---|
59 | |
---|
60 | CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlon_glo,zx_lon) |
---|
61 | IF (nbp_lon>1) THEN |
---|
62 | DO i = 1, nbp_lon |
---|
63 | zx_lon(i,1) = rlon_glo(i+1) |
---|
64 | zx_lon(i,nbp_lat) = rlon_glo(i+1) |
---|
65 | ENDDO |
---|
66 | ENDIF |
---|
67 | |
---|
68 | CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlat_glo,zx_lat) |
---|
69 | |
---|
70 | CALL histbeg("paramLMDZ_phy.nc", & |
---|
71 | np,zx_lon(np:np,1), np,zx_lat(1,np:np), & |
---|
72 | 1,1,1,1, & |
---|
73 | itau_phy, zjulian, dtime, & |
---|
74 | nhori, nid_ctesGCM) |
---|
75 | |
---|
76 | CALL histdef(nid_ctesGCM, "R_ecc", & |
---|
77 | "Excentricite","-", & |
---|
78 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
79 | "ave(X)", zstophy,zout) |
---|
80 | |
---|
81 | CALL histdef(nid_ctesGCM, "R_peri", & |
---|
82 | "Equinoxe","-", & |
---|
83 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
84 | "ave(X)", zstophy,zout) |
---|
85 | |
---|
86 | CALL histdef(nid_ctesGCM, "R_incl", & |
---|
87 | "Inclinaison","deg", & |
---|
88 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
89 | "ave(X)", zstophy,zout) |
---|
90 | |
---|
91 | CALL histdef(nid_ctesGCM, "solaire", & |
---|
92 | "Constante solaire","W/m2", & |
---|
93 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
94 | "ave(X)", zstophy,zout) |
---|
95 | |
---|
96 | #ifdef CPP_RRTM |
---|
97 | IF (iflag_rrtm.EQ.1) THEN |
---|
98 | DO ISW=1, NSW |
---|
99 | WRITE(ch1,'(i1)') ISW |
---|
100 | CALL histdef(nid_ctesGCM, "rsun"//ch1, & |
---|
101 | "Fraction constante solaire bande "//ch1,"W/m2", & |
---|
102 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
103 | "ave(X)", zstophy,zout) |
---|
104 | ENDDO |
---|
105 | ENDIF |
---|
106 | #endif |
---|
107 | |
---|
108 | CALL histdef(nid_ctesGCM, "co2_ppm", & |
---|
109 | "Concentration du CO2", "ppm", & |
---|
110 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
111 | "ave(X)", zstophy,zout) |
---|
112 | |
---|
113 | CALL histdef(nid_ctesGCM, "CH4_ppb", & |
---|
114 | "Concentration du CH4", "ppb", & |
---|
115 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
116 | "ave(X)", zstophy,zout) |
---|
117 | |
---|
118 | CALL histdef(nid_ctesGCM, "N2O_ppb", & |
---|
119 | "Concentration du N2O", "ppb", & |
---|
120 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
121 | "ave(X)", zstophy,zout) |
---|
122 | |
---|
123 | CALL histdef(nid_ctesGCM, "CFC11_ppt", & |
---|
124 | "Concentration du CFC11", "ppt", & |
---|
125 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
126 | "ave(X)", zstophy,zout) |
---|
127 | |
---|
128 | CALL histdef(nid_ctesGCM, "CFC12_ppt", & |
---|
129 | "Concentration du CFC12", "ppt", & |
---|
130 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
131 | "ave(X)", zstophy,zout) |
---|
132 | |
---|
133 | CALL histend(nid_ctesGCM) |
---|
134 | |
---|
135 | ENDIF !(is_mpi_root) |
---|
136 | !$OMP END MASTER |
---|
137 | |
---|
138 | END SUBROUTINE ini_paramLMDZ_phy |
---|
139 | |
---|
140 | !================================================================= |
---|
141 | |
---|
142 | SUBROUTINE write_paramLMDZ_phy(itap,nid_ctesGCM,ok_sync) |
---|
143 | |
---|
144 | USE lmdz_phys_mpi_data, ONLY: is_mpi_root |
---|
145 | USE time_phylmdz_mod, ONLY: day_step_phy, annee_ref, itau_phy, start_time |
---|
146 | USE lmdz_grid_phy, ONLY: nbp_lon, nbp_lat, klon_glo |
---|
147 | |
---|
148 | USE iophy |
---|
149 | USE ioipsl, ONLY: histwrite, histsync |
---|
150 | |
---|
151 | USE lmdz_clesphys |
---|
152 | |
---|
153 | #ifdef CPP_RRTM |
---|
154 | USE YOESW, ONLY: RSUN |
---|
155 | #endif |
---|
156 | |
---|
157 | USE lmdz_yomcst |
---|
158 | |
---|
159 | IMPLICIT NONE |
---|
160 | |
---|
161 | INTEGER, INTENT(IN) :: itap, nid_ctesGCM |
---|
162 | LOGICAL, INTENT(IN) :: ok_sync |
---|
163 | |
---|
164 | INTEGER itau_w, ISW |
---|
165 | INTEGER ndex2d(nbp_lon*nbp_lat) |
---|
166 | REAL :: zx_tmp_0d(1,1) |
---|
167 | INTEGER, PARAMETER :: np=1 |
---|
168 | |
---|
169 | CHARACTER*1 ch1 |
---|
170 | |
---|
171 | !$OMP MASTER |
---|
172 | IF (is_mpi_root) THEN |
---|
173 | |
---|
174 | ndex2d = 0 |
---|
175 | itau_w = itau_phy + itap + int(start_time * day_step_phy) |
---|
176 | |
---|
177 | ! Variables globales |
---|
178 | |
---|
179 | zx_tmp_0d=R_ecc |
---|
180 | CALL histwrite(nid_ctesGCM,"R_ecc",itau_w, & |
---|
181 | zx_tmp_0d,np,ndex2d) |
---|
182 | |
---|
183 | zx_tmp_0d=R_peri |
---|
184 | CALL histwrite(nid_ctesGCM,"R_peri",itau_w, & |
---|
185 | zx_tmp_0d,np,ndex2d) |
---|
186 | |
---|
187 | zx_tmp_0d=R_incl |
---|
188 | CALL histwrite(nid_ctesGCM,"R_incl",itau_w, & |
---|
189 | zx_tmp_0d,np,ndex2d) |
---|
190 | |
---|
191 | zx_tmp_0d=solaire |
---|
192 | CALL histwrite(nid_ctesGCM,"solaire",itau_w, & |
---|
193 | zx_tmp_0d,np,ndex2d) |
---|
194 | |
---|
195 | #ifdef CPP_RRTM |
---|
196 | IF (iflag_rrtm.EQ.1) THEN |
---|
197 | DO ISW=1, NSW |
---|
198 | WRITE(ch1,'(i1)') ISW |
---|
199 | zx_tmp_0d=RSUN(ISW) |
---|
200 | CALL histwrite(nid_ctesGCM,"rsun"//ch1,itau_w, & |
---|
201 | zx_tmp_0d,np,ndex2d) |
---|
202 | ENDDO |
---|
203 | ENDIF |
---|
204 | #endif |
---|
205 | |
---|
206 | zx_tmp_0d=co2_ppm |
---|
207 | CALL histwrite(nid_ctesGCM,"co2_ppm",itau_w, & |
---|
208 | zx_tmp_0d,np,ndex2d) |
---|
209 | |
---|
210 | zx_tmp_0d=CH4_ppb |
---|
211 | CALL histwrite(nid_ctesGCM,"CH4_ppb",itau_w, & |
---|
212 | zx_tmp_0d,np,ndex2d) |
---|
213 | |
---|
214 | zx_tmp_0d=N2O_ppb |
---|
215 | CALL histwrite(nid_ctesGCM,"N2O_ppb",itau_w, & |
---|
216 | zx_tmp_0d,np,ndex2d) |
---|
217 | |
---|
218 | zx_tmp_0d=CFC11_ppt |
---|
219 | CALL histwrite(nid_ctesGCM,"CFC11_ppt",itau_w, & |
---|
220 | zx_tmp_0d,np,ndex2d) |
---|
221 | |
---|
222 | zx_tmp_0d=CFC12_ppt |
---|
223 | CALL histwrite(nid_ctesGCM,"CFC12_ppt",itau_w, & |
---|
224 | zx_tmp_0d,np,ndex2d) |
---|
225 | |
---|
226 | !================================================================= |
---|
227 | |
---|
228 | IF (ok_sync) THEN |
---|
229 | CALL histsync(nid_ctesGCM) |
---|
230 | ENDIF |
---|
231 | |
---|
232 | ENDIF !(is_mpi_root) THEN |
---|
233 | !$OMP END MASTER |
---|
234 | |
---|
235 | END SUBROUTINE write_paramLMDZ_phy |
---|
236 | |
---|
237 | END MODULE paramLMDZ_phy_mod |
---|