Changeset 3552 for trunk/LMDZ.GENERIC/libf
- Timestamp:
- Dec 13, 2024, 5:17:13 PM (7 weeks ago)
- Location:
- trunk/LMDZ.GENERIC/libf/phystd
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/iostart.F90
r3515 r3552 4 4 PRIVATE 5 5 INTEGER,SAVE :: nid_start ! NetCDF file identifier for startfi.nc file 6 INTEGER,SAVE :: nid_restart ! NetCDF file identifier for restartfi.nc file6 ! INTEGER,SAVE :: nid_restart ! NetCDF file identifier for restartfi.nc file 7 7 !$OMP THREADPRIVATE(nid_start,nid_restart) 8 8 … … 49 49 CONTAINS 50 50 51 SUBROUTINE open_startphy(filename )51 SUBROUTINE open_startphy(filename,nid_start) 52 52 USE netcdf, only: NF90_OPEN, NF90_NOERR, NF90_NOWRITE, nf90_strerror 53 53 USE mod_phys_lmdz_para, only: is_master, bcast 54 54 IMPLICIT NONE 55 CHARACTER(LEN=*) :: filename 56 INTEGER :: ierr 55 CHARACTER(LEN=*) :: filename 56 INTEGER,INTENT(INOUT) :: nid_start 57 INTEGER :: ierr 57 58 58 59 IF (is_master) THEN … … 69 70 END SUBROUTINE open_startphy 70 71 71 SUBROUTINE close_startphy 72 SUBROUTINE close_startphy(nid_start) 72 73 USE netcdf, only: NF90_CLOSE 73 74 USE mod_phys_lmdz_para, only: is_master 74 75 IMPLICIT NONE 75 INTEGER :: ierr 76 INTEGER,INTENT(IN) :: nid_start 77 INTEGER :: ierr 76 78 77 79 IF (is_master) THEN … … 82 84 83 85 84 FUNCTION inquire_field( Field_name)86 FUNCTION inquire_field(nid_start,Field_name) 85 87 ! check if a given field is present in the input file 86 88 USE netcdf, only: NF90_INQ_VARID, NF90_NOERR 87 89 USE mod_phys_lmdz_para, only: is_master, bcast 88 90 IMPLICIT NONE 91 INTEGER,INTENT(IN) :: nid_start 89 92 CHARACTER(LEN=*),INTENT(IN) :: Field_name 90 93 LOGICAL :: inquire_field … … 106 109 107 110 108 FUNCTION inquire_field_ndims( Field_name)111 FUNCTION inquire_field_ndims(nid_start,Field_name) 109 112 ! give the number of dimensions of "Field_name" stored in the input file 110 113 USE netcdf, only: nf90_inq_varid, nf90_inquire_variable, & … … 112 115 USE mod_phys_lmdz_para, only: is_master, bcast 113 116 IMPLICIT NONE 117 INTEGER,INTENT(IN) :: nid_start 114 118 CHARACTER(LEN=*),INTENT(IN) :: Field_name 115 119 INTEGER :: inquire_field_ndims … … 134 138 135 139 136 FUNCTION inquire_dimension( Field_name)140 FUNCTION inquire_dimension(nid_start,Field_name) 137 141 ! check if a given dimension is present in the input file 138 142 USE netcdf, only: nf90_inq_dimid, NF90_NOERR 139 143 USE mod_phys_lmdz_para, only: is_master, bcast 140 144 IMPLICIT NONE 145 INTEGER,INTENT(IN) :: nid_start 141 146 CHARACTER(LEN=*),INTENT(IN) :: Field_name 142 147 LOGICAL :: inquire_dimension … … 157 162 END FUNCTION inquire_dimension 158 163 159 FUNCTION inquire_dimension_length( Field_name)164 FUNCTION inquire_dimension_length(nid_start,Field_name) 160 165 ! give the length of the "Field_name" dimension stored in the input file 161 166 USE netcdf, only: nf90_inquire_dimension, nf90_inq_dimid, & … … 163 168 USE mod_phys_lmdz_para, only: is_master, bcast 164 169 IMPLICIT NONE 170 INTEGER,INTENT(IN) :: nid_start 165 171 CHARACTER(LEN=*),INTENT(IN) :: Field_name 166 172 INTEGER :: inquire_dimension_length … … 186 192 187 193 188 SUBROUTINE Get_Field_r1( field_name,field,found,timeindex)194 SUBROUTINE Get_Field_r1(nid_start,field_name,field,found,timeindex) 189 195 ! For a surface field 190 196 use mod_grid_phy_lmdz, only: klon_glo ! number of atmospheric columns (full grid) 191 197 IMPLICIT NONE 198 INTEGER,INTENT(IN) :: nid_start 192 199 CHARACTER(LEN=*),INTENT(IN) :: Field_name 193 200 REAL,INTENT(INOUT) :: Field(:) … … 205 212 206 213 IF (PRESENT(found)) THEN 207 CALL Get_field_rgen( field_name,field,1,corners,edges,found)214 CALL Get_field_rgen(nid_start,field_name,field,1,corners,edges,found) 208 215 ELSE 209 CALL Get_field_rgen( field_name,field,1,corners,edges)216 CALL Get_field_rgen(nid_start,field_name,field,1,corners,edges) 210 217 ENDIF 211 218 212 219 END SUBROUTINE Get_Field_r1 213 220 214 SUBROUTINE Get_Field_r2( field_name,field,found,timeindex)221 SUBROUTINE Get_Field_r2(nid_start,field_name,field,found,timeindex) 215 222 ! For a "3D" horizontal-vertical field 216 223 use mod_grid_phy_lmdz, only: klon_glo ! number of atmospheric columns (full grid) 217 224 IMPLICIT NONE 225 INTEGER,INTENT(IN) :: nid_start 218 226 CHARACTER(LEN=*),INTENT(IN) :: Field_name 219 227 REAL,INTENT(INOUT) :: Field(:,:) … … 232 240 233 241 IF (PRESENT(found)) THEN 234 CALL Get_field_rgen( field_name,field,size(field,2),&242 CALL Get_field_rgen(nid_start,field_name,field,size(field,2),& 235 243 corners,edges,found) 236 244 ELSE 237 CALL Get_field_rgen( field_name,field,size(field,2),&245 CALL Get_field_rgen(nid_start,field_name,field,size(field,2),& 238 246 corners,edges) 239 247 ENDIF … … 242 250 END SUBROUTINE Get_Field_r2 243 251 244 SUBROUTINE Get_Field_r3( field_name,field,found,timeindex)252 SUBROUTINE Get_Field_r3(nid_start,field_name,field,found,timeindex) 245 253 ! for a "4D" field surf/alt/?? 246 254 use mod_grid_phy_lmdz, only: klon_glo ! number of atmospheric columns (full grid) 247 255 IMPLICIT NONE 256 INTEGER,INTENT(IN) :: nid_start 248 257 CHARACTER(LEN=*),INTENT(IN) :: Field_name 249 258 REAL,INTENT(INOUT) :: Field(:,:,:) … … 263 272 264 273 IF (PRESENT(found)) THEN 265 CALL Get_field_rgen( field_name,field,size(field,2)*size(field,3),&274 CALL Get_field_rgen(nid_start,field_name,field,size(field,2)*size(field,3),& 266 275 corners,edges,found) 267 276 ELSE 268 CALL Get_field_rgen( field_name,field,size(field,2)*size(field,3),&277 CALL Get_field_rgen(nid_start,field_name,field,size(field,2)*size(field,3),& 269 278 corners,edges) 270 279 ENDIF … … 272 281 END SUBROUTINE Get_Field_r3 273 282 274 SUBROUTINE Get_field_rgen( field_name,field,field_size, &283 SUBROUTINE Get_field_rgen(nid_start,field_name,field,field_size, & 275 284 corners,edges,found) 276 285 USE netcdf … … 279 288 USE mod_phys_lmdz_para 280 289 IMPLICIT NONE 290 INTEGER,INTENT(IN) :: nid_start 281 291 CHARACTER(LEN=*) :: Field_name 282 292 INTEGER :: field_size … … 296 306 297 307 IF (ierr==NF90_NOERR) THEN 298 CALL body(field_glo )308 CALL body(field_glo,nid_start) 299 309 tmp_found=.TRUE. 300 310 ELSE … … 322 332 CONTAINS 323 333 324 SUBROUTINE body(field_glo )334 SUBROUTINE body(field_glo,nid_start) 325 335 REAL :: field_glo(klon_glo*field_size) 336 INTEGER,INTENT(IN) :: nid_start 326 337 ierr=NF90_GET_VAR(nid_start,varid,field_glo,corners,edges) 327 338 IF (ierr/=NF90_NOERR) THEN … … 349 360 350 361 351 SUBROUTINE get_var_r0( var_name,var,found)362 SUBROUTINE get_var_r0(nid_start,var_name,var,found) 352 363 ! Get a scalar from input file 353 364 IMPLICIT NONE 365 INTEGER,INTENT(IN) :: nid_start 354 366 CHARACTER(LEN=*),INTENT(IN) :: var_name 355 367 REAL,INTENT(INOUT) :: var … … 359 371 360 372 IF (PRESENT(found)) THEN 361 CALL Get_var_rgen( var_name,varout,size(varout),found)373 CALL Get_var_rgen(nid_start,var_name,varout,size(varout),found) 362 374 ELSE 363 CALL Get_var_rgen( var_name,varout,size(varout))375 CALL Get_var_rgen(nid_start,var_name,varout,size(varout)) 364 376 ENDIF 365 377 var=varout(1) … … 367 379 END SUBROUTINE get_var_r0 368 380 369 SUBROUTINE get_var_r1( var_name,var,found)381 SUBROUTINE get_var_r1(nid_start,var_name,var,found) 370 382 ! Get a vector from input file 371 383 IMPLICIT NONE … … 373 385 REAL,INTENT(INOUT) :: var(:) 374 386 LOGICAL,OPTIONAL,INTENT(OUT) :: found 387 INTEGER,INTENT(IN) :: nid_start 375 388 376 389 IF (PRESENT(found)) THEN 377 CALL Get_var_rgen( var_name,var,size(var),found)390 CALL Get_var_rgen(nid_start,var_name,var,size(var),found) 378 391 ELSE 379 CALL Get_var_rgen( var_name,var,size(var))392 CALL Get_var_rgen(nid_start,var_name,var,size(var)) 380 393 ENDIF 381 394 382 395 END SUBROUTINE get_var_r1 383 396 384 SUBROUTINE get_var_r2( var_name,var,found)397 SUBROUTINE get_var_r2(nid_start,var_name,var,found) 385 398 ! Get a 2D field from input file 386 399 IMPLICIT NONE … … 388 401 REAL,INTENT(OUT) :: var(:,:) 389 402 LOGICAL,OPTIONAL,INTENT(OUT) :: found 403 INTEGER,INTENT(IN) :: nid_start 390 404 391 405 IF (PRESENT(found)) THEN 392 CALL Get_var_rgen( var_name,var,size(var),found)406 CALL Get_var_rgen(nid_start,var_name,var,size(var),found) 393 407 ELSE 394 CALL Get_var_rgen( var_name,var,size(var))408 CALL Get_var_rgen(nid_start,var_name,var,size(var)) 395 409 ENDIF 396 410 397 411 END SUBROUTINE get_var_r2 398 412 399 SUBROUTINE get_var_r3( var_name,var,found)413 SUBROUTINE get_var_r3(nid_start,var_name,var,found) 400 414 ! Get a 3D field frominput file 401 415 IMPLICIT NONE … … 403 417 REAL,INTENT(INOUT) :: var(:,:,:) 404 418 LOGICAL,OPTIONAL,INTENT(OUT) :: found 419 INTEGER,INTENT(IN) :: nid_start 405 420 406 421 IF (PRESENT(found)) THEN 407 CALL Get_var_rgen( var_name,var,size(var),found)422 CALL Get_var_rgen(nid_start,var_name,var,size(var),found) 408 423 ELSE 409 CALL Get_var_rgen( var_name,var,size(var))424 CALL Get_var_rgen(nid_start,var_name,var,size(var)) 410 425 ENDIF 411 426 412 427 END SUBROUTINE get_var_r3 413 428 414 SUBROUTINE Get_var_rgen( var_name,var,var_size,found)429 SUBROUTINE Get_var_rgen(nid_start,var_name,var,var_size,found) 415 430 USE netcdf 416 431 USE dimphy … … 418 433 USE mod_phys_lmdz_para 419 434 IMPLICIT NONE 435 INTEGER,INTENT(IN) :: nid_start 420 436 CHARACTER(LEN=*) :: var_name 421 437 INTEGER :: var_size … … 463 479 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 464 480 465 SUBROUTINE create_restartphy(filename )481 SUBROUTINE create_restartphy(filename,nid_restart) 466 482 USE netcdf, only: NF90_CREATE, NF90_CLOBBER, NF90_64BIT_OFFSET, & 467 483 NF90_NOERR, nf90_strerror, & … … 478 494 IMPLICIT NONE 479 495 CHARACTER(LEN=*),INTENT(IN) :: filename 496 INTEGER,INTENT(INOUT) :: nid_restart 480 497 INTEGER :: ierr 481 498 … … 580 597 END SUBROUTINE create_restartphy 581 598 582 SUBROUTINE open_restartphy(filename )599 SUBROUTINE open_restartphy(filename,nid_restart) 583 600 USE netcdf, only: NF90_OPEN, NF90_NOERR, NF90_WRITE, nf90_strerror 584 601 USE mod_phys_lmdz_para, only: is_master … … 586 603 IMPLICIT NONE 587 604 CHARACTER(LEN=*),INTENT(IN) :: filename 605 INTEGER,INTENT(INOUT) :: nid_restart 588 606 INTEGER :: ierr 589 607 … … 599 617 END SUBROUTINE open_restartphy 600 618 601 SUBROUTINE close_restartphy 619 SUBROUTINE close_restartphy(nid_restart) 602 620 USE netcdf, only: NF90_CLOSE 603 621 USE mod_phys_lmdz_para, only: is_master 604 622 IMPLICIT NONE 605 INTEGER :: ierr 623 INTEGER,INTENT(IN) :: nid_restart 624 INTEGER :: ierr 606 625 607 626 IF (is_master) THEN … … 611 630 END SUBROUTINE close_restartphy 612 631 613 SUBROUTINE put_field_r1( field_name,title,field,time)632 SUBROUTINE put_field_r1(nid_restart,field_name,title,field,time) 614 633 ! For a surface field 615 634 IMPLICIT NONE 635 INTEGER,INTENT(IN) :: nid_restart 616 636 CHARACTER(LEN=*),INTENT(IN) :: field_name 617 637 CHARACTER(LEN=*),INTENT(IN) :: title … … 621 641 IF (present(time)) THEN 622 642 ! if timeindex is present, it is a time-dependent variable 623 CALL put_field_rgen( field_name,title,field,1,time)643 CALL put_field_rgen(nid_restart,field_name,title,field,1,time) 624 644 ELSE 625 CALL put_field_rgen( field_name,title,field,1)645 CALL put_field_rgen(nid_restart,field_name,title,field,1) 626 646 ENDIF 627 647 628 648 END SUBROUTINE put_field_r1 629 649 630 SUBROUTINE put_field_r2( field_name,title,field,time)650 SUBROUTINE put_field_r2(nid_restart,field_name,title,field,time) 631 651 ! For a "3D" horizontal-vertical field 632 652 IMPLICIT NONE 653 INTEGER,INTENT(IN) :: nid_restart 633 654 CHARACTER(LEN=*),INTENT(IN) :: field_name 634 655 CHARACTER(LEN=*),INTENT(IN) :: title … … 638 659 IF (present(time)) THEN 639 660 ! if timeindex is present, it is a time-dependent variable 640 CALL put_field_rgen( field_name,title,field,size(field,2),time)661 CALL put_field_rgen(nid_restart,field_name,title,field,size(field,2),time) 641 662 ELSE 642 CALL put_field_rgen( field_name,title,field,size(field,2))663 CALL put_field_rgen(nid_restart,field_name,title,field,size(field,2)) 643 664 ENDIF 644 665 645 666 END SUBROUTINE put_field_r2 646 667 647 SUBROUTINE put_field_r3( field_name,title,field,time)668 SUBROUTINE put_field_r3(nid_restart,field_name,title,field,time) 648 669 ! For a "4D" field surf/alt/?? 649 670 IMPLICIT NONE 671 INTEGER,INTENT(IN) :: nid_restart 650 672 CHARACTER(LEN=*),INTENT(IN) :: field_name 651 673 CHARACTER(LEN=*),INTENT(IN) :: title … … 655 677 IF (present(time)) THEN 656 678 ! if timeindex is present, it is a time-dependent variable 657 CALL put_field_rgen( field_name,title,field,size(field,2)*size(field,3),&679 CALL put_field_rgen(nid_restart,field_name,title,field,size(field,2)*size(field,3),& 658 680 time) 659 681 ELSE 660 CALL put_field_rgen( field_name,title,field,size(field,2)*size(field,3))682 CALL put_field_rgen(nid_restart,field_name,title,field,size(field,2)*size(field,3)) 661 683 ENDIF 662 684 663 685 END SUBROUTINE put_field_r3 664 686 665 SUBROUTINE put_field_rgen( field_name,title,field,field_size,time)687 SUBROUTINE put_field_rgen(nid_restart,field_name,title,field,field_size,time) 666 688 USE netcdf 667 689 USE dimphy … … 673 695 674 696 IMPLICIT NONE 697 INTEGER,INTENT(IN) :: nid_restart 675 698 CHARACTER(LEN=*),INTENT(IN) :: field_name 676 699 CHARACTER(LEN=*),INTENT(IN) :: title … … 918 941 END SUBROUTINE put_field_rgen 919 942 920 SUBROUTINE put_var_r0( var_name,title,var)943 SUBROUTINE put_var_r0(nid_restart,var_name,title,var) 921 944 ! Put a scalar in file 922 945 IMPLICIT NONE 946 INTEGER,INTENT(IN) :: nid_restart 923 947 CHARACTER(LEN=*),INTENT(IN) :: var_name 924 948 CHARACTER(LEN=*),INTENT(IN) :: title … … 928 952 varin(1)=var 929 953 930 CALL put_var_rgen( var_name,title,varin,size(varin))954 CALL put_var_rgen(nid_restart,var_name,title,varin,size(varin)) 931 955 932 956 END SUBROUTINE put_var_r0 933 957 934 958 935 SUBROUTINE put_var_r1( var_name,title,var)959 SUBROUTINE put_var_r1(nid_restart,var_name,title,var) 936 960 ! Put a vector in file 937 961 IMPLICIT NONE 962 INTEGER,INTENT(IN) :: nid_restart 938 963 CHARACTER(LEN=*),INTENT(IN) :: var_name 939 964 CHARACTER(LEN=*),INTENT(IN) :: title 940 965 REAL,INTENT(IN) :: var(:) 941 966 942 CALL put_var_rgen( var_name,title,var,size(var))967 CALL put_var_rgen(nid_restart,var_name,title,var,size(var)) 943 968 944 969 END SUBROUTINE put_var_r1 945 970 946 SUBROUTINE put_var_r2( var_name,title,var)971 SUBROUTINE put_var_r2(nid_restart,var_name,title,var) 947 972 ! Put a 2D field in file 948 973 IMPLICIT NONE 974 INTEGER,INTENT(IN) :: nid_restart 949 975 CHARACTER(LEN=*),INTENT(IN) :: var_name 950 976 CHARACTER(LEN=*),INTENT(IN) :: title 951 977 REAL,INTENT(IN) :: var(:,:) 952 978 953 CALL put_var_rgen( var_name,title,var,size(var))979 CALL put_var_rgen(nid_restart,var_name,title,var,size(var)) 954 980 955 981 END SUBROUTINE put_var_r2 956 982 957 SUBROUTINE put_var_r3( var_name,title,var)983 SUBROUTINE put_var_r3(nid_restart,var_name,title,var) 958 984 ! Put a 3D field in file 959 985 IMPLICIT NONE 986 INTEGER,INTENT(IN) :: nid_restart 960 987 CHARACTER(LEN=*),INTENT(IN) :: var_name 961 988 CHARACTER(LEN=*),INTENT(IN) :: title 962 989 REAL,INTENT(IN) :: var(:,:,:) 963 990 964 CALL put_var_rgen( var_name,title,var,size(var))991 CALL put_var_rgen(nid_restart,var_name,title,var,size(var)) 965 992 966 993 END SUBROUTINE put_var_r3 967 994 968 SUBROUTINE put_var_rgen( var_name,title,var,var_size)995 SUBROUTINE put_var_rgen(nid_restart,var_name,title,var,var_size) 969 996 USE netcdf, only: NF90_REDEF, NF90_DEF_VAR, NF90_ENDDEF, NF90_PUT_VAR, & 970 997 NF90_FLOAT, NF90_DOUBLE, & … … 976 1003 USE ocean_slab_mod, ONLY: nslay 977 1004 IMPLICIT NONE 1005 INTEGER,INTENT(IN) :: nid_restart 978 1006 CHARACTER(LEN=*),INTENT(IN) :: var_name 979 1007 CHARACTER(LEN=*),INTENT(IN) :: title … … 1059 1087 END SUBROUTINE put_var_rgen 1060 1088 1061 SUBROUTINE put_var_c1( var_name,title,var)1089 SUBROUTINE put_var_c1(nid_restart,var_name,title,var) 1062 1090 ! Put a vector of characters in file 1063 1091 … … 1069 1097 1070 1098 IMPLICIT NONE 1099 INTEGER,INTENT(IN) :: nid_restart 1071 1100 CHARACTER(LEN=*),INTENT(IN) :: var_name 1072 1101 CHARACTER(LEN=*),INTENT(IN) :: title -
trunk/LMDZ.GENERIC/libf/phystd/phyetat0_mod.F90
r3522 r3552 4 4 5 5 real, save :: tab_cntrl_mod(100) 6 7 integer,save :: nid_start ! NetCDF file identifier for startfi.nc file 6 8 7 9 !$OMP THREADPRIVATE(tab_cntrl_mod) … … 109 111 if (startphy_file) then 110 112 ! open physics initial state file: 111 call open_startphy(fichnom )113 call open_startphy(fichnom,nid_start) 112 114 113 115 ! possibility to modify tab_cntrl in tabfi … … 124 126 if (startphy_file) then 125 127 ! Load surface geopotential: 126 call get_field( "phisfi",phisfi,found)128 call get_field(nid_start,"phisfi",phisfi,found) 127 129 if (.not.found) then 128 130 call abort_physic(modname,"Failed loading <phisfi>",1) … … 136 138 if (startphy_file) then 137 139 ! Load bare ground albedo: (will be stored in surfdat_h) 138 call get_field( "albedodat",albedodat,found)140 call get_field(nid_start,"albedodat",albedodat,found) 139 141 if (.not.found) then 140 142 call abort_physic(modname,"Failed loading <albedodat>",1) … … 152 154 if (startphy_file) then 153 155 ! Load surface albedo (for now assume it is spectrally homogeneous) 154 call get_field( "albedo",albedo(:,1),found)156 call get_field(nid_start,"albedo",albedo(:,1),found) 155 157 if (.not.found) then 156 158 write(*,*) modname//": Failed loading <albedo>" … … 173 175 ! ZMEA 174 176 if (startphy_file) then 175 call get_field( "ZMEA",zmea,found)177 call get_field(nid_start,"ZMEA",zmea,found) 176 178 if (.not.found) then 177 179 call abort_physic(modname,"Failed loading <ZMEA>",1) … … 185 187 ! ZSTD 186 188 if (startphy_file) then 187 call get_field( "ZSTD",zstd,found)189 call get_field(nid_start,"ZSTD",zstd,found) 188 190 if (.not.found) then 189 191 call abort_physic(modname,"Failed loading <ZSTD>",1) … … 197 199 ! ZSIG 198 200 if (startphy_file) then 199 call get_field( "ZSIG",zsig,found)201 call get_field(nid_start,"ZSIG",zsig,found) 200 202 if (.not.found) then 201 203 call abort_physic(modname,"Failed loading <ZSIG>",1) … … 209 211 ! ZGAM 210 212 if (startphy_file) then 211 call get_field( "ZGAM",zgam,found)213 call get_field(nid_start,"ZGAM",zgam,found) 212 214 if (.not.found) then 213 215 call abort_physic(modname,"Failed loading <ZGAM>",1) … … 221 223 ! ZTHE 222 224 if (startphy_file) then 223 call get_field( "ZTHE",zthe,found)225 call get_field(nid_start,"ZTHE",zthe,found) 224 226 if (.not.found) then 225 227 call abort_physic(modname,"Failed loading <ZTHE>",1) … … 233 235 ! Surface temperature : 234 236 if (startphy_file) then 235 call get_field( "tsurf",tsurf,found,indextime)237 call get_field(nid_start,"tsurf",tsurf,found,indextime) 236 238 if (.not.found) then 237 239 call abort_physic(modname,"Failed loading <tsurf>",1) … … 245 247 ! Surface emissivity 246 248 if (startphy_file) then 247 call get_field( "emis",emis,found,indextime)249 call get_field(nid_start,"emis",emis,found,indextime) 248 250 if (.not.found) then 249 251 call abort_physic(modname,"Failed loading <emis>",1) … … 262 264 if (CLFvarying) then 263 265 if (startphy_file) then 264 call get_field( "cloudfrac",cloudfrac,found,indextime)266 call get_field(nid_start,"cloudfrac",cloudfrac,found,indextime) 265 267 if (.not.found) then 266 268 call abort_physic(modname,"Failed loading <cloudfrac>",1) … … 278 280 if (CLFvarying) then 279 281 if (startphy_file) then 280 call get_field( "totcloudfrac",totcloudfrac,found,indextime)282 call get_field(nid_start,"totcloudfrac",totcloudfrac,found,indextime) 281 283 if (.not.found) then 282 284 call abort_physic(modname,"Failed loading <totcloudfrac>",1) … … 293 295 ! Height of oceanic ice (added by BC 2010) 294 296 if (startphy_file) then 295 call get_field( "hice",hice,found,indextime)297 call get_field(nid_start,"hice",hice,found,indextime) 296 298 if (.not.found) then 297 299 write(*,*) "phyetat0: Failed loading <hice>" … … 308 310 if (startphy_file) then 309 311 ! nature of the surface 310 call get_field( "rnat",rnat,found,indextime)312 call get_field(nid_start,"rnat",rnat,found,indextime) 311 313 if (.not.found) then 312 314 write(*,*) "phyetat0: Failed loading <rnat>" … … 329 331 if (startphy_file) then 330 332 ! Pourcentage of sea ice cover 331 call get_field( "pctsrf_sic",pctsrf_sic,found,indextime)333 call get_field(nid_start,"pctsrf_sic",pctsrf_sic,found,indextime) 332 334 if (.not.found) then 333 335 write(*,*) "phyetat0: Failed loading <pctsrf_sic>" … … 342 344 if (startphy_file) then 343 345 ! Slab ocean temperature (2 layers) 344 call get_field( "tslab",tslab,found,indextime)346 call get_field(nid_start,"tslab",tslab,found,indextime) 345 347 if (.not.found) then 346 348 write(*,*) "phyetat0: Failed loading <tslab>" … … 359 361 if (startphy_file) then 360 362 ! Oceanic ice temperature 361 call get_field( "tsea_ice",tsea_ice,found,indextime)363 call get_field(nid_start,"tsea_ice",tsea_ice,found,indextime) 362 364 if (.not.found) then 363 365 write(*,*) "phyetat0: Failed loading <tsea_ice>" … … 372 374 if (startphy_file) then 373 375 ! Oceanic ice temperature 374 call get_field( "tice",tice,found,indextime)376 call get_field(nid_start,"tice",tice,found,indextime) 375 377 if (.not.found) then 376 378 write(*,*) "phyetat0: Failed loading <tice>" … … 385 387 if (startphy_file) then 386 388 ! Oceanic ice quantity (kg/m^2) 387 call get_field( "sea_ice",sea_ice,found,indextime)389 call get_field(nid_start,"sea_ice",sea_ice,found,indextime) 388 390 if (.not.found) then 389 391 write(*,*) "phyetat0: Failed loading <sea_ice>" … … 399 401 ! pbl wind variance 400 402 if (startphy_file) then 401 call get_field( "q2",q2,found,indextime)403 call get_field(nid_start,"q2",q2,found,indextime) 402 404 if (.not.found) then 403 405 call abort_physic(modname,"Failed loading <q2>",1) … … 414 416 txt=noms(iq) 415 417 if (startphy_file) then 416 call get_field( txt,qsurf(:,iq),found,indextime)418 call get_field(nid_start,txt,qsurf(:,iq),found,indextime) 417 419 if (.not.found) then 418 420 write(*,*) "phyetat0: Failed loading <",trim(txt),">" … … 440 442 ! Non-orographic gravity waves 441 443 if (startphy_file) then 442 call get_field( "du_nonoro_gwd",du_nonoro_gwd,found,indextime)444 call get_field(nid_start,"du_nonoro_gwd",du_nonoro_gwd,found,indextime) 443 445 if (.not.found) then 444 446 write(*,*) "phyetat0: <du_nonoro_gwd> not in file" … … 451 453 endif ! of if (startphy_file) 452 454 if (startphy_file) then 453 call get_field( "dv_nonoro_gwd",dv_nonoro_gwd,found,indextime)455 call get_field(nid_start,"dv_nonoro_gwd",dv_nonoro_gwd,found,indextime) 454 456 if (.not.found) then 455 457 write(*,*) "phyetat0: <dv_nonoro_gwd> not in file" … … 462 464 endif ! of if (startphy_file) 463 465 if (startphy_file) then 464 call get_field( "east_gwstress",east_gwstress,found,indextime)466 call get_field(nid_start,"east_gwstress",east_gwstress,found,indextime) 465 467 if (.not.found) then 466 468 write(*,*) "phyetat0: <east_gwstress> not in file" … … 473 475 endif ! of if (startphy_file) 474 476 if (startphy_file) then 475 call get_field( "west_gwstress",west_gwstress,found,indextime)477 call get_field(nid_start,"west_gwstress",west_gwstress,found,indextime) 476 478 if (.not.found) then 477 479 write(*,*) "phyetat0: <west_gwstress> not in file" … … 486 488 ! close file: 487 489 ! 488 if (startphy_file) call close_startphy 490 if (startphy_file) call close_startphy(nid_start) 489 491 490 492 end subroutine phyetat0 -
trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90
r3515 r3552 2 2 3 3 implicit none 4 5 INTEGER,SAVE :: nid_restart ! NetCDF file identifier for restartfi.nc file 4 6 5 7 contains … … 82 84 83 85 ! Create physics start file 84 call create_restartphy(filename )86 call create_restartphy(filename,nid_restart) 85 87 86 88 ! tab_cntrl() contains run parameters … … 135 137 136 138 ! Write the controle array 137 call put_var( "controle","Control parameters",tab_cntrl)139 call put_var(nid_restart,"controle","Control parameters",tab_cntrl) 138 140 139 141 ! Write the controle array descriptor 140 call put_var( "controle_descriptor",&142 call put_var(nid_restart,"controle_descriptor",& 141 143 "Description of control parameters",dscrpt_tab_cntrl) 142 144 143 145 ! Write the mid-layer depths 144 call put_var( "soildepth","Soil mid-layer depth",mlayer)146 call put_var(nid_restart,"soildepth","Soil mid-layer depth",mlayer) 145 147 146 148 ! Write longitudes 147 call put_field( "longitude","Longitudes of physics grid",lonfi)149 call put_field(nid_restart,"longitude","Longitudes of physics grid",lonfi) 148 150 149 151 ! Write latitudes 150 call put_field( "latitude","Latitudes of physics grid",latfi)152 call put_field(nid_restart,"latitude","Latitudes of physics grid",latfi) 151 153 152 154 ! Write mesh areas 153 call put_field( "area","Mesh area",cell_area)155 call put_field(nid_restart,"area","Mesh area",cell_area) 154 156 155 157 ! Write surface geopotential 156 call put_field( "phisfi","Geopotential at the surface",phisfi)158 call put_field(nid_restart,"phisfi","Geopotential at the surface",phisfi) 157 159 158 160 ! Write surface albedo 159 call put_field( "albedodat","Albedo of bare ground",alb)161 call put_field(nid_restart,"albedodat","Albedo of bare ground",alb) 160 162 161 163 ! Subgrid topogaphy variables 162 call put_field( "ZMEA","Relief: mean relief",zmea)163 call put_field( "ZSTD","Relief: standard deviation",zstd)164 call put_field( "ZSIG","Relief: sigma parameter",zsig)165 call put_field( "ZGAM","Relief: gamma parameter",zgam)166 call put_field( "ZTHE","Relief: theta parameter",zthe)164 call put_field(nid_restart,"ZMEA","Relief: mean relief",zmea) 165 call put_field(nid_restart,"ZSTD","Relief: standard deviation",zstd) 166 call put_field(nid_restart,"ZSIG","Relief: sigma parameter",zsig) 167 call put_field(nid_restart,"ZGAM","Relief: gamma parameter",zgam) 168 call put_field(nid_restart,"ZTHE","Relief: theta parameter",zthe) 167 169 168 170 ! Soil thermal inertia 169 call put_field( "inertiedat","Soil thermal inertia",ith)171 call put_field(nid_restart,"inertiedat","Soil thermal inertia",ith) 170 172 171 173 ! Close file 172 call close_restartphy 174 call close_restartphy(nid_restart) 173 175 174 176 end subroutine physdem0 … … 217 219 218 220 ! Open file 219 call open_restartphy(filename )221 call open_restartphy(filename,nid_restart) 220 222 221 223 ! First variable to write must be "Time", in order to correctly … … 224 226 225 227 ! Surface temperature 226 call put_field( "tsurf","Surface temperature",tsurf)228 call put_field(nid_restart,"tsurf","Surface temperature",tsurf) 227 229 228 230 ! Soil temperature 229 call put_field( "tsoil","Soil temperature",tsoil)231 call put_field(nid_restart,"tsoil","Soil temperature",tsoil) 230 232 231 233 ! Emissivity of the surface 232 call put_field( "emis","Surface emissivity",emis)234 call put_field(nid_restart,"emis","Surface emissivity",emis) 233 235 234 236 ! Surface albedo (assume homegeneous spectral albedo for now) 235 call put_field( "albedo","Surface albedo",albedo(:,1))237 call put_field(nid_restart,"albedo","Surface albedo",albedo(:,1)) 236 238 237 239 ! Planetary Boundary Layer 238 call put_field( "q2","pbl wind variance",q2)240 call put_field(nid_restart,"q2","pbl wind variance",q2) 239 241 240 242 ! cloud fraction and sea ice (NB: these should be optional... to be improved) 241 call put_field( "cloudfrac","Cloud fraction",cloudfrac)242 call put_field( "totcloudfrac","Total fraction",totcloudfrac)243 call put_field( "hice","Height of oceanic ice",hice)243 call put_field(nid_restart,"cloudfrac","Cloud fraction",cloudfrac) 244 call put_field(nid_restart,"totcloudfrac","Total fraction",totcloudfrac) 245 call put_field(nid_restart,"hice","Height of oceanic ice",hice) 244 246 245 247 !Slab ocean 246 248 if(ok_slab_ocean) then 247 call put_field( "rnat","Nature of surface",rnat)248 call put_field( "pctsrf_sic","Pourcentage sea ice",pctsrf_sic)249 call put_field( "tslab","Temperature slab ocean",tslab)250 call put_field( "tsea_ice","Temperature of top layer (seaice or snow)",tsea_ice)251 call put_field( "tice","Temperature of seaice",tice)252 call put_field( "sea_ice","Sea ice mass",sea_ice)249 call put_field(nid_restart,"rnat","Nature of surface",rnat) 250 call put_field(nid_restart,"pctsrf_sic","Pourcentage sea ice",pctsrf_sic) 251 call put_field(nid_restart,"tslab","Temperature slab ocean",tslab) 252 call put_field(nid_restart,"tsea_ice","Temperature of top layer (seaice or snow)",tsea_ice) 253 call put_field(nid_restart,"tice","Temperature of seaice",tice) 254 call put_field(nid_restart,"sea_ice","Sea ice mass",sea_ice) 253 255 endif!(ok_slab_ocean) 254 256 … … 256 258 if (nq>0) then 257 259 do iq=1,nq 258 call put_field(n oms(iq),"tracer on surface",qsurf(:,iq))260 call put_field(nid_restart,noms(iq),"tracer on surface",qsurf(:,iq)) 259 261 enddo 260 262 endif ! of if (nq>0) … … 262 264 ! Non-orographic gavity waves 263 265 if (calllott_nonoro) then 264 call put_field( "du_nonoro_gwd","Zonal wind tendency due to GW",du_nonoro_gwd)265 call put_field( "dv_nonoro_gwd","Meridional wind tendency due to GW",dv_nonoro_gwd)266 call put_field( "east_gwstress","Eastward stress profile due to GW",east_gwstress)267 call put_field( "west_gwstress","Westward stress profile due to GW",west_gwstress)266 call put_field(nid_restart,"du_nonoro_gwd","Zonal wind tendency due to GW",du_nonoro_gwd) 267 call put_field(nid_restart,"dv_nonoro_gwd","Meridional wind tendency due to GW",dv_nonoro_gwd) 268 call put_field(nid_restart,"east_gwstress","Eastward stress profile due to GW",east_gwstress) 269 call put_field(nid_restart,"west_gwstress","Westward stress profile due to GW",west_gwstress) 268 270 endif 269 271 270 272 ! close file 271 CALL close_restartphy 273 CALL close_restartphy(nid_restart) 272 274 !$OMP BARRIER 273 275 -
trunk/LMDZ.GENERIC/libf/phystd/soil_settings.F
r1538 r3552 81 81 ! ------------------- 82 82 ! 1.1 Start by reading how many layers of soil there are 83 dimlen=inquire_dimension_length( "subsurface_layers")83 dimlen=inquire_dimension_length(nid,"subsurface_layers") 84 84 85 85 if (dimlen.ne.nsoil) then … … 97 97 98 98 ! check if olmlayer distribution matches current one 99 call get_var( "soildepth",oldmlayer,found)99 call get_var(nid,"soildepth",oldmlayer,found) 100 100 if (found) then 101 101 malpha=oldmlayer(2)/oldmlayer(1) … … 117 117 118 118 ! 1.2 Find out the # of dimensions <inertiedat> was defined as using 119 ndims=inquire_field_ndims( "inertiedat")119 ndims=inquire_field_ndims(nid,"inertiedat") 120 120 ! 1.3 Read depths values or set olddepthdef flag and values 121 121 if (ndims.eq.1) then ! we know that there is none … … 138 138 ! read <depth> coordinate 139 139 if (interpol) then !put values in oldmlayer 140 call get_var( "soildepth",oldmlayer,found)140 call get_var(nid,"soildepth",oldmlayer,found) 141 141 if (.not.found) then 142 142 write(*,*)'soil_settings: Problem while reading <soildepth>' 143 143 endif 144 144 else ! put values in mlayer 145 call get_var( "soildepth",mlayer,found)145 call get_var(nid,"soildepth",mlayer,found) 146 146 print*,"mlayer",mlayer 147 147 if (.not.found) then … … 205 205 ! Read Surface thermal inertia 206 206 allocate(surfinertia(ngrid)) 207 call get_field( "inertiedat",surfinertia,found)207 call get_field(nid,"inertiedat",surfinertia,found) 208 208 if (.not.found) then 209 209 write(*,*) "soil_settings: Failed loading <inertiedat>" … … 228 228 endif 229 229 endif ! of if (.not.allocated(oldinertiedat)) 230 call get_field( "inertiedat",oldinertiedat,found)230 call get_field(nid,"inertiedat",oldinertiedat,found) 231 231 if (.not.found) then 232 232 write(*,*) "soil_settings: Failed loading <inertiedat>" … … 234 234 endif 235 235 else ! put values in therm_i 236 call get_field( "inertiedat",inertiedat,found)236 call get_field(nid,"inertiedat",inertiedat,found) 237 237 if (.not.found) then 238 238 write(*,*) "soil_settings: Failed loading <inertiedat>" … … 246 246 ! ------------------------- 247 247 ! ierr=nf90_inq_varid(nid,"tsoil",nvarid) 248 ok=inquire_field( "tsoil")248 ok=inquire_field(nid,"tsoil") 249 249 ! if (ierr.ne.nf90_noerr) then 250 250 if (.not.ok) then … … 264 264 endif 265 265 endif 266 call get_field( "tsoil",oldtsoil,found)266 call get_field(nid,"tsoil",oldtsoil,found) 267 267 if (.not.found) then 268 268 write(*,*) "soil_settings: Failed loading <tsoil>" … … 270 270 endif 271 271 else ! put values in tsoil 272 call get_field("tsoil",tsoil,found,timeindex=indextime) 272 call get_field(nid,"tsoil",tsoil,found, 273 & timeindex=indextime) 273 274 if (.not.found) then 274 275 write(*,*) "soil_settings: Failed loading <tsoil>" -
trunk/LMDZ.GENERIC/libf/phystd/tabfi_mod.F90
r3515 r3552 157 157 ! 158 158 159 call get_var( "controle",tab_cntrl,found)159 call get_var(nid,"controle",tab_cntrl,found) 160 160 if (.not.found) then 161 161 call abort_physic(modname,"Failed reading <controle> array",1)
Note: See TracChangeset
for help on using the changeset viewer.