Changeset 3702 for trunk/LMDZ.MARS
- Timestamp:
- Mar 31, 2025, 6:04:59 PM (3 months ago)
- Location:
- trunk/LMDZ.MARS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/changelog.txt
r3681 r3702 4779 4779 == 12/03/2025 == JBC 4780 4780 Small improvements for the python script to display variables in a NetCDF file. 4781 4782 == 31/03/2025 == EM 4783 Add reindexing of columns when reading/writing (re)startfi files. This is not 4784 necessary with the lon-lat (LMDZ.COMMON) dynamical core, but required when 4785 using DYNAMICO (where correspondance between dynamics and physics column 4786 indexes changes with number of computing cores). 4787 -
trunk/LMDZ.MARS/libf/phymars/iostart.F90
r3509 r3702 20 20 INTEGER,SAVE :: idim11 ! "description_size" dimension 21 21 INTEGER,SAVE :: timeindex ! current time index (for time-dependent fields) 22 ! variables above need not be OMP threadprivate, as they are used by master only 23 22 24 INTEGER,PARAMETER :: length = 100 ! size of tab_cntrl array 23 25 INTEGER,PARAMETER :: ldscrpt = 35 ! size of dscrpt_tab_cntrl array … … 271 273 SUBROUTINE Get_field_rgen(field_name,field,field_size, & 272 274 corners,edges,found) 273 USE netcdf 274 USE dimphy 275 USE mod_grid_phy_lmdz 276 USE mod_phys_lmdz_para 277 IMPLICIT NONE 278 CHARACTER(LEN=*) :: Field_name 279 INTEGER :: field_size 280 REAL :: field(klon,field_size) 275 USE netcdf, ONLY: NF90_INQ_VARID, NF90_GET_VAR, NF90_NOERR 276 USE dimphy, ONLY: klon ! number of columns on local grid 277 USE geometry_mod, ONLY: ind_cell_glo 278 USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of columns on global grid 279 USE mod_phys_lmdz_para, ONLY: is_master, bcast, scatter, gather 280 IMPLICIT NONE 281 CHARACTER(LEN=*),INTENT(IN) :: Field_name 282 INTEGER,INTENT(IN) :: field_size 283 REAL,INTENT(OUT) :: field(klon,field_size) 281 284 INTEGER,INTENT(IN) :: corners(4) 282 285 INTEGER,INTENT(IN) :: edges(4) 283 LOGICAL,OPTIONAL :: found 284 285 REAL :: field_glo(klon_glo,field_size) 286 LOGICAL,OPTIONAL,INTENT(OUT) :: found 287 288 REAL :: field_glo(klon_glo,field_size) ! field on global grid 289 REAL :: field_glo_tmp(klon_glo,field_size) 290 INTEGER :: ind_cell_glo_glo(klon_glo) ! cell indexes on global grid 286 291 LOGICAL :: tmp_found 287 292 INTEGER :: varid 288 INTEGER :: ierr 289 293 INTEGER :: ierr, i 294 295 ! gather columns indexes on global grid 296 CALL gather(ind_cell_glo,ind_cell_glo_glo) 297 290 298 IF (is_master) THEN 291 299 … … 293 301 294 302 IF (ierr==NF90_NOERR) THEN 295 CALL body(field_glo )303 CALL body(field_glo_tmp) 296 304 tmp_found=.TRUE. 297 305 ELSE … … 299 307 ENDIF 300 308 301 ENDIF 309 ENDIF ! of IF (is_master) 302 310 303 311 CALL bcast(tmp_found) 304 312 305 313 IF (tmp_found) THEN 314 IF (is_master) THEN 315 ! reorder columns according to ind_cell_glo(:) indexes 316 DO i=1,klon_glo 317 field_glo(i,:)=field_glo_tmp(ind_cell_glo_glo(i),:) 318 ENDDO 319 ENDIF 306 320 CALL scatter(field_glo,field) 307 321 ENDIF … … 326 340 PRINT*, 'get_field_rgen: Failed reading <'//field_name//'>' 327 341 328 ! IF (field_name=='CLWCON' .OR. field_name=='RNEBCON' .OR. field_name=='RATQS') THEN 329 ! ! Essaye de lire le variable sur surface uniqument, comme fait avant 330 ! field_glo(:)=0. 331 ! ierr=NF90_GET_VAR(nid_start,varid,field_glo(1:klon_glo)) 332 ! IF (ierr/=NF90_NOERR) THEN 333 ! PRINT*, 'phyetat0: Lecture echouee aussi en 2D pour <'//field_name//'>' 334 ! CALL abort 335 ! ELSE 336 ! PRINT*, 'phyetat0: La variable <'//field_name//'> lu sur surface seulement'!, selon ancien format, le reste mis a zero' 337 ! END IF 338 ! ELSE 339 CALL abort_physic("get_field_rgen","Failed to read field",1) 340 ! ENDIF 342 CALL abort_physic("get_field_rgen","Failed to read field",1) 341 343 ENDIF 342 344 … … 410 412 411 413 SUBROUTINE Get_var_rgen(var_name,var,var_size,found) 412 USE netcdf 413 USE dimphy 414 USE mod_grid_phy_lmdz 415 USE mod_phys_lmdz_para 416 IMPLICIT NONE 417 CHARACTER(LEN=*) :: var_name 418 INTEGER :: var_size 419 REAL :: var(var_size) 420 LOGICAL,OPTIONAL :: found 414 USE netcdf, ONLY: NF90_INQ_VARID, NF90_GET_VAR, NF90_NOERR 415 USE mod_phys_lmdz_para, ONLY: is_master, bcast 416 IMPLICIT NONE 417 CHARACTER(LEN=*),INTENT(IN) :: var_name 418 INTEGER,INTENT(IN) :: var_size 419 REAL,INTENT(OUT) :: var(var_size) 420 LOGICAL,OPTIONAL,INTENT(OUT) :: found 421 421 422 422 LOGICAL :: tmp_found … … 424 424 INTEGER :: ierr 425 425 426 IF (is_m pi_root .AND. is_omp_root) THEN426 IF (is_master) THEN 427 427 428 428 ierr=NF90_INQ_VARID(nid_start,var_name,varid) … … 669 669 670 670 SUBROUTINE put_field_rgen(field_name,title,field,field_size,time) 671 USE netcdf 672 USE dimphy 671 USE netcdf, ONLY: NF90_REDEF, NF90_ENDDEF, NF90_DEF_VAR, NF90_PUT_ATT, & 672 NF90_INQ_VARID, NF90_PUT_VAR, NF90_STRERROR, & 673 NF90_NOERR, NF90_FLOAT, NF90_DOUBLE 674 USE dimphy, ONLY: klon, klev, klevp1 673 675 USE comsoil_h, only: nsoilmx 674 676 USE comslope_mod, ONLY: nslope 675 USE mod_grid_phy_lmdz 676 USE mod_phys_lmdz_para 677 USE mod_grid_phy_lmdz, ONLY: klon_glo 678 USE mod_phys_lmdz_para, ONLY: is_master, gather 679 USE geometry_mod, ONLY: ind_cell_glo 680 677 681 IMPLICIT NONE 678 682 CHARACTER(LEN=*),INTENT(IN) :: field_name … … 682 686 REAL,OPTIONAL,INTENT(IN) :: time 683 687 684 REAL :: field_glo(klon_glo,field_size) 685 REAL :: field_glo_reshape(klon_glo,nsoilmx,nslope,timeindex) 688 REAL :: field_glo(klon_glo,field_size) 689 REAL :: field_glo_tmp(klon_glo,field_size) 690 INTEGER :: ind_cell_glo_glo(klon_glo) ! cell indexes on global grid 691 REAL :: field_glo_reshape(klon_glo,nsoilmx,nslope,timeindex) 686 692 INTEGER :: ierr 687 693 INTEGER :: nvarid 688 694 INTEGER :: idim 695 INTEGER :: i 689 696 690 CALL gather(field,field_glo) 691 692 IF (is_master) THEN 697 ! gather indexes on global grid 698 CALL gather(ind_cell_glo,ind_cell_glo_glo) 699 ! gather field on master 700 CALL gather(field,field_glo_tmp) 701 702 IF (is_master) THEN 703 ! reorder columns 704 DO i=1,klon_glo 705 field_glo(ind_cell_glo_glo(i),:)=field_glo_tmp(i,:) 706 ENDDO 693 707 694 708 IF (field_size==1) THEN
Note: See TracChangeset
for help on using the changeset viewer.