[1001] | 1 | MODULE iostart |
---|
| 2 | |
---|
| 3 | PRIVATE |
---|
| 4 | INTEGER,SAVE :: nid_start |
---|
| 5 | INTEGER,SAVE :: nid_restart |
---|
| 6 | |
---|
[1403] | 7 | INTEGER,SAVE :: idim1,idim2,idim3,idim4 |
---|
[1001] | 8 | INTEGER,PARAMETER :: length=100 |
---|
| 9 | |
---|
| 10 | INTERFACE get_field |
---|
| 11 | MODULE PROCEDURE Get_field_r1,Get_field_r2,Get_field_r3 |
---|
| 12 | END INTERFACE get_field |
---|
| 13 | |
---|
| 14 | INTERFACE get_var |
---|
| 15 | MODULE PROCEDURE get_var_r0,Get_var_r1,Get_var_r2,Get_var_r3 |
---|
| 16 | END INTERFACE get_var |
---|
| 17 | |
---|
| 18 | INTERFACE put_field |
---|
| 19 | MODULE PROCEDURE put_field_r1,put_field_r2,put_field_r3 |
---|
| 20 | END INTERFACE put_field |
---|
| 21 | |
---|
| 22 | INTERFACE put_var |
---|
| 23 | MODULE PROCEDURE put_var_r0,put_var_r1,put_var_r2,put_var_r3 |
---|
| 24 | END INTERFACE put_var |
---|
| 25 | |
---|
| 26 | PUBLIC get_field,get_var,put_field,put_var |
---|
| 27 | PUBLIC Open_startphy,close_startphy,open_restartphy,close_restartphy |
---|
| 28 | |
---|
| 29 | CONTAINS |
---|
| 30 | |
---|
| 31 | SUBROUTINE Open_startphy(filename) |
---|
| 32 | USE netcdf |
---|
| 33 | USE mod_phys_lmdz_para |
---|
| 34 | IMPLICIT NONE |
---|
| 35 | CHARACTER(LEN=*) :: filename |
---|
| 36 | INTEGER :: ierr |
---|
| 37 | |
---|
| 38 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 39 | ierr = NF90_OPEN (filename, NF90_NOWRITE,nid_start) |
---|
| 40 | IF (ierr.NE.NF90_NOERR) THEN |
---|
| 41 | write(6,*)' Pb d''ouverture du fichier '//filename |
---|
| 42 | write(6,*)' ierr = ', ierr |
---|
[2311] | 43 | CALL abort_physic("", "", 1) |
---|
[1001] | 44 | ENDIF |
---|
| 45 | ENDIF |
---|
| 46 | |
---|
| 47 | END SUBROUTINE Open_startphy |
---|
| 48 | |
---|
| 49 | SUBROUTINE Close_startphy |
---|
| 50 | USE netcdf |
---|
| 51 | USE mod_phys_lmdz_para |
---|
| 52 | IMPLICIT NONE |
---|
| 53 | INTEGER :: ierr |
---|
| 54 | |
---|
| 55 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 56 | ierr = NF90_CLOSE (nid_start) |
---|
| 57 | ENDIF |
---|
| 58 | |
---|
| 59 | END SUBROUTINE close_startphy |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | FUNCTION Inquire_Field(Field_name) |
---|
| 63 | USE netcdf |
---|
| 64 | USE mod_phys_lmdz_para |
---|
| 65 | IMPLICIT NONE |
---|
| 66 | CHARACTER(LEN=*) :: Field_name |
---|
| 67 | LOGICAL :: inquire_field |
---|
| 68 | INTEGER :: varid |
---|
| 69 | INTEGER :: ierr |
---|
| 70 | |
---|
| 71 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 72 | ierr=NF90_INQ_VARID(nid_start,Field_name,varid) |
---|
| 73 | IF (ierr==NF90_NOERR) THEN |
---|
| 74 | Inquire_field=.TRUE. |
---|
| 75 | ELSE |
---|
| 76 | Inquire_field=.FALSE. |
---|
| 77 | ENDIF |
---|
| 78 | ENDIF |
---|
| 79 | |
---|
| 80 | CALL bcast(Inquire_field) |
---|
| 81 | |
---|
| 82 | END FUNCTION Inquire_Field |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | SUBROUTINE Get_Field_r1(field_name,field,found) |
---|
| 86 | IMPLICIT NONE |
---|
| 87 | CHARACTER(LEN=*),INTENT(IN) :: Field_name |
---|
| 88 | REAL,INTENT(INOUT) :: Field(:) |
---|
| 89 | LOGICAL,INTENT(OUT),OPTIONAL :: found |
---|
| 90 | |
---|
[3070] | 91 | CALL Get_field_rgen(field_name,field,1,found) |
---|
[1001] | 92 | |
---|
| 93 | END SUBROUTINE Get_Field_r1 |
---|
| 94 | |
---|
| 95 | SUBROUTINE Get_Field_r2(field_name,field,found) |
---|
| 96 | IMPLICIT NONE |
---|
| 97 | CHARACTER(LEN=*),INTENT(IN) :: Field_name |
---|
| 98 | REAL,INTENT(INOUT) :: Field(:,:) |
---|
| 99 | LOGICAL,INTENT(OUT),OPTIONAL :: found |
---|
| 100 | |
---|
[3070] | 101 | CALL Get_field_rgen(field_name,field,size(field,2),found) |
---|
[1001] | 102 | |
---|
| 103 | |
---|
| 104 | END SUBROUTINE Get_Field_r2 |
---|
| 105 | |
---|
| 106 | SUBROUTINE Get_Field_r3(field_name,field,found) |
---|
| 107 | IMPLICIT NONE |
---|
| 108 | CHARACTER(LEN=*),INTENT(IN) :: Field_name |
---|
| 109 | REAL,INTENT(INOUT) :: Field(:,:,:) |
---|
| 110 | LOGICAL,INTENT(OUT),OPTIONAL :: found |
---|
| 111 | |
---|
[3070] | 112 | CALL Get_field_rgen(field_name,field,size(field,2)*size(field,3),found) |
---|
[1001] | 113 | |
---|
| 114 | END SUBROUTINE Get_Field_r3 |
---|
| 115 | |
---|
| 116 | SUBROUTINE Get_field_rgen(field_name,field,field_size,found) |
---|
| 117 | USE netcdf |
---|
| 118 | USE dimphy |
---|
[3435] | 119 | USE geometry_mod |
---|
[1001] | 120 | USE mod_grid_phy_lmdz |
---|
| 121 | USE mod_phys_lmdz_para |
---|
| 122 | IMPLICIT NONE |
---|
| 123 | CHARACTER(LEN=*) :: Field_name |
---|
| 124 | INTEGER :: field_size |
---|
| 125 | REAL :: field(klon,field_size) |
---|
| 126 | LOGICAL,OPTIONAL :: found |
---|
| 127 | |
---|
[3465] | 128 | REAL,ALLOCATABLE :: field_glo(:,:) |
---|
| 129 | REAL,ALLOCATABLE :: field_glo_tmp(:,:) |
---|
| 130 | INTEGER,ALLOCATABLE :: ind_cell_glo_glo(:) |
---|
[1001] | 131 | LOGICAL :: tmp_found |
---|
| 132 | INTEGER :: varid |
---|
[3435] | 133 | INTEGER :: ierr,i |
---|
| 134 | |
---|
[3465] | 135 | IF (is_master) THEN |
---|
| 136 | ALLOCATE(ind_cell_glo_glo(klon_glo)) |
---|
| 137 | ALLOCATE(field_glo(klon_glo,field_size)) |
---|
| 138 | ALLOCATE(field_glo_tmp(klon_glo,field_size)) |
---|
| 139 | ELSE |
---|
| 140 | ALLOCATE(ind_cell_glo_glo(0)) |
---|
| 141 | ALLOCATE(field_glo(0,0)) |
---|
| 142 | ENDIF |
---|
| 143 | |
---|
[3435] | 144 | CALL gather(ind_cell_glo,ind_cell_glo_glo) |
---|
[1001] | 145 | |
---|
[3435] | 146 | IF (is_master) THEN |
---|
[1001] | 147 | |
---|
| 148 | ierr=NF90_INQ_VARID(nid_start,Field_name,varid) |
---|
| 149 | |
---|
| 150 | IF (ierr==NF90_NOERR) THEN |
---|
[3435] | 151 | CALL body(field_glo_tmp) |
---|
[1001] | 152 | tmp_found=.TRUE. |
---|
| 153 | ELSE |
---|
| 154 | tmp_found=.FALSE. |
---|
| 155 | ENDIF |
---|
| 156 | |
---|
| 157 | ENDIF |
---|
| 158 | |
---|
| 159 | CALL bcast(tmp_found) |
---|
| 160 | |
---|
| 161 | IF (tmp_found) THEN |
---|
[3435] | 162 | IF (is_master) THEN |
---|
| 163 | DO i=1,klon_glo |
---|
| 164 | field_glo(i,:)=field_glo_tmp(ind_cell_glo_glo(i),:) |
---|
| 165 | ENDDO |
---|
| 166 | ENDIF |
---|
[1001] | 167 | CALL scatter(field_glo,field) |
---|
| 168 | ENDIF |
---|
| 169 | |
---|
| 170 | IF (PRESENT(found)) THEN |
---|
| 171 | found=tmp_found |
---|
| 172 | ELSE |
---|
| 173 | IF (.NOT. tmp_found) THEN |
---|
| 174 | PRINT*, 'phyetat0: Le champ <'//field_name//'> est absent' |
---|
[2311] | 175 | call abort_physic("", "", 1) |
---|
[1001] | 176 | ENDIF |
---|
| 177 | ENDIF |
---|
| 178 | |
---|
| 179 | |
---|
| 180 | CONTAINS |
---|
| 181 | |
---|
| 182 | SUBROUTINE body(field_glo) |
---|
| 183 | REAL :: field_glo(klon_glo*field_size) |
---|
| 184 | ierr=NF90_GET_VAR(nid_start,varid,field_glo) |
---|
| 185 | IF (ierr/=NF90_NOERR) THEN |
---|
[1619] | 186 | ! La variable exist dans le fichier mais la lecture a echouee. |
---|
[1001] | 187 | PRINT*, 'phyetat0: Lecture echouee pour <'//field_name//'>' |
---|
[1619] | 188 | |
---|
| 189 | IF (field_name=='CLWCON' .OR. field_name=='RNEBCON' .OR. field_name=='RATQS') THEN |
---|
| 190 | ! Essaye de lire le variable sur surface uniqument, comme fait avant |
---|
| 191 | field_glo(:)=0. |
---|
| 192 | ierr=NF90_GET_VAR(nid_start,varid,field_glo(1:klon_glo)) |
---|
| 193 | IF (ierr/=NF90_NOERR) THEN |
---|
| 194 | PRINT*, 'phyetat0: Lecture echouee aussi en 2D pour <'//field_name//'>' |
---|
[2311] | 195 | call abort_physic("", "", 1) |
---|
[1619] | 196 | ELSE |
---|
| 197 | PRINT*, 'phyetat0: La variable <'//field_name//'> lu sur surface seulement'!, selon ancien format, le reste mis a zero' |
---|
| 198 | END IF |
---|
| 199 | ELSE |
---|
[2311] | 200 | call abort_physic("", "", 1) |
---|
[1619] | 201 | ENDIF |
---|
[1001] | 202 | ENDIF |
---|
| 203 | |
---|
| 204 | END SUBROUTINE body |
---|
| 205 | |
---|
| 206 | END SUBROUTINE Get_field_rgen |
---|
| 207 | |
---|
| 208 | |
---|
| 209 | SUBROUTINE get_var_r0(var_name,var,found) |
---|
| 210 | IMPLICIT NONE |
---|
| 211 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 212 | REAL,INTENT(INOUT) :: var |
---|
| 213 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 214 | |
---|
| 215 | REAL :: varout(1) |
---|
| 216 | |
---|
[3070] | 217 | CALL Get_var_rgen(var_name,varout,size(varout),found) |
---|
[1001] | 218 | var=varout(1) |
---|
| 219 | |
---|
| 220 | END SUBROUTINE get_var_r0 |
---|
| 221 | |
---|
| 222 | SUBROUTINE get_var_r1(var_name,var,found) |
---|
| 223 | IMPLICIT NONE |
---|
| 224 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 225 | REAL,INTENT(INOUT) :: var(:) |
---|
| 226 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 227 | |
---|
[3070] | 228 | CALL Get_var_rgen(var_name,var,size(var),found) |
---|
[1001] | 229 | |
---|
| 230 | END SUBROUTINE get_var_r1 |
---|
| 231 | |
---|
| 232 | SUBROUTINE get_var_r2(var_name,var,found) |
---|
| 233 | IMPLICIT NONE |
---|
| 234 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 235 | REAL,INTENT(OUT) :: var(:,:) |
---|
| 236 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 237 | |
---|
[3070] | 238 | CALL Get_var_rgen(var_name,var,size(var),found) |
---|
[1001] | 239 | |
---|
| 240 | END SUBROUTINE get_var_r2 |
---|
| 241 | |
---|
| 242 | SUBROUTINE get_var_r3(var_name,var,found) |
---|
| 243 | IMPLICIT NONE |
---|
| 244 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 245 | REAL,INTENT(INOUT) :: var(:,:,:) |
---|
| 246 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 247 | |
---|
[3070] | 248 | CALL Get_var_rgen(var_name,var,size(var),found) |
---|
[1001] | 249 | |
---|
| 250 | END SUBROUTINE get_var_r3 |
---|
| 251 | |
---|
| 252 | SUBROUTINE Get_var_rgen(var_name,var,var_size,found) |
---|
| 253 | USE netcdf |
---|
| 254 | USE dimphy |
---|
| 255 | USE mod_grid_phy_lmdz |
---|
| 256 | USE mod_phys_lmdz_para |
---|
| 257 | IMPLICIT NONE |
---|
| 258 | CHARACTER(LEN=*) :: var_name |
---|
| 259 | INTEGER :: var_size |
---|
| 260 | REAL :: var(var_size) |
---|
| 261 | LOGICAL,OPTIONAL :: found |
---|
| 262 | |
---|
| 263 | LOGICAL :: tmp_found |
---|
| 264 | INTEGER :: varid |
---|
| 265 | INTEGER :: ierr |
---|
| 266 | |
---|
| 267 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 268 | |
---|
| 269 | ierr=NF90_INQ_VARID(nid_start,var_name,varid) |
---|
| 270 | |
---|
| 271 | IF (ierr==NF90_NOERR) THEN |
---|
| 272 | ierr=NF90_GET_VAR(nid_start,varid,var) |
---|
| 273 | IF (ierr/=NF90_NOERR) THEN |
---|
| 274 | PRINT*, 'phyetat0: Lecture echouee pour <'//var_name//'>' |
---|
[2311] | 275 | call abort_physic("", "", 1) |
---|
[1001] | 276 | ENDIF |
---|
| 277 | tmp_found=.TRUE. |
---|
| 278 | ELSE |
---|
| 279 | tmp_found=.FALSE. |
---|
| 280 | ENDIF |
---|
| 281 | |
---|
| 282 | ENDIF |
---|
| 283 | |
---|
| 284 | CALL bcast(tmp_found) |
---|
| 285 | |
---|
| 286 | IF (tmp_found) THEN |
---|
| 287 | CALL bcast(var) |
---|
| 288 | ENDIF |
---|
| 289 | |
---|
| 290 | IF (PRESENT(found)) THEN |
---|
| 291 | found=tmp_found |
---|
| 292 | ELSE |
---|
| 293 | IF (.NOT. tmp_found) THEN |
---|
| 294 | PRINT*, 'phyetat0: La variable champ <'//var_name//'> est absente' |
---|
[2311] | 295 | call abort_physic("", "", 1) |
---|
[1001] | 296 | ENDIF |
---|
| 297 | ENDIF |
---|
| 298 | |
---|
| 299 | END SUBROUTINE Get_var_rgen |
---|
| 300 | |
---|
| 301 | |
---|
| 302 | SUBROUTINE open_restartphy(filename) |
---|
| 303 | USE netcdf |
---|
[3401] | 304 | USE mod_phys_lmdz_para, ONLY: is_master |
---|
| 305 | USE mod_grid_phy_lmdz, ONLY: klon_glo |
---|
| 306 | USE dimphy, ONLY: klev, klevp1 |
---|
| 307 | USE print_control_mod, ONLY: lunout |
---|
[1001] | 308 | IMPLICIT NONE |
---|
| 309 | CHARACTER(LEN=*),INTENT(IN) :: filename |
---|
| 310 | INTEGER :: ierr |
---|
| 311 | |
---|
[3401] | 312 | IF (is_master) THEN |
---|
| 313 | ierr = NF90_CREATE(filename, IOR(NF90_CLOBBER,NF90_64BIT_OFFSET), & |
---|
| 314 | nid_restart) |
---|
[1001] | 315 | IF (ierr/=NF90_NOERR) THEN |
---|
[3401] | 316 | write(lunout,*)'open_restartphy: problem creating file '//trim(filename) |
---|
| 317 | write(lunout,*)trim(nf90_strerror(ierr)) |
---|
| 318 | CALL abort_physic("open_restartphy", trim(nf90_strerror(ierr)), 1) |
---|
[1001] | 319 | ENDIF |
---|
| 320 | |
---|
| 321 | ierr = NF90_PUT_ATT (nid_restart, NF90_GLOBAL, "title","Fichier redemmarage physique") |
---|
| 322 | |
---|
| 323 | ierr = NF90_DEF_DIM (nid_restart, "index", length, idim1) |
---|
| 324 | ierr = NF90_DEF_DIM (nid_restart, "points_physiques", klon_glo, idim2) |
---|
| 325 | ierr = NF90_DEF_DIM (nid_restart, "horizon_vertical", klon_glo*klev, idim3) |
---|
[1403] | 326 | ierr = NF90_DEF_DIM (nid_restart, "horizon_klevp1", klon_glo*klevp1, idim4) |
---|
[1001] | 327 | |
---|
| 328 | ierr = NF90_ENDDEF(nid_restart) |
---|
| 329 | ENDIF |
---|
| 330 | |
---|
| 331 | END SUBROUTINE open_restartphy |
---|
| 332 | |
---|
| 333 | SUBROUTINE close_restartphy |
---|
| 334 | USE netcdf |
---|
| 335 | USE mod_phys_lmdz_para |
---|
| 336 | IMPLICIT NONE |
---|
| 337 | INTEGER :: ierr |
---|
| 338 | |
---|
| 339 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 340 | ierr = NF90_CLOSE (nid_restart) |
---|
| 341 | ENDIF |
---|
| 342 | |
---|
| 343 | END SUBROUTINE close_restartphy |
---|
| 344 | |
---|
| 345 | |
---|
| 346 | SUBROUTINE put_field_r1(field_name,title,field) |
---|
| 347 | IMPLICIT NONE |
---|
| 348 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 349 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 350 | REAL,INTENT(IN) :: field(:) |
---|
| 351 | |
---|
| 352 | CALL put_field_rgen(field_name,title,field,1) |
---|
| 353 | |
---|
| 354 | END SUBROUTINE put_field_r1 |
---|
| 355 | |
---|
| 356 | SUBROUTINE put_field_r2(field_name,title,field) |
---|
| 357 | IMPLICIT NONE |
---|
| 358 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 359 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 360 | REAL,INTENT(IN) :: field(:,:) |
---|
| 361 | |
---|
| 362 | CALL put_field_rgen(field_name,title,field,size(field,2)) |
---|
| 363 | |
---|
| 364 | END SUBROUTINE put_field_r2 |
---|
| 365 | |
---|
| 366 | SUBROUTINE put_field_r3(field_name,title,field) |
---|
| 367 | IMPLICIT NONE |
---|
| 368 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 369 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 370 | REAL,INTENT(IN) :: field(:,:,:) |
---|
| 371 | |
---|
| 372 | CALL put_field_rgen(field_name,title,field,size(field,2)*size(field,3)) |
---|
| 373 | |
---|
| 374 | END SUBROUTINE put_field_r3 |
---|
| 375 | |
---|
| 376 | SUBROUTINE put_field_rgen(field_name,title,field,field_size) |
---|
| 377 | USE netcdf |
---|
| 378 | USE dimphy |
---|
[3435] | 379 | USE geometry_mod |
---|
[1001] | 380 | USE mod_grid_phy_lmdz |
---|
| 381 | USE mod_phys_lmdz_para |
---|
| 382 | IMPLICIT NONE |
---|
| 383 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 384 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 385 | INTEGER,INTENT(IN) :: field_size |
---|
| 386 | REAL,INTENT(IN) :: field(klon,field_size) |
---|
| 387 | |
---|
| 388 | REAL :: field_glo(klon_glo,field_size) |
---|
[3435] | 389 | REAL :: field_glo_tmp(klon_glo,field_size) |
---|
| 390 | ! INTEGER,ALLOCATABLE :: ind_cell_glo_glo(:) |
---|
| 391 | INTEGER :: ind_cell_glo_glo(klon_glo) |
---|
| 392 | INTEGER :: ierr,i |
---|
[1001] | 393 | INTEGER :: nvarid |
---|
| 394 | INTEGER :: idim |
---|
| 395 | |
---|
| 396 | |
---|
[3435] | 397 | ! IF (is_master) ALLOCATE(ind_cell_glo_glo(klon_glo)) |
---|
| 398 | CALL gather(ind_cell_glo,ind_cell_glo_glo) |
---|
| 399 | |
---|
| 400 | CALL gather(field,field_glo_tmp) |
---|
[1001] | 401 | |
---|
[3435] | 402 | IF (is_master) THEN |
---|
[1403] | 403 | |
---|
[3435] | 404 | DO i=1,klon_glo |
---|
| 405 | field_glo(ind_cell_glo_glo(i),:)=field_glo_tmp(i,:) |
---|
| 406 | ENDDO |
---|
| 407 | |
---|
| 408 | |
---|
[1001] | 409 | IF (field_size==1) THEN |
---|
| 410 | idim=idim2 |
---|
| 411 | ELSE IF (field_size==klev) THEN |
---|
| 412 | idim=idim3 |
---|
[1403] | 413 | ELSE IF (field_size==klevp1) THEN |
---|
| 414 | idim=idim4 |
---|
[1001] | 415 | ELSE |
---|
| 416 | PRINT *, "erreur phyredem : probleme de dimension" |
---|
[2311] | 417 | CALL abort_physic("", "", 1) |
---|
[1001] | 418 | ENDIF |
---|
| 419 | |
---|
| 420 | ierr = NF90_REDEF (nid_restart) |
---|
| 421 | #ifdef NC_DOUBLE |
---|
| 422 | ierr = NF90_DEF_VAR (nid_restart, field_name, NF90_DOUBLE,(/ idim /),nvarid) |
---|
| 423 | #else |
---|
| 424 | ierr = NF90_DEF_VAR (nid_restart, field_name, NF90_FLOAT,(/ idim /),nvarid) |
---|
| 425 | #endif |
---|
| 426 | IF (LEN_TRIM(title) > 0) ierr = NF90_PUT_ATT (nid_restart,nvarid,"title", title) |
---|
| 427 | ierr = NF90_ENDDEF(nid_restart) |
---|
| 428 | ierr = NF90_PUT_VAR(nid_restart,nvarid,RESHAPE(field_glo,(/klon_glo*field_size/))) |
---|
| 429 | ENDIF |
---|
| 430 | |
---|
| 431 | END SUBROUTINE put_field_rgen |
---|
| 432 | |
---|
| 433 | SUBROUTINE put_var_r0(var_name,title,var) |
---|
| 434 | IMPLICIT NONE |
---|
| 435 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 436 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 437 | REAL,INTENT(IN) :: var |
---|
| 438 | REAL :: varin(1) |
---|
| 439 | |
---|
| 440 | varin(1)=var |
---|
| 441 | |
---|
| 442 | CALL put_var_rgen(var_name,title,varin,size(varin)) |
---|
| 443 | |
---|
| 444 | END SUBROUTINE put_var_r0 |
---|
| 445 | |
---|
| 446 | |
---|
| 447 | SUBROUTINE put_var_r1(var_name,title,var) |
---|
| 448 | IMPLICIT NONE |
---|
| 449 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 450 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 451 | REAL,INTENT(IN) :: var(:) |
---|
| 452 | |
---|
| 453 | CALL put_var_rgen(var_name,title,var,size(var)) |
---|
| 454 | |
---|
| 455 | END SUBROUTINE put_var_r1 |
---|
| 456 | |
---|
| 457 | SUBROUTINE put_var_r2(var_name,title,var) |
---|
| 458 | IMPLICIT NONE |
---|
| 459 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 460 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 461 | REAL,INTENT(IN) :: var(:,:) |
---|
| 462 | |
---|
| 463 | CALL put_var_rgen(var_name,title,var,size(var)) |
---|
| 464 | |
---|
| 465 | END SUBROUTINE put_var_r2 |
---|
| 466 | |
---|
| 467 | SUBROUTINE put_var_r3(var_name,title,var) |
---|
| 468 | IMPLICIT NONE |
---|
| 469 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 470 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 471 | REAL,INTENT(IN) :: var(:,:,:) |
---|
| 472 | |
---|
| 473 | CALL put_var_rgen(var_name,title,var,size(var)) |
---|
| 474 | |
---|
| 475 | END SUBROUTINE put_var_r3 |
---|
| 476 | |
---|
| 477 | SUBROUTINE put_var_rgen(var_name,title,var,var_size) |
---|
| 478 | USE netcdf |
---|
| 479 | USE dimphy |
---|
| 480 | USE mod_phys_lmdz_para |
---|
| 481 | IMPLICIT NONE |
---|
| 482 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 483 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 484 | INTEGER,INTENT(IN) :: var_size |
---|
| 485 | REAL,INTENT(IN) :: var(var_size) |
---|
| 486 | |
---|
| 487 | INTEGER :: ierr |
---|
| 488 | INTEGER :: nvarid |
---|
| 489 | |
---|
| 490 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
[1403] | 491 | |
---|
[1001] | 492 | IF (var_size/=length) THEN |
---|
| 493 | PRINT *, "erreur phyredem : probleme de dimension" |
---|
[2311] | 494 | call abort_physic("", "", 1) |
---|
[1001] | 495 | ENDIF |
---|
| 496 | |
---|
| 497 | ierr = NF90_REDEF (nid_restart) |
---|
| 498 | |
---|
| 499 | #ifdef NC_DOUBLE |
---|
| 500 | ierr = NF90_DEF_VAR (nid_restart, var_name, NF90_DOUBLE,(/ idim1 /),nvarid) |
---|
| 501 | #else |
---|
| 502 | ierr = NF90_DEF_VAR (nid_restart, var_name, NF90_FLOAT,(/ idim1 /),nvarid) |
---|
| 503 | #endif |
---|
| 504 | IF (LEN_TRIM(title)>0) ierr = NF90_PUT_ATT (nid_restart,nvarid,"title", title) |
---|
| 505 | ierr = NF90_ENDDEF(nid_restart) |
---|
| 506 | |
---|
| 507 | ierr = NF90_PUT_VAR(nid_restart,nvarid,var) |
---|
| 508 | |
---|
| 509 | ENDIF |
---|
| 510 | |
---|
| 511 | END SUBROUTINE put_var_rgen |
---|
| 512 | |
---|
| 513 | END MODULE iostart |
---|