Changeset 6021 for branches/2015/dev_MetOffice_merge_2015/NEMOGCM
- Timestamp:
- 2015-12-08T12:49:56+01:00 (9 years ago)
- Location:
- branches/2015/dev_MetOffice_merge_2015/NEMOGCM
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2015/dev_MetOffice_merge_2015/NEMOGCM/ARCH/OLD/NOC/arch-ALTIX_NAUTILUS.fcm
- Property svn:keywords set to Id
-
branches/2015/dev_MetOffice_merge_2015/NEMOGCM/ARCH/arch-ALTIX_NAUTILUS_MPT.fcm
- Property svn:keywords set to Id
-
branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90
r5341 r6021 12 12 !! - ! Currently needs a fixed processor 13 13 !! - ! layout between restarts 14 !! - ! 2015-11 Dave Storkey Convert icb_rst_read to use IOM so can 15 !! read single restart files 14 16 !!---------------------------------------------------------------------- 15 17 !!---------------------------------------------------------------------- … … 22 24 USE lib_mpp ! NEMO MPI library, lk_mpp in particular 23 25 USE netcdf ! netcdf routines for IO 26 USE iom 24 27 USE icb_oce ! define iceberg arrays 25 28 USE icbutl ! iceberg utility routines … … 57 60 INTEGER :: idim, ivar, iatt 58 61 INTEGER :: jn, iunlim_dim, ibergs_in_file 59 INTEGER :: iclass 60 INTEGER, DIMENSION(1) :: istrt, ilngth, idata 61 INTEGER, DIMENSION(2) :: istrt2, ilngth2 62 INTEGER, DIMENSION(nkounts) :: idata2 63 REAL(wp), DIMENSION(1) :: zdata ! need 1d array to read in with 64 ! start and count arrays 62 INTEGER :: ii,ij,iclass 63 REAL(wp), DIMENSION(nkounts) :: zdata 65 64 LOGICAL :: ll_found_restart 66 65 CHARACTER(len=256) :: cl_path … … 71 70 !!---------------------------------------------------------------------- 72 71 73 ! Find a restart file. Assume iceberg restarts in same directory as ocean restarts. 72 ! Find a restart file. Assume iceberg restarts in same directory as ocean restarts 73 ! and are called TRIM(cn_ocerst)//'_icebergs' 74 74 cl_path = TRIM(cn_ocerst_indir) 75 75 IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 76 cl_filename = ' ' 77 IF ( lk_mpp ) THEN 78 cl_filename = ' ' 79 WRITE( cl_filename, '("restart_icebergs_",I4.4,".nc")' ) narea-1 80 INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 81 ELSE 82 cl_filename = 'restart_icebergs.nc' 83 INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 84 ENDIF 85 86 IF ( .NOT. ll_found_restart) THEN ! only do the following if a file was found 87 CALL ctl_stop('icebergs: no restart file found') 88 ENDIF 89 90 IF (nn_verbose_level >= 0 .AND. lwp) & 91 WRITE(numout,'(2a)') 'icebergs, read_restart_bergs: found restart file = ',TRIM(cl_path)//TRIM(cl_filename) 92 93 nret = NF90_OPEN(TRIM(cl_path)//TRIM(cl_filename), NF90_NOWRITE, ncid) 94 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_open failed') 95 96 nret = nf90_inquire(ncid, idim, ivar, iatt, iunlim_dim) 97 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_inquire failed') 98 99 IF( iunlim_dim .NE. -1) THEN 100 101 nret = nf90_inquire_dimension(ncid, iunlim_dim, cl_dname, ibergs_in_file) 102 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_inq_dimlen failed') 103 104 nret = NF90_INQ_VARID(ncid, 'number', numberid) 105 nret = NF90_INQ_VARID(ncid, 'mass_scaling', nscaling_id) 106 nret = NF90_INQ_VARID(ncid, 'xi', nxid) 107 nret = NF90_INQ_VARID(ncid, 'yj', nyid) 108 nret = NF90_INQ_VARID(ncid, 'lon', nlonid) 109 nret = NF90_INQ_VARID(ncid, 'lat', nlatid) 110 nret = NF90_INQ_VARID(ncid, 'uvel', nuvelid) 111 nret = NF90_INQ_VARID(ncid, 'vvel', nvvelid) 112 nret = NF90_INQ_VARID(ncid, 'mass', nmassid) 113 nret = NF90_INQ_VARID(ncid, 'thickness', nthicknessid) 114 nret = NF90_INQ_VARID(ncid, 'width', nwidthid) 115 nret = NF90_INQ_VARID(ncid, 'length', nlengthid) 116 nret = NF90_INQ_VARID(ncid, 'year', nyearid) 117 nret = NF90_INQ_VARID(ncid, 'day', ndayid) 118 nret = NF90_INQ_VARID(ncid, 'mass_of_bits', nmass_of_bits_id) 119 nret = NF90_INQ_VARID(ncid, 'heat_density', nheat_density_id) 120 121 ilngth(1) = 1 122 istrt2(1) = 1 123 ilngth2(1) = nkounts 124 ilngth2(2) = 1 125 DO jn=1, ibergs_in_file 126 127 istrt(1) = jn 128 istrt2(2) = jn 129 130 nret = NF90_GET_VAR(ncid, numberid, idata2, istrt2, ilngth2 ) 131 localberg%number(:) = idata2(:) 132 133 nret = NF90_GET_VAR(ncid, nscaling_id, zdata, istrt, ilngth ) 134 localberg%mass_scaling = zdata(1) 135 136 nret = NF90_GET_VAR(ncid, nlonid, zdata, istrt, ilngth) 137 localpt%lon = zdata(1) 138 nret = NF90_GET_VAR(ncid, nlatid, zdata, istrt, ilngth) 139 localpt%lat = zdata(1) 140 IF (nn_verbose_level >= 2 .AND. lwp) THEN 141 WRITE(numout,'(a,i5,a,2f10.4,a,i5)') 'icebergs, read_restart_bergs: berg ',jn,' is at ', & 142 localpt%lon,localpt%lat,' on PE ',narea-1 76 cl_filename = TRIM(cn_ocerst_in)//'_icebergs' 77 CALL iom_open( TRIM(cl_path)//cl_filename, ncid ) 78 79 IF( iom_file(ncid)%iduld .GE. 0) THEN 80 81 ibergs_in_file = iom_file(ncid)%lenuld 82 DO jn = 1,ibergs_in_file 83 84 ! iom_get treats the unlimited dimension as time. Here the unlimited dimension 85 ! is the iceberg index, but we can still use the ktime keyword to get the iceberg we want. 86 87 CALL iom_get( ncid, 'xi' ,localpt%xi , ktime=jn ) 88 CALL iom_get( ncid, 'yj' ,localpt%yj , ktime=jn ) 89 90 ii = INT( localpt%xi + 0.5 ) 91 ij = INT( localpt%yj + 0.5 ) 92 ! Only proceed if this iceberg is on the local processor (excluding halos). 93 IF ( ii .GE. nldi+nimpp-1 .AND. ii .LE. nlei+nimpp-1 .AND. & 94 & ij .GE. nldj+njmpp-1 .AND. ij .LE. nlej+njmpp-1 ) THEN 95 96 CALL iom_get( ncid, jpdom_unknown, 'number' , (/zdata(:)/) , ktime=jn, kstart=(/1/), kcount=(/nkounts/) ) 97 localberg%number(:) = INT(zdata(:)) 98 CALL iom_get( ncid, 'mass_scaling' , localberg%mass_scaling, ktime=jn ) 99 CALL iom_get( ncid, 'lon' , localpt%lon , ktime=jn ) 100 CALL iom_get( ncid, 'lat' , localpt%lat , ktime=jn ) 101 CALL iom_get( ncid, 'uvel' , localpt%uvel , ktime=jn ) 102 CALL iom_get( ncid, 'vvel' , localpt%vvel , ktime=jn ) 103 CALL iom_get( ncid, 'mass' , localpt%mass , ktime=jn ) 104 CALL iom_get( ncid, 'thickness' , localpt%thickness , ktime=jn ) 105 CALL iom_get( ncid, 'width' , localpt%width , ktime=jn ) 106 CALL iom_get( ncid, 'length' , localpt%length , ktime=jn ) 107 CALL iom_get( ncid, 'year' , zdata(1) , ktime=jn ) 108 localpt%year = INT(zdata(1)) 109 CALL iom_get( ncid, 'day' , localpt%day , ktime=jn ) 110 CALL iom_get( ncid, 'mass_of_bits' , localpt%mass_of_bits , ktime=jn ) 111 CALL iom_get( ncid, 'heat_density' , localpt%heat_density , ktime=jn ) 112 113 ! 114 CALL icb_utl_add( localberg, localpt ) 115 143 116 ENDIF 144 nret = NF90_GET_VAR(ncid, nxid, zdata, istrt, ilngth) 145 localpt%xi = zdata(1) 146 nret = NF90_GET_VAR(ncid, nyid, zdata, istrt, ilngth) 147 localpt%yj = zdata(1) 148 nret = NF90_GET_VAR(ncid, nuvelid, zdata, istrt, ilngth ) 149 localpt%uvel = zdata(1) 150 nret = NF90_GET_VAR(ncid, nvvelid, zdata, istrt, ilngth ) 151 localpt%vvel = zdata(1) 152 nret = NF90_GET_VAR(ncid, nmassid, zdata, istrt, ilngth ) 153 localpt%mass = zdata(1) 154 nret = NF90_GET_VAR(ncid, nthicknessid, zdata, istrt, ilngth ) 155 localpt%thickness = zdata(1) 156 nret = NF90_GET_VAR(ncid, nwidthid, zdata, istrt, ilngth ) 157 localpt%width = zdata(1) 158 nret = NF90_GET_VAR(ncid, nlengthid, zdata, istrt, ilngth ) 159 localpt%length = zdata(1) 160 nret = NF90_GET_VAR(ncid, nyearid, idata, istrt, ilngth ) 161 localpt%year = idata(1) 162 nret = NF90_GET_VAR(ncid, ndayid, zdata, istrt, ilngth ) 163 localpt%day = zdata(1) 164 nret = NF90_GET_VAR(ncid, nmass_of_bits_id, zdata, istrt, ilngth ) 165 localpt%mass_of_bits = zdata(1) 166 nret = NF90_GET_VAR(ncid, nheat_density_id, zdata, istrt, ilngth ) 167 localpt%heat_density = zdata(1) 168 ! 169 CALL icb_utl_add( localberg, localpt ) 117 170 118 END DO 171 ! 172 ENDIF 173 174 nret = NF90_INQ_DIMID( ncid, 'c', nc_dim ) 175 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart: nf_inq_dimid c failed') 176 177 nret = NF90_INQUIRE_DIMENSION( ncid, nc_dim, cl_dname, iclass ) 178 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart: nf_inquire_dimension failed') 179 180 nret = NF90_INQ_VARID(ncid, 'kount' , nkountid) 181 nret = NF90_INQ_VARID(ncid, 'calving' , ncalvid) 182 nret = NF90_INQ_VARID(ncid, 'calving_hflx', ncalvhid) 183 nret = NF90_INQ_VARID(ncid, 'stored_ice' , nsiceid) 184 nret = NF90_INQ_VARID(ncid, 'stored_heat' , nsheatid) 185 186 nstrt3(1) = 1 187 nstrt3(2) = 1 188 nlngth3(1) = jpi 189 nlngth3(2) = jpj 190 nlngth3(3) = 1 191 192 DO jn = 1, iclass 193 nstrt3(3) = jn 194 nret = NF90_GET_VAR( ncid, nsiceid , griddata, nstrt3, nlngth3 ) 195 berg_grid%stored_ice(:,:,jn) = griddata(:,:,1) 196 END DO 197 198 nret = NF90_GET_VAR( ncid, ncalvid , src_calving (:,:) ) 199 nret = NF90_GET_VAR( ncid, ncalvhid, src_calving_hflx (:,:) ) 200 nret = NF90_GET_VAR( ncid, nsheatid, berg_grid%stored_heat(:,:) ) 201 nret = NF90_GET_VAR( ncid, nkountid, idata2(:) ) 202 num_bergs(:) = idata2(:) 203 204 ! Finish up 205 nret = NF90_CLOSE(ncid) 206 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart: nf_close failed') 119 120 ENDIF 121 122 ! Gridded variables 123 CALL iom_get( ncid, jpdom_autoglo, 'calving' , src_calving ) 124 CALL iom_get( ncid, jpdom_autoglo, 'calving_hflx', src_calving_hflx ) 125 CALL iom_get( ncid, jpdom_autoglo, 'stored_heat' , berg_grid%stored_heat ) 126 CALL iom_get( ncid, jpdom_autoglo_xy, 'stored_ice' , berg_grid%stored_ice, kstart=(/1,1,1/), kcount=(/1,1,nclasses/) ) 127 128 CALL iom_get( ncid, jpdom_unknown, 'kount' , (/zdata(:)/) ) 129 num_bergs(:) = INT(zdata(:)) 207 130 208 131 ! Sanity check … … 211 134 WRITE(numout,'(2(a,i5))') 'icebergs, read_restart_bergs: # bergs =',jn,' on PE',narea-1 212 135 IF( lk_mpp ) THEN 213 CALL mpp_sum(ibergs_in_file) 136 ! Only mpp_sum ibergs_in_file if we are reading from multiple restart files. 137 IF( INDEX(iom_file(ncid)%name,'icebergs.nc' ) .EQ. 0 ) CALL mpp_sum(ibergs_in_file) 214 138 CALL mpp_sum(jn) 215 139 ENDIF 216 140 IF(lwp) WRITE(numout,'(a,i5,a,i5,a)') 'icebergs, read_restart_bergs: there were',ibergs_in_file, & 217 141 & ' bergs in the restart file and', jn,' bergs have been read' 142 ! 143 ! Finish up 144 CALL iom_close( ncid ) 218 145 ! 219 146 IF( lwp .and. nn_verbose_level >= 0) WRITE(numout,'(a)') 'icebergs, read_restart_bergs: completed' -
branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
r5836 r6021 673 673 CHARACTER(LEN=256) :: clname ! file name 674 674 CHARACTER(LEN=1) :: clrankpv, cldmspc ! 675 LOGICAL :: ll_depth_spec ! T => if kstart, kcount present then *only* use values for 3rd spatial dimension. 675 676 !--------------------------------------------------------------------- 676 677 ! … … 685 686 IF( PRESENT(kcount) .AND. (.NOT. PRESENT(kstart)) ) CALL ctl_stop(trim(clinfo), 'kcount present needs kstart present') 686 687 IF( PRESENT(kstart) .AND. (.NOT. PRESENT(kcount)) ) CALL ctl_stop(trim(clinfo), 'kstart present needs kcount present') 687 IF( PRESENT(kstart) .AND. idom /= jpdom_unknown ) CALL ctl_stop(trim(clinfo), 'kstart present needs kdom = jpdom_unknown') 688 IF( PRESENT(kstart) .AND. idom /= jpdom_unknown .AND. idom /= jpdom_autoglo_xy ) & 689 & CALL ctl_stop(trim(clinfo), 'kstart present needs kdom = jpdom_unknown or kdom = jpdom_autoglo_xy') 688 690 689 691 luse_jattr = .false. … … 718 720 ! update idom definition... 719 721 ! Identify the domain in case of jpdom_auto(glo/dta) definition 722 IF( idom == jpdom_autoglo_xy ) THEN 723 ll_depth_spec = .TRUE. 724 idom = jpdom_autoglo 725 ELSE 726 ll_depth_spec = .FALSE. 727 ENDIF 720 728 IF( idom == jpdom_autoglo .OR. idom == jpdom_autodta ) THEN 721 729 IF( idom == jpdom_autoglo ) THEN ; idom = jpdom_global … … 771 779 istart(idmspc+1) = itime 772 780 773 IF( PRESENT(kstart)) THEN ; istart(1:idmspc) = kstart(1:idmspc) ; icnt(1:idmspc) = kcount(1:idmspc)781 IF( PRESENT(kstart) .AND. .NOT. ll_depth_spec ) THEN ; istart(1:idmspc) = kstart(1:idmspc) ; icnt(1:idmspc) = kcount(1:idmspc) 774 782 ELSE 775 IF( idom == jpdom_unknown ) THEN ; icnt(1:idmspc) = idimsz(1:idmspc)783 IF( idom == jpdom_unknown ) THEN ; icnt(1:idmspc) = idimsz(1:idmspc) 776 784 ELSE 777 785 IF( .NOT. PRESENT(pv_r1d) ) THEN ! not a 1D array … … 796 804 ENDIF 797 805 IF( PRESENT(pv_r3d) ) THEN 798 IF( idom == jpdom_data ) THEN ; icnt(3) = jpkdta 799 ELSE ; icnt(3) = jpk 806 IF( idom == jpdom_data ) THEN ; icnt(3) = jpkdta 807 ELSE IF( ll_depth_spec .AND. PRESENT(kstart) ) THEN ; istart(3) = kstart(3); icnt(3) = kcount(3) 808 ELSE ; icnt(3) = jpk 800 809 ENDIF 801 810 ENDIF -
branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90
r4205 r6021 9 9 !!--------------------------------------------------------------------------------- 10 10 !! NEMO/OPA 3.3 , NEMO Consortium (2010) 11 !! $Id$ 11 !! $Id$ 12 12 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 13 13 !!--------------------------------------------------------------------------------- … … 26 26 INTEGER, PARAMETER, PUBLIC :: jpdom_unknown = 7 !: No dimension checking 27 27 INTEGER, PARAMETER, PUBLIC :: jpdom_autoglo = 8 !: 28 INTEGER, PARAMETER, PUBLIC :: jpdom_autodta = 9 !: 28 INTEGER, PARAMETER, PUBLIC :: jpdom_autoglo_xy = 9 !: Automatically set horizontal dimensions only 29 INTEGER, PARAMETER, PUBLIC :: jpdom_autodta = 10 !: 29 30 30 31 INTEGER, PARAMETER, PUBLIC :: jpioipsl = 100 !: Use ioipsl (fliocom only) library … … 57 58 INTEGER :: nvars !: number of identified varibles in the file 58 59 INTEGER :: iduld !: id of the unlimited dimension 60 INTEGER :: lenuld !: length of the unlimited dimension (number of records in file) 59 61 INTEGER :: irec !: writing record position 60 62 CHARACTER(LEN=32) :: uldname !: name of the unlimited dimension -
branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90
r5341 r6021 154 154 CALL iom_nf90_check(NF90_Inquire(if90id, unlimitedDimId = iom_file(kiomid)%iduld), clinfo) 155 155 IF ( iom_file(kiomid)%iduld .GE. 0 ) THEN 156 CALL iom_nf90_check(NF90_Inquire_Dimension(if90id, iom_file(kiomid)%iduld, & 157 & name = iom_file(kiomid)%uldname), clinfo) 156 CALL iom_nf90_check(NF90_Inquire_Dimension(if90id, iom_file(kiomid)%iduld, & 157 & name = iom_file(kiomid)%uldname, & 158 & len = iom_file(kiomid)%lenuld ), clinfo ) 158 159 ENDIF 159 160 IF(lwp) WRITE(numout,*) ' ---> '//TRIM(cdname)//' OK'
Note: See TracChangeset
for help on using the changeset viewer.