[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 |
---|
| 119 | USE mod_grid_phy_lmdz |
---|
| 120 | USE mod_phys_lmdz_para |
---|
| 121 | IMPLICIT NONE |
---|
| 122 | CHARACTER(LEN=*) :: Field_name |
---|
| 123 | INTEGER :: field_size |
---|
| 124 | REAL :: field(klon,field_size) |
---|
| 125 | LOGICAL,OPTIONAL :: found |
---|
| 126 | |
---|
| 127 | REAL :: field_glo(klon_glo,field_size) |
---|
| 128 | LOGICAL :: tmp_found |
---|
| 129 | INTEGER :: varid |
---|
| 130 | INTEGER :: ierr |
---|
| 131 | |
---|
| 132 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 133 | |
---|
| 134 | ierr=NF90_INQ_VARID(nid_start,Field_name,varid) |
---|
| 135 | |
---|
| 136 | IF (ierr==NF90_NOERR) THEN |
---|
| 137 | CALL body(field_glo) |
---|
| 138 | tmp_found=.TRUE. |
---|
| 139 | ELSE |
---|
| 140 | tmp_found=.FALSE. |
---|
| 141 | ENDIF |
---|
| 142 | |
---|
| 143 | ENDIF |
---|
| 144 | |
---|
| 145 | CALL bcast(tmp_found) |
---|
| 146 | |
---|
| 147 | IF (tmp_found) THEN |
---|
| 148 | CALL scatter(field_glo,field) |
---|
| 149 | ENDIF |
---|
| 150 | |
---|
| 151 | IF (PRESENT(found)) THEN |
---|
| 152 | found=tmp_found |
---|
| 153 | ELSE |
---|
| 154 | IF (.NOT. tmp_found) THEN |
---|
| 155 | PRINT*, 'phyetat0: Le champ <'//field_name//'> est absent' |
---|
[2311] | 156 | call abort_physic("", "", 1) |
---|
[1001] | 157 | ENDIF |
---|
| 158 | ENDIF |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | CONTAINS |
---|
| 162 | |
---|
| 163 | SUBROUTINE body(field_glo) |
---|
| 164 | REAL :: field_glo(klon_glo*field_size) |
---|
| 165 | ierr=NF90_GET_VAR(nid_start,varid,field_glo) |
---|
| 166 | IF (ierr/=NF90_NOERR) THEN |
---|
[1619] | 167 | ! La variable exist dans le fichier mais la lecture a echouee. |
---|
[1001] | 168 | PRINT*, 'phyetat0: Lecture echouee pour <'//field_name//'>' |
---|
[1619] | 169 | |
---|
| 170 | IF (field_name=='CLWCON' .OR. field_name=='RNEBCON' .OR. field_name=='RATQS') THEN |
---|
| 171 | ! Essaye de lire le variable sur surface uniqument, comme fait avant |
---|
| 172 | field_glo(:)=0. |
---|
| 173 | ierr=NF90_GET_VAR(nid_start,varid,field_glo(1:klon_glo)) |
---|
| 174 | IF (ierr/=NF90_NOERR) THEN |
---|
| 175 | PRINT*, 'phyetat0: Lecture echouee aussi en 2D pour <'//field_name//'>' |
---|
[2311] | 176 | call abort_physic("", "", 1) |
---|
[1619] | 177 | ELSE |
---|
| 178 | PRINT*, 'phyetat0: La variable <'//field_name//'> lu sur surface seulement'!, selon ancien format, le reste mis a zero' |
---|
| 179 | END IF |
---|
| 180 | ELSE |
---|
[2311] | 181 | call abort_physic("", "", 1) |
---|
[1619] | 182 | ENDIF |
---|
[1001] | 183 | ENDIF |
---|
| 184 | |
---|
| 185 | END SUBROUTINE body |
---|
| 186 | |
---|
| 187 | END SUBROUTINE Get_field_rgen |
---|
| 188 | |
---|
| 189 | |
---|
| 190 | SUBROUTINE get_var_r0(var_name,var,found) |
---|
| 191 | IMPLICIT NONE |
---|
| 192 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 193 | REAL,INTENT(INOUT) :: var |
---|
| 194 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 195 | |
---|
| 196 | REAL :: varout(1) |
---|
| 197 | |
---|
[3070] | 198 | CALL Get_var_rgen(var_name,varout,size(varout),found) |
---|
[1001] | 199 | var=varout(1) |
---|
| 200 | |
---|
| 201 | END SUBROUTINE get_var_r0 |
---|
| 202 | |
---|
| 203 | SUBROUTINE get_var_r1(var_name,var,found) |
---|
| 204 | IMPLICIT NONE |
---|
| 205 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 206 | REAL,INTENT(INOUT) :: var(:) |
---|
| 207 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 208 | |
---|
[3070] | 209 | CALL Get_var_rgen(var_name,var,size(var),found) |
---|
[1001] | 210 | |
---|
| 211 | END SUBROUTINE get_var_r1 |
---|
| 212 | |
---|
| 213 | SUBROUTINE get_var_r2(var_name,var,found) |
---|
| 214 | IMPLICIT NONE |
---|
| 215 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 216 | REAL,INTENT(OUT) :: var(:,:) |
---|
| 217 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 218 | |
---|
[3070] | 219 | CALL Get_var_rgen(var_name,var,size(var),found) |
---|
[1001] | 220 | |
---|
| 221 | END SUBROUTINE get_var_r2 |
---|
| 222 | |
---|
| 223 | SUBROUTINE get_var_r3(var_name,var,found) |
---|
| 224 | IMPLICIT NONE |
---|
| 225 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 226 | REAL,INTENT(INOUT) :: var(:,:,:) |
---|
| 227 | LOGICAL,OPTIONAL,INTENT(OUT) :: found |
---|
| 228 | |
---|
[3070] | 229 | CALL Get_var_rgen(var_name,var,size(var),found) |
---|
[1001] | 230 | |
---|
| 231 | END SUBROUTINE get_var_r3 |
---|
| 232 | |
---|
| 233 | SUBROUTINE Get_var_rgen(var_name,var,var_size,found) |
---|
| 234 | USE netcdf |
---|
| 235 | USE dimphy |
---|
| 236 | USE mod_grid_phy_lmdz |
---|
| 237 | USE mod_phys_lmdz_para |
---|
| 238 | IMPLICIT NONE |
---|
| 239 | CHARACTER(LEN=*) :: var_name |
---|
| 240 | INTEGER :: var_size |
---|
| 241 | REAL :: var(var_size) |
---|
| 242 | LOGICAL,OPTIONAL :: found |
---|
| 243 | |
---|
| 244 | LOGICAL :: tmp_found |
---|
| 245 | INTEGER :: varid |
---|
| 246 | INTEGER :: ierr |
---|
| 247 | |
---|
| 248 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 249 | |
---|
| 250 | ierr=NF90_INQ_VARID(nid_start,var_name,varid) |
---|
| 251 | |
---|
| 252 | IF (ierr==NF90_NOERR) THEN |
---|
| 253 | ierr=NF90_GET_VAR(nid_start,varid,var) |
---|
| 254 | IF (ierr/=NF90_NOERR) THEN |
---|
| 255 | PRINT*, 'phyetat0: Lecture echouee pour <'//var_name//'>' |
---|
[2311] | 256 | call abort_physic("", "", 1) |
---|
[1001] | 257 | ENDIF |
---|
| 258 | tmp_found=.TRUE. |
---|
| 259 | ELSE |
---|
| 260 | tmp_found=.FALSE. |
---|
| 261 | ENDIF |
---|
| 262 | |
---|
| 263 | ENDIF |
---|
| 264 | |
---|
| 265 | CALL bcast(tmp_found) |
---|
| 266 | |
---|
| 267 | IF (tmp_found) THEN |
---|
| 268 | CALL bcast(var) |
---|
| 269 | ENDIF |
---|
| 270 | |
---|
| 271 | IF (PRESENT(found)) THEN |
---|
| 272 | found=tmp_found |
---|
| 273 | ELSE |
---|
| 274 | IF (.NOT. tmp_found) THEN |
---|
| 275 | PRINT*, 'phyetat0: La variable champ <'//var_name//'> est absente' |
---|
[2311] | 276 | call abort_physic("", "", 1) |
---|
[1001] | 277 | ENDIF |
---|
| 278 | ENDIF |
---|
| 279 | |
---|
| 280 | END SUBROUTINE Get_var_rgen |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | SUBROUTINE open_restartphy(filename) |
---|
| 284 | USE netcdf |
---|
| 285 | USE mod_phys_lmdz_para |
---|
| 286 | USE mod_grid_phy_lmdz |
---|
| 287 | USE dimphy |
---|
| 288 | IMPLICIT NONE |
---|
| 289 | CHARACTER(LEN=*),INTENT(IN) :: filename |
---|
| 290 | INTEGER :: ierr |
---|
| 291 | |
---|
| 292 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 293 | ierr = NF90_CREATE(filename, NF90_CLOBBER, nid_restart) |
---|
| 294 | IF (ierr/=NF90_NOERR) THEN |
---|
| 295 | write(6,*)' Pb d''ouverture du fichier '//filename |
---|
| 296 | write(6,*)' ierr = ', ierr |
---|
[2311] | 297 | CALL abort_physic("", "", 1) |
---|
[1001] | 298 | ENDIF |
---|
| 299 | |
---|
| 300 | ierr = NF90_PUT_ATT (nid_restart, NF90_GLOBAL, "title","Fichier redemmarage physique") |
---|
| 301 | |
---|
| 302 | ierr = NF90_DEF_DIM (nid_restart, "index", length, idim1) |
---|
| 303 | ierr = NF90_DEF_DIM (nid_restart, "points_physiques", klon_glo, idim2) |
---|
| 304 | ierr = NF90_DEF_DIM (nid_restart, "horizon_vertical", klon_glo*klev, idim3) |
---|
[1403] | 305 | ierr = NF90_DEF_DIM (nid_restart, "horizon_klevp1", klon_glo*klevp1, idim4) |
---|
[1001] | 306 | |
---|
| 307 | ierr = NF90_ENDDEF(nid_restart) |
---|
| 308 | ENDIF |
---|
| 309 | |
---|
| 310 | END SUBROUTINE open_restartphy |
---|
| 311 | |
---|
| 312 | SUBROUTINE close_restartphy |
---|
| 313 | USE netcdf |
---|
| 314 | USE mod_phys_lmdz_para |
---|
| 315 | IMPLICIT NONE |
---|
| 316 | INTEGER :: ierr |
---|
| 317 | |
---|
| 318 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 319 | ierr = NF90_CLOSE (nid_restart) |
---|
| 320 | ENDIF |
---|
| 321 | |
---|
| 322 | END SUBROUTINE close_restartphy |
---|
| 323 | |
---|
| 324 | |
---|
| 325 | SUBROUTINE put_field_r1(field_name,title,field) |
---|
| 326 | IMPLICIT NONE |
---|
| 327 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 328 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 329 | REAL,INTENT(IN) :: field(:) |
---|
| 330 | |
---|
| 331 | CALL put_field_rgen(field_name,title,field,1) |
---|
| 332 | |
---|
| 333 | END SUBROUTINE put_field_r1 |
---|
| 334 | |
---|
| 335 | SUBROUTINE put_field_r2(field_name,title,field) |
---|
| 336 | IMPLICIT NONE |
---|
| 337 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 338 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 339 | REAL,INTENT(IN) :: field(:,:) |
---|
| 340 | |
---|
| 341 | CALL put_field_rgen(field_name,title,field,size(field,2)) |
---|
| 342 | |
---|
| 343 | END SUBROUTINE put_field_r2 |
---|
| 344 | |
---|
| 345 | SUBROUTINE put_field_r3(field_name,title,field) |
---|
| 346 | IMPLICIT NONE |
---|
| 347 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 348 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 349 | REAL,INTENT(IN) :: field(:,:,:) |
---|
| 350 | |
---|
| 351 | CALL put_field_rgen(field_name,title,field,size(field,2)*size(field,3)) |
---|
| 352 | |
---|
| 353 | END SUBROUTINE put_field_r3 |
---|
| 354 | |
---|
| 355 | SUBROUTINE put_field_rgen(field_name,title,field,field_size) |
---|
| 356 | USE netcdf |
---|
| 357 | USE dimphy |
---|
| 358 | USE mod_grid_phy_lmdz |
---|
| 359 | USE mod_phys_lmdz_para |
---|
| 360 | IMPLICIT NONE |
---|
| 361 | CHARACTER(LEN=*),INTENT(IN) :: field_name |
---|
| 362 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 363 | INTEGER,INTENT(IN) :: field_size |
---|
| 364 | REAL,INTENT(IN) :: field(klon,field_size) |
---|
| 365 | |
---|
| 366 | REAL :: field_glo(klon_glo,field_size) |
---|
| 367 | INTEGER :: ierr |
---|
| 368 | INTEGER :: nvarid |
---|
| 369 | INTEGER :: idim |
---|
| 370 | |
---|
| 371 | |
---|
| 372 | CALL gather(field,field_glo) |
---|
| 373 | |
---|
| 374 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
[1403] | 375 | |
---|
[1001] | 376 | IF (field_size==1) THEN |
---|
| 377 | idim=idim2 |
---|
| 378 | ELSE IF (field_size==klev) THEN |
---|
| 379 | idim=idim3 |
---|
[1403] | 380 | ELSE IF (field_size==klevp1) THEN |
---|
| 381 | idim=idim4 |
---|
[1001] | 382 | ELSE |
---|
| 383 | PRINT *, "erreur phyredem : probleme de dimension" |
---|
[2311] | 384 | CALL abort_physic("", "", 1) |
---|
[1001] | 385 | ENDIF |
---|
| 386 | |
---|
| 387 | ierr = NF90_REDEF (nid_restart) |
---|
| 388 | #ifdef NC_DOUBLE |
---|
| 389 | ierr = NF90_DEF_VAR (nid_restart, field_name, NF90_DOUBLE,(/ idim /),nvarid) |
---|
| 390 | #else |
---|
| 391 | ierr = NF90_DEF_VAR (nid_restart, field_name, NF90_FLOAT,(/ idim /),nvarid) |
---|
| 392 | #endif |
---|
| 393 | IF (LEN_TRIM(title) > 0) ierr = NF90_PUT_ATT (nid_restart,nvarid,"title", title) |
---|
| 394 | ierr = NF90_ENDDEF(nid_restart) |
---|
| 395 | ierr = NF90_PUT_VAR(nid_restart,nvarid,RESHAPE(field_glo,(/klon_glo*field_size/))) |
---|
| 396 | ENDIF |
---|
| 397 | |
---|
| 398 | END SUBROUTINE put_field_rgen |
---|
| 399 | |
---|
| 400 | SUBROUTINE put_var_r0(var_name,title,var) |
---|
| 401 | IMPLICIT NONE |
---|
| 402 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 403 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 404 | REAL,INTENT(IN) :: var |
---|
| 405 | REAL :: varin(1) |
---|
| 406 | |
---|
| 407 | varin(1)=var |
---|
| 408 | |
---|
| 409 | CALL put_var_rgen(var_name,title,varin,size(varin)) |
---|
| 410 | |
---|
| 411 | END SUBROUTINE put_var_r0 |
---|
| 412 | |
---|
| 413 | |
---|
| 414 | SUBROUTINE put_var_r1(var_name,title,var) |
---|
| 415 | IMPLICIT NONE |
---|
| 416 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 417 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 418 | REAL,INTENT(IN) :: var(:) |
---|
| 419 | |
---|
| 420 | CALL put_var_rgen(var_name,title,var,size(var)) |
---|
| 421 | |
---|
| 422 | END SUBROUTINE put_var_r1 |
---|
| 423 | |
---|
| 424 | SUBROUTINE put_var_r2(var_name,title,var) |
---|
| 425 | IMPLICIT NONE |
---|
| 426 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 427 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 428 | REAL,INTENT(IN) :: var(:,:) |
---|
| 429 | |
---|
| 430 | CALL put_var_rgen(var_name,title,var,size(var)) |
---|
| 431 | |
---|
| 432 | END SUBROUTINE put_var_r2 |
---|
| 433 | |
---|
| 434 | SUBROUTINE put_var_r3(var_name,title,var) |
---|
| 435 | IMPLICIT NONE |
---|
| 436 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 437 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 438 | REAL,INTENT(IN) :: var(:,:,:) |
---|
| 439 | |
---|
| 440 | CALL put_var_rgen(var_name,title,var,size(var)) |
---|
| 441 | |
---|
| 442 | END SUBROUTINE put_var_r3 |
---|
| 443 | |
---|
| 444 | SUBROUTINE put_var_rgen(var_name,title,var,var_size) |
---|
| 445 | USE netcdf |
---|
| 446 | USE dimphy |
---|
| 447 | USE mod_phys_lmdz_para |
---|
| 448 | IMPLICIT NONE |
---|
| 449 | CHARACTER(LEN=*),INTENT(IN) :: var_name |
---|
| 450 | CHARACTER(LEN=*),INTENT(IN) :: title |
---|
| 451 | INTEGER,INTENT(IN) :: var_size |
---|
| 452 | REAL,INTENT(IN) :: var(var_size) |
---|
| 453 | |
---|
| 454 | INTEGER :: ierr |
---|
| 455 | INTEGER :: nvarid |
---|
| 456 | |
---|
| 457 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
[1403] | 458 | |
---|
[1001] | 459 | IF (var_size/=length) THEN |
---|
| 460 | PRINT *, "erreur phyredem : probleme de dimension" |
---|
[2311] | 461 | call abort_physic("", "", 1) |
---|
[1001] | 462 | ENDIF |
---|
| 463 | |
---|
| 464 | ierr = NF90_REDEF (nid_restart) |
---|
| 465 | |
---|
| 466 | #ifdef NC_DOUBLE |
---|
| 467 | ierr = NF90_DEF_VAR (nid_restart, var_name, NF90_DOUBLE,(/ idim1 /),nvarid) |
---|
| 468 | #else |
---|
| 469 | ierr = NF90_DEF_VAR (nid_restart, var_name, NF90_FLOAT,(/ idim1 /),nvarid) |
---|
| 470 | #endif |
---|
| 471 | IF (LEN_TRIM(title)>0) ierr = NF90_PUT_ATT (nid_restart,nvarid,"title", title) |
---|
| 472 | ierr = NF90_ENDDEF(nid_restart) |
---|
| 473 | |
---|
| 474 | ierr = NF90_PUT_VAR(nid_restart,nvarid,var) |
---|
| 475 | |
---|
| 476 | ENDIF |
---|
| 477 | |
---|
| 478 | END SUBROUTINE put_var_rgen |
---|
| 479 | |
---|
| 480 | END MODULE iostart |
---|