Changeset 2209 for LMDZ5/trunk/libf/phylmd/limit_slab.F90
- Timestamp:
- Feb 16, 2015, 8:34:28 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phylmd/limit_slab.F90
r2057 r2209 1 1 ! $Header$ 2 2 3 SUBROUTINE limit_slab(itime, dtime, jour, lmt_bils, diff_sst )3 SUBROUTINE limit_slab(itime, dtime, jour, lmt_bils, diff_sst, diff_siv) 4 4 5 5 USE dimphy … … 20 20 INTEGER, INTENT(IN) :: jour ! jour a lire dans l'annee 21 21 REAL , INTENT(IN) :: dtime ! pas de temps de la physique (en s) 22 REAL, DIMENSION(klon), INTENT(OUT) :: lmt_bils, diff_sst 22 REAL, DIMENSION(klon), INTENT(OUT) :: lmt_bils, diff_sst, diff_siv 23 23 24 24 ! Locals variables with attribute SAVE 25 25 !**************************************************************************************** 26 26 REAL, DIMENSION(:), ALLOCATABLE, SAVE :: bils_save, diff_sst_save 27 !$OMP THREADPRIVATE(bils_save, diff_sst_save) 27 REAL, DIMENSION(:), ALLOCATABLE, SAVE :: diff_siv_save 28 !$OMP THREADPRIVATE(bils_save, diff_sst_save, diff_siv_save) 28 29 29 30 ! Locals variables … … 33 34 INTEGER, DIMENSION(2) :: start, epais 34 35 REAL, DIMENSION(klon_glo):: bils_glo, sst_l_glo, sst_lp1_glo, diff_sst_glo 36 REAL, DIMENSION(klon_glo):: siv_l_glo, siv_lp1_glo, diff_siv_glo 35 37 CHARACTER (len = 20) :: modname = 'limit_slab' 36 LOGICAL :: read_bils,read_sst 38 LOGICAL :: read_bils,read_sst,read_siv 37 39 38 40 ! End declaration … … 49 51 read_bils=.TRUE. 50 52 read_sst=.TRUE. 53 read_siv=.TRUE. 51 54 52 55 ierr = NF90_OPEN ('limit_slab.nc', NF90_NOWRITE, nid) … … 54 57 read_bils=.FALSE. 55 58 read_sst=.FALSE. 59 read_siv=.FALSE. 56 60 ELSE ! read file 57 61 … … 63 67 64 68 !**************************************************************************************** 65 ! 2) Read bils and SST tendency69 ! 2) Read bils and SST/ ice volume tendency 66 70 ! 67 71 !**************************************************************************************** … … 89 93 END IF 90 94 95 ! Read siv_glo for this day 96 ierr = NF90_INQ_VARID(nid, 'SICV', nvarid) 97 IF (ierr /= NF90_NOERR) THEN 98 read_siv=.FALSE. 99 ELSE 100 start(2) = jour 101 ierr = NF90_GET_VAR(nid,nvarid,siv_l_glo,start,epais) 102 IF (ierr /= NF90_NOERR) read_siv=.FALSE. 103 ! Read siv_glo for one day ahead 104 start(2) = jour + 1 105 IF (start(2) > 360) start(2)=1 106 ierr = NF90_GET_VAR(nid,nvarid,siv_lp1_glo,start,epais) 107 IF (ierr /= NF90_NOERR) read_siv=.FALSE. 108 END IF 109 91 110 !**************************************************************************************** 92 111 ! 5) Close file and distribute variables to all processus … … 98 117 IF (read_sst) THEN 99 118 ! Calculate difference in temperature between this day and one ahead 100 ! DO i=1, klon_glo-1101 ! diff_sst_glo(i) = sst_lp1_glo(i) - sst_l_glo(i)102 ! END DO103 ! diff_sst_glo(klon_glo) = sst_lp1_glo(klon_glo) - sst_l_glo(1)104 119 DO i=1, klon_glo 105 120 diff_sst_glo(i) = sst_lp1_glo(i) - sst_l_glo(i) 106 121 END DO 107 122 END IF !read_sst 123 IF (read_siv) THEN 124 ! Calculate difference in temperature between this day and one ahead 125 DO i=1, klon_glo 126 diff_siv_glo(i) = siv_lp1_glo(i) - siv_l_glo(i) 127 END DO 128 END IF !read_siv 108 129 ENDIF ! is_mpi_root 109 130 … … 111 132 112 133 IF (.NOT. ALLOCATED(bils_save)) THEN 113 ALLOCATE(bils_save(klon), diff_sst_save(klon), stat=ierr)134 ALLOCATE(bils_save(klon), diff_sst_save(klon), diff_siv_save(klon), stat=ierr) 114 135 IF (ierr /= 0) CALL abort_gcm('limit_slab', 'pb in allocation',1) 115 136 END IF 116 137 117 ! Give ddefault values if needed138 ! Give default values if needed 118 139 IF (read_bils) THEN 119 140 CALL Scatter(bils_glo, bils_save) … … 126 147 diff_sst_save(:)=0. 127 148 END IF 149 IF (read_siv) THEN 150 CALL Scatter(diff_siv_glo, diff_siv_save) 151 ELSE 152 diff_siv_save(:)=0. 153 END IF 128 154 129 155 ENDIF ! time to read … … 131 157 lmt_bils(:) = bils_save(:) 132 158 diff_sst(:) = diff_sst_save(:) 159 diff_siv(:) = diff_siv_save(:) 160 133 161 134 162 END SUBROUTINE limit_slab
Note: See TracChangeset
for help on using the changeset viewer.