| 1 | ! |
|---|
| 2 | ! $Id $ |
|---|
| 3 | ! |
|---|
| 4 | subroutine phyetat0(fichnom) |
|---|
| 5 | ! Load initial state for the physics |
|---|
| 6 | ! and do some resulting initializations |
|---|
| 7 | |
|---|
| 8 | USE dimphy |
|---|
| 9 | USE mod_grid_phy_lmdz |
|---|
| 10 | USE mod_phys_lmdz_para |
|---|
| 11 | USE iophy |
|---|
| 12 | USE phys_state_var_mod |
|---|
| 13 | USE iostart |
|---|
| 14 | use geometry_mod, only: longitude_deg, latitude_deg |
|---|
| 15 | USE time_phylmdz_mod, only: itau_phy, raz_date, pdtphys |
|---|
| 16 | USE ioipsl_getin_p_mod, only: getin_p |
|---|
| 17 | use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd, & |
|---|
| 18 | east_gwstress, west_gwstress |
|---|
| 19 | |
|---|
| 20 | implicit none |
|---|
| 21 | !====================================================================== |
|---|
| 22 | ! Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818 |
|---|
| 23 | ! Objet: Lecture de l'etat initial pour la physique |
|---|
| 24 | !====================================================================== |
|---|
| 25 | !include "netcdf.inc" |
|---|
| 26 | include "dimsoil.h" |
|---|
| 27 | include "clesphys.h" |
|---|
| 28 | include "tabcontrol.h" |
|---|
| 29 | !====================================================================== |
|---|
| 30 | |
|---|
| 31 | character(len=*),intent(in) :: fichnom ! input file name |
|---|
| 32 | LOGICAL :: found |
|---|
| 33 | REAL :: tab_cntrl(length) |
|---|
| 34 | integer :: i,isoil |
|---|
| 35 | CHARACTER(len=2) :: str2 |
|---|
| 36 | REAL :: lon_startphy(klon), lat_startphy(klon) |
|---|
| 37 | REAL :: surface_albedo |
|---|
| 38 | |
|---|
| 39 | ! les variables globales lues dans le fichier restart |
|---|
| 40 | |
|---|
| 41 | ! open physics initial state file: |
|---|
| 42 | if (startphy_file) then |
|---|
| 43 | call open_startphy(fichnom) |
|---|
| 44 | endif |
|---|
| 45 | |
|---|
| 46 | ! |
|---|
| 47 | ! Load control parameters: |
|---|
| 48 | ! |
|---|
| 49 | IF (startphy_file) THEN |
|---|
| 50 | CALL get_var("controle",tab_cntrl,found) |
|---|
| 51 | IF (.not.found) THEN |
|---|
| 52 | PRINT*, 'phyetat0: Le champ <controle> est absent' |
|---|
| 53 | CALL abort |
|---|
| 54 | ENDIF |
|---|
| 55 | |
|---|
| 56 | DO i = 1, length |
|---|
| 57 | tabcntr0( i ) = tab_cntrl( i ) |
|---|
| 58 | ENDDO |
|---|
| 59 | |
|---|
| 60 | dtime = tab_cntrl(1) |
|---|
| 61 | radpas = tab_cntrl(2) |
|---|
| 62 | |
|---|
| 63 | itau_phy = tab_cntrl(15) |
|---|
| 64 | |
|---|
| 65 | ! Attention si raz_date est active : |
|---|
| 66 | ! il faut remettre a zero itau_phy apres phyetat0 ! |
|---|
| 67 | IF (raz_date.eq.1) THEN |
|---|
| 68 | itau_phy=0 |
|---|
| 69 | ENDIF |
|---|
| 70 | |
|---|
| 71 | ELSE |
|---|
| 72 | tabcntr0(:)=1 ! dummy initialization |
|---|
| 73 | ! Initialize parameter or get values from def files |
|---|
| 74 | dtime=pdtphys |
|---|
| 75 | radpas=1 |
|---|
| 76 | itau_phy=0 |
|---|
| 77 | ENDIF ! of IF (startphy_file) |
|---|
| 78 | |
|---|
| 79 | IF (startphy_file) THEN |
|---|
| 80 | ! read latitudes and make a sanity check (because already known from dyn) |
|---|
| 81 | call get_field("latitude",lat_startphy,found) |
|---|
| 82 | IF (.not.found) THEN |
|---|
| 83 | PRINT*, 'phyetat0: Le champ <latitude> est absent' |
|---|
| 84 | CALL abort |
|---|
| 85 | ENDIF |
|---|
| 86 | DO i=1,klon |
|---|
| 87 | IF (ABS(lat_startphy(i)-latitude_deg(i))>=0.01) THEN |
|---|
| 88 | WRITE(*,*) "phyetat0: Warning! Latitude discrepancy wrt startphy file:",& |
|---|
| 89 | " i=",i," lat_startphy(i)=",lat_startphy(i),& |
|---|
| 90 | " latitude_deg(i)=",latitude_deg(i) |
|---|
| 91 | CALL abort |
|---|
| 92 | ENDIF |
|---|
| 93 | ENDDO |
|---|
| 94 | |
|---|
| 95 | ! read longitudes and make a sanity check (because already known from dyn) |
|---|
| 96 | call get_field("longitude",lon_startphy,found) |
|---|
| 97 | IF (.not.found) THEN |
|---|
| 98 | PRINT*, 'phyetat0: Le champ <longitude> est absent' |
|---|
| 99 | CALL abort |
|---|
| 100 | ENDIF |
|---|
| 101 | DO i=1,klon |
|---|
| 102 | IF (ABS(lon_startphy(i)-longitude_deg(i))>=0.01) THEN |
|---|
| 103 | WRITE(*,*) "phyetat0: Warning! Longitude discrepancy wrt startphy file:",& |
|---|
| 104 | " i=",i," lon_startphy(i)=",lon_startphy(i),& |
|---|
| 105 | " longitude_deg(i)=",longitude_deg(i) |
|---|
| 106 | CALL abort |
|---|
| 107 | ENDIF |
|---|
| 108 | ENDDO |
|---|
| 109 | ENDIF ! of IF (startphy_file) |
|---|
| 110 | |
|---|
| 111 | ! read in other variables here ... |
|---|
| 112 | |
|---|
| 113 | IF (startphy_file) THEN |
|---|
| 114 | ! Load surface temperature: |
|---|
| 115 | CALL get_field("TS",ftsol(:),found) |
|---|
| 116 | IF (.not.found) THEN |
|---|
| 117 | PRINT*, 'phyetat0: Le champ <TS> est absent' |
|---|
| 118 | PRINT*, "phyetat0: Lecture echouee pour <TS>" |
|---|
| 119 | CALL abort |
|---|
| 120 | ELSE |
|---|
| 121 | PRINT*, 'phyetat0: Le champ <TS> est present' |
|---|
| 122 | PRINT*,'Temperature du sol <TS>', minval(ftsol), maxval(ftsol) |
|---|
| 123 | ENDIF |
|---|
| 124 | ELSE |
|---|
| 125 | ! Dummy initialization, but in fact this is later handled in physiq |
|---|
| 126 | ftsol(:)=0 |
|---|
| 127 | ENDIF ! of IF (startphy_file) |
|---|
| 128 | |
|---|
| 129 | IF (startphy_file) THEN |
|---|
| 130 | ! Load sub-surface temperatures: |
|---|
| 131 | DO isoil=1, nsoilmx |
|---|
| 132 | IF (isoil.GT.99) THEN |
|---|
| 133 | PRINT*, "Trop de couches" |
|---|
| 134 | CALL abort |
|---|
| 135 | ENDIF |
|---|
| 136 | WRITE(str2,'(i2.2)') isoil |
|---|
| 137 | CALL get_field('Tsoil'//str2,ftsoil(:,isoil),found) |
|---|
| 138 | IF (.not.found) THEN |
|---|
| 139 | PRINT*, "phyetat0: Le champ <Tsoil"//str2//"> est absent" |
|---|
| 140 | PRINT*, " Il prend donc la valeur de surface" |
|---|
| 141 | DO i=1, klon |
|---|
| 142 | ftsoil(i,isoil)=ftsol(i) |
|---|
| 143 | ENDDO |
|---|
| 144 | ENDIF |
|---|
| 145 | ENDDO |
|---|
| 146 | ELSE |
|---|
| 147 | ! Dummy initialization, but in fact this is later handled in physiq |
|---|
| 148 | ftsoil(:,:)=0 |
|---|
| 149 | ENDIF ! of IF (startphy_file) |
|---|
| 150 | |
|---|
| 151 | IF (startphy_file) THEN |
|---|
| 152 | ! Load surface albedo: |
|---|
| 153 | CALL get_field("ALBE", falbe,found) |
|---|
| 154 | IF (.not.found) THEN |
|---|
| 155 | PRINT*, 'phyetat0: Le champ <ALBE> est absent' |
|---|
| 156 | PRINT*, "phyetat0: Lecture echouee pour <ALBE>" |
|---|
| 157 | CALL abort |
|---|
| 158 | ENDIF |
|---|
| 159 | ELSE |
|---|
| 160 | ! Dummy initialization: read value from def file |
|---|
| 161 | surface_albedo=0.5 ! default |
|---|
| 162 | CALL getin_p("surface_albedo",surface_albedo) |
|---|
| 163 | falbe(:)=surface_albedo |
|---|
| 164 | ENDIF ! of IF (startphy_file) |
|---|
| 165 | PRINT*,'Albedo du sol <ALBE>', minval(falbe), maxval(falbe) |
|---|
| 166 | |
|---|
| 167 | IF (startphy_file) THEN |
|---|
| 168 | ! Lecture rayonnement solaire au sol: |
|---|
| 169 | CALL get_field("solsw",solsw,found) |
|---|
| 170 | IF (.not.found) THEN |
|---|
| 171 | PRINT*, 'phyetat0: Le champ <solsw> est absent' |
|---|
| 172 | PRINT*, 'mis a zero' |
|---|
| 173 | solsw = 0. |
|---|
| 174 | ENDIF |
|---|
| 175 | ELSE |
|---|
| 176 | ! Dummy initialization |
|---|
| 177 | solsw(:)=0 |
|---|
| 178 | ENDIF ! of IF (startphy_file) |
|---|
| 179 | PRINT*,'Rayonnement solaire au sol solsw:', minval(solsw), maxval(solsw) |
|---|
| 180 | |
|---|
| 181 | IF (startphy_file) THEN |
|---|
| 182 | ! Lecture rayonnement IR au sol: |
|---|
| 183 | CALL get_field("sollw",sollw,found) |
|---|
| 184 | IF (.not.found) THEN |
|---|
| 185 | PRINT*, 'phyetat0: Le champ <sollw> est absent' |
|---|
| 186 | PRINT*, 'mis a zero' |
|---|
| 187 | sollw = 0. |
|---|
| 188 | ENDIF |
|---|
| 189 | ELSE |
|---|
| 190 | ! Dummy initialization |
|---|
| 191 | sollw(:)=0 |
|---|
| 192 | ENDIF ! of IF (startphy_file) |
|---|
| 193 | PRINT*,'Rayonnement IR au sol sollw:', minval(sollw), maxval(solsw) |
|---|
| 194 | |
|---|
| 195 | IF (startphy_file) THEN |
|---|
| 196 | ! Lecture derive des flux: |
|---|
| 197 | CALL get_field("fder",fder,found) |
|---|
| 198 | IF (.not.found) THEN |
|---|
| 199 | PRINT*, 'phyetat0: Le champ <fder> est absent' |
|---|
| 200 | PRINT*, 'mis a zero' |
|---|
| 201 | fder = 0. |
|---|
| 202 | ENDIF |
|---|
| 203 | ELSE |
|---|
| 204 | ! Dummy initialization |
|---|
| 205 | fder(:)=0 |
|---|
| 206 | ENDIF ! of IF (startphy_file) |
|---|
| 207 | PRINT*,'Derive des flux fder:', minval(fder), maxval(fder) |
|---|
| 208 | |
|---|
| 209 | IF (startphy_file) THEN |
|---|
| 210 | ! Lecture derive flux IR: |
|---|
| 211 | CALL get_field("dlw",dlw,found) |
|---|
| 212 | IF (.not.found) THEN |
|---|
| 213 | PRINT*, 'phyetat0: Le champ <dlw> est absent' |
|---|
| 214 | PRINT*, 'mis a zero' |
|---|
| 215 | dlw = 0. |
|---|
| 216 | ENDIF |
|---|
| 217 | ELSE |
|---|
| 218 | ! Dummy initialization |
|---|
| 219 | dlw(:)=0 |
|---|
| 220 | ENDIF ! of IF (startphy_file) |
|---|
| 221 | PRINT*,'Derive flux IR dlw:', minval(dlw), maxval(dlw) |
|---|
| 222 | |
|---|
| 223 | IF (startphy_file) THEN |
|---|
| 224 | ! Lecture rayonnement IR vers le bas au sol: |
|---|
| 225 | CALL get_field("sollwdown",sollwdown,found) |
|---|
| 226 | IF (.not.found) THEN |
|---|
| 227 | PRINT*, 'phyetat0: Le champ <sollwdown> est absent' |
|---|
| 228 | PRINT*, 'mis a zero' |
|---|
| 229 | sollwdown = 0. |
|---|
| 230 | ENDIF |
|---|
| 231 | ELSE |
|---|
| 232 | ! Dummy initialization |
|---|
| 233 | sollwdown(:)=0 |
|---|
| 234 | ENDIF ! of IF (startphy_file) |
|---|
| 235 | PRINT*,'Flux IR vers le bas au sol sollwdown:', minval(sollwdown), maxval(sollwdown) |
|---|
| 236 | |
|---|
| 237 | IF (startphy_file) THEN |
|---|
| 238 | ! Lecture du rayonnement net au sol: |
|---|
| 239 | CALL get_field("RADS",radsol,found) |
|---|
| 240 | IF (.not.found) THEN |
|---|
| 241 | PRINT*, 'phyetat0: Le champ <RADS> est absent' |
|---|
| 242 | CALL abort |
|---|
| 243 | ENDIF |
|---|
| 244 | ELSE |
|---|
| 245 | ! Dummy initialization |
|---|
| 246 | radsol(:)=0 |
|---|
| 247 | ENDIF ! of IF (startphy_file) |
|---|
| 248 | PRINT*,'Rayonnement net au sol radsol:', minval(radsol), maxval(radsol) |
|---|
| 249 | |
|---|
| 250 | IF (startphy_file) THEN |
|---|
| 251 | ! Load sub-grid scale orography parameters: |
|---|
| 252 | CALL get_field("ZMEA",zmea,found) |
|---|
| 253 | IF (.not.found) THEN |
|---|
| 254 | PRINT*, 'phyetat0: Le champ <ZMEA> est absent' |
|---|
| 255 | PRINT*, 'mis a zero' |
|---|
| 256 | zmea=0. |
|---|
| 257 | ENDIF |
|---|
| 258 | ELSE |
|---|
| 259 | zmea(:)=0 |
|---|
| 260 | ENDIF ! of IF (startphy_file) |
|---|
| 261 | PRINT*,'OROGRAPHIE SOUS-MAILLE zmea:', minval(zmea), maxval(zmea) |
|---|
| 262 | |
|---|
| 263 | IF (startphy_file) THEN |
|---|
| 264 | ! Load sub-grid scale orography parameters: |
|---|
| 265 | CALL get_field("ZSTD",zstd,found) |
|---|
| 266 | IF (.not.found) THEN |
|---|
| 267 | PRINT*, 'phyetat0: Le champ <ZSTD> est absent' |
|---|
| 268 | PRINT*, 'mis a zero' |
|---|
| 269 | zstd=0. |
|---|
| 270 | ENDIF |
|---|
| 271 | ELSE |
|---|
| 272 | zstd(:)=0 |
|---|
| 273 | ENDIF ! of IF (startphy_file) |
|---|
| 274 | PRINT*,'OROGRAPHIE SOUS-MAILLE zstd:', minval(zstd), maxval(zstd) |
|---|
| 275 | |
|---|
| 276 | IF (startphy_file) THEN |
|---|
| 277 | ! Load sub-grid scale orography parameters: |
|---|
| 278 | CALL get_field("ZSIG",zsig,found) |
|---|
| 279 | IF (.not.found) THEN |
|---|
| 280 | PRINT*, 'phyetat0: Le champ <ZSIG> est absent' |
|---|
| 281 | PRINT*, 'mis a zero' |
|---|
| 282 | zsig=0. |
|---|
| 283 | ENDIF |
|---|
| 284 | ELSE |
|---|
| 285 | zsig(:)=0 |
|---|
| 286 | ENDIF ! of IF (startphy_file) |
|---|
| 287 | PRINT*,'OROGRAPHIE SOUS-MAILLE zsig:', minval(zsig), maxval(zsig) |
|---|
| 288 | |
|---|
| 289 | IF (startphy_file) THEN |
|---|
| 290 | ! Load sub-grid scale orography parameters: |
|---|
| 291 | CALL get_field("ZGAM",zgam,found) |
|---|
| 292 | IF (.not.found) THEN |
|---|
| 293 | PRINT*, 'phyetat0: Le champ <ZGAM> est absent' |
|---|
| 294 | PRINT*, 'mis a zero' |
|---|
| 295 | zgam=0. |
|---|
| 296 | ENDIF |
|---|
| 297 | ELSE |
|---|
| 298 | zgam(:)=0 |
|---|
| 299 | ENDIF ! of IF (startphy_file) |
|---|
| 300 | PRINT*,'OROGRAPHIE SOUS-MAILLE zgam:', minval(zgam), maxval(zgam) |
|---|
| 301 | |
|---|
| 302 | IF (startphy_file) THEN |
|---|
| 303 | ! Load sub-grid scale orography parameters: |
|---|
| 304 | CALL get_field("ZTHE",zthe,found) |
|---|
| 305 | IF (.not.found) THEN |
|---|
| 306 | PRINT*, 'phyetat0: Le champ <ZTHE> est absent' |
|---|
| 307 | PRINT*, 'mis a zero' |
|---|
| 308 | zthe=0. |
|---|
| 309 | ENDIF |
|---|
| 310 | ELSE |
|---|
| 311 | zthe(:)=0 |
|---|
| 312 | ENDIF ! of IF (startphy_file) |
|---|
| 313 | PRINT*,'OROGRAPHIE SOUS-MAILLE zthe:', minval(zthe), maxval(zthe) |
|---|
| 314 | |
|---|
| 315 | IF (startphy_file) THEN |
|---|
| 316 | ! Load sub-grid scale orography parameters: |
|---|
| 317 | CALL get_field("ZPIC",zpic,found) |
|---|
| 318 | IF (.not.found) THEN |
|---|
| 319 | PRINT*, 'phyetat0: Le champ <ZPIC> est absent' |
|---|
| 320 | PRINT*, 'mis a zero' |
|---|
| 321 | zpic=0. |
|---|
| 322 | ENDIF |
|---|
| 323 | ELSE |
|---|
| 324 | zpic(:)=0 |
|---|
| 325 | ENDIF ! of IF (startphy_file) |
|---|
| 326 | PRINT*,'OROGRAPHIE SOUS-MAILLE zpic:', minval(zpic), maxval(zpic) |
|---|
| 327 | |
|---|
| 328 | IF (startphy_file) THEN |
|---|
| 329 | ! Load sub-grid scale orography parameters: |
|---|
| 330 | CALL get_field("ZVAL",zval,found) |
|---|
| 331 | IF (.not.found) THEN |
|---|
| 332 | PRINT*, 'phyetat0: Le champ <ZVAL> est absent' |
|---|
| 333 | PRINT*, 'mis a zero' |
|---|
| 334 | zval=0. |
|---|
| 335 | ENDIF |
|---|
| 336 | ELSE |
|---|
| 337 | zval(:)=0 |
|---|
| 338 | ENDIF ! of IF (startphy_file) |
|---|
| 339 | PRINT*,'OROGRAPHIE SOUS-MAILLE zval:', minval(zval), maxval(zval) |
|---|
| 340 | |
|---|
| 341 | IF (startphy_file) THEN |
|---|
| 342 | ! Lecture de TANCIEN: |
|---|
| 343 | ancien_ok = .TRUE. |
|---|
| 344 | |
|---|
| 345 | CALL get_field("TANCIEN",t_ancien,found) |
|---|
| 346 | IF (.not.found) THEN |
|---|
| 347 | PRINT*, "phyetat0: Le champ <TANCIEN> est absent" |
|---|
| 348 | PRINT*, "Depart legerement fausse. Mais je continue" |
|---|
| 349 | ancien_ok = .FALSE. |
|---|
| 350 | ENDIF |
|---|
| 351 | ELSE |
|---|
| 352 | ancien_ok=.false. |
|---|
| 353 | ENDIF |
|---|
| 354 | |
|---|
| 355 | IF (startphy_file) THEN |
|---|
| 356 | ! Load Q2 the TKE at interlayer: |
|---|
| 357 | CALL get_field("Q2",q2,found) |
|---|
| 358 | IF (.not.found) THEN |
|---|
| 359 | PRINT*, 'phyetat0: Le champ <Q2> est absent' |
|---|
| 360 | PRINT*, 'mis a zero' |
|---|
| 361 | q2(:,:)=0. |
|---|
| 362 | ENDIF |
|---|
| 363 | ELSE |
|---|
| 364 | ! Dummy initialization |
|---|
| 365 | q2(:,:)=0 |
|---|
| 366 | ENDIF ! of IF (startphy_file) |
|---|
| 367 | PRINT*,'Turbulent Kinetic Energy', minval(q2), maxval(q2) |
|---|
| 368 | |
|---|
| 369 | ! Non-orographic gravity waves |
|---|
| 370 | if (startphy_file) then |
|---|
| 371 | call get_field("du_nonoro_gwd",du_nonoro_gwd,found) |
|---|
| 372 | if (.not.found) then |
|---|
| 373 | write(*,*) "phyetat0: <du_nonoro_gwd> not in file" |
|---|
| 374 | du_nonoro_gwd(:,:)=0. |
|---|
| 375 | endif |
|---|
| 376 | endif ! of if (startphy_file) |
|---|
| 377 | if (startphy_file) then |
|---|
| 378 | call get_field("dv_nonoro_gwd",dv_nonoro_gwd,found) |
|---|
| 379 | if (.not.found) then |
|---|
| 380 | write(*,*) "phyetat0: <dv_nonoro_gwd> not in file" |
|---|
| 381 | dv_nonoro_gwd(:,:)=0. |
|---|
| 382 | endif |
|---|
| 383 | endif ! of if (startphy_file) |
|---|
| 384 | if (startphy_file) then |
|---|
| 385 | call get_field("east_gwstress",east_gwstress,found) |
|---|
| 386 | if (.not.found) then |
|---|
| 387 | write(*,*) "phyetat0: <east_gwstress> not in file" |
|---|
| 388 | east_gwstress(:,:)=0. |
|---|
| 389 | endif |
|---|
| 390 | endif ! of if (startphy_file) |
|---|
| 391 | if (startphy_file) then |
|---|
| 392 | call get_field("west_gwstress",west_gwstress,found) |
|---|
| 393 | if (.not.found) then |
|---|
| 394 | write(*,*) "phyetat0: <west_gwstress> not in file" |
|---|
| 395 | west_gwstress(:,:)=0. |
|---|
| 396 | endif |
|---|
| 397 | endif ! of if (startphy_file) |
|---|
| 398 | |
|---|
| 399 | ! close file |
|---|
| 400 | IF (startphy_file) call close_startphy |
|---|
| 401 | |
|---|
| 402 | ! do some more initializations |
|---|
| 403 | call init_iophy_new(latitude_deg,longitude_deg) |
|---|
| 404 | |
|---|
| 405 | end subroutine phyetat0 |
|---|