Changeset 2839 for LMDZ5/branches/testing/libf
- Timestamp:
- Mar 30, 2017, 4:16:38 PM (8 years ago)
- Location:
- LMDZ5/branches/testing
- Files:
-
- 9 deleted
- 52 edited
- 12 copied
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/branches/testing
- Property svn:mergeinfo changed
/LMDZ5/trunk merged: 2786,2788-2790,2792-2814,2816-2838
- Property svn:mergeinfo changed
-
LMDZ5/branches/testing/libf/dyn3d_common/disvert.F90
r2641 r2839 10 10 use new_unit_m, only: new_unit 11 11 use assert_m, only: assert 12 USE comvert_mod, ONLY: ap, bp, nivsigs, nivsig, dpres, presnivs, &13 p a, preff, scaleheight12 USE comvert_mod, ONLY: ap, bp, aps, bps, nivsigs, nivsig, dpres, presnivs, & 13 pseudoalt, pa, preff, scaleheight 14 14 USE logic_mod, ONLY: ok_strato 15 15 … … 346 346 DO l = 1, llm 347 347 dpres(l) = bp(l) - bp(l+1) 348 aps(l) = 0.5 *( ap(l) +ap(l+1)) 349 bps(l) = 0.5 *( bp(l) +bp(l+1)) 348 350 presnivs(l) = 0.5 *( ap(l)+bp(l)*preff + ap(l+1)+bp(l+1)*preff ) 351 pseudoalt(l) = log(preff/presnivs(l))*scaleheight 349 352 write(lunout, *)'PRESNIVS(', l, ')=', presnivs(l), ' Z ~ ', & 350 log(preff/presnivs(l))*scaleheight&353 pseudoalt(l) & 351 354 , ' DZ ~ ', scaleheight*log((ap(l)+bp(l)*preff)/ & 352 355 max(ap(l+1)+bp(l+1)*preff, 1.e-10)) -
LMDZ5/branches/testing/libf/dyn3dmem/dynetat0_loc.f90
r2641 r2839 153 153 DO iq=1,nqtot 154 154 var=tname(iq) 155 #ifdef INCA 156 IF (var .eq. "O3" ) THEN 157 IF(NF90_INQ_VARID(fID,var,vID) == NF90_NoErr) THEN 158 CALL get_var2(var,q_glo); q(ijb_u:ije_u,:,iq)=q_glo(ijb_u:ije_u,:); CYCLE 159 ELSE 160 WRITE(lunout,*) 'Tracer O3 is missing - it is initialized to OX' 161 IF(NF90_INQ_VARID(fID,"OX",vID) == NF90_NoErr) THEN 162 CALL get_var2("OX",q_glo); q(ijb_u:ije_u,:,iq)=q_glo(ijb_u:ije_u,:); CYCLE 163 ENDIF 164 ENDIF 165 ENDIF 166 #endif 155 167 IF(NF90_INQ_VARID(fID,var,vID)==NF90_NoErr) THEN 156 168 CALL get_var2(var,q_glo); q(ijb_u:ije_u,:,iq)=q_glo(ijb_u:ije_u,:); CYCLE -
LMDZ5/branches/testing/libf/dynphy_lonlat/inigeomphy_mod.F90
r2594 r2839 24 24 USE mod_interface_dyn_phys, ONLY : init_interface_dyn_phys 25 25 USE nrtype, ONLY: pi 26 USE comvert_mod, ONLY: preff, ap, bp, aps, bps, presnivs, & 27 scaleheight, pseudoalt 28 USE vertical_layers_mod, ONLY: init_vertical_layers 26 29 IMPLICIT NONE 27 30 … … 216 219 airefi,cufi,cvfi) 217 220 221 ! copy over preff , ap(), bp(), etc 222 CALL init_vertical_layers(nlayer,preff,scaleheight, & 223 ap,bp,aps,bps,presnivs,pseudoalt) 224 218 225 !$OMP END PARALLEL 219 226 -
LMDZ5/branches/testing/libf/dynphy_lonlat/phylmd/etat0phys_netcdf.F90
r2787 r2839 82 82 USE fonte_neige_mod 83 83 USE pbl_surface_mod 84 USE regr_ lat_time_climoz_m, ONLY: regr_lat_time_climoz84 USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz 85 85 USE indice_sol_mod 86 86 USE conf_phys_m, ONLY: conf_phys … … 170 170 radsol(:) = 0.0 !--- Net radiation at ground 171 171 rugmer(:) = 0.001 !--- Ocean rugosity 172 IF(read_climoz>=1) & !--- Ozone climatology173 CALL regr_lat_time_climoz(read_climoz)172 !--- Ozone (zonal or 3D) interpolation in space and time (if 2nd arg is TRUE) 173 IF(read_climoz>=1) CALL regr_horiz_time_climoz(read_climoz,ok_daily_climoz) 174 174 175 175 ! Sub-surfaces initialization. -
LMDZ5/branches/testing/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90
r2669 r2839 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE comvert_mod, ONLY: preff, ap, bp, presnivs, scaleheight, pseudoalt15 14 USE inigeomphy_mod, ONLY: inigeomphy 16 15 USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat,nbp_lev,klon_glo ! number of atmospheric columns (on full grid) … … 110 109 !$OMP COPYIN(annee_ref, day_ini, day_ref, start_time) 111 110 112 ! copy over preff , ap(), bp(), etc113 CALL init_vertical_layers(nlayer,preff,scaleheight, &114 ap,bp,presnivs,pseudoalt)115 116 111 ! Initialize physical constants in physics: 117 112 CALL inifis(punjours,prad,pg,pr,pcpp) -
LMDZ5/branches/testing/libf/dynphy_lonlat/phylmd/init_ssrf_m.F90
r2641 r2839 9 9 USE grid_atob_m, ONLY: grille_m 10 10 USE ioipsl, ONLY: flininfo, flinopen, flinget, flinclo 11 USE ioipsl_getin_p_mod, ONLY: getin_p 11 12 USE comconst_mod, ONLY: im, pi 12 13 … … 42 43 REAL, ALLOCATABLE :: dlat_lic(:), lat_lic(:,:), flic_tmp(:,:), vtmp(:,:) 43 44 REAL :: date, lev(1), dt, deg2rad 45 LOGICAL :: no_ter_antartique ! If true, no land points are allowed at Antartic 44 46 !------------------------------------------------------------------------------- 45 47 deg2rad= pi/180.0 … … 97 99 END DO 98 100 101 102 !--- Option no_ter_antartique removes all land fractions souther than 60S. 103 !--- Land ice is set instead of the land fractions on these latitudes. 104 !--- The ocean and sea-ice fractions are not changed. 105 no_ter_antartique=.FALSE. 106 CALL getin_p('no_ter_antartique',no_ter_antartique) 107 WRITE(lunout,*)"no_ter_antartique=",no_ter_antartique 108 IF (no_ter_antartique) THEN 109 ! Remove all land fractions souther than 60S and set land-ice instead 110 WRITE(lunout,*) "Remove land fractions souther than 60deg south by increasing" 111 WRITE(lunout,*) "the continental ice fractions. No land can now be found at Antartic." 112 DO ji=1, klon 113 IF (latitude_deg(ji)<-60.0) THEN 114 pctsrf(ji,is_lic) = pctsrf(ji,is_lic) + pctsrf(ji,is_ter) 115 pctsrf(ji,is_ter) = 0 116 END IF 117 END DO 118 END IF 119 120 99 121 !--- Sub-surface ocean and sea ice (sea ice set to zero for start). 100 122 pctsrf(:,is_oce)=(1.-zmasq(:)) -
LMDZ5/branches/testing/libf/dynphy_lonlat/phymar/iniphysiq_mod.F90
r2641 r2839 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE comvert_mod, ONLY: preff, ap, bp, presnivs, scaleheight, pseudoalt15 14 USE inigeomphy_mod, ONLY: inigeomphy 16 15 USE vertical_layers_mod, ONLY : init_vertical_layers … … 71 70 !$OMP PARALLEL 72 71 73 ! copy over preff , ap(), bp(), etc74 CALL init_vertical_layers(nlayer,preff,scaleheight, &75 ap,bp,presnivs,pseudoalt)76 77 72 ! Initialize tracer names, numbers, etc. for physics 78 73 CALL init_infotrac_phy(nqtot) -
LMDZ5/branches/testing/libf/misc/slopes_m.F90
r2471 r2839 1 moduleslopes_m1 MODULE slopes_m 2 2 3 3 ! Author: Lionel GUEZ 4 5 implicit none 6 7 interface slopes 8 ! This generic function computes second order slopes with Van 9 ! Leer slope-limiting, given cell averages. Reference: Dukowicz, 10 ! 1987, SIAM Journal on Scientific and Statistical Computing, 8, 11 ! 305. 12 13 ! The only difference between the specific functions is the rank 14 ! of the first argument and the equal rank of the result. 15 16 ! real, intent(in), rank >= 1:: f ! (n, ...) cell averages, n must be >= 1 17 ! real, intent(in):: x(:) ! (n + 1) cell edges 18 ! real slopes, same shape as f ! (n, ...) 19 20 module procedure slopes1, slopes2, slopes3, slopes4 21 end interface 22 23 private 24 public slopes 25 26 contains 27 28 pure function slopes1(f, x) 29 30 real, intent(in):: f(:) 31 real, intent(in):: x(:) 32 real slopes1(size(f)) 33 34 ! Local: 35 integer n, i 36 real xc(size(f)) ! (n) cell centers 37 real h 38 39 !------------------------------------------------------ 40 41 n = size(f) 42 forall (i = 1:n) xc(i) = (x(i) + x(i + 1)) / 2. 43 slopes1(1) = 0. 44 slopes1(n) = 0. 45 46 do i = 2, n - 1 47 if (f(i) >= max(f(i - 1), f(i + 1)) .or. f(i) & 48 <= min(f(i - 1), f(i + 1))) then 49 ! Local extremum 50 slopes1(i) = 0. 51 else 52 ! (f(i - 1), f(i), f(i + 1)) strictly monotonous 53 54 ! Second order slope: 55 slopes1(i) = (f(i + 1) - f(i - 1)) / (xc(i + 1) - xc(i - 1)) 56 57 ! Slope limitation: 58 h = abs(x(i + 1) - xc(i)) 59 slopes1(i) = sign(min(abs(slopes1(i)), abs(f(i + 1) - f(i)) / h, & 60 abs(f(i) - f(i - 1)) / h), slopes1(i)) 61 end if 62 end do 63 64 end function slopes1 65 66 !************************************************************* 67 68 pure function slopes2(f, x) 69 70 real, intent(in):: f(:, :) 71 real, intent(in):: x(:) 72 real slopes2(size(f, 1), size(f, 2)) 73 74 ! Local: 75 integer n, i, j 76 real xc(size(f, 1)) ! (n) cell centers 77 real h(2:size(f, 1) - 1), delta_xc(2:size(f, 1) - 1) ! (2:n - 1) 78 79 !------------------------------------------------------ 80 81 n = size(f, 1) 82 forall (i = 1:n) xc(i) = (x(i) + x(i + 1)) / 2. 83 84 forall (i = 2:n - 1) 85 h(i) = abs(x(i + 1) - xc(i)) 86 delta_xc(i) = xc(i + 1) - xc(i - 1) 87 end forall 88 89 do j = 1, size(f, 2) 90 slopes2(1, j) = 0. 91 92 do i = 2, n - 1 93 if (f(i, j) >= max(f(i - 1, j), f(i + 1, j)) .or. & 94 f(i, j) <= min(f(i - 1, j), f(i + 1, j))) then 95 ! Local extremum 96 slopes2(i, j) = 0. 97 else 98 ! (f(i - 1, j), f(i, j), f(i + 1, j)) 99 ! strictly monotonous 100 101 ! Second order slope: 102 slopes2(i, j) = (f(i + 1, j) - f(i - 1, j)) / delta_xc(i) 103 104 ! Slope limitation: 105 slopes2(i, j) = sign(min(abs(slopes2(i, j)), & 106 abs(f(i + 1, j) - f(i, j)) / h(i), & 107 abs(f(i, j) - f(i - 1, j)) / h(i)), slopes2(i, j)) 108 end if 109 end do 110 111 slopes2(n, j) = 0. 112 end do 113 114 end function slopes2 115 116 !************************************************************* 117 118 pure function slopes3(f, x) 119 120 real, intent(in):: f(:, :, :) 121 real, intent(in):: x(:) 122 real slopes3(size(f, 1), size(f, 2), size(f, 3)) 123 124 ! Local: 125 integer n, i, j, k 126 real xc(size(f, 1)) ! (n) cell centers 127 real h(2:size(f, 1) - 1), delta_xc(2:size(f, 1) - 1) ! (2:n - 1) 128 129 !------------------------------------------------------ 130 131 n = size(f, 1) 132 forall (i = 1:n) xc(i) = (x(i) + x(i + 1)) / 2. 133 134 forall (i = 2:n - 1) 135 h(i) = abs(x(i + 1) - xc(i)) 136 delta_xc(i) = xc(i + 1) - xc(i - 1) 137 end forall 138 139 do k = 1, size(f, 3) 140 do j = 1, size(f, 2) 141 slopes3(1, j, k) = 0. 142 143 do i = 2, n - 1 144 if (f(i, j, k) >= max(f(i - 1, j, k), f(i + 1, j, k)) .or. & 145 f(i, j, k) <= min(f(i - 1, j, k), f(i + 1, j, k))) then 146 ! Local extremum 147 slopes3(i, j, k) = 0. 148 else 149 ! (f(i - 1, j, k), f(i, j, k), f(i + 1, j, k)) 150 ! strictly monotonous 151 152 ! Second order slope: 153 slopes3(i, j, k) = (f(i + 1, j, k) - f(i - 1, j, k)) & 154 / delta_xc(i) 155 156 ! Slope limitation: 157 slopes3(i, j, k) = sign(min(abs(slopes3(i, j, k)), & 158 abs(f(i + 1, j, k) - f(i, j, k)) / h(i), & 159 abs(f(i, j, k) - f(i - 1, j, k)) / h(i)), slopes3(i, j, k)) 160 end if 161 end do 162 163 slopes3(n, j, k) = 0. 164 end do 165 end do 166 167 end function slopes3 168 169 !************************************************************* 170 171 pure function slopes4(f, x) 172 173 real, intent(in):: f(:, :, :, :) 174 real, intent(in):: x(:) 175 real slopes4(size(f, 1), size(f, 2), size(f, 3), size(f, 4)) 176 177 ! Local: 178 integer n, i, j, k, l 179 real xc(size(f, 1)) ! (n) cell centers 180 real h(2:size(f, 1) - 1), delta_xc(2:size(f, 1) - 1) ! (2:n - 1) 181 182 !------------------------------------------------------ 183 184 n = size(f, 1) 185 forall (i = 1:n) xc(i) = (x(i) + x(i + 1)) / 2. 186 187 forall (i = 2:n - 1) 188 h(i) = abs(x(i + 1) - xc(i)) 189 delta_xc(i) = xc(i + 1) - xc(i - 1) 190 end forall 191 192 do l = 1, size(f, 4) 193 do k = 1, size(f, 3) 194 do j = 1, size(f, 2) 195 slopes4(1, j, k, l) = 0. 196 197 do i = 2, n - 1 198 if (f(i, j, k, l) >= max(f(i - 1, j, k, l), f(i + 1, j, k, l)) & 199 .or. f(i, j, k, l) & 200 <= min(f(i - 1, j, k, l), f(i + 1, j, k, l))) then 201 ! Local extremum 202 slopes4(i, j, k, l) = 0. 203 else 204 ! (f(i - 1, j, k, l), f(i, j, k, l), f(i + 1, j, k, l)) 205 ! strictly monotonous 206 207 ! Second order slope: 208 slopes4(i, j, k, l) = (f(i + 1, j, k, l) & 209 - f(i - 1, j, k, l)) / delta_xc(i) 210 211 ! Slope limitation: 212 slopes4(i, j, k, l) = sign(min(abs(slopes4(i, j, k, l)), & 213 abs(f(i + 1, j, k, l) - f(i, j, k, l)) / h(i), & 214 abs(f(i, j, k, l) - f(i - 1, j, k, l)) / h(i)), & 215 slopes4(i, j, k, l)) 216 end if 217 end do 218 219 slopes4(n, j, k, l) = 0. 220 end do 221 end do 222 end do 223 224 end function slopes4 225 226 end module slopes_m 4 ! Extension / factorisation: David CUGNET 5 6 IMPLICIT NONE 7 8 ! Those generic function computes second order slopes with Van 9 ! Leer slope-limiting, given cell averages. Reference: Dukowicz, 10 ! 1987, SIAM Journal on Scientific and Statistical Computing, 8, 11 ! 305. 12 13 ! The only difference between the specific functions is the rank 14 ! of the first argument and the equal rank of the result. 15 16 ! slope(ix,...) acts on ix th dimension. 17 18 ! real, intent(in), rank >= 1:: f ! (n, ...) cell averages, n must be >= 1 19 ! real, intent(in):: x(:) ! (n + 1) cell edges 20 ! real slopes, same shape as f ! (n, ...) 21 INTERFACE slopes 22 MODULE procedure slopes1, slopes2, slopes3, slopes4, slopes5 23 END INTERFACE 24 25 PRIVATE 26 PUBLIC :: slopes 27 28 CONTAINS 29 30 !------------------------------------------------------------------------------- 31 ! 32 PURE FUNCTION slopes1(ix, f, x) 33 ! 34 !------------------------------------------------------------------------------- 35 ! Arguments: 36 INTEGER, INTENT(IN) :: ix 37 REAL, INTENT(IN) :: f(:) 38 REAL, INTENT(IN) :: x(:) 39 REAL :: slopes1(SIZE(f,1)) 40 !------------------------------------------------------------------------------- 41 ! Local: 42 INTEGER :: n, i, j, sta(2), sto(2) 43 REAL :: xc(SIZE(f,1)) ! (n) cell centers 44 REAL :: h(2:SIZE(f,1)-1), delta_xc(2:SIZE(f,1)-1) ! (2:n-1) 45 REAL :: fm, ff, fp, dx 46 !------------------------------------------------------------------------------- 47 n=SIZE(f,ix) 48 FORALL(i=1:n) xc(i)=(x(i)+x(i+1))/2. 49 FORALL(i=2:n-1) 50 h(i)=ABS(x(i+1)-xc(i)) ; delta_xc(i)=xc(i+1)-xc(i-1) 51 END FORALL 52 slopes1(:)=0. 53 DO i=2,n-1 54 ff=f(i); fm=f(i-1); fp=f(i+1) 55 IF(ff>=MAX(fm,fp).OR.ff<=MIN(fm,fp)) THEN 56 slopes1(i)=0.; CYCLE !--- Local extremum 57 !--- 2nd order slope ; (fm, ff, fp) strictly monotonous 58 slopes1(i)=(fp-fm)/delta_xc(i) 59 !--- Slope limitation 60 slopes1(i) = SIGN(MIN(ABS(slopes1(i)), & 61 ABS(fp-ff)/h(i),ABS(ff-fm)/h(i)),slopes1(i) ) 62 END IF 63 END DO 64 65 END FUNCTION slopes1 66 ! 67 !------------------------------------------------------------------------------- 68 69 70 !------------------------------------------------------------------------------- 71 ! 72 PURE FUNCTION slopes2(ix, f, x) 73 ! 74 !------------------------------------------------------------------------------- 75 ! Arguments: 76 INTEGER, INTENT(IN) :: ix 77 REAL, INTENT(IN) :: f(:, :) 78 REAL, INTENT(IN) :: x(:) 79 REAL :: slopes2(SIZE(f,1),SIZE(f,2)) 80 !------------------------------------------------------------------------------- 81 ! Local: 82 INTEGER :: n, i, j, sta(2), sto(2) 83 REAL, ALLOCATABLE :: xc(:) ! (n) cell centers 84 REAL, ALLOCATABLE :: h(:), delta_xc(:) ! (2:n-1) 85 REAL :: fm, ff, fp, dx 86 !------------------------------------------------------------------------------- 87 n=SIZE(f,ix); ALLOCATE(xc(n),h(2:n-1),delta_xc(2:n-1)) 88 FORALL(i=1:n) xc(i)=(x(i)+x(i+1))/2. 89 FORALL(i=2:n-1) 90 h(i)=ABS(x(i+1)-xc(i)) ; delta_xc(i)=xc(i+1)-xc(i-1) 91 END FORALL 92 slopes2(:,:)=0. 93 sta=[1,1]; sta(ix)=2 94 sto=SHAPE(f); sto(ix)=n-1 95 DO j=sta(2),sto(2); IF(ix==2) dx=delta_xc(j) 96 DO i=sta(1),sto(1); IF(ix==1) dx=delta_xc(i) 97 ff=f(i,j) 98 SELECT CASE(ix) 99 CASE(1); fm=f(i-1,j); fp=f(i+1,j) 100 CASE(2); fm=f(i,j-1); fp=f(i,j+1) 101 END SELECT 102 IF(ff>=MAX(fm,fp).OR.ff<=MIN(fm,fp)) THEN 103 slopes2(i,j)=0.; CYCLE !--- Local extremum 104 !--- 2nd order slope ; (fm, ff, fp) strictly monotonous 105 slopes2(i,j)=(fp-fm)/dx 106 !--- Slope limitation 107 slopes2(i,j) = SIGN(MIN(ABS(slopes2(i,j)), & 108 ABS(fp-ff)/h(i),ABS(ff-fm)/h(i)),slopes2(i,j) ) 109 END IF 110 END DO 111 END DO 112 DEALLOCATE(xc,h,delta_xc) 113 114 END FUNCTION slopes2 115 ! 116 !------------------------------------------------------------------------------- 117 118 119 !------------------------------------------------------------------------------- 120 ! 121 PURE FUNCTION slopes3(ix, f, x) 122 ! 123 !------------------------------------------------------------------------------- 124 ! Arguments: 125 INTEGER, INTENT(IN) :: ix 126 REAL, INTENT(IN) :: f(:, :, :) 127 REAL, INTENT(IN) :: x(:) 128 REAL :: slopes3(SIZE(f,1),SIZE(f,2),SIZE(f,3)) 129 !------------------------------------------------------------------------------- 130 ! Local: 131 INTEGER :: n, i, j, k, sta(3), sto(3) 132 REAL, ALLOCATABLE :: xc(:) ! (n) cell centers 133 REAL, ALLOCATABLE :: h(:), delta_xc(:) ! (2:n-1) 134 REAL :: fm, ff, fp, dx 135 !------------------------------------------------------------------------------- 136 n=SIZE(f,ix); ALLOCATE(xc(n),h(2:n-1),delta_xc(2:n-1)) 137 FORALL(i=1:n) xc(i)=(x(i)+x(i+1))/2. 138 FORALL(i=2:n-1) 139 h(i)=ABS(x(i+1)-xc(i)) ; delta_xc(i)=xc(i+1)-xc(i-1) 140 END FORALL 141 slopes3(:,:,:)=0. 142 sta=[1,1,1]; sta(ix)=2 143 sto=SHAPE(f); sto(ix)=n-1 144 DO k=sta(3),sto(3); IF(ix==3) dx=delta_xc(k) 145 DO j=sta(2),sto(2); IF(ix==2) dx=delta_xc(j) 146 DO i=sta(1),sto(1); IF(ix==1) dx=delta_xc(i) 147 ff=f(i,j,k) 148 SELECT CASE(ix) 149 CASE(1); fm=f(i-1,j,k); fp=f(i+1,j,k) 150 CASE(2); fm=f(i,j-1,k); fp=f(i,j+1,k) 151 CASE(3); fm=f(i,j,k-1); fp=f(i,j,k+1) 152 END SELECT 153 IF(ff>=MAX(fm,fp).OR.ff<=MIN(fm,fp)) THEN 154 slopes3(i,j,k)=0.; CYCLE !--- Local extremum 155 !--- 2nd order slope ; (fm, ff, fp) strictly monotonous 156 slopes3(i,j,k)=(fp-fm)/dx 157 !--- Slope limitation 158 slopes3(i,j,k) = SIGN(MIN(ABS(slopes3(i,j,k)), & 159 ABS(fp-ff)/h(i),ABS(ff-fm)/h(i)),slopes3(i,j,k) ) 160 END IF 161 END DO 162 END DO 163 END DO 164 DEALLOCATE(xc,h,delta_xc) 165 166 END FUNCTION slopes3 167 ! 168 !------------------------------------------------------------------------------- 169 170 171 !------------------------------------------------------------------------------- 172 ! 173 PURE FUNCTION slopes4(ix, f, x) 174 ! 175 !------------------------------------------------------------------------------- 176 ! Arguments: 177 INTEGER, INTENT(IN) :: ix 178 REAL, INTENT(IN) :: f(:, :, :, :) 179 REAL, INTENT(IN) :: x(:) 180 REAL :: slopes4(SIZE(f,1),SIZE(f,2),SIZE(f,3),SIZE(f,4)) 181 !------------------------------------------------------------------------------- 182 ! Local: 183 INTEGER :: n, i, j, k, l, m, sta(4), sto(4) 184 REAL, ALLOCATABLE :: xc(:) ! (n) cell centers 185 REAL, ALLOCATABLE :: h(:), delta_xc(:) ! (2:n-1) 186 REAL :: fm, ff, fp, dx 187 !------------------------------------------------------------------------------- 188 n=SIZE(f,ix); ALLOCATE(xc(n),h(2:n-1),delta_xc(2:n-1)) 189 FORALL(i=1:n) xc(i)=(x(i)+x(i+1))/2. 190 FORALL(i=2:n-1) 191 h(i)=ABS(x(i+1)-xc(i)) ; delta_xc(i)=xc(i+1)-xc(i-1) 192 END FORALL 193 slopes4(:,:,:,:)=0. 194 sta=[1,1,1,1]; sta(ix)=2 195 sto=SHAPE(f); sto(ix)=n-1 196 DO l=sta(4),sto(4); IF(ix==4) dx=delta_xc(l) 197 DO k=sta(3),sto(3); IF(ix==3) dx=delta_xc(k) 198 DO j=sta(2),sto(2); IF(ix==2) dx=delta_xc(j) 199 DO i=sta(1),sto(1); IF(ix==1) dx=delta_xc(i) 200 ff=f(i,j,k,l) 201 SELECT CASE(ix) 202 CASE(1); fm=f(i-1,j,k,l); fp=f(i+1,j,k,l) 203 CASE(2); fm=f(i,j-1,k,l); fp=f(i,j+1,k,l) 204 CASE(3); fm=f(i,j,k-1,l); fp=f(i,j,k+1,l) 205 CASE(4); fm=f(i,j,k,l-1); fp=f(i,j,k,l+1) 206 END SELECT 207 IF(ff>=MAX(fm,fp).OR.ff<=MIN(fm,fp)) THEN 208 slopes4(i,j,k,l)=0.; CYCLE !--- Local extremum 209 !--- 2nd order slope ; (fm, ff, fp) strictly monotonous 210 slopes4(i,j,k,l)=(fp-fm)/dx 211 !--- Slope limitation 212 slopes4(i,j,k,l) = SIGN(MIN(ABS(slopes4(i,j,k,l)), & 213 ABS(fp-ff)/h(i),ABS(ff-fm)/h(i)),slopes4(i,j,k,l) ) 214 END IF 215 END DO 216 END DO 217 END DO 218 END DO 219 DEALLOCATE(xc,h,delta_xc) 220 221 END FUNCTION slopes4 222 ! 223 !------------------------------------------------------------------------------- 224 225 226 !------------------------------------------------------------------------------- 227 ! 228 PURE FUNCTION slopes5(ix, f, x) 229 ! 230 !------------------------------------------------------------------------------- 231 ! Arguments: 232 INTEGER, INTENT(IN) :: ix 233 REAL, INTENT(IN) :: f(:, :, :, :, :) 234 REAL, INTENT(IN) :: x(:) 235 REAL :: slopes5(SIZE(f,1),SIZE(f,2),SIZE(f,3),SIZE(f,4),SIZE(f,5)) 236 !------------------------------------------------------------------------------- 237 ! Local: 238 INTEGER :: n, i, j, k, l, m, sta(5), sto(5) 239 REAL, ALLOCATABLE :: xc(:) ! (n) cell centers 240 REAL, ALLOCATABLE :: h(:), delta_xc(:) ! (2:n-1) 241 REAL :: fm, ff, fp, dx 242 !------------------------------------------------------------------------------- 243 n=SIZE(f,ix); ALLOCATE(xc(n),h(2:n-1),delta_xc(2:n-1)) 244 FORALL(i=1:n) xc(i)=(x(i)+x(i+1))/2. 245 FORALL(i=2:n-1) 246 h(i)=ABS(x(i+1)-xc(i)) ; delta_xc(i)=xc(i+1)-xc(i-1) 247 END FORALL 248 slopes5(:,:,:,:,:)=0. 249 sta=[1,1,1,1,1]; sta(ix)=2 250 sto=SHAPE(f); sto(ix)=n-1 251 DO m=sta(5),sto(5); IF(ix==5) dx=delta_xc(m) 252 DO l=sta(4),sto(4); IF(ix==4) dx=delta_xc(l) 253 DO k=sta(3),sto(3); IF(ix==3) dx=delta_xc(k) 254 DO j=sta(2),sto(2); IF(ix==2) dx=delta_xc(j) 255 DO i=sta(1),sto(1); IF(ix==1) dx=delta_xc(i) 256 ff=f(i,j,k,l,m) 257 SELECT CASE(ix) 258 CASE(1); fm=f(i-1,j,k,l,m); fp=f(i+1,j,k,l,m) 259 CASE(2); fm=f(i,j-1,k,l,m); fp=f(i,j+1,k,l,m) 260 CASE(3); fm=f(i,j,k-1,l,m); fp=f(i,j,k+1,l,m) 261 CASE(4); fm=f(i,j,k,l-1,m); fp=f(i,j,k,l+1,m) 262 CASE(5); fm=f(i,j,k,l,m-1); fp=f(i,j,k,l,m+1) 263 END SELECT 264 IF(ff>=MAX(fm,fp).OR.ff<=MIN(fm,fp)) THEN 265 slopes5(i,j,k,l,m)=0.; CYCLE !--- Local extremum 266 !--- 2nd order slope ; (fm, ff, fp) strictly monotonous 267 slopes5(i,j,k,l,m)=(fp-fm)/dx 268 !--- Slope limitation 269 slopes5(i,j,k,l,m) = SIGN(MIN(ABS(slopes5(i,j,k,l,m)), & 270 ABS(fp-ff)/h(i),ABS(ff-fm)/h(i)),slopes5(i,j,k,l,m) ) 271 END IF 272 END DO 273 END DO 274 END DO 275 END DO 276 END DO 277 DEALLOCATE(xc,h,delta_xc) 278 279 END FUNCTION slopes5 280 ! 281 !------------------------------------------------------------------------------- 282 283 END MODULE slopes_m -
LMDZ5/branches/testing/libf/phylmd/YOETHF.h
r2641 r2839 19 19 REAL R5ALVCP,R5ALSCP,RALVDCP,RALSDCP,RALFDCP,RTWAT,RTBER,RTBERCU 20 20 REAL RTICE,RTICECU,RTWAT_RTICE_R,RTWAT_RTICECU_R,RKOOP1,RKOOP2 21 LOGICAL OK_BAD_ECMWF_THERMO ! If TRUE, then variables set by rrtm/suphec.F90 22 ! If FALSE, then variables set by suphel.F90 21 23 COMMON /YOETHF/R2ES, R3LES, R3IES, R4LES, R4IES, R5LES, R5IES, & 22 24 & RVTMP2, RHOH2O, & … … 24 26 & RALFDCP,RTWAT,RTBER,RTBERCU, & 25 27 & RTICE,RTICECU,RTWAT_RTICE_R,RTWAT_RTICECU_R,RKOOP1,& 26 & RKOOP2 28 & RKOOP2, & 29 & OK_BAD_ECMWF_THERMO 27 30 28 31 !$OMP THREADPRIVATE(/YOETHF/) -
LMDZ5/branches/testing/libf/phylmd/aero_mod.F90
r2594 r2839 46 46 ! 2/ Total number of aerosols for which an aerosol mass is provided 47 47 48 INTEGER, PARAMETER :: naero_spc = 1 048 INTEGER, PARAMETER :: naero_spc = 13 49 49 50 50 ! Corresponding names for the aerosols … … 59 59 "CIDUSTM", & 60 60 "AIBCM ", & 61 "AIPOMM " /) 61 "AIPOMM " ,& 62 "ASNO3M ", & 63 "CSNO3M ", & 64 "CINO3M " /) 62 65 63 66 ! 3/ Number of aerosol groups -
LMDZ5/branches/testing/libf/phylmd/calcul_divers.h
r2408 r2839 5 5 IF(itap.EQ.1) THEN 6 6 itapm1=0 7 ! surface terre8 DO i=1, klon9 IF(pctsrf(i,is_ter).GT.0.) THEN10 paire_ter(i)=cell_area(i)*pctsrf(i,is_ter)11 ENDIF12 ENDDO13 7 ENDIF 14 8 -
LMDZ5/branches/testing/libf/phylmd/clesphys.h
r2787 r2839 87 87 LOGICAL :: ok_qch4 88 88 LOGICAL :: ok_conserv_q 89 LOGICAL :: adjust_tropopause 90 LOGICAL :: ok_daily_climoz 89 91 90 92 COMMON/clesphys/ & … … 130 132 & , iflag_rrtm, ok_strato,ok_hines, ok_qch4 & 131 133 & , iflag_ice_thermo, ok_gwd_rando, NSW, iflag_albedo & 132 & , ok_chlorophyll,ok_conserv_q, ok_all_xml 134 & , ok_chlorophyll,ok_conserv_q, adjust_tropopause & 135 & , ok_daily_climoz, ok_all_xml 133 136 134 137 save /clesphys/ -
LMDZ5/branches/testing/libf/phylmd/climb_hq_mod.F90
r2187 r2839 9 9 SAVE 10 10 PRIVATE 11 PUBLIC :: climb_hq_down, climb_hq_up 11 PUBLIC :: climb_hq_down, climb_hq_up, d_h_col_vdf, f_h_bnd 12 12 13 13 REAL, DIMENSION(:,:), ALLOCATABLE :: gamaq, gamah … … 23 23 REAL, DIMENSION(:,:), ALLOCATABLE :: Kcoefhq 24 24 !$OMP THREADPRIVATE(Kcoefhq) 25 REAL, SAVE, DIMENSION(:,:), ALLOCATABLE :: h_old ! for diagnostics, h before solving diffusion 26 !$OMP THREADPRIVATE(h_old) 27 REAL, SAVE, DIMENSION(:), ALLOCATABLE :: d_h_col_vdf ! for diagnostics, vertical integral of enthalpy change 28 !$OMP THREADPRIVATE(d_h_col_vdf) 29 REAL, SAVE, DIMENSION(:), ALLOCATABLE :: f_h_bnd ! for diagnostics, enthalpy flux at surface 30 !$OMP THREADPRIVATE(f_h_bnd) 25 31 26 32 CONTAINS … … 71 77 LOGICAL, SAVE :: first=.TRUE. 72 78 !$OMP THREADPRIVATE(first) 73 REAL, DIMENSION(klon,klev) :: local_H 79 ! JLD now renamed h_old and declared in module 80 ! REAL, DIMENSION(klon,klev) :: local_H 74 81 REAL, DIMENSION(klon) :: psref 75 82 REAL :: delz, pkh 76 83 INTEGER :: k, i, ierr 77 78 84 ! Include 79 85 !**************************************************************************************** … … 113 119 ALLOCATE(gamah(1:klon,2:klev), STAT=ierr) 114 120 IF ( ierr /= 0 ) PRINT*,' pb in allloc gamah, ierr=', ierr 121 122 ALLOCATE(h_old(klon,klev), STAT=ierr) 123 IF ( ierr /= 0 ) PRINT*,' pb in allloc h_old, ierr=', ierr 124 125 ALLOCATE(d_h_col_vdf(klon), STAT=ierr) 126 IF ( ierr /= 0 ) PRINT*,' pb in allloc d_h_col_vdf, ierr=', ierr 127 128 ALLOCATE(f_h_bnd(klon), STAT=ierr) 129 IF ( ierr /= 0 ) PRINT*,' pb in allloc f_h_bnd, ierr=', ierr 115 130 END IF 116 131 … … 177 192 ! 178 193 !**************************************************************************************** 179 local_H(:,:) = 0.0194 h_old(:,:) = 0.0 180 195 181 196 DO k=1,klev 182 197 DO i = 1, knon 183 198 ! convertie la temperature en entalpie potentielle 184 local_H(i,k) = RCPD * temp(i,k) * &199 h_old(i,k) = RCPD * temp(i,k) * & 185 200 (psref(i)/pplay(i,k))**RKAPPA 186 201 ENDDO 187 202 ENDDO 188 203 189 CALL calc_coef(knon, Kcoefhq(:,:), gamah(:,:), delp(:,:), local_H(:,:), &204 CALL calc_coef(knon, Kcoefhq(:,:), gamah(:,:), delp(:,:), h_old(:,:), & 190 205 Ccoef_H(:,:), Dcoef_H(:,:), Acoef_H, Bcoef_H) 191 206 … … 349 364 ! 1) 350 365 ! Definition of some variables 366 REAL, DIMENSION(klon,klev) :: d_h, zairm 351 367 ! 352 368 !**************************************************************************************** … … 355 371 d_q(:,:) = 0.0 356 372 d_t(:,:) = 0.0 373 d_h(:,:) = 0.0 374 f_h_bnd(:)= 0.0 357 375 358 376 psref(1:knon) = paprs(1:knon,1) … … 393 411 q_new(1:knon,1) = Acoef_Q(1:knon) + Bcoef_Q(1:knon)*flx_q1(1:knon)*dtime 394 412 h_new(1:knon,1) = Acoef_H(1:knon) + Bcoef_H(1:knon)*flx_h1(1:knon)*dtime 395 413 f_h_bnd(1:knon) = flx_h1(1:knon) 396 414 !- All the other layers 397 415 DO k = 2, klev … … 427 445 ! 428 446 !**************************************************************************************** 429 447 d_h_col_vdf(:) = 0.0 430 448 DO k = 1, klev 431 449 DO i = 1, knon 432 450 d_t(i,k) = h_new(i,k)/(psref(i)/pplay(i,k))**RKAPPA/RCPD - t_old(i,k) 433 451 d_q(i,k) = q_new(i,k) - q_old(i,k) 434 END DO 452 d_h(i,k) = h_new(i,k) - h_old(i,k) 453 !JLD d_t(i,k) = d_h(i,k)/(psref(i)/pplay(i,k))**RKAPPA/RCPD !correction a venir 454 ! layer air mass 455 zairm(i, k) = (paprs(i,k)-paprs(i,k+1))/rg 456 d_h_col_vdf(i) = d_h_col_vdf(i) + d_h(i,k)*zairm(i,k) 457 END DO 435 458 END DO 436 459 … … 448 471 DEALLOCATE(Kcoefhq,stat=ierr) 449 472 IF ( ierr /= 0 ) PRINT*,' pb in dealllocate Kcoefhq, ierr=', ierr 473 DEALLOCATE(h_old, d_h_col_vdf, f_h_bnd, stat=ierr) 474 IF ( ierr /= 0 ) PRINT*,' pb in dealllocate h_old, d_h_col_vdf, f_h_bnd, ierr=', ierr 450 475 END IF 451 476 END SUBROUTINE climb_hq_up -
LMDZ5/branches/testing/libf/phylmd/concvl.F90
r2488 r2839 5 5 d_t, d_q, d_u, d_v, d_tra, & 6 6 rain, snow, kbas, ktop, sigd, & 7 cbmf, plcl, plfc, wbeff, upwd, dnwd, dnwdbis, & 7 cbmf, plcl, plfc, wbeff, convoccur, & 8 upwd, dnwd, dnwdbis, & 8 9 Ma, mip, Vprecip, & 9 10 cape, cin, tvp, Tconv, iflag, & … … 157 158 REAL qs(klon, klev), qs_wake(klon, klev) 158 159 REAL cbmf(klon), plcl(klon), plfc(klon), wbeff(klon) 160 REAL convoccur(klon) 159 161 !LF SAVE cbmf 160 162 !IM/JYG REAL, SAVE, ALLOCATABLE :: cbmf(:) … … 228 230 ALLOCATE (t1(klon,klev)) 229 231 ALLOCATE (q1(klon,klev)) 232 ! 233 convoccur(:) = 0. 234 ! 230 235 itap = 0 231 236 igout = klon/2 + 1/klon … … 450 455 END DO 451 456 457 IF (iflag_con==3) THEN 458 DO i = 1,klon 459 IF (wbeff(i) > 100. .OR. wbeff(i) == 0 .OR. iflag(i) > 3) THEN 460 wbeff(i) = 0. 461 convoccur(i) = 0. 462 ELSE 463 convoccur(i) = 1. 464 ENDIF 465 ENDDO 466 ENDIF 467 452 468 IF (iflag_con==30) THEN 453 469 DO itra = 1, ntra -
LMDZ5/branches/testing/libf/phylmd/conf_phys_m.F90
r2787 r2839 222 222 LOGICAL,SAVE :: carbon_cycle_tr_omp 223 223 LOGICAL,SAVE :: carbon_cycle_cpl_omp 224 LOGICAL,SAVE :: adjust_tropopause_omp 225 LOGICAL,SAVE :: ok_daily_climoz_omp 224 226 225 227 INTEGER, INTENT(OUT):: read_climoz ! read ozone climatology, OpenMP shared … … 2035 2037 !Config Help = ... 2036 2038 ! 2039 ! 2040 adjust_tropopause = .FALSE. 2041 CALL getin('adjust_tropopause', adjust_tropopause_omp) 2042 ! 2043 !Config Key = adjust_tropopause 2044 !Config Desc = Adjust the ozone field from the climoz file by stretching its 2045 ! tropopause so that it matches the one of LMDZ. 2046 !Config Def = .FALSE. 2047 !Config Help = Ensure tropospheric ozone column conservation. 2048 ! 2049 ! 2050 ok_daily_climoz = .FALSE. 2051 CALL getin('ok_daily_climoz', ok_daily_climoz_omp) 2052 ! 2053 !Config Key = ok_daily_climoz 2054 !Config Desc = Interpolate in time the ozone forcings within ce0l. 2055 ! .TRUE. if backward compatibility is needed. 2056 !Config Def = .TRUE. 2057 !Config Help = .FALSE. ensure much fewer (no calendar dependency) 2058 ! and lighter monthly climoz files, inetrpolated in time at gcm run time. 2037 2059 ! 2038 2060 ecrit_LES_omp = 1./8. … … 2291 2313 callstats = callstats_omp 2292 2314 ecrit_LES = ecrit_LES_omp 2315 adjust_tropopause = adjust_tropopause_omp 2316 ok_daily_climoz = ok_daily_climoz_omp 2293 2317 carbon_cycle_tr = carbon_cycle_tr_omp 2294 2318 carbon_cycle_cpl = carbon_cycle_cpl_omp … … 2485 2509 write(lunout,*)' aerosol_couple = ', aerosol_couple 2486 2510 write(lunout,*)' flag_aerosol = ', flag_aerosol 2487 write(lunout,*)' flag_aerosol_strat 2511 write(lunout,*)' flag_aerosol_strat= ', flag_aerosol_strat 2488 2512 write(lunout,*)' new_aod = ', new_aod 2489 2513 write(lunout,*)' aer_type = ',aer_type … … 2568 2592 write(lunout,*) 'SSO gkwake=',gkwake 2569 2593 write(lunout,*) 'SSO gklift=',gklift 2594 write(lunout,*) 'adjust_tropopause = ', adjust_tropopause 2595 write(lunout,*) 'ok_daily_climoz = ',ok_daily_climoz 2570 2596 write(lunout,*) 'read_climoz = ', read_climoz 2571 2597 write(lunout,*) 'carbon_cycle_tr = ', carbon_cycle_tr -
LMDZ5/branches/testing/libf/phylmd/cosp/cosp_output_mod.F90
r2720 r2839 20 20 INTEGER, DIMENSION(3), SAVE :: nhoricosp,nvert,nvertmcosp,nvertcol,nvertbze, & 21 21 nvertsratio,nvertisccp,nvertp,nverttemp,nvertmisr, & 22 nvertReffIce,nvertReffLiq 22 nvertReffIce,nvertReffLiq,nverttau 23 23 REAL, DIMENSION(3), SAVE :: zoutm_cosp 24 24 !$OMP THREADPRIVATE(nhoricosp, nvert,nvertmcosp,nvertcol,nvertsratio,nvertbze,nvertisccp,nvertp,zoutm_cosp,nverttemp,nvertmisr) 25 !$OMP THREADPRIVATE(nvertReffIce,nvertReffLiq )25 !$OMP THREADPRIVATE(nvertReffIce,nvertReffLiq,nverttau) 26 26 REAL, SAVE :: zdtimemoy_cosp 27 27 !$OMP THREADPRIVATE(zdtimemoy_cosp) … … 207 207 SUBROUTINE cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, & 208 208 ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml, & 209 ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid) 210 209 ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid, stlidar) 211 210 212 211 USE iophy … … 229 228 logical :: ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, use_vgrid, ok_all_xml 230 229 type(cosp_vgrid) :: vgrid ! Information on vertical grid of stats 230 type(cosp_lidarstats) :: stlidar ! Summary statistics from lidar simulator 231 231 232 232 !!! Variables locales … … 236 236 real,dimension(2,SR_BINS) :: sratio_bounds 237 237 real,dimension(SR_BINS) :: sratio_ax 238 real,dimension(DBZE_BINS) :: dbze_ax 238 239 CHARACTER(LEN=20), DIMENSION(3) :: chfreq = (/ '1day', '1d ', '3h ' /) 239 240 … … 257 258 enddo 258 259 259 ! do ii=1,DBZE_BINS 260 ! dbze_ax(i) = CFAD_ZE_MIN + CFAD_ZE_WIDTH*(ii - 0.5) 261 ! enddo 262 263 ! sratio_bounds(2,:)=stlidar%srbval(:) ! srbval contains the upper 260 do i=1,DBZE_BINS 261 dbze_ax(i) = CFAD_ZE_MIN + CFAD_ZE_WIDTH*(i - 0.5) 262 enddo 263 264 265 sratio_bounds(2,:)=stlidar%srbval(:) ! srbval contains the upper 264 266 ! limits from lmd_ipsl_stats.f90 265 !sratio_bounds(1,2:SR_BINS) = stlidar%srbval(1:SR_BINS-1)266 !sratio_bounds(1,1) = 0.0267 !sratio_bounds(2,SR_BINS) = 1.e5 ! This matches with Chepfer et al., JGR,267 sratio_bounds(1,2:SR_BINS) = stlidar%srbval(1:SR_BINS-1) 268 sratio_bounds(1,1) = 0.0 269 sratio_bounds(2,SR_BINS) = 1.e5 ! This matches with Chepfer et al., JGR, 268 270 ! ! 2009. However, it is not consistent 269 271 ! with the upper limit in 270 272 ! lmd_ipsl_stats.f90, which is 271 273 ! LIDAR_UNDEF-1=998.999 272 !sratio_ax(:) = (sratio_bounds(1,:)+sratio_bounds(2,:))/2.0274 sratio_ax(:) = (sratio_bounds(1,:)+sratio_bounds(2,:))/2.0 273 275 274 276 cosp_outfilenames(1) = 'histmthCOSP' … … 331 333 CALL wxios_add_vaxis("temp", LIDAR_NTEMP, LIDAR_PHASE_TEMP) 332 334 CALL wxios_add_vaxis("cth16", MISR_N_CTH, MISR_CTH) 333 !CALL wxios_add_vaxis("dbze", DBZE_BINS, dbze_ax)334 !CALL wxios_add_vaxis("scatratio", SR_BINS, sratio_ax)335 CALL wxios_add_vaxis("dbze", DBZE_BINS, dbze_ax) 336 CALL wxios_add_vaxis("scatratio", SR_BINS, sratio_ax) 335 337 CALL wxios_add_vaxis("ReffIce", numMODISReffIceBins, reffICE_binCenters) 336 338 CALL wxios_add_vaxis("ReffLiq", numMODISReffLiqBins, reffLIQ_binCenters) 339 print*,'reffICE_binCenters=',reffICE_binCenters 340 CALL wxios_add_vaxis("tau", 7, ISCCP_TAU) 337 341 338 342 #endif … … 384 388 nvertReffLiq(iff)) 385 389 386 !CALL histvert(cosp_nidfiles(iff),"dbze","equivalent_reflectivity_factor","dBZ",DBZE_BINS,dbze_ax,nvertbze(iff))390 CALL histvert(cosp_nidfiles(iff),"dbze","equivalent_reflectivity_factor","dBZ",DBZE_BINS,dbze_ax,nvertbze(iff)) 387 391 388 ! CALL histvert(cosp_nidfiles(iff),"scatratio","backscattering_ratio","1",SR_BINS,sratio_ax,nvertsratio(iff)) 392 CALL histvert(cosp_nidfiles(iff),"scatratio","backscattering_ratio","1",SR_BINS,sratio_ax,nvertsratio(iff)) 393 394 CALL histvert(cosp_nidfiles(iff),"tau","cloud optical depth","1",7,ISCCP_TAU,nverttau(iff)) 389 395 390 396 !!! Valeur indefinie en cas IOIPSL -
LMDZ5/branches/testing/libf/phylmd/cosp/cosp_output_write_mod.F90
r2787 r2839 17 17 CONTAINS 18 18 19 SUBROUTINE cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, &19 SUBROUTINE cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_cosp, & 20 20 cfg, gbx, vgrid, sglidar, sgradar, stlidar, stradar, & 21 21 isccp, misr, modis) … … 32 32 !!! Variables d'entree 33 33 integer :: itap, Nlevlmdz, Ncolumns, Npoints 34 real :: freq_COSP, dtime 34 real :: freq_COSP, dtime, missing_val, missing_cosp 35 35 type(cosp_config) :: cfg ! Control outputs 36 36 type(cosp_gridbox) :: gbx ! Gridbox information. Input for COSP … … 49 49 integer :: itau_wcosp 50 50 real, dimension(Npoints,PARASOL_NREFL) :: parasolcrefl, Ncref 51 52 53 #ifdef CPP_XIOS 54 missing_val=missing_cosp 55 #else 56 missing_val=0. 57 #endif 51 58 52 59 Nlevout = vgrid%Nlvgrid … … 95 102 do ip = 1,Npoints 96 103 if(stlidar%lidarcld(ip,k).eq.R_UNDEF)then 97 stlidar%lidarcld(ip,k)= Cosp_fill_value104 stlidar%lidarcld(ip,k)=missing_val 98 105 endif 99 106 enddo … … 102 109 do ip = 1,Npoints 103 110 if(stlidar%cfad_sr(ip,ii,k).eq.R_UNDEF)then 104 stlidar%cfad_sr(ip,ii,k)= Cosp_fill_value111 stlidar%cfad_sr(ip,ii,k)=missing_val 105 112 endif 106 113 enddo … … 111 118 do k = 1,Nlevlmdz 112 119 if(sglidar%beta_mol(ip,k).eq.R_UNDEF)then 113 sglidar%beta_mol(ip,k)= Cosp_fill_value120 sglidar%beta_mol(ip,k)=missing_val 114 121 endif 115 122 116 123 do ii= 1,Ncolumns 117 124 if(sglidar%beta_tot(ip,ii,k).eq.R_UNDEF)then 118 sglidar%beta_tot(ip,ii,k)= Cosp_fill_value125 sglidar%beta_tot(ip,ii,k)=missing_val 119 126 endif 120 127 enddo … … 126 133 do ip = 1,Npoints 127 134 if(stlidar%cldlayer(ip,k).eq.R_UNDEF)then 128 stlidar%cldlayer(ip,k)=Cosp_fill_value135 stlidar%cldlayer(ip,k)=missing_val 129 136 endif 130 137 enddo … … 133 140 ! AI 11 / 2015 134 141 135 where(stlidar%parasolrefl == R_UNDEF) stlidar%parasolrefl = 0.0136 where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = 0.0137 where(stlidar%cldlayerphase == R_UNDEF) stlidar%cldlayerphase = 0.0138 where(stlidar%lidarcldphase == R_UNDEF) stlidar%lidarcldphase = 0.0139 where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = 0.0142 where(stlidar%parasolrefl == R_UNDEF) stlidar%parasolrefl = missing_val 143 where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = missing_val 144 where(stlidar%cldlayerphase == R_UNDEF) stlidar%cldlayerphase = missing_val 145 where(stlidar%lidarcldphase == R_UNDEF) stlidar%lidarcldphase = missing_val 146 where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = missing_val 140 147 141 148 … … 169 176 CALL histwrite3d_cosp(o_clcalipsotmpun,stlidar%lidarcldtmp(:,:,4),nverttemp) 170 177 178 #ifdef CPP_XIOS 179 CALL histwrite4d_cosp(o_cfad_lidarsr532,stlidar%cfad_sr) 180 #else 171 181 do icl=1,SR_BINS 172 182 CALL histwrite3d_cosp(o_cfad_lidarsr532,stlidar%cfad_sr(:,icl,:),nvert,icl) 173 183 enddo 174 175 CALL histwrite3d_cosp(o_parasol_refl,stlidar%parasolrefl,nvertp) 184 CALL histwrite3d_cosp(o_parasol_refl,stlidar%parasolrefl,nvertp) 185 #endif 176 186 177 187 do k=1,PARASOL_NREFL … … 182 192 Ncref(ip,k) = 1. 183 193 else 184 parasolcrefl(ip,k)= 0.194 parasolcrefl(ip,k)=missing_val 185 195 Ncref(ip,k) = 0. 186 196 endif … … 190 200 CALL histwrite3d_cosp(o_parasol_crefl,parasolcrefl,nvertp) 191 201 202 #ifdef CPP_XIOS 203 CALL histwrite4d_cosp(o_atb532,sglidar%beta_tot) 204 #else 192 205 do icl=1,Ncolumns 193 206 CALL histwrite3d_cosp(o_atb532,sglidar%beta_tot(:,icl,:),nvertmcosp,icl) 194 207 enddo 208 #endif 209 195 210 CALL histwrite3d_cosp(o_beta_mol532,sglidar%beta_mol,nvertmcosp) 196 211 endif !Lidar 197 212 198 213 if (cfg%Lradar_sim) then 214 215 #ifdef CPP_XIOS 216 CALL histwrite4d_cosp(o_dbze94,sgradar%Ze_tot) 217 CALL histwrite4d_cosp(o_cfadDbze94,stradar%cfad_ze) 218 #else 199 219 do icl=1,Ncolumns 200 220 CALL histwrite3d_cosp(o_dbze94,sgradar%Ze_tot(:,icl,:),nvertmcosp,icl) … … 203 223 CALL histwrite3d_cosp(o_cfadDbze94,stradar%cfad_ze(:,icl,:),nvert,icl) 204 224 enddo 225 #endif 205 226 endif 206 227 207 228 if (cfg%Llidar_sim .and. cfg%Lradar_sim) then 208 229 where(stradar%lidar_only_freq_cloud == R_UNDEF) & 209 stradar%lidar_only_freq_cloud = 0.0230 stradar%lidar_only_freq_cloud = missing_val 210 231 CALL histwrite3d_cosp(o_clcalipso2,stradar%lidar_only_freq_cloud,nvert) 211 232 where(stradar%radar_lidar_tcc == R_UNDEF) & 212 stradar%radar_lidar_tcc = 0.0233 stradar%radar_lidar_tcc = missing_val 213 234 CALL histwrite2d_cosp(o_cltlidarradar,stradar%radar_lidar_tcc) 214 235 endif … … 219 240 do ip = 1,Npoints 220 241 if(isccp%totalcldarea(ip).eq.R_UNDEF)then 221 isccp%totalcldarea(ip)= Cosp_fill_value242 isccp%totalcldarea(ip)=missing_val 222 243 endif 223 244 if(isccp%meanptop(ip).eq.R_UNDEF)then 224 isccp%meanptop(ip)= Cosp_fill_value245 isccp%meanptop(ip)=missing_val 225 246 endif 226 247 if(isccp%meantaucld(ip).eq.R_UNDEF)then 227 isccp%meantaucld(ip)= Cosp_fill_value248 isccp%meantaucld(ip)=missing_val 228 249 endif 229 250 if(isccp%meanalbedocld(ip).eq.R_UNDEF)then 230 isccp%meanalbedocld(ip)=Cosp_fill_value251 isccp%meanalbedocld(ip)=missing_val 231 252 endif 232 253 if(isccp%meantb(ip).eq.R_UNDEF)then 233 isccp%meantb(ip)=Cosp_fill_value254 isccp%meantb(ip)=missing_val 234 255 endif 235 256 if(isccp%meantbclr(ip).eq.R_UNDEF)then 236 isccp%meantbclr(ip)=Cosp_fill_value257 isccp%meantbclr(ip)=missing_val 237 258 endif 238 259 … … 240 261 do ii=1,7 241 262 if(isccp%fq_isccp(ip,ii,k).eq.R_UNDEF)then 242 isccp%fq_isccp(ip,ii,k)= Cosp_fill_value263 isccp%fq_isccp(ip,ii,k)=missing_val 243 264 endif 244 265 enddo … … 247 268 do ii=1,Ncolumns 248 269 if(isccp%boxtau(ip,ii).eq.R_UNDEF)then 249 isccp%boxtau(ip,ii)= Cosp_fill_value270 isccp%boxtau(ip,ii)=missing_val 250 271 endif 251 272 enddo … … 253 274 do ii=1,Ncolumns 254 275 if(isccp%boxptop(ip,ii).eq.R_UNDEF)then 255 isccp%boxptop(ip,ii)=Cosp_fill_value276 isccp%boxptop(ip,ii)=missing_val 256 277 endif 257 278 enddo … … 259 280 260 281 CALL histwrite2d_cosp(o_sunlit,gbx%sunlit) 282 #ifdef CPP_XIOS 283 CALL histwrite4d_cosp(o_clisccp2,isccp%fq_isccp) 284 #else 261 285 do icl=1,7 262 286 CALL histwrite3d_cosp(o_clisccp2,isccp%fq_isccp(:,icl,:),nvertisccp,icl) 263 287 enddo 288 #endif 264 289 CALL histwrite3d_cosp(o_boxtauisccp,isccp%boxtau,nvertcol) 265 290 CALL histwrite3d_cosp(o_boxptopisccp,isccp%boxptop,nvertcol) … … 278 303 do k=1,MISR_N_CTH 279 304 if(misr%fq_MISR(ip,ii,k).eq.R_UNDEF)then 280 misr%fq_MISR(ip,ii,k)=Cosp_fill_value305 misr%fq_MISR(ip,ii,k)=missing_val 281 306 endif 282 307 enddo … … 284 309 enddo 285 310 311 #ifdef CPP_XIOS 312 CALL histwrite4d_cosp(o_clMISR,misr%fq_MISR) 313 #else 286 314 do icl=1,7 287 315 CALL histwrite3d_cosp(o_clMISR,misr%fq_MISR(:,icl,:),nvertmisr,icl) 288 316 enddo 317 #endif 289 318 endif 290 319 … … 294 323 do ip=1,Npoints 295 324 if(modis%Cloud_Fraction_Low_Mean(ip).eq.R_UNDEF)then 296 modis%Cloud_Fraction_Low_Mean(ip)=Cosp_fill_value325 modis%Cloud_Fraction_Low_Mean(ip)=missing_val 297 326 endif 298 327 if(modis%Cloud_Fraction_High_Mean(ip).eq.R_UNDEF)then 299 modis%Cloud_Fraction_High_Mean(ip)= Cosp_fill_value328 modis%Cloud_Fraction_High_Mean(ip)=missing_val 300 329 endif 301 330 if(modis%Cloud_Fraction_Mid_Mean(ip).eq.R_UNDEF)then 302 modis%Cloud_Fraction_Mid_Mean(ip)= Cosp_fill_value331 modis%Cloud_Fraction_Mid_Mean(ip)=missing_val 303 332 endif 304 333 if(modis%Cloud_Fraction_Total_Mean(ip).eq.R_UNDEF)then 305 modis%Cloud_Fraction_Total_Mean(ip)= Cosp_fill_value334 modis%Cloud_Fraction_Total_Mean(ip)=missing_val 306 335 endif 307 336 if(modis%Cloud_Fraction_Water_Mean(ip).eq.R_UNDEF)then 308 modis%Cloud_Fraction_Water_Mean(ip)= Cosp_fill_value337 modis%Cloud_Fraction_Water_Mean(ip)=missing_val 309 338 endif 310 339 if(modis%Cloud_Fraction_Ice_Mean(ip).eq.R_UNDEF)then 311 modis%Cloud_Fraction_Ice_Mean(ip)= Cosp_fill_value340 modis%Cloud_Fraction_Ice_Mean(ip)=missing_val 312 341 endif 313 342 if(modis%Optical_Thickness_Total_Mean(ip).eq.R_UNDEF)then 314 modis%Optical_Thickness_Total_Mean(ip)= Cosp_fill_value343 modis%Optical_Thickness_Total_Mean(ip)=missing_val 315 344 endif 316 345 if(modis%Optical_Thickness_Water_Mean(ip).eq.R_UNDEF)then 317 modis%Optical_Thickness_Water_Mean(ip)= Cosp_fill_value346 modis%Optical_Thickness_Water_Mean(ip)=missing_val 318 347 endif 319 348 if(modis%Optical_Thickness_Ice_Mean(ip).eq.R_UNDEF)then 320 modis%Optical_Thickness_Ice_Mean(ip)= Cosp_fill_value349 modis%Optical_Thickness_Ice_Mean(ip)=missing_val 321 350 endif 322 351 if(modis%Cloud_Particle_Size_Water_Mean(ip).eq.R_UNDEF)then 323 modis%Cloud_Particle_Size_Water_Mean(ip)= Cosp_fill_value352 modis%Cloud_Particle_Size_Water_Mean(ip)=missing_val 324 353 endif 325 354 if(modis%Cloud_Particle_Size_Ice_Mean(ip).eq.R_UNDEF)then 326 modis%Cloud_Particle_Size_Ice_Mean(ip)= Cosp_fill_value355 modis%Cloud_Particle_Size_Ice_Mean(ip)=missing_val 327 356 endif 328 357 if(modis%Cloud_Top_Pressure_Total_Mean(ip).eq.R_UNDEF)then 329 modis%Cloud_Top_Pressure_Total_Mean(ip)= Cosp_fill_value358 modis%Cloud_Top_Pressure_Total_Mean(ip)=missing_val 330 359 endif 331 360 if(modis%Liquid_Water_Path_Mean(ip).eq.R_UNDEF)then 332 modis%Liquid_Water_Path_Mean(ip)= Cosp_fill_value361 modis%Liquid_Water_Path_Mean(ip)=missing_val 333 362 endif 334 363 if(modis%Ice_Water_Path_Mean(ip).eq.R_UNDEF)then 335 modis%Ice_Water_Path_Mean(ip)= Cosp_fill_value364 modis%Ice_Water_Path_Mean(ip)=missing_val 336 365 endif 337 366 338 367 enddo 368 369 where(modis%Optical_Thickness_Total_LogMean == R_UNDEF) & 370 modis%Optical_Thickness_Total_LogMean = missing_val 371 372 373 where(modis%Optical_Thickness_Water_LogMean == R_UNDEF) & 374 modis%Optical_Thickness_Water_LogMean = missing_val 375 376 where(modis%Optical_Thickness_Ice_LogMean == R_UNDEF) & 377 modis%Optical_Thickness_Ice_LogMean = missing_val 339 378 340 379 CALL histwrite2d_cosp(o_cllmodis,modis%Cloud_Fraction_Low_Mean) … … 360 399 do k=1,7 361 400 if(modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k).eq.R_UNDEF)then 362 modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k)= 0.401 modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k)=missing_val 363 402 endif 364 403 enddo … … 366 405 enddo 367 406 407 #ifdef CPP_XIOS 408 CALL histwrite4d_cosp(o_clmodis,modis%Optical_Thickness_vs_Cloud_Top_Pressure) 409 #else 368 410 do icl=1,7 369 411 CALL histwrite3d_cosp(o_clmodis, & 370 412 modis%Optical_Thickness_vs_Cloud_Top_Pressure(:,icl,:),nvertisccp,icl) 371 413 enddo 414 #endif 372 415 373 416 where(modis%Optical_Thickness_vs_ReffIce == R_UNDEF) & 374 modis%Optical_Thickness_vs_ReffIce = Cosp_fill_value417 modis%Optical_Thickness_vs_ReffIce = missing_val 375 418 376 419 where(modis%Optical_Thickness_vs_ReffLiq == R_UNDEF) & 377 modis%Optical_Thickness_vs_ReffLiq = Cosp_fill_value 378 420 modis%Optical_Thickness_vs_ReffLiq = missing_val 421 422 #ifdef CPP_XIOS 423 ! print*,'dimension de crimodis=',size(modis%Optical_Thickness_vs_ReffIce,2),& 424 ! size(modis%Optical_Thickness_vs_ReffIce,3) 425 CALL histwrite4d_cosp(o_crimodis,modis%Optical_Thickness_vs_ReffIce) 426 CALL histwrite4d_cosp(o_crlmodis,modis%Optical_Thickness_vs_ReffLiq) 427 #else 379 428 do icl=1,7 380 429 CALL histwrite3d_cosp(o_crimodis, & … … 383 432 modis%Optical_Thickness_vs_ReffLiq(:,icl,:),nvertReffLiq,icl) 384 433 enddo 434 #endif 385 435 endif 386 436 … … 784 834 END SUBROUTINE histwrite3d_cosp 785 835 836 ! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE 837 ! AI sept 2013 838 SUBROUTINE histwrite4d_cosp(var, field) 839 USE dimphy 840 USE mod_phys_lmdz_para 841 USE ioipsl 842 use iophy 843 USE mod_grid_phy_lmdz, ONLY: nbp_lon 844 USE print_control_mod, ONLY: lunout,prt_level 845 846 #ifdef CPP_XIOS 847 USE xios, only: xios_send_field 848 #endif 849 850 851 IMPLICIT NONE 852 INCLUDE 'clesphys.h' 853 854 TYPE(ctrl_outcosp), INTENT(IN) :: var 855 REAL, DIMENSION(:,:,:), INTENT(IN) :: field ! --> field(klon,:) 856 857 INTEGER :: iff, k 858 859 REAL,DIMENSION(klon_mpi,SIZE(field,2),SIZE(field,3)) :: buffer_omp 860 REAL :: field4d(nbp_lon,jj_nb,SIZE(field,2),SIZE(field,3)) 861 INTEGER :: ip, n, nlev, nlev2 862 INTEGER, ALLOCATABLE, DIMENSION(:) :: index4d 863 CHARACTER(LEN=20) :: nomi, nom 864 865 IF (prt_level >= 9) write(lunout,*)'Begin histrwrite4d ',var%name 866 867 IF(cosp_varsdefined) THEN 868 !Et sinon on.... écrit 869 IF (SIZE(field,1)/=klon) & 870 CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1) 871 872 nlev=SIZE(field,2) 873 nlev2=SIZE(field,3) 874 CALL Gather_omp(field,buffer_omp) 875 !$OMP MASTER 876 CALL grid1Dto2D_mpi(buffer_omp,field4d) 877 878 #ifdef CPP_XIOS 879 IF (ok_all_xml) THEN 880 CALL xios_send_field(var%name, Field4d(:,:,1:nlev,1:nlev2)) 881 IF (prt_level >= 1) WRITE(lunout,*)'xios_send_field ',var%name 882 ENDIF 883 #endif 884 885 !$OMP END MASTER 886 ENDIF ! vars_defined 887 IF (prt_level >= 9) write(lunout,*)'End histrwrite4d_cosp ',nom 888 END SUBROUTINE histwrite4d_cosp 889 786 890 SUBROUTINE conf_cospoutputs(nam_var,cles_var) 787 891 !!! Lecture des noms et cles de sortie des variables dans config.def -
LMDZ5/branches/testing/libf/phylmd/cosp/modis_simulator.F90
r2720 r2839 532 532 533 533 ! ######################################################################################## 534 ! Normalize pixel counts to fraction. The first three cloud fractions have been set to -1 535 ! in cloud-free areas, so set those places to 0. 536 ! ######################################################################################## 537 Cloud_Fraction_High_Mean(1:nPoints) = Cloud_Fraction_High_Mean(1:nPoints) /nSubcols 538 Cloud_Fraction_Mid_Mean(1:nPoints) = Cloud_Fraction_Mid_Mean(1:nPoints) /nSubcols 539 Cloud_Fraction_Low_Mean(1:nPoints) = Cloud_Fraction_Low_Mean(1:nPoints) /nSubcols 540 534 ! Normalize pixel counts to fraction. 535 ! ######################################################################################## 536 Cloud_Fraction_High_Mean(1:nPoints) = Cloud_Fraction_High_Mean(1:nPoints) /nSubcols 537 Cloud_Fraction_Mid_Mean(1:nPoints) = Cloud_Fraction_Mid_Mean(1:nPoints) /nSubcols 538 Cloud_Fraction_Low_Mean(1:nPoints) = Cloud_Fraction_Low_Mean(1:nPoints) /nSubcols 539 Cloud_Fraction_Total_Mean(1:nPoints) = Cloud_Fraction_Total_Mean(1:nPoints) /nSubcols 540 Cloud_Fraction_Ice_Mean(1:nPoints) = Cloud_Fraction_Ice_Mean(1:nPoints) /nSubcols 541 Cloud_Fraction_Water_Mean(1:nPoints) = Cloud_Fraction_Water_Mean(1:nPoints) /nSubcols 542 541 543 ! ######################################################################################## 542 544 ! Set clear-scenes to undefined -
LMDZ5/branches/testing/libf/phylmd/cosp/phys_cosp.F90
r2594 r2839 7 7 subroutine phys_cosp( itap,dtime,freq_cosp, & 8 8 ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, & 9 ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, &9 ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, missing_val, & 10 10 Nptslmdz,Nlevlmdz,lon,lat, presnivs,overlaplmdz,sunlit, & 11 11 ref_liq,ref_ice,fracTerLic,u_wind,v_wind,phis,phi,ph,p,skt,t, & … … 130 130 ! Declaration necessaires pour les sorties IOIPSL 131 131 integer :: ii 132 real :: ecrit_day,ecrit_hf,ecrit_mth 132 real :: ecrit_day,ecrit_hf,ecrit_mth, missing_val 133 133 logical :: ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, ok_all_xml 134 134 … … 192 192 ! Allocate memory for gridbox type 193 193 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 194 print *, 'Allocating memory for gridbox type...' 194 ! AI mars 2017 195 ! print *, 'Allocating memory for gridbox type...' 196 195 197 !! AI 196 198 ! call construct_cosp_gridbox(dble(itap),radar_freq,surface_radar,use_mie_tables,use_gas_abs,do_ray,melt_lay,k2, & … … 215 217 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 216 218 217 print *, 'Populating input structure...'219 ! print *, 'Populating input structure...' 218 220 gbx%longitude = lon 219 221 gbx%latitude = lat … … 299 301 ! Define new vertical grid 300 302 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 301 print *, 'Defining new vertical grid...'303 ! print *, 'Defining new vertical grid...' 302 304 call construct_cosp_vgrid(gbx,Nlr,use_vgrid,csat_vgrid,vgrid) 303 305 … … 305 307 ! Allocate memory for other types 306 308 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 307 print *, 'Allocating memory for other types...'309 ! print *, 'Allocating memory for other types...' 308 310 call construct_cosp_subgrid(Npoints, Ncolumns, Nlevels, sgx) 309 311 call construct_cosp_sgradar(cfg,Npoints,Ncolumns,Nlevels,N_HYDRO,sgradar) … … 325 327 call cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, & 326 328 ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml, & 327 ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid )329 ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid, stlidar) 328 330 !$OMP END MASTER 329 331 !$OMP BARRIER … … 333 335 ! Call simulator 334 336 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 335 print *, 'Calling simulator...'337 ! print *, 'Calling simulator...' 336 338 !! AI 337 339 ! call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,stradar,stlidar) … … 347 349 !!!!!!!!!!!!!!!!!! Ecreture des sorties Cosp !!!!!!!!!!!!!!r!!!!!!:!!!!! 348 350 349 print *, 'Calling write output'350 call cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, &351 ! print *, 'Calling write output' 352 call cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_val, & 351 353 cfg, gbx, vgrid, sglidar, sgradar, stlidar, stradar, & 352 354 isccp, misr, modis) … … 355 357 ! Deallocate memory in derived types 356 358 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 357 print *, 'Deallocating memory...'359 ! print *, 'Deallocating memory...' 358 360 call free_cosp_gridbox(gbx) 359 361 call free_cosp_subgrid(sgx) -
LMDZ5/branches/testing/libf/phylmd/cv3_routines.F90
r2787 r2839 281 281 wghti, tnk, thnk, qnk, qsnk, unk, vnk, & 282 282 cpnk, hnk, nk, icb, icbmax, iflag, gznk, plcl) 283 284 USE mod_phys_lmdz_transfert_para, ONLY : bcast 283 285 IMPLICIT NONE 284 286 … … 349 351 END IF 350 352 PRINT *, ' ok_new_feed: ', ok_new_feed 351 first = .FALSE.352 353 !$OMP END MASTER 354 call bcast(ok_new_feed) 355 first = .FALSE. 353 356 END IF 354 357 !jyg> -
LMDZ5/branches/testing/libf/phylmd/cv3p1_closure.F90
r2542 r2839 543 543 ELSE IF (flag_wb==2) THEN 544 544 wbeff(il) = wbmax*(0.01*(ph(il,1)-plfc(il)))**2 545 ELSE ! Option provisoire ou le iflag_wb/10 est considere comme une vitesse 546 wbeff(il) = flag_wb*0.01+wbmax/(1.+500./(ph(il,1)-plfc(il))) 545 547 END IF 546 548 END IF -
LMDZ5/branches/testing/libf/phylmd/dyn1d/1DUTILS.h
r2720 r2839 2783 2783 hq_mod_cas(l)= hq_prof_cas(k2) - frac*(hq_prof_cas(k2)-hq_prof_cas(k1)) 2784 2784 vq_mod_cas(l)= vq_prof_cas(k2) - frac*(vq_prof_cas(k2)-vq_prof_cas(k1)) 2785 dtrad_mod_cas(l)= dtrad_prof_cas(k2) - frac*(dtrad_prof_cas(k2)-dtrad_prof_cas(k1)) 2785 2786 2786 2787 else !play>plev_prof_cas(1) … … 2809 2810 hq_mod_cas(l)= frac1*hq_prof_cas(k1) - frac2*hq_prof_cas(k2) 2810 2811 vq_mod_cas(l)= frac1*vq_prof_cas(k1) - frac2*vq_prof_cas(k2) 2812 dtrad_mod_cas(l)= frac1*dtrad_prof_cas(k1) - frac2*dtrad_prof_cas(k2) 2811 2813 2812 2814 endif ! play.le.plev_prof_cas(1) … … 2837 2839 hq_mod_cas(l)= hq_prof_cas(nlev_cas)*fact !jyg 2838 2840 vq_mod_cas(l)= vq_prof_cas(nlev_cas)*fact !jyg 2841 dtrad_mod_cas(l)= dtrad_prof_cas(nlev_cas)*fact !jyg 2839 2842 2840 2843 endif ! play … … 5162 5165 hq_mod_cas(l)= hq_prof_cas(k2) - frac*(hq_prof_cas(k2)-hq_prof_cas(k1)) 5163 5166 vq_mod_cas(l)= vq_prof_cas(k2) - frac*(vq_prof_cas(k2)-vq_prof_cas(k1)) 5167 dtrad_mod_cas(l)= dtrad_prof_cas(k2) - frac*(dtrad_prof_cas(k2)-dtrad_prof_cas(k1)) 5164 5168 5165 5169 else !play>plev_prof_cas(1) … … 5198 5202 hq_mod_cas(l)= frac1*hq_prof_cas(k1) - frac2*hq_prof_cas(k2) 5199 5203 vq_mod_cas(l)= frac1*vq_prof_cas(k1) - frac2*vq_prof_cas(k2) 5204 dtrad_mod_cas(l)= frac1*dtrad_prof_cas(k1) - frac2*dtrad_prof_cas(k2) 5200 5205 5201 5206 endif ! play.le.plev_prof_cas(1) … … 5234 5239 hq_mod_cas(l)= hq_prof_cas(nlev_cas)*fact !jyg 5235 5240 vq_mod_cas(l)= vq_prof_cas(nlev_cas)*fact !jyg 5241 dtrad_mod_cas(l)= dtrad_prof_cas(nlev_cas)*fact !jyg 5236 5242 5237 5243 endif ! play -
LMDZ5/branches/testing/libf/phylmd/dyn1d/lmdz1d.F90
r2720 r2839 40 40 USE physiq_mod, ONLY: physiq 41 41 USE comvert_mod, ONLY: presnivs, ap, bp, dpres,nivsig, nivsigs, pa, & 42 preff 42 preff, aps, bps, pseudoalt, scaleheight 43 43 USE temps_mod, ONLY: annee_ref, calend, day_end, day_ini, day_ref, & 44 44 itau_dyn, itau_phy, start_time … … 634 634 call disvert0(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig) 635 635 print *,'On utilise disvert0' 636 aps(1:llm)=0.5*(ap(1:llm)+ap(2:llm+1)) 637 bps(1:llm)=0.5*(bp(1:llm)+bp(2:llm+1)) 638 scaleheight=8. 639 pseudoalt(1:llm)=-scaleheight*log(presnivs(1:llm)/preff) 636 640 ELSE 637 641 call disvert() … … 640 644 ! Dans ce cas, on lit ap,bp dans le fichier hybrid.txt 641 645 ENDIF 642 ! initialize ap,bp, etc. in vertical_layers_mod 646 643 647 sig_s=presnivs/preff 644 648 plev =ap+bp*psurf -
LMDZ5/branches/testing/libf/phylmd/ener_conserv.F90
r2408 r2839 153 153 154 154 bils_ec(:)=0. 155 bils_ech(:)=0. 155 156 bils_tke(:)=0. 156 157 bils_diss(:)=0. -
LMDZ5/branches/testing/libf/phylmd/fisrtilp.F90
r2720 r2839 17 17 USE cloudth_mod 18 18 USE ioipsl_getin_p_mod, ONLY : getin_p 19 USE phys_local_var_mod, ONLY: ql_seri,qs_seri 20 ! flag to include modifications to ensure energy conservation (if flag >0) 21 USE add_phys_tend_mod, only : fl_cor_ebil 19 22 IMPLICIT none 20 23 !====================================================================== … … 26 29 ! et ilp (il pleut, L. Li) 27 30 ! Principales parties: 31 ! P0> Thermalisation des precipitations venant de la couche du dessus 28 32 ! P1> Evaporation de la precipitation (qui vient du niveau k+1) 29 33 ! P2> Formation du nuage (en k) 34 ! P2.A.0> Calcul des grandeurs nuageuses une pdf en creneau 35 ! P2.A.1> Avec les nouvelles PDFs, calcul des grandeurs nuageuses pour 36 ! les valeurs de T et Q initiales 37 ! P2.A.2> Prise en compte du couplage entre eau condensee et T. 38 ! P2.A.3> Calcul des valeures finales associees a la formation des nuages 39 ! P2.B> Nuage "tout ou rien" 40 ! P2.C> Prise en compte de la Chaleur latente apres formation nuage 30 41 ! P3> Formation de la precipitation (en k) 31 42 !====================================================================== 43 ! JLD: 44 ! * Routine probablement fausse (au moins incoherente) si thermcep = .false. 45 ! * fl_cor_ebil doit etre > 0 ; 46 ! fl_cor_ebil= 0 pour reproduire anciens bugs 32 47 !====================================================================== 33 48 include "YOMCST.h" … … 38 53 ! Principaux inputs: 39 54 ! 40 REAL dtime ! intervalle du temps (s) 41 REAL paprs(klon,klev+1) ! pression a inter-couche 42 REAL pplay(klon,klev) ! pression au milieu de couche 43 REAL t(klon,klev) ! temperature (K) 44 REAL q(klon,klev) ! humidite specifique (kg/kg) 55 REAL, INTENT(IN) :: dtime ! intervalle du temps (s) 56 REAL, DIMENSION(klon,klev+1), INTENT(IN) :: paprs ! pression a inter-couche 57 REAL, DIMENSION(klon,klev), INTENT(IN) :: pplay ! pression au milieu de couche 58 REAL, DIMENSION(klon,klev), INTENT(IN) :: t ! temperature (K) 59 REAL, DIMENSION(klon,klev), INTENT(IN) :: q ! humidite specifique (kg/kg) 60 LOGICAL, DIMENSION(klon,klev), INTENT(IN) :: ptconv ! points ou le schema de conv. prof. est actif 61 INTEGER, INTENT(IN) :: iflag_cld_th 62 INTEGER, INTENT(IN) :: iflag_ice_thermo 63 ! 64 ! Inputs lies aux thermiques 65 ! 66 REAL, DIMENSION(klon,klev), INTENT(IN) :: ztv 67 REAL, DIMENSION(klon,klev), INTENT(IN) :: zqta, fraca 68 REAL, DIMENSION(klon,klev), INTENT(IN) :: zpspsk, ztla 69 REAL, DIMENSION(klon,klev), INTENT(IN) :: zthl 70 ! 71 ! Input/output 72 REAL, DIMENSION(klon,klev), INTENT(INOUT):: ratqs ! determine la largeur de distribution de vapeur 45 73 ! 46 74 ! Principaux outputs: 47 75 ! 48 REAL d_t(klon,klev) ! incrementation de la temperature (K) 49 REAL d_q(klon,klev) ! incrementation de la vapeur d'eau 50 REAL d_ql(klon,klev) ! incrementation de l'eau liquide 51 REAL d_qi(klon,klev) ! incrementation de l'eau glace 52 REAL rneb(klon,klev) ! fraction nuageuse 53 REAL radliq(klon,klev) ! eau liquide utilisee dans rayonnements 54 REAL rhcl(klon,klev) ! humidite relative en ciel clair 55 REAL rain(klon) ! pluies (mm/s) 56 REAL snow(klon) ! neige (mm/s) 57 REAL prfl(klon,klev+1) ! flux d'eau precipitante aux interfaces (kg/m2/s) 58 REAL psfl(klon,klev+1) ! flux d'eau precipitante aux interfaces (kg/m2/s) 59 ! 60 ! Autres arguments 61 ! 62 REAL ztv(klon,klev) 63 REAL zqta(klon,klev),fraca(klon,klev) 64 REAL sigma1(klon,klev),sigma2(klon,klev) 65 REAL qltot(klon,klev),ctot(klon,klev) 66 REAL zpspsk(klon,klev),ztla(klon,klev) 67 REAL zthl(klon,klev) 68 REAL ztfondue, qsl, qsi 69 70 logical lognormale(klon) 71 logical ice_thermo 76 REAL, DIMENSION(klon,klev), INTENT(OUT) :: d_t ! incrementation de la temperature (K) 77 REAL, DIMENSION(klon,klev), INTENT(OUT) :: d_q ! incrementation de la vapeur d'eau 78 REAL, DIMENSION(klon,klev), INTENT(OUT) :: d_ql ! incrementation de l'eau liquide 79 REAL, DIMENSION(klon,klev), INTENT(OUT) :: d_qi ! incrementation de l'eau glace 80 REAL, DIMENSION(klon,klev), INTENT(OUT) :: rneb ! fraction nuageuse 81 REAL, DIMENSION(klon,klev), INTENT(OUT) :: radliq ! eau liquide utilisee dans rayonnements 82 REAL, DIMENSION(klon,klev), INTENT(OUT) :: rhcl ! humidite relative en ciel clair 83 REAL, DIMENSION(klon), INTENT(OUT) :: rain 84 REAL, DIMENSION(klon), INTENT(OUT) :: snow 85 REAL, DIMENSION(klon,klev+1), INTENT(OUT) :: prfl 86 REAL, DIMENSION(klon,klev+1), INTENT(OUT) :: psfl 72 87 73 88 !AA 74 89 ! Coeffients de fraction lessivee : pour OFF-LINE 75 90 ! 76 REAL pfrac_nucl(klon,klev)77 REAL pfrac_1nucl(klon,klev)78 REAL pfrac_impa(klon,klev)91 REAL, DIMENSION(klon,klev), INTENT(OUT) :: pfrac_nucl 92 REAL, DIMENSION(klon,klev), INTENT(OUT) :: pfrac_1nucl 93 REAL, DIMENSION(klon,klev), INTENT(OUT) :: pfrac_impa 79 94 ! 80 95 ! Fraction d'aerosols lessivee par impaction et par nucleation 81 96 ! POur ON-LINE 82 97 ! 83 REAL frac_impa(klon,klev) 84 REAL frac_nucl(klon,klev) 85 real zct ,zcl 98 REAL, DIMENSION(klon,klev), INTENT(OUT) :: frac_impa 99 REAL, DIMENSION(klon,klev), INTENT(OUT) :: frac_nucl 86 100 !AA 101 ! -------------------------------------------------------------------------------- 87 102 ! 88 103 ! Options du programme: … … 92 107 93 108 INTEGER ninter ! sous-intervals pour la precipitation 94 INTEGER ncoreczq95 INTEGER iflag_cld_th96 INTEGER iflag_ice_thermo97 109 PARAMETER (ninter=5) 98 110 LOGICAL evap_prec ! evaporation de la pluie 99 111 PARAMETER (evap_prec=.TRUE.) 100 REAL ratqs(klon,klev) ! determine la largeur de distribution de vapeur 101 logical ptconv(klon,klev) ! determine la largeur de distribution de vapeur 112 ! 113 LOGICAL cpartiel ! condensation partielle 114 PARAMETER (cpartiel=.TRUE.) 115 REAL t_coup 116 PARAMETER (t_coup=234.0) 117 REAL DDT0 118 PARAMETER (DDT0=.01) 119 REAL ztfondue 120 PARAMETER (ztfondue=278.15) 121 ! -------------------------------------------------------------------------------- 122 ! 123 ! Variables locales: 124 ! 125 INTEGER i, k, n, kk 126 REAL qsl, qsi 127 real zct ,zcl 128 INTEGER ncoreczq 129 REAL ctot(klon,klev) 130 REAL zqs(klon), zdqs(klon), zdelta, zcor, zcvm5 131 REAL zdqsdT_raw(klon) 132 REAL Tbef(klon),qlbef(klon),DT(klon),num,denom 133 134 logical lognormale(klon) 135 logical ice_thermo 136 LOGICAL convergence(klon) 137 INTEGER n_i(klon), iter 138 REAL cste 102 139 103 140 real zpdf_sig(klon),zpdf_k(klon),zpdf_delta(klon) … … 105 142 real erf 106 143 REAL qcloud(klon) 107 !108 LOGICAL cpartiel ! condensation partielle109 PARAMETER (cpartiel=.TRUE.)110 REAL t_coup111 PARAMETER (t_coup=234.0)112 !113 ! Variables locales:114 !115 INTEGER i, k, n, kk116 REAL zqs(klon), zdqs(klon), zdelta, zcor, zcvm5117 REAL Tbef(klon),qlbef(klon),DT(klon),num,denom118 LOGICAL convergence(klon)119 REAL DDT0120 PARAMETER (DDT0=.01)121 INTEGER n_i(klon), iter122 REAL cste123 144 124 145 REAL zrfl(klon), zrfln(klon), zqev, zqevt … … 134 155 REAL zdz(klon),zrho(klon),ztot , zrhol(klon) 135 156 REAL zchau ,zfroi ,zfice(klon),zneb(klon) 136 REAL zmelt, zpluie, zice, zcondold 137 PARAMETER (ztfondue=278.15) 157 REAL zmelt, zpluie, zice 138 158 REAL dzfice(klon) 139 159 REAL zsolid 140 160 !!!! 141 161 ! Variables pour Bergeron 142 REAL zcp, coef1, DeltaT 162 REAL zcp, coef1, DeltaT, Deltaq, Deltaqprecl 143 163 REAL zqpreci(klon), zqprecl(klon) 164 ! Variable pour conservation enegie des precipitations 165 REAL zmqc(klon) 144 166 ! 145 167 LOGICAL appel1er … … 170 192 REAL beta(klon,klev) ! taux de conversion de l'eau cond 171 193 ! RomP <<< 172 REAL zmair , zcpair, zcpeau194 REAL zmair(klon), zcpair, zcpeau 173 195 ! Pour la conversion eau-neige 174 196 REAL zlh_solid(klon), zm_solid … … 180 202 ! (Heymsfield & Donner, 1990) 181 203 REAL zzz 204 182 205 include "YOETHF.h" 183 206 include "FCTTRE.h" … … 312 335 ENDDO 313 336 ! 337 ! ---------------------------------------------------------------- 338 ! P0> Thermalisation des precipitations venant de la couche du dessus 339 ! ---------------------------------------------------------------- 314 340 ! Calculer la varition de temp. de l'air du a la chaleur sensible 315 ! transporter par la pluie. 316 ! Il resterait a rajouter cet effet de la chaleur sensible sur les 317 ! flux de surface, du a la diff. de temp. entre le 1er niveau et la 318 ! surface. 341 ! transporter par la pluie. On thermalise la pluie avec l'air de la couche. 342 ! Cette quantite de pluie qui est thermalisee, et devra continue a l'etre lors 343 ! des differentes transformations thermodynamiques. Cette masse d'eau doit 344 ! donc etre ajoute a l'humidite de la couche lorsque l'on calcule la variation 345 ! de l'enthalpie de la couche avec la temperature 346 ! Variables calculees ou modifiees: 347 ! - zt: temperature de la cocuhe 348 ! - zmqc: masse de precip qui doit etre thermalisee 319 349 ! 320 350 IF(k.LE.klevm1) THEN 321 351 DO i = 1, klon 322 352 !IM 323 zmair=(paprs(i,k)-paprs(i,k+1))/RG 353 zmair(i)=(paprs(i,k)-paprs(i,k+1))/RG 354 ! il n'y a pas encore d'eau liquide ni glace dans la maiille, donc zq suffit 324 355 zcpair=RCPD*(1.0+RVTMP2*zq(i)) 325 356 zcpeau=RCPD*RVTMP2 357 if (fl_cor_ebil .GT. 0) then 358 ! zmqc: masse de precip qui doit etre thermalisee avec l'air de la couche atm 359 ! pour s'assurer que la precip arrivant au sol aura bien la temperature de la 360 ! derniere couche 361 zmqc(i) = (zrfl(i)+zifl(i))*dtime/zmair(i) 362 ! t(i,k+1)+d_t(i,k+1): nouvelle temp de la couche au dessus 363 zt(i) = ( (t(i,k+1)+d_t(i,k+1))*zmqc(i)*zcpeau + zcpair*zt(i) ) & 364 / (zcpair + zmqc(i)*zcpeau) 365 else ! si on maintient les anciennes erreurs 326 366 zt(i) = ( (t(i,k+1)+d_t(i,k+1))*zrfl(i)*dtime*zcpeau & 327 + zmair *zcpair*zt(i) ) &328 / (zmair *zcpair + zrfl(i)*dtime*zcpeau)329 ! C WRITE (6,*) 'cppluie ', zt(i)-(t(i,k+1)+d_t(i,k+1))367 + zmair(i)*zcpair*zt(i) ) & 368 / (zmair(i)*zcpair + zrfl(i)*dtime*zcpeau) 369 end if 330 370 ENDDO 331 ENDIF 332 ! ---------------------------------------------------------------- 333 ! P1> Debut evaporation de la precipitation 334 ! ---------------------------------------------------------------- 371 ENDIF ! end IF(k.LE.klevm1) 372 ! 373 ! ---------------------------------------------------------------- 374 ! P1> Calcul de l'evaporation de la precipitation 375 ! ---------------------------------------------------------------- 376 ! On evapore une partie des precipitations venant de la maille du dessus. 377 ! On calcule l'evaporation et la sublimation des precipitations, jusqu'a 378 ! ce que la fraction de cette couche qui est sous le nuage soit saturee. 379 ! Variables calculees ou modifiees: 380 ! - zrfl et zifl: flux de precip liquide et glace 381 ! - zq, zt: humidite et temperature de la cocuhe 382 ! - zmqc: masse de precip qui doit etre thermalisee 383 ! 335 384 IF (evap_prec) THEN 336 385 DO i = 1, klon 337 !AJ< 338 !! IF (zrfl(i) .GT.0.) THEN 386 ! S'il y a des precipitations 339 387 IF (zrfl(i)+zifl(i).GT.0.) THEN 340 !>AJ341 388 ! Calcul du qsat 342 389 IF (thermcep) THEN … … 356 403 ENDDO 357 404 !AJ< 405 358 406 IF (.NOT. ice_thermo) THEN 359 407 DO i = 1, klon 360 !AJ< 361 !! IF (zrfl(i) .GT.0.) THEN 408 ! S'il y a des precipitations 362 409 IF (zrfl(i)+zifl(i).GT.0.) THEN 363 !>AJ364 410 ! Evap max pour ne pas saturer la fraction sous le nuage 411 ! Evap max jusqu'à atteindre la saturation dans la partie 412 ! de la maille qui est sous le nuage de la couche du dessus 413 !!! On ne tient compte de cette fraction que sous une seule 414 !!! couche sous le nuage 365 415 zqev = MAX (0.0, (zqs(i)-zq(i))*zneb(i) ) 416 ! Ajout de la prise en compte des precip a thermiser 417 ! avec petite reecriture 418 if (fl_cor_ebil .GT. 0) then ! nouveau 419 ! Calcul de l'evaporation du flux de precip herite 420 ! d'au-dessus 421 zqevt = coef_eva * (1.0-zq(i)/zqs(i)) * SQRT(zrfl(i)) & 422 * zmair(i)/pplay(i,k)*zt(i)*RD 423 zqevt = MAX(0.0,MIN(zqevt,zrfl(i))) * dtime/zmair(i) 424 425 ! Seuil pour ne pas saturer la fraction sous le nuage 426 zqev = MIN (zqev, zqevt) 427 ! Nouveau flux de precip 428 zrfln(i) = zrfl(i) - zqev*zmair(i)/dtime 429 ! Aucun flux liquide pour T < t_coup, on reevapore tout. 430 IF (zt(i) .LT. t_coup.and.reevap_ice) THEN 431 zrfln(i)=0. 432 zqev = (zrfl(i)-zrfln(i))/zmair(i)*dtime 433 END IF 434 ! Nouvelle vapeur 435 zq(i) = zq(i) + zqev 436 zmqc(i) = zmqc(i)-zqev 437 ! Nouvelle temperature (chaleur latente) 438 zt(i) = zt(i) - zqev & 439 * RLVTT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i))) 440 !!JLD debut de partie a supprimer a terme 441 else ! if (fl_cor_ebil .GT. 0) 366 442 ! Calcul de l'evaporation du flux de precip herite 367 443 ! d'au-dessus … … 384 460 * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime & 385 461 * RLVTT/RCPD/(1.0+RVTMP2*zq(i)) 462 end if ! if (fl_cor_ebil .GT. 0) 463 !!JLD fin de partie a supprimer a terme 386 464 zrfl(i) = zrfln(i) 387 465 zifl(i) = 0. … … 390 468 ! 391 469 ELSE ! (.NOT. ice_thermo) 392 ! 470 ! ================================ 471 ! Avec thermodynamique de la glace 472 ! ================================ 393 473 DO i = 1, klon 394 474 !AJ< 395 !! IF (zrfl(i) .GT.0.) THEN 396 IF (zrfl(i)+zifl(i).GT.0.) THEN 397 !>AJ 398 !JAM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 399 ! Modification de l'evaporation avec la glace 400 ! Differentiation entre precipitation liquide et solide 401 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 475 ! S'il y a des precipitations 476 IF (zrfl(i)+zifl(i).GT.0.) THEN 402 477 403 ! Evap max pour ne pas saturer la fraction sous le nuage478 ! Evap max pour ne pas saturer la fraction sous le nuage 404 479 zqev0 = MAX (0.0, (zqs(i)-zq(i))*zneb(i) ) 405 ! zqev0 = MAX (0.0, zqs(i)-zq(i) ) 406 407 !JAM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 408 ! On differencie qsat pour l'eau et la glace 409 ! Si zdelta=1. --> glace 410 ! Si zdelta=0. --> eau liquide 411 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 480 481 !JAM 482 ! On differencie qsat pour l'eau et la glace 483 ! Si zdelta=1. --> glace 484 ! Si zdelta=0. --> eau liquide 412 485 413 486 ! Calcul du qsat par rapport a l'eau liquide … … 417 490 qsl= qsl*zcor 418 491 419 ! Calcul de l'evaporation du flux de precip herite 420 ! d'au-dessus 492 ! Calcul de l'evaporation du flux de precip venant du dessus 421 493 ! Formulation en racine du flux de precip 422 494 ! (Klemp & Wilhelmson, 1978; Sundqvist, 1988) … … 425 497 zqevt = MAX(0.0,MIN(zqevt,zrfl(i))) & 426 498 *RG*dtime/(paprs(i,k)-paprs(i,k+1)) 427 428 499 429 500 ! Calcul du qsat par rapport a la glace … … 440 511 *RG*dtime/(paprs(i,k)-paprs(i,k+1)) 441 512 442 443 !JAM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 444 ! Verification sur l'evaporation 445 ! On s'assure qu'on ne sature pas 446 ! la fraction sous le nuage sinon on 447 ! repartit zqev0 en gardant la proportion 448 ! liquide / glace 449 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 513 !JAM 514 ! Limitation de l'evaporation. On s'assure qu'on ne sature pas 515 ! la fraction de la couche sous le nuage sinon on repartit zqev0 516 ! en conservant la proportion liquide / glace 450 517 451 518 IF (zqevt+zqevti.GT.zqev0) THEN 452 zqev=zqev0*zqevt/(zqevt+zqevti) 453 zqevi=zqev0*zqevti/(zqevt+zqevti) 454 519 zqev=zqev0*zqevt/(zqevt+zqevti) 520 zqevi=zqev0*zqevti/(zqevt+zqevti) 455 521 ELSE 522 !JLD je ne comprends pas les lignes ci-dessous. On repartit les precips 523 ! liquides et solides meme si on ne sature pas la couche. 524 ! A mon avis, le test est inutile, et il faudrait tout remplacer par: 525 ! zqev=zqevt 526 ! zqevi=zqevti 456 527 IF (zqevt+zqevti.GT.0.) THEN 457 458 528 zqev=MIN(zqev0*zqevt/(zqevt+zqevti),zqevt) 529 zqevi=MIN(zqev0*zqevti/(zqevt+zqevti),zqevti) 459 530 ELSE 460 531 zqev=0. … … 471 542 zq(i) = zq(i) - (zrfln(i)+zifln(i)-zrfl(i)-zifl(i)) & 472 543 * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime 544 if (fl_cor_ebil .GT. 0) then ! avec correction thermalisation des precips 545 zmqc(i) = zmqc(i) + (zrfln(i)+zifln(i)-zrfl(i)-zifl(i)) & 546 * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime 547 zt(i) = zt(i) + (zrfln(i)-zrfl(i)) & 548 * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime & 549 * RLVTT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i))) & 550 + (zifln(i)-zifl(i)) & 551 * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime & 552 * RLSTT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i))) 553 else ! sans correction thermalisation des precips 473 554 zt(i) = zt(i) + (zrfln(i)-zrfl(i)) & 474 555 * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime & … … 477 558 * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime & 478 559 * RLSTT/RCPD/(1.0+RVTMP2*zq(i)) 479 560 end if 561 ! Nouvelles vaeleurs des precips liquides et solides 480 562 zrfl(i) = zrfln(i) 481 563 zifl(i) = zifln(i) … … 486 568 !jyg : Bug !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! jyg 487 569 zmelt = ((zt(i)-273.15)/(ztfondue-273.15)) ! jyg 570 ! fraction de la precip solide qui est fondue 488 571 zmelt = MIN(MAX(zmelt,0.),1.) 489 572 ! Fusion de la glace 490 573 zrfl(i)=zrfl(i)+zmelt*zifl(i) 491 zifl(i)=zifl(i)*(1.-zmelt) 492 ! print*,zt(i),'octavio1' 574 if (fl_cor_ebil .LE. 0) then 575 ! the following line should not be here. Indeed, if zifl is modified 576 ! now, zifl(i)*zmelt is no more the amount of ice that has melt 577 ! and therefore the change in temperature computed below is wrong 578 zifl(i)=zifl(i)*(1.-zmelt) 579 end if 493 580 ! Chaleur latente de fusion 581 if (fl_cor_ebil .GT. 0) then ! avec correction thermalisation des precips 582 zt(i)=zt(i)-zifl(i)*zmelt*(RG*dtime)/(paprs(i,k)-paprs(i,k+1)) & 583 *RLMLT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i))) 584 else ! sans correction thermalisation des precips 494 585 zt(i)=zt(i)-zifl(i)*zmelt*(RG*dtime)/(paprs(i,k)-paprs(i,k+1)) & 495 586 *RLMLT/RCPD/(1.0+RVTMP2*zq(i)) 496 ! print*,zt(i),zrfl(i),zifl(i),zmelt,'octavio2' 497 !fin CR 498 499 587 end if 588 if (fl_cor_ebil .GT. 0) then ! correction bug, deplacement ligne precedente 589 zifl(i)=zifl(i)*(1.-zmelt) 590 end if 500 591 501 592 ENDIF ! (zrfl(i)+zifl(i).GT.0.) … … 515 606 zdelta = MAX(0.,SIGN(1.,RTT-zt(i))) 516 607 zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta 608 if (fl_cor_ebil .GT. 0) then ! nouveau 609 zcvm5 = zcvm5 /RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i))) 610 else 517 611 zcvm5 = zcvm5 /RCPD/(1.0+RVTMP2*zq(i)) 612 endif 518 613 zqs(i) = R2ES*FOEEW(zt(i),zdelta)/pplay(i,k) 519 614 zqs(i) = MIN(0.5,zqs(i)) … … 521 616 zqs(i) = zqs(i)*zcor 522 617 zdqs(i) = FOEDE(zt(i),zdelta,zcvm5,zqs(i),zcor) 618 zdqsdT_raw(i) = zdqs(i)* & 619 & RCPD*(1.0+RVTMP2*zq(i)) / (RLVTT*(1.-zdelta) + RLSTT*zdelta) 523 620 ENDDO 524 621 ELSE … … 547 644 ! P2> Formation du nuage 548 645 ! ---------------------------------------------------------------- 646 ! Variables calculees: 647 ! rneb : fraction nuageuse 648 ! zcond : eau condensee moyenne dans la maille. 649 ! rhcl: humidite relative ciel-clair 650 ! zt : temperature de la maille 651 ! ---------------------------------------------------------------- 652 ! 549 653 IF (cpartiel) THEN 550 551 ! print*,'Dans partiel k=',k 654 ! ------------------------- 655 ! P2.A> Nuage fractionnaire 656 ! ------------------------- 552 657 ! 553 658 ! Calcul de l'eau condensee et de la fraction nuageuse et de l'eau … … 561 666 ! Version avec les raqts 562 667 668 ! ---------------------------------------------------------------- 669 ! P2.A.0> Calcul des grandeurs nuageuses une pdf en creneau 670 ! ---------------------------------------------------------------- 563 671 if (iflag_pdf.eq.0) then 564 672 … … 570 678 enddo 571 679 572 else 573 ! 574 ! Version avec les nouvelles PDFs. 680 else ! if (iflag_pdf.eq.0) 681 ! ---------------------------------------------------------------- 682 ! P2.A.1> Avec les nouvelles PDFs, calcul des grandeurs nuageuses pour 683 ! les valeurs de T et Q initiales 684 ! ---------------------------------------------------------------- 575 685 do i=1,klon 576 686 if(zq(i).lt.1.e-15) then … … 620 730 enddo 621 731 732 ! ---------------------------------------------------------------- 733 ! P2.A.2> Prise en compte du couplage entre eau condensee et T. 734 ! Calcul des grandeurs nuageuses en tenant compte de l'effet de 735 ! la condensation sur T, et donc sur qsat et sur les grandeurs nuageuses 736 ! qui en dependent. Ce changement de temperature est provisoire, et 737 ! la valeur definitive sera calcule plus tard. 738 ! Variables calculees: 739 ! rneb : nebulosite 740 ! zcond: eau condensee en moyenne dans la maille 741 ! note JLD: si on n'a pas de pdf lognormale, ce qui se passe ne me semble 742 ! pas clair, il n'y a probablement pas de prise en compte de l'effet de 743 ! T sur qsat 744 ! ---------------------------------------------------------------- 622 745 623 746 !Boucle iterative: ATTENTION, l'option -1 n'est plus activable ici … … 629 752 do i=1,klon 630 753 ! do while ((abs(DT(i)).gt.DDT0).or.(n_i(i).eq.0)) 754 ! !! convergence = .true. tant que l'on n'a pas converge !! 755 ! ------------------------------ 631 756 convergence(i)=abs(DT(i)).gt.DDT0 632 757 if ((convergence(i).or.(n_i(i).eq.0)).and.lognormale(i)) then 633 Tbef(i)=Tbef(i)+DT(i) 758 ! si on n'a pas converge 759 ! 760 ! P2.A.2.1> Calcul de la fraction nuageuse et de la quantite d'eau condensee 761 ! --------------------------------------------------------------- 762 ! Variables calculees: 763 ! rneb : nebulosite 764 ! zqn : eau condensee, dans le nuage (in cloud water content) 765 ! zcond: eau condensee en moyenne dans la maille 766 ! rhcl: humidite relative ciel-clair 767 ! 768 Tbef(i)=Tbef(i)+DT(i) ! nouvelle temperature 634 769 if (.not.ice_thermo) then 635 770 zdelta = MAX(0.,SIGN(1.,RTT-Tbef(i))) … … 641 776 zdelta = MAX(0.,SIGN(1.,t_glace_max-Tbef(i))) 642 777 else 643 !avec bug : zdelta = MAX(0.,SIGN(1.,t_glace_min-Tbef(i)))778 !avec bug : zdelta = MAX(0.,SIGN(1.,t_glace_min-Tbef(i))) 644 779 zdelta = MAX(0.,SIGN(1.,t_glace_min-Tbef(i))) 645 780 endif 646 781 endif 647 782 endif 648 ! Calcul de s PDF lognormales783 ! Calcul de rneb, qzn et zcond pour les PDF lognormales 649 784 zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta 785 if (fl_cor_ebil .GT. 0) then 786 zcvm5 = zcvm5 /RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i))) 787 else 650 788 zcvm5 = zcvm5 /RCPD/(1.0+RVTMP2*zq(i)) 789 end if 651 790 zqs(i) = R2ES*FOEEW(Tbef(i),zdelta)/pplay(i,k) 652 791 zqs(i) = MIN(0.5,zqs(i)) … … 677 816 enddo ! boucle en i 678 817 818 ! P2.A.2.2> Calcul APPROCHE de la variation de temperature DT 819 ! due a la condensation. 820 ! --------------------------------------------------------------- 821 ! Variables calculees: 822 ! DT : variation de temperature due a la condensation 823 679 824 if (.not. ice_thermo) then 680 825 ! -------------------------- 681 826 do i=1,klon 682 827 if ((convergence(i).or.(n_i(i).eq.0)).and.lognormale(i)) then 683 828 684 829 qlbef(i)=max(0.,zqn(i)-zqs(i)) 830 if (fl_cor_ebil .GT. 0) then 831 num=-Tbef(i)+zt(i)+rneb(i,k)*RLVTT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i)))*qlbef(i) 832 else 685 833 num=-Tbef(i)+zt(i)+rneb(i,k)*RLVTT/RCPD/(1.0+RVTMP2*zq(i))*qlbef(i) 834 end if 686 835 denom=1.+rneb(i,k)*zdqs(i) 687 836 DT(i)=num/denom … … 690 839 enddo 691 840 692 else 693 ! Iteration pour convergence avec qsat(T)841 else ! if (.not. ice_thermo) 842 ! -------------------------- 694 843 if (iflag_t_glace.ge.1) then 695 844 CALL icefrac_lsc(klon,zt(:),pplay(:,k)/paprs(:,1),zfice(:)) … … 703 852 zfice(i) = MIN(MAX(zfice(i),0.0),1.0) 704 853 zfice(i) = zfice(i)**exposant_glace_old 705 dzfice(i)= exposant_glace_old * zfice(i)**(exposant_glace_old-1) / (t_glace_min_old - RTT) 854 dzfice(i)= exposant_glace_old * zfice(i)**(exposant_glace_old-1) & 855 & / (t_glace_min_old - RTT) 706 856 endif 707 857 708 858 if (iflag_t_glace.ge.1) then 709 dzfice(i)= exposant_glace * zfice(i)**(exposant_glace-1) / (t_glace_min - t_glace_max) 859 dzfice(i)= exposant_glace * zfice(i)**(exposant_glace-1) & 860 & / (t_glace_min - t_glace_max) 710 861 endif 711 862 … … 721 872 722 873 qlbef(i)=max(0.,zqn(i)-zqs(i)) 723 num=-Tbef(i)+zt(i)+rneb(i,k)*((1-zfice(i))*RLVTT+zfice(i)*RLSTT)/RCPD/(1.0+RVTMP2*zq(i))*qlbef(i) 724 denom=1.+rneb(i,k)*((1-zfice(i))*RLVTT+zfice(i)*RLSTT)/cste*zdqs(i) & 874 if (fl_cor_ebil .GT. 0) then 875 num = -Tbef(i)+zt(i)+rneb(i,k)*((1-zfice(i))*RLVTT & 876 & +zfice(i)*RLSTT)/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i)))*qlbef(i) 877 denom = 1.+rneb(i,k)*((1-zfice(i))*RLVTT+zfice(i)*RLSTT)/cste*zdqs(i) & 878 -(RLSTT-RLVTT)/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i)))*rneb(i,k) & 879 & *qlbef(i)*dzfice(i) 880 else 881 num = -Tbef(i)+zt(i)+rneb(i,k)*((1-zfice(i))*RLVTT & 882 & +zfice(i)*RLSTT)/RCPD/(1.0+RVTMP2*zq(i))*qlbef(i) 883 denom = 1.+rneb(i,k)*((1-zfice(i))*RLVTT+zfice(i)*RLSTT)/cste*zdqs(i) & 725 884 -(RLSTT-RLVTT)/RCPD/(1.0+RVTMP2*zq(i))*rneb(i,k)*qlbef(i)*dzfice(i) 885 end if 726 886 DT(i)=num/denom 727 887 n_i(i)=n_i(i)+1 … … 732 892 endif !ice_thermo 733 893 734 ! endif735 ! enddo736 737 738 894 enddo ! iter=1,iflag_fisrtilp_qsat+1 739 895 ! Fin d'iteration pour condensation avec variation de qsat(T) 740 896 ! ----------------------------------------------------------- 741 endif 742 897 endif ! if (iflag_fisrtilp_qsat.ge.0) 898 ! ---------------------------------------------------------------- 899 ! Fin de P2.A.2> la prise en compte du couplage entre eau condensee et T 900 ! ---------------------------------------------------------------- 743 901 744 902 endif ! iflag_pdf 745 746 903 747 904 ! if (iflag_fisrtilp_qsat.eq.-1) then … … 771 928 772 929 ! ELSE 773 774 ! Calcul de l'eau in-cloud (zqn), 775 ! moyenne dans la maille (zcond), 776 ! fraction nuageuse (rneb) et 777 ! humidite relative ciel-clair (rhcl) 930 ! ---------------------------------------------------------------- 931 ! P2.A.3> Calcul des valeures finales associees a la formation des nuages 932 ! Variables calculees: 933 ! rneb : nebulosite 934 ! zcond: eau condensee en moyenne dans la maille 935 ! zq : eau vapeur dans la maille 936 ! zt : temperature de la maille 937 ! rhcl: humidite relative ciel-clair 938 ! ---------------------------------------------------------------- 939 ! 940 ! Bornage de l'eau in-cloud (zqn) et de la fraction nuageuse (rneb) 941 ! Calcule de l'eau condensee moyenne dans la maille (zcond), 942 ! et de l'humidite relative ciel-clair (rhcl) 778 943 DO i=1,klon 779 944 IF (rneb(i,k) .LE. 0.0) THEN … … 793 958 ENDDO 794 959 795 796 960 ! ENDIF 797 961 798 962 ELSE ! de IF (cpartiel) 799 ! Cas "tout ou rien" 963 ! ------------------------- 964 ! P2.B> Nuage "tout ou rien" 965 ! ------------------------- 966 ! note JLD: attention, rhcl non calcule. Ca peut avoir des consequences? 800 967 DO i = 1, klon 801 968 IF (zq(i).GT.zqs(i)) THEN … … 806 973 zcond(i) = MAX(0.0,zq(i)-zqs(i))/(1.+zdqs(i)) 807 974 ENDDO 808 ENDIF 809 ! ---------------------------------------------------------------- 810 ! Fin de formation du nuage 811 ! ---------------------------------------------------------------- 975 ENDIF ! de IF (cpartiel) 812 976 ! 813 977 ! Mise a jour vapeur d'eau 978 ! ------------------------- 814 979 DO i = 1, klon 815 980 zq(i) = zq(i) - zcond(i) … … 817 982 ENDDO 818 983 !AJ< 819 ! Chaleur latente apres formation nuage 984 ! ------------------------------------ 985 ! P2.C> Prise en compte de la Chaleur latente apres formation nuage 820 986 ! ------------------------------------- 987 ! Variable calcule: 988 ! zt : temperature de la maille 989 ! 821 990 IF (.NOT. ice_thermo) THEN 822 991 if (iflag_fisrtilp_qsat.lt.1) then … … 826 995 else if (iflag_fisrtilp_qsat.gt.0) then 827 996 DO i= 1, klon 997 if (fl_cor_ebil .GT. 0) then 998 zt(i) = zt(i) + zcond(i) * RLVTT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i)+zcond(i))) 999 else 828 1000 zt(i) = zt(i) + zcond(i) * RLVTT/RCPD/(1.0+RVTMP2*(zq(i)+zcond(i))) 1001 end if 829 1002 ENDDO 830 1003 endif … … 856 1029 zfice(i) = zfice(i)**exposant_glace_old 857 1030 endif 1031 if (fl_cor_ebil .GT. 0) then 1032 zt(i) = zt(i) + (1.-zfice(i))*zcond(i) & 1033 & * RLVTT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i)+zcond(i))) & 1034 +zfice(i)*zcond(i) * RLSTT/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i)+zcond(i))) 1035 else 858 1036 zt(i) = zt(i) + (1.-zfice(i))*zcond(i) * RLVTT/RCPD/(1.0+RVTMP2*(zq(i)+zcond(i))) & 859 +zfice(i)*zcond(i) * RLSTT/RCPD/(1.0+RVTMP2*(zq(i)+zcond(i))) 1037 +zfice(i)*zcond(i) * RLSTT/RCPD/(1.0+RVTMP2*(zq(i)+zcond(i))) 1038 end if 860 1039 ENDDO 861 1040 endif … … 863 1042 ENDIF 864 1043 !>AJ 1044 865 1045 ! ---------------------------------------------------------------- 866 1046 ! P3> Formation des precipitations … … 958 1138 ! zoliqp = MAX(zoliq(i)*(1.-zfice(i))-1.*zpluie , 0.0) 959 1139 ! zoliqi = MAX(zoliq(i)*zfice(i)-1.*zice , 0.0) 1140 !JLD : les 2 variables zoliqp et zoliqi crorresponent a des pseudo precip 1141 ! temporaires et ne doivent pas etre calcule (alors qu'elles le sont 1142 ! si iflag_bergeron <> 2 1143 ! A SUPPRIMER A TERME 960 1144 zoliqp(i) = MAX(zoliq(i)*(1.-zfice(i))-1.*zpluie , 0.0) 961 1145 zoliqi(i) = MAX(zoliq(i)*zfice(i)-1.*zice , 0.0) … … 966 1150 ENDDO ! i = 1,klon 967 1151 ENDDO ! n = 1,ninter 1152 968 1153 ! ---------------------------------------------------------------- 969 1154 ! … … 994 1179 zqpreci(i)=(zcond(i)-zoliq(i))*zfice(i) 995 1180 zqprecl(i)=(zcond(i)-zoliq(i))*(1.-zfice(i)) 1181 if (fl_cor_ebil .GT. 0) then 1182 zcp=RCPD*(1.0+RVTMP2*(zq(i)+zmqc(i)+zcond(i))) 1183 coef1 = rneb(i,k)*RLSTT/zcp*zdqsdT_raw(i) 1184 ! Calcul de DT si toute les precips liquides congelent 1185 DeltaT = RLMLT*zqprecl(i) / (zcp*(1.+coef1)) 1186 ! On ne veut pas que T devienne superieur a la temp. de congelation. 1187 ! donc que Delta > RTT-zt(i 1188 DeltaT = max( min( RTT-zt(i), DeltaT) , 0. ) 1189 zt(i) = zt(i) + DeltaT 1190 ! Eau vaporisee du fait de l'augmentation de T 1191 Deltaq = rneb(i,k)*zdqsdT_raw(i)*DeltaT 1192 ! on reajoute cette eau vaporise a la vapeur et on l'enleve des precips 1193 zq(i) = zq(i) + Deltaq 1194 ! Les 3 max si dessous prtotegent uniquement des erreurs d'arrondies 1195 zcond(i) = max( zcond(i)- Deltaq, 0. ) 1196 ! precip liquide qui congele ou qui s'evapore 1197 Deltaqprecl = -zcp/RLMLT*(1.+coef1)*DeltaT 1198 zqprecl(i) = max( zqprecl(i) + Deltaqprecl, 0. ) 1199 ! bilan eau glacee 1200 zqpreci(i) = max (zqpreci(i) - Deltaqprecl - Deltaq, 0.) 1201 else ! if (fl_cor_ebil .GT. 0) 1202 ! ancien calcul 996 1203 zcp=RCPD*(1.0+RVTMP2*(zq(i)+zcond(i))) 997 1204 coef1 = RLMLT*zdqs(i)/RLVTT … … 1002 1209 zq(i) = zq(i) + zcp/RLVTT*zdqs(i)*DeltaT 1003 1210 zt(i) = zt(i) + DeltaT 1211 end if ! if (fl_cor_ebil .GT. 0) 1004 1212 ENDIF ! rneb(i,k) .GT. 0.0 1005 1213 ENDDO … … 1021 1229 IF (rneb(i,k).GT.0.0) THEN 1022 1230 !CR on prend en compte la phase glace 1023 if (.not.ice_thermo) then 1024 d_ql(i,k) = zoliq(i) 1025 d_qi(i,k) = 0. 1026 else 1231 !JLD inutile car on ne passe jamais ici si .not.ice_thermo 1232 ! if (.not.ice_thermo) then 1233 ! d_ql(i,k) = zoliq(i) 1234 ! d_qi(i,k) = 0. 1235 ! else 1027 1236 d_ql(i,k) = (1-zfice(i))*zoliq(i) 1028 1237 d_qi(i,k) = zfice(i)*zoliq(i) 1029 endif1238 ! endif 1030 1239 !AJ< 1031 1240 zrfl(i) = zrfl(i)+ MAX(zcond(i)*(1.-zfice(i))-zoliqp(i),0.0) & … … 1043 1252 zifl(i) = zifl(i)+zrfl(i) 1044 1253 zrfl(i) = 0. 1254 if (fl_cor_ebil .GT. 0) then 1255 zt(i)=zt(i)+zsolid*(RG*dtime)/(paprs(i,k)-paprs(i,k+1)) & 1256 *(RLSTT-RLVTT)/RCPD/(1.0+RVTMP2*(zq(i)+zmqc(i))) 1257 else 1045 1258 zt(i)=zt(i)+zsolid*(RG*dtime)/(paprs(i,k)-paprs(i,k+1)) & 1046 1259 *(RLSTT-RLVTT)/RCPD/(1.0+RVTMP2*zq(i)) 1260 end if 1047 1261 ENDIF ! (iflag_bergeron .EQ. 1) .AND. (zt(i) .LT. 273.15) 1048 1262 !RC … … 1094 1308 ! Fin de formation des precipitations 1095 1309 ! ---------------------------------------------------------------- 1096 !1097 1310 ! 1098 1311 ! Calculer les tendances de q et de t: … … 1202 1415 DO i = 1, klon 1203 1416 zcpair=RCPD*(1.0+RVTMP2*(q(i,k)+d_q(i,k))) 1204 zmair =(paprs(i,k)-paprs(i,k+1))/RG1417 zmair(i)=(paprs(i,k)-paprs(i,k+1))/RG 1205 1418 zm_solid = (prfl(i,k)-prfl(i,k+1)+psfl(i,k)-psfl(i,k+1))*dtime 1206 d_t(i,k) = d_t(i,k) + zlh_solid(i) *zm_solid / (zcpair*zmair )1419 d_t(i,k) = d_t(i,k) + zlh_solid(i) *zm_solid / (zcpair*zmair(i)) 1207 1420 END DO 1208 1421 END DO -
LMDZ5/branches/testing/libf/phylmd/iophys.F90
r2787 r2839 1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 ! Interface pour ecrire en netcdf avec les routines d'enseignement 3 ! iotd de Frederic Hourdin 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5 1 6 subroutine iophys_ecrit(nom,lllm,titre,unite,px) 2 7 … … 62 67 end 63 68 69 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 70 ! Version avec reindexation pour appeler depuis les routines internes 71 ! à la sous surface 72 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 73 74 75 subroutine iophys_ecrit_index(nom,lllm,titre,unite,knon,knindex,px) 76 77 USE mod_phys_lmdz_para, ONLY: klon_omp 78 USE dimphy, ONLY : klon 79 USE mod_grid_phy_lmdz, ONLY: klon_glo 80 IMPLICIT NONE 81 82 ! This subroutine returns the sea surface temperature already read from limit.nc 83 ! 84 85 ! Arguments on input: 86 INTEGER lllm 87 CHARACTER (len=*) :: nom,titre,unite 88 REAL px(klon_omp,lllm) 89 INTEGER, INTENT(IN) :: knon ! nomber of points on compressed grid 90 INTEGER, DIMENSION(klon), INTENT(IN) :: knindex ! grid point number for compressed grid 91 REAL, DIMENSION(klon,lllm) :: varout 92 93 INTEGER :: i,l 94 95 IF (klon/=klon_omp) THEN 96 print*,'klon, klon_omp',klon,klon_omp 97 STOP'probleme de dimension parallele' 98 ENDIF 99 100 varout(1:klon,1:lllm)=0. 101 DO l = 1, lllm 102 DO i = 1, knon 103 varout(knindex(i),l) = px(i,l) 104 END DO 105 END DO 106 CALL iophys_ecrit(nom,lllm,titre,unite,varout) 107 108 END SUBROUTINE iophys_ecrit_index 109 64 110 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 65 111 SUBROUTINE iophys_ini … … 68 114 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 69 115 USE dimphy, ONLY: klev 116 USE mod_grid_phy_lmdz, ONLY: klon_glo 70 117 71 118 IMPLICIT NONE … … 88 135 89 136 real pi 137 INTEGER nlat_eff 90 138 91 139 ! Arguments: … … 94 142 !$OMP MASTER 95 143 IF (is_mpi_root) THEN 144 145 ! Bidouille pour gerer le fait que lat_reg contient deux latitudes 146 ! en version uni-dimensionnelle (chose qui pourrait être résolue 147 ! par ailleurs) 148 IF (klon_glo==1) THEN 149 nlat_eff=1 150 ELSE 151 nlat_eff=size(lat_reg) 152 ENDIF 96 153 pi=2.*asin(1.) 97 154 call iotd_ini('phys.nc ', & 98 !iim,jjp1,llm,rlonv(1:iim)*180./pi,rlatu*180./pi,presnivs) 99 size(lon_reg),size(lat_reg),klev,lon_reg(:)*180./pi,lat_reg*180./pi,presnivs) 155 size(lon_reg),nlat_eff,klev,lon_reg(:)*180./pi,lat_reg*180./pi,presnivs) 100 156 ENDIF 101 157 !$OMP END MASTER -
LMDZ5/branches/testing/libf/phylmd/limit_read_mod.F90
r2787 r2839 223 223 ierr=NF90_INQUIRE(nid, UnlimitedDimID=ndimid) 224 224 ierr=NF90_INQUIRE_DIMENSION(nid, ndimid, len=nn) 225 WRITE(abort_message,'(a,2(i 0,a))')'limit.nc records number (',nn,') does no'//&225 WRITE(abort_message,'(a,2(i3,a))')'limit.nc records number (',nn,') does no'//& 226 226 't match year length (',year_len,')' 227 227 IF(nn/=year_len) CALL abort_physic(modname,abort_message,1) -
LMDZ5/branches/testing/libf/phylmd/open_climoz_m.F90
r1910 r2839 1 1 ! $Id$ 2 moduleopen_climoz_m2 MODULE open_climoz_m 3 3 4 implicit none 4 USE print_control_mod, ONLY: lunout 5 IMPLICIT NONE 5 6 6 contains 7 CONTAINS 7 8 8 subroutine open_climoz(ncid, press_in_edg) 9 !------------------------------------------------------------------------------- 10 ! 11 SUBROUTINE open_climoz(ncid, press_in_cen, press_in_edg, time_in, daily, adjust) 12 ! 13 !------------------------------------------------------------------------------- 14 USE netcdf95, ONLY: nf95_open, nf95_close, nf95_gw_var, nf95_inq_varid 15 USE netcdf, ONLY: nf90_nowrite 16 USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root 17 USE mod_phys_lmdz_mpi_transfert, ONLY: bcast_mpi 18 USE phys_cal_mod, ONLY: calend, year_len, year_cur 19 !------------------------------------------------------------------------------- 20 ! Purpose: This procedure should be called once per "gcm" run, by a single 21 ! thread of each MPI process. 22 ! The root MPI process opens "climoz_LMDZ.nc", reads the pressure 23 ! levels and the times and broadcasts them to the other processes. 24 ! We assume that, in "climoz_LMDZ.nc", the pressure levels are in hPa 25 ! and in strictly ascending order. 26 !------------------------------------------------------------------------------- 27 ! Arguments (OpenMP shared): 28 INTEGER, INTENT(OUT):: ncid !--- "climoz_LMDZ.nc" identifier 29 REAL, POINTER :: press_in_cen(:) !--- at cells centers 30 REAL, POINTER :: press_in_edg(:) !--- at the interfaces (pressure intervals) 31 REAL, POINTER :: time_in(:) !--- records times, in days since Jan. 1st 32 LOGICAL, INTENT(IN) :: daily !--- daily files (calendar dependent days nb) 33 LOGICAL, INTENT(IN) :: adjust !--- tropopause adjustement required 34 ! pressure levels press_in_cen/edg are in Pa a,d strictly ascending order. 35 ! time_in is only used for monthly files (14 records) 36 !------------------------------------------------------------------------------- 37 ! Local variables: 38 INTEGER :: varid !--- NetCDF variables identifier 39 INTEGER :: nlev, ntim !--- pressure levels and time records numbers 40 CHARACTER(LEN=80) :: sub 41 CHARACTER(LEN=320) :: msg 42 !------------------------------------------------------------------------------- 43 sub="open_climoz" 44 WRITE(lunout,*)"Entering routine "//TRIM(sub) 9 45 10 ! This procedure should be called once per "gcm" run, by a single 11 ! thread of each MPI process. 12 ! The root MPI process opens "climoz_LMDZ.nc", reads the pressure 13 ! levels and broadcasts them to the other processes. 46 IF(is_mpi_root) THEN 14 47 15 ! We assume that, in "climoz_LMDZ.nc", the pressure levels are in hPa 16 ! and in strictly ascending order. 48 !--- OPEN FILE, READ PRESSURE LEVELS AND TIME VECTOR 49 CALL nf95_open("climoz_LMDZ.nc", nf90_nowrite, ncid) 50 CALL nf95_inq_varid(ncid, "plev", varid) 51 CALL nf95_gw_var(ncid, varid, press_in_cen) 52 ! Convert from hPa to Pa because "paprs" and "pplay" are in Pa: 53 press_in_cen = press_in_cen * 100. 54 nlev = SIZE(press_in_cen) 55 CALL NF95_INQ_VARID(ncID, "time", varID) 56 CALL NF95_GW_VAR(ncid, varid, time_in) 57 ntim = SIZE(time_in) 17 58 18 use netcdf95, only: nf95_open, nf95_close, nf95_gw_var, nf95_inq_varid 19 use netcdf, only: nf90_nowrite 59 !--- BUILD EDGES OF PRESSURE INTERVALS: HALFWAY IN LOGARITHMS 60 ALLOCATE(press_in_edg(nlev+1)) 61 press_in_edg=[0.,SQRT(press_in_cen(1:nlev-1)*press_in_cen(2:nlev)),HUGE(0.)] 20 62 21 use mod_phys_lmdz_mpi_data, only: is_mpi_root 22 use mod_phys_lmdz_mpi_transfert, only: bcast_mpi ! broadcast 63 !--- CHECK RECORDS NUMBER AND DISPLAY CORRESPONDING INFORMATION 64 IF(daily.AND.ntim/=year_len) THEN 65 WRITE(msg,'(a,3(i4,a))')TRIM(sub)//': Expecting a daily ozone file with',& 66 &year_len,' records (year ',year_cur,') ; found ',ntim,' instead' 67 CALL abort_physic(sub, msg, 1) 68 ELSE IF(ALL([360,14]/=ntim)) THEN 69 WRITE(msg,'(a,i4,a)')TRIM(sub)//': Expecting an ozone file with 14 (mont'& 70 &//'hly case) or 360 (old style files) records ; found ',ntim,' instead' 71 CALL abort_physic(sub, msg, 1) 72 ELSE 73 IF(daily) THEN 74 WRITE(msg,'(a,2(i4,a))')'daily file (',ntim,' days in ',year_cur,')' 75 ELSE IF(ntim==14) THEN 76 msg='14 records monthly file' 77 ELSE 78 msg='360 records files (old convention)' 79 END IF 80 WRITE(lunout,*)TRIM(sub)//': Using a '//TRIM(msg) 81 END IF 23 82 24 integer, intent(out):: ncid ! of "climoz_LMDZ.nc", OpenMP shared 83 !--- MESSAGE ABOUT OPTIONAL STRETCHING FOR TROPOPAUSES MATCHING 84 IF(adjust) THEN 85 WRITE(lunout,*)TRIM(sub)//': Adjusting O3 field to match gcm tropopause.' 86 ELSE 87 WRITE(lunout,*)TRIM(sub)//': Interpolating O3 field directly on gcm levels.' 88 END IF 25 89 26 real, pointer:: press_in_edg(:) 27 ! edges of pressure intervals for ozone climatology, in Pa, in strictly 28 ! ascending order, OpenMP shared 90 END IF 91 CALL bcast_mpi(nlev) 92 IF(.NOT.is_mpi_root) ALLOCATE(press_in_cen(nlev )); CALL bcast_mpi(press_in_cen) 93 IF(.NOT.is_mpi_root) ALLOCATE(press_in_edg(nlev+1)); CALL bcast_mpi(press_in_edg) 94 CALL bcast_mpi(ntim) 95 IF(.NOT.is_mpi_root) ALLOCATE(time_in(ntim)); CALL bcast_mpi(time_in) 29 96 30 ! Variables local to the procedure: 97 END SUBROUTINE open_climoz 98 ! 99 !------------------------------------------------------------------------------- 31 100 32 real, pointer:: plev(:) 33 ! (pressure levels for ozone climatology, converted to Pa, in strictly 34 ! ascending order) 35 36 integer varid ! for NetCDF 37 integer n_plev ! number of pressure levels in the input data 38 integer k 39 40 !--------------------------------------- 41 42 print *, "Call sequence information: open_climoz" 43 44 if (is_mpi_root) then 45 call nf95_open("climoz_LMDZ.nc", nf90_nowrite, ncid) 46 47 call nf95_inq_varid(ncid, "plev", varid) 48 call nf95_gw_var(ncid, varid, plev) 49 ! Convert from hPa to Pa because "paprs" and "pplay" are in Pa: 50 plev = plev * 100. 51 n_plev = size(plev) 52 end if 53 54 call bcast_mpi(n_plev) 55 if (.not. is_mpi_root) allocate(plev(n_plev)) 56 call bcast_mpi(plev) 57 58 ! Compute edges of pressure intervals: 59 allocate(press_in_edg(n_plev + 1)) 60 if (is_mpi_root) then 61 press_in_edg(1) = 0. 62 ! We choose edges halfway in logarithm: 63 forall (k = 2:n_plev) press_in_edg(k) = sqrt(plev(k - 1) * plev(k)) 64 press_in_edg(n_plev + 1) = huge(0.) 65 ! (infinity, but any value guaranteed to be greater than the 66 ! surface pressure would do) 67 end if 68 call bcast_mpi(press_in_edg) 69 deallocate(plev) ! pointer 70 71 end subroutine open_climoz 72 73 end module open_climoz_m 101 END MODULE open_climoz_m -
LMDZ5/branches/testing/libf/phylmd/phyaqua_mod.F90
r2408 r2839 339 339 PRINT *, 'iniaqua: before phyredem' 340 340 341 pbl_tke(:,:,:)=1.e-8 341 342 falb1 = albedo 342 343 falb2 = albedo … … 354 355 entr_therm = 0. 355 356 detr_therm = 0. 357 ale_bl = 0. 358 ale_bl_trig =0. 359 alp_bl =0. 360 356 361 357 362 -
LMDZ5/branches/testing/libf/phylmd/phys_cal_mod.F90
r2542 r2839 9 9 INTEGER,SAVE :: day_cur ! current day 10 10 !$OMP THREADPRIVATE(day_cur) 11 INTEGER,SAVE :: days_elapsed ! number of whole days since start of the simulation11 INTEGER,SAVE :: days_elapsed ! number of whole days since start of the current year 12 12 !$OMP THREADPRIVATE(days_elapsed) 13 13 INTEGER,SAVE :: mth_len ! number of days in the current month … … 33 33 !$OMP THREADPRIVATE(calend) 34 34 35 36 35 CONTAINS 37 36 38 37 SUBROUTINE phys_cal_init(annee_ref,day_ref) 39 USE IOIPSL, ONLY: ymds2ju 40 USE ioipsl_getin_p_mod, ONLY: getin_p 41 IMPLICIT NONE 38 39 USE IOIPSL, ONLY: ymds2ju 40 USE ioipsl_getin_p_mod, ONLY: getin_p 41 42 IMPLICIT NONE 42 43 INTEGER,INTENT(IN) :: annee_ref 43 44 INTEGER,INTENT(IN) :: day_ref … … 79 80 80 81 END MODULE phys_cal_mod 81 -
LMDZ5/branches/testing/libf/phylmd/phys_local_var_mod.F90
r2787 r2839 163 163 REAL, SAVE, ALLOCATABLE :: lcc3dstra(:,:) 164 164 !$OMP THREADPRIVATE(lcc3dstra) 165 REAL, SAVE, ALLOCATABLE :: od443aer(:) 166 !$OMP THREADPRIVATE(od443aer) 165 167 REAL, SAVE, ALLOCATABLE :: od550aer(:) 166 168 !$OMP THREADPRIVATE(od550aer) … … 207 209 REAL, SAVE, ALLOCATABLE :: loaddust(:) 208 210 !$OMP THREADPRIVATE(loaddust) 211 REAL, SAVE, ALLOCATABLE :: loadno3(:) 212 !$OMP THREADPRIVATE(loadno3) 209 213 REAL, SAVE, ALLOCATABLE :: load_tmp1(:) 210 214 !$OMP THREADPRIVATE(load_tmp1) … … 213 217 REAL, SAVE, ALLOCATABLE :: load_tmp3(:) 214 218 !$OMP THREADPRIVATE(load_tmp3) 215 REAL, SAVE, ALLOCATABLE :: load_tmp4(:)216 !$OMP THREADPRIVATE(load_tmp4)217 REAL, SAVE, ALLOCATABLE :: load_tmp5(:)218 !$OMP THREADPRIVATE(load_tmp5)219 REAL, SAVE, ALLOCATABLE :: load_tmp6(:)220 !$OMP THREADPRIVATE(load_tmp6)221 REAL, SAVE, ALLOCATABLE :: load_tmp7(:)222 !$OMP THREADPRIVATE(load_tmp7)223 219 224 220 !IM ajout variables CFMIP2/CMIP5 … … 352 348 !>jyg+nrlmd 353 349 ! 354 REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: wbeff, zmax_th, zq2m, zt2m355 !$OMP THREADPRIVATE(wbeff, zmax_th, zq2m, zt2m)350 REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: wbeff, convoccur, zmax_th, zq2m, zt2m 351 !$OMP THREADPRIVATE(wbeff, convoccur, zmax_th, zq2m, zt2m) 356 352 REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zt2m_min_mon, zt2m_max_mon 357 353 !$OMP THREADPRIVATE(zt2m_min_mon, zt2m_max_mon) … … 487 483 !$OMP THREADPRIVATE(budg_sed_part) 488 484 #endif 485 REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: pr_tropopause 486 !$OMP THREADPRIVATE(pr_tropopause) 489 487 490 488 CONTAINS … … 578 576 allocate(lcc3dcon(klon, klev)) 579 577 allocate(lcc3dstra(klon, klev)) 578 allocate(od443aer(klon)) 580 579 allocate(od550aer(klon)) 581 580 allocate(od865aer(klon)) … … 600 599 allocate(loadss(klon)) 601 600 allocate(loaddust(klon)) 601 allocate(loadno3(klon)) 602 602 allocate(load_tmp1(klon)) 603 603 allocate(load_tmp2(klon)) 604 604 allocate(load_tmp3(klon)) 605 allocate(load_tmp4(klon))606 allocate(load_tmp5(klon))607 allocate(load_tmp6(klon))608 allocate(load_tmp7(klon))609 605 610 606 !IM ajout variables CFMIP2/CMIP5 … … 628 624 !! Wake variables 629 625 ALLOCATE(ale_wake(klon), alp_wake(klon)) 626 ale_wake(:)=0. 630 627 ALLOCATE(wake_h(klon),wake_k(klon)) 631 628 ALLOCATE(wake_omg(klon, klev)) … … 677 674 ALLOCATE(kh(klon), kh_x(klon), kh_w(klon)) 678 675 ! 679 ALLOCATE(wbeff(klon), zmax_th(klon))676 ALLOCATE(wbeff(klon), convoccur(klon), zmax_th(klon)) 680 677 ALLOCATE(zq2m(klon), zt2m(klon), weak_inversion(klon)) 681 678 ALLOCATE(zt2m_min_mon(klon), zt2m_max_mon(klon)) … … 764 761 ALLOCATE (vsed_aer(klon,klev)) 765 762 #endif 763 ALLOCATE (pr_tropopause(klon)) 766 764 767 765 END SUBROUTINE phys_local_var_init … … 837 835 deallocate(lcc3dcon) 838 836 deallocate(lcc3dstra) 837 deallocate(od443aer) 839 838 deallocate(od550aer) 840 839 deallocate(od865aer) … … 859 858 deallocate(loadss) 860 859 deallocate(loaddust) 860 deallocate(loadno3) 861 861 deallocate(load_tmp1) 862 862 deallocate(load_tmp2) 863 863 deallocate(load_tmp3) 864 deallocate(load_tmp4)865 deallocate(load_tmp5)866 deallocate(load_tmp6)867 deallocate(load_tmp7)868 864 deallocate(du_gwd_hines,dv_gwd_hines,d_t_hin) 869 865 deallocate(d_q_ch4) … … 935 931 DEALLOCATE(kh, kh_x, kh_w) 936 932 ! 937 DEALLOCATE(wbeff, zmax_th)933 DEALLOCATE(wbeff, convoccur, zmax_th) 938 934 DEALLOCATE(zq2m, zt2m, weak_inversion) 939 935 DEALLOCATE(zt2m_min_mon, zt2m_max_mon) … … 1018 1014 DEALLOCATE (budg_sed_part) 1019 1015 #endif 1016 DEALLOCATE (pr_tropopause) 1020 1017 1021 1018 END SUBROUTINE phys_local_var_end -
LMDZ5/branches/testing/libf/phylmd/phys_output_ctrlout_mod.F90
r2787 r2839 669 669 TYPE(ctrl_out), SAVE :: o_wbeff = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), & 670 670 'wbeff', 'Conv. updraft velocity at LFC (<100)', 'm/s', (/ ('', i=1, 10) /)) 671 TYPE(ctrl_out), SAVE :: o_convoccur = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), & 672 'convoccur', 'Convective occurence', '', (/ ('', i=1, 10) /)) 671 673 TYPE(ctrl_out), SAVE :: o_prw = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11, 11/), & 672 674 'prw', 'Precipitable water', 'kg/m2', (/ ('', i=1, 10) /)) … … 1092 1094 'OD_10um_STRAT', 'Stratospheric Aerosol Optical depth at 10 um ', '1', (/ ('', i=1, 10) /)) 1093 1095 ! 1096 TYPE(ctrl_out), SAVE :: o_od443aer = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11, 11/), & 1097 'od443aer', 'Total aerosol optical depth at 440nm', '-', (/ ('', i=1, 10) /)) 1094 1098 TYPE(ctrl_out), SAVE :: o_od550aer = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11, 11/), & 1095 1099 'od550aer', 'Total aerosol optical depth at 550nm', '-', (/ ('', i=1, 10) /)) … … 1134 1138 TYPE(ctrl_out), SAVE :: o_loaddust = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11, 11/), & 1135 1139 'loaddust', 'Column Load of Dust ', 'kg/m2', (/ ('', i=1, 10) /)) 1140 TYPE(ctrl_out), SAVE :: o_loadno3 = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11, 11/), & 1141 'loadno3', 'Column Load of Nitrate ', 'kg/m2', (/ ('', i=1, 10) /)) 1136 1142 TYPE(ctrl_out), SAVE :: o_swtoaas_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11, 11/), & 1137 1143 'swtoaas_nat', 'Natural aerosol radiative forcing all-sky at TOA', 'W/m2', (/ ('', i=1, 10) /)) -
LMDZ5/branches/testing/libf/phylmd/phys_output_mod.F90
r2787 r2839 5 5 USE indice_sol_mod 6 6 USE phys_output_var_mod 7 USE aero_mod, only : naero_spc,name_aero8 7 USE phys_output_write_mod, ONLY : phys_output_write 9 8 REAL, DIMENSION(nfiles),SAVE :: ecrit_files … … 40 39 USE phys_cal_mod, only : hour, calend 41 40 USE mod_phys_lmdz_para 42 USE aero_mod, only : naero_spc,name_aero43 41 !Martin 44 42 USE surface_data, ONLY : ok_snow … … 46 44 USE mod_grid_phy_lmdz, only: klon_glo,nbp_lon,nbp_lat 47 45 USE print_control_mod, ONLY: prt_level,lunout 48 USE vertical_layers_mod, ONLY: ap,bp,preff,presnivs 46 USE vertical_layers_mod, ONLY: ap,bp,preff,presnivs, aps, bps, pseudoalt 49 47 USE time_phylmdz_mod, ONLY: day_ini, itau_phy, start_time, annee_ref, day_ref 50 48 #ifdef CPP_XIOS … … 95 93 INTEGER :: idayref 96 94 REAL :: zjulian_start, zjulian 97 REAL, DIMENSION(klev) :: Ahyb, Bhyb, Alt98 95 CHARACTER(LEN=4), DIMENSION(nlevSTD) :: clevSTD 99 96 REAL, DIMENSION(nlevSTD) :: rlevSTD … … 293 290 zdtime_moy = dtime ! Frequence ou l on moyenne 294 291 295 ! Calcul des Ahyb, Bhyb et Alt296 DO k=1,klev297 Ahyb(k)=(ap(k)+ap(k+1))/2.298 Bhyb(k)=(bp(k)+bp(k+1))/2.299 Alt(k)=log(preff/presnivs(k))*8.300 ENDDO301 ! if(prt_level.ge.1) then302 WRITE(lunout,*)'Ap Hybrid = ',Ahyb(1:klev)303 WRITE(lunout,*)'Bp Hybrid = ',Bhyb(1:klev)304 WRITE(lunout,*)'Alt approx des couches pour une haut d echelle de 8km = ',Alt(1:klev)305 ! ENDIF306 292 307 293 ecrit_files(7) = ecrit_files(1) … … 345 331 levmax(iff) - levmin(iff) + 1, presnivs(levmin(iff):levmax(iff))) 346 332 CALL wxios_add_vaxis("Ahyb", & 347 levmax(iff) - levmin(iff) + 1, Ahyb)333 levmax(iff) - levmin(iff) + 1, aps) 348 334 CALL wxios_add_vaxis("Bhyb", & 349 levmax(iff) - levmin(iff) + 1, Bhyb)335 levmax(iff) - levmin(iff) + 1, bps) 350 336 CALL wxios_add_vaxis("Alt", & 351 levmax(iff) - levmin(iff) + 1, Alt)337 levmax(iff) - levmin(iff) + 1, pseudoalt) 352 338 ELSE 353 339 ! NMC files … … 418 404 !!!! Composantes de la coordonnee sigma-hybride 419 405 CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", & 420 levmax(iff) - levmin(iff) + 1, Ahyb,nvertap(iff))406 levmax(iff) - levmin(iff) + 1,aps,nvertap(iff)) 421 407 422 408 CALL histvert(nid_files(iff), "Bhyb","Bhyb comp of Hyb Cord", " ", & 423 levmax(iff) - levmin(iff) + 1, Bhyb,nvertbp(iff))409 levmax(iff) - levmin(iff) + 1,bps,nvertbp(iff)) 424 410 425 411 CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", & 426 levmax(iff) - levmin(iff) + 1, Alt,nvertAlt(iff))412 levmax(iff) - levmin(iff) + 1,pseudoalt,nvertAlt(iff)) 427 413 428 414 ELSE -
LMDZ5/branches/testing/libf/phylmd/phys_output_var_mod.F90
r2787 r2839 24 24 REAL, SAVE, ALLOCATABLE :: bils_latent(:) ! bilan de chaleur au sol 25 25 !$OMP THREADPRIVATE(bils_ec,bils_ech,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent) 26 ! output variables for energy conservation tests, computed in add_phys_tend 27 REAL, SAVE, ALLOCATABLE :: d_qw_col(:) ! watter vapour mass budget for each column (kg/m2/s) 28 REAL, SAVE, ALLOCATABLE :: d_ql_col(:) ! liquid watter mass budget for each column (kg/m2/s) 29 REAL, SAVE, ALLOCATABLE :: d_qs_col(:) ! solid watter mass budget for each column (kg/m2/s) 30 REAL, SAVE, ALLOCATABLE :: d_qt_col(:) ! total watter mass budget for each column (kg/m2/s) 31 REAL, SAVE, ALLOCATABLE :: d_ek_col(:) ! kinetic energy budget for each column (W/m2) 32 REAL, SAVE, ALLOCATABLE :: d_h_dair_col(:) ! enthalpy budget of dry air for each column (W/m2) 33 REAL, SAVE, ALLOCATABLE :: d_h_qw_col(:) ! enthalpy budget of watter vapour for each column (W/m2) 34 REAL, SAVE, ALLOCATABLE :: d_h_ql_col(:) ! enthalpy budget of liquid watter for each column (W/m2) 35 REAL, SAVE, ALLOCATABLE :: d_h_qs_col(:) ! enthalpy budget of solid watter for each column (W/m2) 36 REAL, SAVE, ALLOCATABLE :: d_h_col(:) ! total enthalpy budget for each column (W/m2) 37 !$OMP THREADPRIVATE(d_qw_col, d_ql_col, d_qs_col, d_qt_col, d_ek_col, d_h_dair_col) 38 !$OMP THREADPRIVATE(d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_col) 26 39 27 40 ! Marine … … 121 134 122 135 allocate (bils_ec(klon),bils_ech(klon),bils_tke(klon),bils_diss(klon),bils_kinetic(klon),bils_enthalp(klon),bils_latent(klon)) 136 allocate (d_qw_col(klon), d_ql_col(klon), d_qs_col(klon), d_qt_col(klon), d_ek_col(klon), d_h_dair_col(klon) & 137 & , d_h_qw_col(klon), d_h_ql_col(klon), d_h_qs_col(klon), d_h_col(klon)) 138 d_qw_col=0. ; d_ql_col=0. ; d_qs_col=0. ; d_qt_col=0. ; d_ek_col=0. ; d_h_dair_col =0. 139 d_h_qw_col=0. ; d_h_ql_col=0. ; d_h_qs_col=0. ; d_h_col=0. 123 140 124 141 ! Marine … … 155 172 deallocate(snow_o,zfra_o,itau_con) 156 173 deallocate (bils_ec,bils_ech,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent) 174 deallocate (d_qw_col, d_ql_col, d_qs_col, d_qt_col, d_ek_col, d_h_dair_col & 175 & , d_h_qw_col, d_h_ql_col, d_h_qs_col, d_h_col) 157 176 158 177 ! Marine -
LMDZ5/branches/testing/libf/phylmd/phys_output_write_mod.F90
r2787 r2839 68 68 o_ue, o_ve, o_uq, o_vq, o_cape, o_pbase, & 69 69 o_ptop, o_fbase, o_plcl, o_plfc, & 70 o_wbeff, o_c ape_max, o_upwd, o_ep,o_epmax_diag, o_Ma, &70 o_wbeff, o_convoccur, o_cape_max, o_upwd, o_ep,o_epmax_diag, o_Ma, & 71 71 o_dnwd, o_dnwd0, o_ftime_con, o_mc, & 72 72 o_prw, o_prlw, o_prsw, o_s_pblh, o_s_pblt, o_s_lcl, & … … 99 99 o_SWdownOR, o_LWdownOR, o_snowl, & 100 100 o_solldown, o_dtsvdfo, o_dtsvdft, & 101 o_dtsvdfg, o_dtsvdfi, o_z0m, o_z0h, o_od 550aer, &101 o_dtsvdfg, o_dtsvdfi, o_z0m, o_z0h, o_od443aer, o_od550aer, & 102 102 o_od865aer, o_absvisaer, o_od550lt1aer, & 103 103 o_sconcso4, o_sconcno3, o_sconcoa, o_sconcbc, & … … 105 105 o_concoa, o_concbc, o_concss, o_concdust, & 106 106 o_loadso4, o_loadoa, o_loadbc, o_loadss, & 107 o_loaddust, o_ tausumaero, o_tausumaero_lw, &107 o_loaddust, o_loadno3, o_tausumaero, o_tausumaero_lw, & 108 108 o_topswad, o_topswad0, o_solswad, o_solswad0, & 109 109 o_toplwad, o_toplwad0, o_sollwad, o_sollwad0, & … … 196 196 #endif 197 197 198 USE phys_state_var_mod, ONLY: pctsrf, paire_ter,rain_fall, snow_fall, &198 USE phys_state_var_mod, ONLY: pctsrf, rain_fall, snow_fall, & 199 199 qsol, z0m, z0h, fevap, agesno, & 200 200 nday_rain, rain_con, snow_con, & … … 236 236 cldh, cldt, JrNt, cldljn, cldmjn, cldhjn, & 237 237 cldtjn, cldq, flwp, fiwp, ue, ve, uq, vq, & 238 plcl, plfc, wbeff, upwd, dnwd, dnwd0, prw, prlw, prsw, &238 plcl, plfc, wbeff, convoccur, upwd, dnwd, dnwd0, prw, prlw, prsw, & 239 239 s_pblh, s_pblt, s_lcl, s_therm, uwriteSTD, & 240 240 vwriteSTD, wwriteSTD, phiwriteSTD, qwriteSTD, & … … 252 252 weak_inversion, dthmin, cldtau, cldemi, & 253 253 pmflxr, pmflxs, prfl, psfl, re, fl, rh2m, & 254 qsat2m, tpote, tpot, d_ts, od 550aer, &254 qsat2m, tpote, tpot, d_ts, od443aer, od550aer, & 255 255 od865aer, absvisaer, od550lt1aer, sconcso4, sconcno3, & 256 256 sconcoa, sconcbc, sconcss, sconcdust, concso4, concno3, & 257 257 concoa, concbc, concss, concdust, loadso4, & 258 loadoa, loadbc, loadss, loaddust, tausum_aero, &258 loadoa, loadbc, loadss, loaddust, loadno3, tausum_aero, & 259 259 topswad_aero, topswad0_aero, solswad_aero, & 260 260 solswad0_aero, topsw_aero, solsw_aero, & … … 325 325 USE geometry_mod, ONLY: cell_area 326 326 USE surface_data, ONLY: type_ocean, version_ocean, ok_veget, ok_snow 327 ! USE aero_mod, ONLY: naero_spc328 327 USE aero_mod, ONLY: naero_tot, id_STRAT_phy 329 328 USE ioipsl, ONLY: histend, histsync … … 410 409 #ifdef CPP_XIOS 411 410 #ifdef CPP_StratAer 412 IF (.NOT.vars_defined) THEN 411 !$OMP MASTER 412 IF (.NOT.vars_defined) THEN 413 413 !On ajoute les variables 3D traceurs par l interface fortran 414 414 CALL xios_get_handle("fields_strataer_trac_3D", group_handle) … … 474 474 ENDDO 475 475 ENDIF 476 #endif 477 #endif 478 476 !$OMP END MASTER 477 #endif 478 #endif 479 479 ! ug la boucle qui suit ne sert qu'une fois, pour l'initialisation, sinon il n'y a toujours qu'un seul passage: 480 480 DO iinit=1, iinitend … … 513 513 CALL histwrite_phy(o_contfracATM, zx_tmp_fi2d) 514 514 CALL histwrite_phy(o_contfracOR, pctsrf(:,is_ter)) 515 CALL histwrite_phy(o_aireTER, paire_ter)516 515 ! 517 516 #ifdef CPP_XIOS … … 739 738 CALL histwrite_phy(o_bils_diss, bils_diss) 740 739 CALL histwrite_phy(o_bils_ec, bils_ec) 741 IF (iflag_ener_conserv>=1) THEN 742 CALL histwrite_phy(o_bils_ech, bils_ech) 743 ENDIF 740 CALL histwrite_phy(o_bils_ech, bils_ech) 744 741 CALL histwrite_phy(o_bils_tke, bils_tke) 745 742 CALL histwrite_phy(o_bils_kinetic, bils_kinetic) … … 890 887 CALL histwrite_phy(o_plfc, plfc) 891 888 CALL histwrite_phy(o_wbeff, wbeff) 889 CALL histwrite_phy(o_convoccur, convoccur) 892 890 ENDIF 893 891 … … 1172 1170 IF (new_aod) THEN 1173 1171 IF (flag_aerosol.GT.0) THEN 1172 CALL histwrite_phy(o_od443aer, od443aer) 1174 1173 CALL histwrite_phy(o_od550aer, od550aer) 1175 1174 CALL histwrite_phy(o_od865aer, od865aer) … … 1193 1192 CALL histwrite_phy(o_loadss, loadss) 1194 1193 CALL histwrite_phy(o_loaddust, loaddust) 1194 CALL histwrite_phy(o_loadno3, loadno3) 1195 1195 !--STRAT AER 1196 1196 ENDIF -
LMDZ5/branches/testing/libf/phylmd/phys_state_var_mod.F90
r2787 r2839 275 275 REAL,ALLOCATABLE,SAVE :: total_rain(:), nday_rain(:) 276 276 !$OMP THREADPRIVATE(total_rain,nday_rain) 277 REAL,ALLOCATABLE,SAVE :: paire_ter(:)278 !$OMP THREADPRIVATE(paire_ter)279 277 ! albsol1: albedo du sol total pour SW visible 280 278 ! albsol2: albedo du sol total pour SW proche IR … … 536 534 ALLOCATE(pfrac_1nucl(klon,klev)) 537 535 ALLOCATE(total_rain(klon), nday_rain(klon)) 538 ALLOCATE(paire_ter(klon))539 536 ALLOCATE(albsol1(klon), albsol2(klon)) 540 537 !albedo SB >>> … … 675 672 deallocate(pfrac_1nucl) 676 673 deallocate(total_rain, nday_rain) 677 deallocate(paire_ter)678 674 deallocate(albsol1, albsol2) 679 675 !albedo SB >>> -
LMDZ5/branches/testing/libf/phylmd/physiq_mod.F90
r2787 r2839 35 35 USE change_srf_frac_mod 36 36 USE surface_data, ONLY : type_ocean, ok_veget, ok_snow 37 USE tropopause_m, ONLY: dyn_tropopause 37 38 #ifdef CPP_Dust 38 39 USE phytracr_spl_mod, ONLY: phytracr_spl … … 154 155 !!! d_s_the, d_dens_the, & ! due to thermals 155 156 ! 156 wbeff, zmax_th, &157 wbeff, convoccur, zmax_th, & 157 158 sens, flwp, fiwp, & 158 159 ale_bl_stat,alp_bl_conv,alp_bl_det, & … … 191 192 beta_prec, & 192 193 rneb, & 193 zxsnow,snowhgt,qsnow,to_ice,sissnow,runoff,albsol3_lic 194 zxsnow,snowhgt,qsnow,to_ice,sissnow,runoff,albsol3_lic, & 195 pr_tropopause 194 196 ! 195 197 USE phys_state_var_mod ! Variables sauvegardees de la physique … … 205 207 USE phys_output_ctrlout_mod 206 208 use open_climoz_m, only: open_climoz ! ozone climatology from a file 207 use regr_pr_ av_m, only: regr_pr_av209 use regr_pr_time_av_m, only: regr_pr_time_av 208 210 use netcdf95, only: nf95_close 209 211 !IM for NMC files … … 240 242 241 243 USE cmp_seri_mod 244 USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, prt_enerbil, & 245 & fl_ebil, fl_cor_ebil 242 246 243 247 !IM stations CFMIP … … 245 249 use FLOTT_GWD_rando_m, only: FLOTT_GWD_rando 246 250 use ACAMA_GWD_rando_m, only: ACAMA_GWD_rando 251 USE VERTICAL_LAYERS_MOD, ONLY: aps,bps 252 247 253 248 254 IMPLICIT none … … 404 410 REAL pphis(klon) 405 411 REAL presnivs(klev) 406 REAL znivsig(klev)407 real pir412 !JLD REAL znivsig(klev) 413 !JLD real pir 408 414 409 415 REAL u(klon,klev) … … 465 471 ! jmin_debut : indice minimum de j; nbptj : nombre de points en 466 472 ! direction j (latitude) 467 INTEGER imin_debut, nbpti468 INTEGER jmin_debut, nbptj473 !JLD INTEGER imin_debut, nbpti 474 !JLD INTEGER jmin_debut, nbptj 469 475 !IM: region='3d' <==> sorties en global 470 476 CHARACTER*3 region … … 530 536 REAL Tconv(klon,klev) 531 537 REAL sij(klon,klev,klev) 538 !! ! 539 !! ! variables pour tester la conservation de l'energie dans concvl 540 !! REAL, DIMENSION(klon,klev) :: d_t_con_sat 541 !! REAL, DIMENSION(klon,klev) :: d_q_con_sat 542 !! REAL, DIMENSION(klon,klev) :: dql_sat 532 543 533 544 real, save :: alp_bl_prescr=0. … … 615 626 real env_tke_max0(klon) ! TKE dans l'environnement au LCL 616 627 617 !---D\'eclenchement stochastique618 integer :: tau_trig(klon)628 !JLD !---D\'eclenchement stochastique 629 !JLD integer :: tau_trig(klon) 619 630 620 631 REAL,SAVE :: random_notrig_max=1. … … 650 661 REAL beta_prec_fisrt(klon,klev) ! taux de conv de l'eau cond (fisrt) 651 662 ! RomP <<< 652 653 663 REAL :: calday 654 664 … … 749 759 REAL conv_t(klon,klev) ! convergence de la temperature(K/s) 750 760 ! 761 #ifdef INCA 751 762 REAL zxsnow_dummy(klon) 763 #endif 752 764 REAL zsav_tsol(klon) 753 765 ! … … 760 772 LOGICAL zx_ajustq 761 773 ! 762 REAL za , zb763 REAL zx_t, zx_qs, zdelta, zcor , zlvdcp, zlsdcp774 REAL za 775 REAL zx_t, zx_qs, zdelta, zcor 764 776 real zqsat(klon,klev) 765 777 ! 766 INTEGER i, k, iq, j, nsrf, ll, l778 INTEGER i, k, iq, nsrf, l 767 779 ! 768 780 REAL t_coup … … 820 832 REAL, dimension(klon) :: dsig0, ddens0 821 833 INTEGER, dimension(klon) :: wkoccur1 834 ! tendance buffer pour appel de add_phys_tend 835 REAL, DIMENSION(klon,klev) :: d_q_ch4_dtime 822 836 ! 823 837 ! Flag pour pouvoir ne pas ajouter les tendances. … … 872 886 873 887 ! 874 integer itau_w ! pas de temps ecriture = itap + itau_phy888 !JLD integer itau_w ! pas de temps ecriture = itap + itau_phy 875 889 ! 876 890 ! … … 884 898 REAL tabcntr0( length ) 885 899 ! 886 INTEGER ndex2d(nbp_lon*nbp_lat)900 !JLD INTEGER ndex2d(nbp_lon*nbp_lat) 887 901 !IM 888 902 ! 889 903 !IM AMIP2 BEG 890 REAL moyglo, mountor904 !JLD REAL moyglo, mountor 891 905 !IM 141004 BEG 892 906 REAL zustrdr(klon), zvstrdr(klon) … … 902 916 ! REAL airedyn(nbp_lon+1,nbp_lat) 903 917 !IM 190504 END 904 LOGICAL ok_msk905 REAL msk(klon)918 !JLD LOGICAL ok_msk 919 !JLD REAL msk(klon) 906 920 !ym A voir plus tard 907 921 !ym REAL zm_wo(jjmp1, klev) … … 910 924 REAL zx_tmp_fi2d(klon) ! variable temporaire grille physique 911 925 REAL zx_tmp_fi3d(klon,klev) ! variable temporaire pour champs 3D 912 REAL zx_tmp_2d(nbp_lon,nbp_lat)913 REAL zx_lon(nbp_lon,nbp_lat)914 REAL zx_lat(nbp_lon,nbp_lat)926 !JLD REAL zx_tmp_2d(nbp_lon,nbp_lat) 927 !JLD REAL zx_lon(nbp_lon,nbp_lat) 928 !JLD REAL zx_lat(nbp_lon,nbp_lat) 915 929 ! 916 930 INTEGER nid_ctesGCM … … 928 942 REAL uq_lay(klon,klev) ! transport zonal de l'eau a chaque niveau vert. 929 943 ! 930 REAL zjulian931 SAVE zjulian932 ! $OMP THREADPRIVATE(zjulian)933 934 INTEGER nhori, nvert935 REAL zsto936 REAL zstophy, zout944 !JLD REAL zjulian 945 !JLD SAVE zjulian 946 !JLD!$OMP THREADPRIVATE(zjulian) 947 948 !JLD INTEGER nhori, nvert 949 !JLD REAL zsto 950 !JLD REAL zstophy, zout 937 951 938 952 character*20 modname … … 948 962 parameter (prof2d_on = 1, prof3d_on = 2, & 949 963 prof2d_av = 3, prof3d_av = 4) 950 ! Variables liees au bilan d'energie et d'enthalpi951 964 REAL ztsol(klon) 952 REAL d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec953 REAL d_h_vcol_phy954 REAL fs_bound, fq_bound955 SAVE d_h_vcol_phy956 !$OMP THREADPRIVATE(d_h_vcol_phy)957 REAL zero_v(klon)958 CHARACTER*40 ztit959 INTEGER ip_ebil ! PRINT level for energy conserv. diag.960 SAVE ip_ebil961 DATA ip_ebil/0/962 !$OMP THREADPRIVATE(ip_ebil)963 965 REAL q2m(klon,nbsrf) ! humidite a 2m 964 966 965 967 !IM: t2m, q2m, ustar, u10m, v10m et t2mincels, t2maxcels 966 968 CHARACTER*40 t2mincels, t2maxcels !t2m min., t2m max 967 CHARACTER*40 tinst, tave , typeval969 CHARACTER*40 tinst, tave 968 970 REAL cldtaupi(klon,klev) ! Cloud optical thickness for 969 971 ! pre-industrial (pi) aerosols … … 1006 1008 !$OMP THREADPRIVATE(first) 1007 1009 1008 integer, save:: read_climoz ! read ozone climatology 1010 ! VARIABLES RELATED TO OZONE CLIMATOLOGIES ; all are OpenMP shared 1011 ! Note that pressure vectors are in Pa and in stricly ascending order 1012 INTEGER,SAVE :: read_climoz ! Read ozone climatology 1009 1013 ! (let it keep the default OpenMP shared attribute) 1010 1014 ! Allowed values are 0, 1 and 2 … … 1013 1017 ! 2: read two ozone climatologies, the average day and night 1014 1018 ! climatology and the daylight climatology 1015 1016 integer, save:: ncid_climoz ! NetCDF file containing ozone climatologies 1017 ! (let it keep the default OpenMP shared attribute) 1018 1019 real, pointer, save:: press_climoz(:) 1020 ! (let it keep the default OpenMP shared attribute) 1021 ! edges of pressure intervals for ozone climatologies, in Pa, in strictly 1022 ! ascending order 1023 1024 integer ro3i 1025 ! required time index in NetCDF file for the ozone fields, between 1 1026 ! and 360 1027 1028 INTEGER ierr 1019 INTEGER,SAVE :: ncid_climoz ! NetCDF file identifier 1020 REAL, POINTER, SAVE :: press_cen_climoz(:) ! Pressure levels 1021 REAL, POINTER, SAVE :: press_edg_climoz(:) ! Edges of pressure intervals 1022 REAL, POINTER, SAVE :: time_climoz(:) ! Time vector 1023 CHARACTER(LEN=13), PARAMETER :: vars_climoz(2) & 1024 = ["tro3 ","tro3_daylight"] 1025 ! vars_climoz(1:read_climoz): variables names in climoz file. 1026 ! vars_climoz(1:read_climoz-2) if read_climoz>2 (temporary) 1027 REAL :: ro3i ! 0<=ro3i<=360 ; required time index in NetCDF file for 1028 ! the ozone fields, old method. 1029 1029 1030 include "YOMCST.h" 1030 1031 include "YOETHF.h" … … 1040 1041 ! Declarations pour Simulateur COSP 1041 1042 !============================================================ 1043 #ifdef CPP_COSP 1042 1044 real :: mr_ozone(klon,klev) 1043 1045 #endif 1044 1046 !IM stations CFMIP 1045 1047 INTEGER, SAVE :: nCFMIP … … 1090 1092 !--OB variables for mass fixer (hard coded for now) 1091 1093 logical, parameter :: mass_fixer=.false. 1092 real qql1(klon),qql2(klon), zdz,corrqql1094 real qql1(klon),qql2(klon),corrqql 1093 1095 1094 1096 ! Ehouarn: set value of jjmp1 since it is no longer a "fixed parameter" … … 1194 1196 1195 1197 modname = 'physiq' 1196 !IM1197 IF (ip_ebil_phy.ge.1) THEN1198 DO i=1,klon1199 zero_v(i)=0.1200 ENDDO1201 ENDIF1202 1198 1203 1199 IF (debut) THEN … … 1211 1207 iflag_wake_tend = 0 1212 1208 CALL getin_p('iflag_wake_tend',iflag_wake_tend) 1209 ok_bad_ecmwf_thermo=.TRUE. ! By default thermodynamical constants are set 1210 ! in rrtm/suphec.F90 (and rvtmp2 is set to 0). 1211 CALL getin_p('ok_bad_ecmwf_thermo',ok_bad_ecmwf_thermo) 1212 fl_ebil = 0 ! by default, conservation diagnostics are desactivated 1213 CALL getin_p('fl_ebil',fl_ebil) 1214 fl_cor_ebil = 0 ! by default, no correction to ensure energy conservation 1215 CALL getin_p('fl_cor_ebil',fl_cor_ebil) 1213 1216 ENDIF 1214 1217 … … 1274 1277 clwcon(:,:) = 0.0 1275 1278 1276 !IM1277 IF (ip_ebil_phy.ge.1) d_h_vcol_phy=0.1278 1279 ! 1279 1280 print*,'iflag_coupl,iflag_clos,iflag_wake', & … … 1656 1657 start_time, & 1657 1658 itau_phy, & 1659 date0, & 1658 1660 io_lon, & 1659 1661 io_lat) … … 1671 1673 1672 1674 !$omp single 1673 IF (read_climoz >= 1) THEN 1674 CALL open_climoz(ncid_climoz, press_climoz) 1675 ENDIF 1675 IF (read_climoz >= 1) CALL open_climoz(ncid_climoz, press_cen_climoz, & 1676 press_edg_climoz, time_climoz, ok_daily_climoz, adjust_tropopause) 1676 1677 !$omp end single 1677 1678 ! … … 1737 1738 ! 1738 1739 itap = itap + 1 1739 IF (is_m pi_root .AND. is_omp_root) THEN1740 IF (is_master .OR. prt_level > 9) THEN 1740 1741 IF (prt_level > 5 .or. MOD(itap,5) == 0) THEN 1741 WRITE(LUNOUT,*)'Entering physics current time = ', current_time 1742 WRITE(LUNOUT,*)'Date = ',year_cur,'/',mth_cur,'/',day_cur,':',hour/3600 1742 WRITE(LUNOUT,*)'Entering physics elapsed seconds since start ', current_time 1743 WRITE(LUNOUT,100)year_cur,mth_cur,day_cur,hour/3600. 1744 100 FORMAT('Date = ',i4.4,' / ',i2.2, ' / ',i2.2,' : ',f20.17) 1743 1745 ENDIF 1744 1746 ENDIF … … 1978 1980 wo(:,:,1)=ozonecm(latitude_deg, paprs,read_climoz,rjour=zzz) 1979 1981 ELSE 1980 ro3i = int((days_elapsed + jh_cur - jh_1jan) / year_len * 360.) + 1 1981 1982 IF (ro3i == 361) ro3i = 360 1983 ! (This should never occur, except perhaps because of roundup 1984 ! error. See documentation.) 1985 1986 IF (read_climoz == 1) THEN 1987 CALL regr_pr_av(ncid_climoz, (/"tro3"/), julien=ro3i, & 1988 press_in_edg=press_climoz, paprs=paprs, v3=wo) 1982 !--- ro3i = elapsed days number since current year 1st january, 0h 1983 ro3i=days_elapsed+jh_cur-jh_1jan 1984 !--- scaling for old style files (360 records) 1985 IF(SIZE(time_climoz)==360.AND..NOT.ok_daily_climoz) ro3i=ro3i*360./year_len 1986 IF(adjust_tropopause) THEN 1987 CALL dyn_tropopause(t_seri, ztsol, paprs, pplay, presnivs, rot, & 1988 pr_tropopause) 1989 CALL regr_pr_time_av(ncid_climoz, vars_climoz(1:read_climoz), & 1990 ro3i, press_edg_climoz, paprs, wo, time_climoz, & 1991 latitude_deg, press_cen_climoz, pr_tropopause) 1989 1992 ELSE 1990 ! read_climoz == 2 1991 CALL regr_pr_av(ncid_climoz, (/"tro3 ", & 1992 "tro3_daylight"/), julien=ro3i, press_in_edg=press_climoz, & 1993 paprs=paprs, v3=wo) 1994 ENDIF 1993 CALL regr_pr_time_av(ncid_climoz, vars_climoz(1:read_climoz), & 1994 ro3i, press_edg_climoz, paprs, wo, time_climoz) 1995 END IF 1995 1996 ! Convert from mole fraction of ozone to column density of ozone in a 1996 1997 ! cell, in kDU: 1997 1998 FORALL (l = 1: read_climoz) wo(:, :, l) = wo(:, :, l) * rmo3 / rmd & 1998 1999 * zmasse / dobson_u / 1e3 1999 ! (By regridding ozone values for LMDZ only once perday, we2000 ! (By regridding ozone values for LMDZ only once a day, we 2000 2001 ! have already neglected the variation of pressure in one 2001 2002 ! day. So do not recompute "wo" at each time step even if … … 2011 2012 CALL add_phys_tend & 2012 2013 (du0,dv0,d_t_eva,d_q_eva,d_ql_eva,d_qi_eva,paprs,& 2013 'eva',abortphy,flag_inhib_tend) 2014 'eva',abortphy,flag_inhib_tend,itap,0) 2015 call prt_enerbil('eva',itap) 2014 2016 2015 2017 !========================================================================= … … 2233 2235 CALL add_pbl_tend & 2234 2236 (d_u_vdf,d_v_vdf,d_t_vdf+d_t_diss,d_q_vdf,dql0,dqi0,paprs,& 2235 'vdf',abortphy,flag_inhib_tend )2237 'vdf',abortphy,flag_inhib_tend,itap) 2236 2238 ELSE 2237 2239 CALL add_phys_tend & 2238 2240 (d_u_vdf,d_v_vdf,d_t_vdf+d_t_diss,d_q_vdf,dql0,dqi0,paprs,& 2239 'vdf',abortphy,flag_inhib_tend) 2240 ENDIF 2241 'vdf',abortphy,flag_inhib_tend,itap,0) 2242 ENDIF 2243 call prt_enerbil('vdf',itap) 2241 2244 !-------------------------------------------------------------------- 2242 2245 … … 2485 2488 d_t_con,d_q_con,d_u_con,d_v_con,d_tr, & 2486 2489 rain_con, snow_con, ibas_con, itop_con, sigd, & 2487 ema_cbmf,plcl,plfc,wbeff, upwd,dnwd,dnwd0, &2490 ema_cbmf,plcl,plfc,wbeff,convoccur,upwd,dnwd,dnwd0, & 2488 2491 Ma,mip,Vprecip,cape,cin,tvp,Tconv,iflagctrl, & 2489 2492 pbase,bbase,dtvpdt1,dtvpdq1,dplcldt,dplcldr,qcondc,wd, & … … 2618 2621 itapcv = itapcv+1 2619 2622 2623 !!!jyg Appel diagnostique a add_phys_tend pour tester la conservation de 2624 !!! l'energie dans les courants satures. 2625 !! d_t_con_sat(:,:) = d_t_con(:,:) - ftd(:,:)*dtime 2626 !! d_q_con_sat(:,:) = d_q_con(:,:) - fqd(:,:)*dtime 2627 !! dql_sat(:,:) = (wdtrainA(:,:)+wdtrainM(:,:))*dtime/zmasse(:,:) 2628 !! CALL add_phys_tend(d_u_con, d_v_con, d_t_con_sat, d_q_con_sat, dql_sat, & 2629 !! dqi0, paprs, 'convection_sat', abortphy, flag_inhib_tend,& 2630 !! itap, 1) 2631 !! call prt_enerbil('convection_sat',itap) 2632 !! 2633 !! 2620 2634 CALL add_phys_tend(d_u_con, d_v_con, d_t_con, d_q_con, dql0, dqi0, paprs, & 2621 'convection',abortphy,flag_inhib_tend) 2635 'convection',abortphy,flag_inhib_tend,itap,0) 2636 call prt_enerbil('convection',itap) 2622 2637 2623 2638 !------------------------------------------------------------------------- … … 2748 2763 ! ajout des tendances des poches froides 2749 2764 CALL add_phys_tend(du0,dv0,d_t_wake,d_q_wake,dql0,dqi0,paprs,'wake', & 2750 abortphy,flag_inhib_tend) 2765 abortphy,flag_inhib_tend,itap,0) 2766 call prt_enerbil('wake',itap) 2751 2767 !------------------------------------------------------------------------ 2752 2768 … … 2757 2773 (d_deltat_wk, d_deltaq_wk, d_s_wk, d_dens_wk, wake_k, & 2758 2774 'wake', abortphy) 2759 2775 call prt_enerbil('wake',itap) 2760 2776 ENDIF ! (iflag_wake_tend .GT. 0.) 2761 2777 … … 2878 2894 CALL add_wake_tend & 2879 2895 (d_deltat_the, d_deltaq_the, dsig0, ddens0, wkoccur1, 'the', abortphy) 2896 call prt_enerbil('the',itap) 2880 2897 ! 2881 2898 ENDIF ! (mod(iflag_pbl_split/2,2) .EQ. 1) 2882 2899 ! 2883 2900 CALL add_phys_tend(d_u_ajs,d_v_ajs,d_t_ajs,d_q_ajs, & 2884 dql0,dqi0,paprs,'thermals', abortphy,flag_inhib_tend) 2901 dql0,dqi0,paprs,'thermals', abortphy,flag_inhib_tend,itap,0) 2902 call prt_enerbil('thermals',itap) 2885 2903 ! 2886 2904 ! … … 2944 2962 ! ajout des tendances de l'ajustement sec ou des thermiques 2945 2963 CALL add_phys_tend(du0,dv0,d_t_ajsb,d_q_ajsb,dql0,dqi0,paprs, & 2946 'ajsb',abortphy,flag_inhib_tend) 2964 'ajsb',abortphy,flag_inhib_tend,itap,0) 2965 call prt_enerbil('ajsb',itap) 2947 2966 d_t_ajs(:,:)=d_t_ajs(:,:)+d_t_ajsb(:,:) 2948 2967 d_q_ajs(:,:)=d_q_ajs(:,:)+d_q_ajsb(:,:) … … 2987 3006 WHERE (snow_lsc < 0) snow_lsc = 0. 2988 3007 3008 !+JLD 3009 ! write(*,9000) 'phys lsc',"enerbil: bil_q, bil_e,",rain_lsc+snow_lsc & 3010 ! & ,((rcw-rcpd)*rain_lsc + (rcs-rcpd)*snow_lsc)*t_seri(1,1)-rlvtt*rain_lsc+rlstt*snow_lsc & 3011 ! & ,rain_lsc,snow_lsc 3012 ! write(*,9000) "rcpv","rcw",rcpv,rcw,rcs,t_seri(1,1) 3013 !-JLD 2989 3014 CALL add_phys_tend(du0,dv0,d_t_lsc,d_q_lsc,d_ql_lsc,d_qi_lsc,paprs, & 2990 'lsc',abortphy,flag_inhib_tend) 3015 'lsc',abortphy,flag_inhib_tend,itap,0) 3016 call prt_enerbil('lsc',itap) 2991 3017 rain_num(:)=0. 2992 3018 DO k = 1, klev … … 3767 3793 ENDDO 3768 3794 3769 CALL add_phys_tend(du0,dv0,d_t_swr,dq0,dql0,dqi0,paprs,'SW',abortphy,flag_inhib_tend) 3770 CALL add_phys_tend(du0,dv0,d_t_lwr,dq0,dql0,dqi0,paprs,'LW',abortphy,flag_inhib_tend) 3795 CALL add_phys_tend(du0,dv0,d_t_swr,dq0,dql0,dqi0,paprs,'SW',abortphy,flag_inhib_tend,itap,0) 3796 call prt_enerbil('SW',itap) 3797 CALL add_phys_tend(du0,dv0,d_t_lwr,dq0,dql0,dqi0,paprs,'LW',abortphy,flag_inhib_tend,itap,0) 3798 call prt_enerbil('LW',itap) 3771 3799 3772 3800 ! … … 3838 3866 ! ajout des tendances de la trainee de l'orographie 3839 3867 CALL add_phys_tend(d_u_oro,d_v_oro,d_t_oro,dq0,dql0,dqi0,paprs,'oro', & 3840 abortphy,flag_inhib_tend) 3868 abortphy,flag_inhib_tend,itap,0) 3869 call prt_enerbil('oro',itap) 3841 3870 !---------------------------------------------------------------------- 3842 3871 ! … … 3884 3913 ! ajout des tendances de la portance de l'orographie 3885 3914 CALL add_phys_tend(d_u_lif, d_v_lif, d_t_lif, dq0, dql0, dqi0, paprs, & 3886 'lif', abortphy,flag_inhib_tend) 3915 'lif', abortphy,flag_inhib_tend,itap,0) 3916 call prt_enerbil('lif',itap) 3887 3917 ENDIF ! fin de test sur ok_orolf 3888 3918 … … 3907 3937 d_t_hin(:, :)=0. 3908 3938 CALL add_phys_tend(du_gwd_hines, dv_gwd_hines, d_t_hin, dq0, dql0, & 3909 dqi0, paprs, 'hin', abortphy,flag_inhib_tend) 3939 dqi0, paprs, 'hin', abortphy,flag_inhib_tend,itap,0) 3940 call prt_enerbil('hin',itap) 3910 3941 ENDIF 3911 3942 … … 3924 3955 3925 3956 CALL add_phys_tend(du_gwd_front, dv_gwd_front, dt0, dq0, dql0, dqi0, & 3926 paprs, 'front_gwd_rando', abortphy,flag_inhib_tend) 3957 paprs, 'front_gwd_rando', abortphy,flag_inhib_tend,itap,0) 3958 call prt_enerbil('front_gwd_rando',itap) 3927 3959 ENDIF 3928 3960 … … 3932 3964 du_gwd_rando, dv_gwd_rando, east_gwstress, west_gwstress) 3933 3965 CALL add_phys_tend(du_gwd_rando, dv_gwd_rando, dt0, dq0, dql0, dqi0, & 3934 paprs, 'flott_gwd_rando', abortphy,flag_inhib_tend) 3966 paprs, 'flott_gwd_rando', abortphy,flag_inhib_tend,itap,0) 3967 call prt_enerbil('flott_gwd_rando',itap) 3935 3968 zustr_gwd_rando=0. 3936 3969 zvstr_gwd_rando=0. … … 3981 4014 CALL METHOX(1,klon,klon,klev,q_seri,d_q_ch4,pplay) 3982 4015 ! ajout de la tendance d'humidite due au methane 3983 CALL add_phys_tend(du0, dv0, dt0, d_q_ch4*dtime, dql0, dqi0, paprs, & 3984 'q_ch4', abortphy,flag_inhib_tend) 4016 d_q_ch4_dtime(:,:) = d_q_ch4(:,:)*dtime 4017 CALL add_phys_tend(du0, dv0, dt0, d_q_ch4_dtime, dql0, dqi0, paprs, & 4018 'q_ch4', abortphy,flag_inhib_tend,itap,0) 4019 d_q_ch4(:,:) = d_q_ch4_dtime(:,:)/dtime 3985 4020 ENDIF 3986 4021 ! … … 4004 4039 CALL phys_cosp(itap,dtime,freq_cosp, & 4005 4040 ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, & 4006 ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, &4041 ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, missing_val, & 4007 4042 klon,klev,longitude_deg,latitude_deg,presnivs,overlap, & 4008 4043 JrNt,ref_liq,ref_ice, & … … 4211 4246 pphi, & 4212 4247 pphis, & 4213 zx_rh) 4248 zx_rh, & 4249 aps, bps) 4214 4250 4215 4251 CALL VTe(VTinca) … … 4465 4501 CALL nf95_close(ncid_climoz) 4466 4502 ENDIF 4467 DEALLOCATE(press_climoz) ! pointer 4503 DEALLOCATE(press_edg_climoz) ! pointer 4504 DEALLOCATE(press_cen_climoz) ! pointer 4468 4505 ENDIF 4469 4506 !$OMP END MASTER -
LMDZ5/branches/testing/libf/phylmd/readaerosol.F90
r2408 r2839 222 222 REAL, ALLOCATABLE, DIMENSION(:) :: varktmp 223 223 224 REAL, DIMENSION(nbp_lon,nbp_lat,12) 224 REAL, DIMENSION(nbp_lon,nbp_lat,12) :: psurf_glo2D ! Surface pression for 12 months on dynamics global grid 225 225 REAL, DIMENSION(klon_glo,12) :: psurf_glo1D ! -"- on physical global grid 226 REAL, DIMENSION(nbp_lon,nbp_lat,12) 226 REAL, DIMENSION(nbp_lon,nbp_lat,12) :: load_glo2D ! Load for 12 months on dynamics global grid 227 227 REAL, DIMENSION(klon_glo,12) :: load_glo1D ! -"- on physical global grid 228 REAL, DIMENSION(nbp_lon,nbp_lat) 229 REAL, DIMENSION(nbp_lon) 230 REAL, DIMENSION(nbp_lat) 228 REAL, DIMENSION(nbp_lon,nbp_lat) :: vartmp 229 REAL, DIMENSION(nbp_lon) :: lon_src ! longitudes in file 230 REAL, DIMENSION(nbp_lat) :: lat_src, lat_src_inv ! latitudes in file 231 231 LOGICAL :: new_file ! true if new file format detected 232 232 LOGICAL :: invert_lat ! true if the field has to be inverted for latitudes … … 245 245 246 246 WRITE(lunout,*) 'reading variable ',TRIM(varname),' in file ', TRIM(fname) 247 CALL check_err( nf90_open(TRIM(fname), NF90_NOWRITE, ncid), "pb open "//trim( varname) )247 CALL check_err( nf90_open(TRIM(fname), NF90_NOWRITE, ncid), "pb open "//trim(fname) ) 248 248 249 249 ! Test for equal longitudes and latitudes in file and model … … 338 338 !**************************************************************************************** 339 339 ! Get variable id 340 CALL check_err( nf90_inq_varid(ncid, TRIM(varname), varid),"pb inq var "//TRIM(varname) ) 341 342 ! Get the variable 343 CALL check_err( nf90_get_var(ncid, varid, varyear(:,:,:,:)),"pb get var "//TRIM(varname) ) 340 !CALL check_err( nf90_inq_varid(ncid, TRIM(varname), varid),"pb inq var "//TRIM(varname) ) 341 print *,'readaerosol ', TRIM(varname) 342 IF ( nf90_inq_varid(ncid, TRIM(varname), varid) /= NF90_NOERR ) THEN 343 ! Variable is not there 344 WRITE(lunout,*) 'Attention '//TRIM(varname)//' is not in aerosol input file' 345 varyear(:,:,:,:)=0.0 346 ELSE 347 ! Get the variable 348 CALL check_err( nf90_get_var(ncid, varid, varyear(:,:,:,:)),"pb get var "//TRIM(varname) ) 349 ENDIF 344 350 345 351 ! ++) Read surface pression, 12 month in one variable … … 353 359 !**************************************************************************************** 354 360 ! Get variable id 355 CALL check_err( nf90_inq_varid(ncid, "load_"//TRIM(varname), varid) ,"pb inq var load_"//TRIM(varname)) 356 ! Get the variable 357 CALL check_err( nf90_get_var(ncid, varid, load_glo2D),"pb get var load_"//TRIM(varname) ) 361 !CALL check_err( nf90_inq_varid(ncid, "load_"//TRIM(varname), varid) ,"pb inq var load_"//TRIM(varname)) 362 IF ( nf90_inq_varid(ncid, "load_"//TRIM(varname), varid) /= NF90_NOERR ) THEN 363 WRITE(lunout,*) 'Attention load_'//TRIM(varname)//' is not in aerosol input file' 364 load_glo2D(:,:,:)=0.0 365 ELSE 366 ! Get the variable 367 CALL check_err( nf90_get_var(ncid, varid, load_glo2D),"pb get var load_"//TRIM(varname) ) 368 ENDIF 358 369 359 370 ! ++) Read ap -
LMDZ5/branches/testing/libf/phylmd/readaerosol_optic.F90
r2669 r2839 16 16 USE phys_local_var_mod, only: sconcso4,sconcno3,sconcoa,sconcbc,sconcss,sconcdust, & 17 17 concso4,concno3,concoa,concbc,concss,concdust,loadso4,loadoa,loadbc,loadss,loaddust, & 18 load_tmp1,load_tmp2,load_tmp3 ,load_tmp4,load_tmp5,load_tmp6,load_tmp718 load_tmp1,load_tmp2,load_tmp3 19 19 IMPLICIT NONE 20 20 … … 93 93 94 94 ! Get bc aerosol distribution 95 CALL readaerosol_interp(id_ASBCM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, bcsol, bcsol_pi, load_tmp1 96 CALL readaerosol_interp(id_AIBCM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, bcins, bcins_pi, load_tmp2 95 CALL readaerosol_interp(id_ASBCM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, bcsol, bcsol_pi, load_tmp1) 96 CALL readaerosol_interp(id_AIBCM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, bcins, bcins_pi, load_tmp2) 97 97 loadbc(:)=load_tmp1(:)+load_tmp2(:) 98 98 ELSE … … 107 107 flag_aerosol .EQ. 6 ) THEN 108 108 109 CALL readaerosol_interp(id_ASPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomsol, pomsol_pi, load_tmp 3)110 CALL readaerosol_interp(id_AIPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomins, pomins_pi, load_tmp 4)111 loadoa(:)=load_tmp 3(:)+load_tmp4(:)109 CALL readaerosol_interp(id_ASPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomsol, pomsol_pi, load_tmp1) 110 CALL readaerosol_interp(id_AIPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomins, pomins_pi, load_tmp2) 111 loadoa(:)=load_tmp1(:)+load_tmp2(:) 112 112 ELSE 113 113 pomsol(:,:) = 0. ; pomsol_pi(:,:) = 0. … … 121 121 flag_aerosol .EQ. 6 ) THEN 122 122 123 CALL readaerosol_interp(id_SSSSM_phy ,itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, sssupco, sssupco_pi, load_tmp5)124 CALL readaerosol_interp(id_CSSSM_phy ,itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, sscoarse,sscoarse_pi, load_tmp 6)125 CALL readaerosol_interp(id_ASSSM_phy ,itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, ssacu, ssacu_pi, load_tmp7)126 loadss(:)=load_tmp5(:)+load_tmp6(:)+load_tmp7(:)127 ELSE 128 sscoarse(:,:) = 0. ; sscoarse_pi(:,:) = 0.129 ssacu(:,:) = 0. ; ssacu_pi(:,:) = 0.130 sssupco(:,:) = 0. ; sssupco_pi = 0.131 loadss=0.123 CALL readaerosol_interp(id_SSSSM_phy ,itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, sssupco, sssupco_pi, load_tmp1) 124 CALL readaerosol_interp(id_CSSSM_phy ,itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, sscoarse,sscoarse_pi, load_tmp2) 125 CALL readaerosol_interp(id_ASSSM_phy ,itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, ssacu, ssacu_pi, load_tmp3) 126 loadss(:)=load_tmp1(:)+load_tmp2(:)+load_tmp3(:) 127 ELSE 128 sscoarse(:,:) = 0. ; sscoarse_pi(:,:) = 0. 129 ssacu(:,:) = 0. ; ssacu_pi(:,:) = 0. 130 sssupco(:,:) = 0. ; sssupco_pi = 0. 131 loadss=0. 132 132 ENDIF 133 133 … … 137 137 138 138 CALL readaerosol_interp(id_CIDUSTM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, cidust, cidust_pi, loaddust) 139 140 139 ELSE 141 140 cidust(:,:) = 0. ; cidust_pi(:,:) = 0. … … 174 173 m_allaer_pi(:,:,id_CSNO3M_phy) = 0.0 175 174 m_allaer_pi(:,:,id_CINO3M_phy) = 0.0 176 177 175 ! 178 176 ! Calculate the total mass of all soluble aersosols … … 214 212 215 213 END IF 216 217 214 218 215 ! Diagnostics calculation for CMIP5 protocol … … 230 227 concdust(:,:)=m_allaer(:,:,id_CIDUSTM_phy)*1.e-9 231 228 232 233 229 END SUBROUTINE readaerosol_optic -
LMDZ5/branches/testing/libf/phylmd/reevap.F90
r2720 r2839 2 2 & d_t_eva,d_q_eva,d_ql_eva,d_qs_eva) 3 3 4 4 ! flag to include modifications to ensure energy conservation (if flag >0) 5 USE add_phys_tend_mod, only : fl_cor_ebil 6 5 7 IMPLICIT none 6 8 !>====================================================================== … … 22 24 ! Re-evaporer l'eau liquide nuageuse 23 25 ! 24 26 !print *,'rrevap ; fl_cor_ebil:',fl_cor_ebil,' iflag_ice_thermo:',iflag_ice_thermo,' RVTMP2',RVTMP2 25 27 DO k = 1, klev ! re-evaporation de l'eau liquide nuageuse 26 28 DO i = 1, klon 29 if (fl_cor_ebil .GT. 0) then 30 zlvdcp=RLVTT/RCPD/(1.0+RVTMP2*(q_seri(i,k)+ql_seri(i,k)+qs_seri(i,k))) 31 zlsdcp=RLSTT/RCPD/(1.0+RVTMP2*(q_seri(i,k)+ql_seri(i,k)+qs_seri(i,k))) 32 else 27 33 zlvdcp=RLVTT/RCPD/(1.0+RVTMP2*q_seri(i,k)) 28 34 !jyg< … … 30 36 ! A verifier !!! 31 37 zlsdcp=RLSTT/RCPD/(1.0+RVTMP2*q_seri(i,k)) 38 end if 32 39 IF (iflag_ice_thermo .EQ. 0) THEN 33 40 zlsdcp=zlvdcp … … 39 46 40 47 zdelta = MAX(0.,SIGN(1.,RTT-t_seri(i,k))) 48 zdelta = 0. 41 49 zb = MAX(0.0,ql_seri(i,k)) 42 50 za = - MAX(0.0,ql_seri(i,k)) & -
LMDZ5/branches/testing/libf/phylmd/regr_lat_time_coefoz_m.F90
r2471 r2839 41 41 42 42 use mod_grid_phy_lmdz, ONLY : nbp_lat 43 use regr 1_conserv_m, only: regr1_conserv44 use regr 3_lint_m, only: regr3_lint43 use regr_conserv_m, only: regr_conserv 44 use regr_lint_m, only: regr_lint 45 45 use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, handle_err, & 46 46 nf95_put_var, nf95_gw_var … … 84 84 ! Last dimension is month number.) 85 85 86 real, allocatable:: o3_par_out(:, :, :) ! (jjm + 1, n_plev, 360)86 real, allocatable:: o3_par_out(:, :, :) ! (jjm + 1, n_plev, ndays) 87 87 ! (regridded ozone parameter) 88 88 ! ("o3_par_out(j, l, day)" is at latitude "rlatu(j)", pressure … … 162 162 latitude = latitude / 180. * pi 163 163 n_lat = size(latitude) 164 ! We need to supply the latitudes to "regr 1_conserv" in164 ! We need to supply the latitudes to "regr_conserv" in 165 165 ! ascending order, so invert order if necessary: 166 166 desc_lat = latitude(1) > latitude(n_lat) … … 209 209 ! We average with respect to sine of latitude, which is 210 210 ! equivalent to weighting by cosine of latitude: 211 call regr 1_conserv(o3_par_in, xs = sin(lat_in_edg), &211 call regr_conserv(1, o3_par_in, xs = sin(lat_in_edg), & 212 212 xt = (/-1., sin((/boundslat_reg(nbp_lat-1:1:-1,south)/)), 1./), & 213 213 vt = v_regr_lat(nbp_lat:1:-1, :, 1:12)) … … 221 221 222 222 ! Regrid in time by linear interpolation: 223 o3_par_out = regr3_lint(v_regr_lat, tmidmonth, tmidday)223 call regr_lint(3, v_regr_lat, tmidmonth, tmidday, o3_par_out) 224 224 225 225 ! Write to file: -
LMDZ5/branches/testing/libf/phylmd/regr_pr_comb_coefoz_m.F90
r2408 r2839 76 76 use dimphy, only: klon 77 77 use mod_phys_lmdz_mpi_data, only: is_mpi_root 78 use regr_pr_ av_m, only: regr_pr_av78 use regr_pr_time_av_m, only: regr_pr_time_av 79 79 use regr_pr_int_m, only: regr_pr_int 80 80 use press_coefoz_m, only: press_in_edg, plev … … 128 128 !$omp end master 129 129 130 call regr_pr_ av(ncid, (/"a2 ", "a4 ", "a6 ", &131 "P_net_Mob", "r_Mob ", "temp_Mob ", "R_Het "/), julien, &130 call regr_pr_time_av(ncid, (/"a2 ", "a4 ", "a6 ", & 131 "P_net_Mob", "r_Mob ", "temp_Mob ", "R_Het "/), REAL(julien-1), & 132 132 press_in_edg, paprs, coefoz) 133 133 a2 = coefoz(:, :, 1) -
LMDZ5/branches/testing/libf/phylmd/regr_pr_int_m.F90
r2408 r2839 28 28 use netcdf, only: nf90_get_var 29 29 use assert_m, only: assert 30 use regr 1_lint_m, only: regr1_lint30 use regr_lint_m, only: regr_lint 31 31 use mod_phys_lmdz_mpi_data, only: is_mpi_root 32 32 use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, nbp_lev … … 97 97 ! Regrid in pressure at each horizontal position: 98 98 do i = 1, klon 99 v3(i, nbp_lev:1:-1) = regr1_lint(v2(i, :), (/0., plev/), pplay(i, nbp_lev:1:-1)) 99 call regr_lint(1, v2(i, :), (/0., plev/), pplay(i, nbp_lev:1:-1), & 100 v3(i, nbp_lev:1:-1)) 100 101 ! (invert order of indices because "pplay" is in descending order) 101 102 end do -
LMDZ5/branches/testing/libf/phylmd/regr_pr_o3_m.F90
r2471 r2839 28 28 use netcdf, only: nf90_nowrite, nf90_get_var 29 29 use assert_m, only: assert 30 use regr 1_conserv_m, only: regr1_conserv30 use regr_conserv_m, only: regr_conserv 31 31 use press_coefoz_m, only: press_in_edg 32 32 use time_phylmdz_mod, only: day_ref … … 75 75 ! Poles: 76 76 do j = 1, nbp_lat, nbp_lat-1 77 call regr 1_conserv(r_mob(j, :), press_in_edg, &77 call regr_conserv(1, r_mob(j, :), press_in_edg, & 78 78 p3d(1, j, nbp_lev + 1:1:-1), o3_mob_regr(1, j, nbp_lev:1:-1)) 79 79 ! (invert order of indices because "p3d" is in descending order) … … 83 83 do j = 2, nbp_lat-1 84 84 do i = 1, nbp_lon 85 call regr 1_conserv(r_mob(j, :), press_in_edg, &85 call regr_conserv(1, r_mob(j, :), press_in_edg, & 86 86 p3d(i, j, nbp_lev + 1:1:-1), o3_mob_regr(i, j, nbp_lev:1:-1)) 87 87 ! (invert order of indices because "p3d" is in descending order) -
LMDZ5/branches/testing/libf/phylmd/rrtm/aeropt_5wv_rrtm.F90
r2787 r2839 12 12 USE DIMPHY 13 13 USE aero_mod 14 USE phys_local_var_mod, ONLY: od 550aer,od865aer,ec550aer,od550lt1aer14 USE phys_local_var_mod, ONLY: od443aer,od550aer,od865aer,ec550aer,od550lt1aer 15 15 USE YOMCST, ONLY: RD,RG 16 16 … … 327 327 soluble=.TRUE. 328 328 spsol=4 329 fac=1.375 ! (NH4)2-SO4/SO4 132/96 mass conversion factor for AOD 329 !fac=1.375 ! (NH4)2-SO4/SO4 132/96 mass conversion factor for AOD 330 fac=0.0 !--6 March 2017 - OB as Didier H said CSSO4 should not be used 330 331 ELSEIF (aerosol_name(m).EQ.id_SSSSM_phy) THEN 331 332 soluble=.TRUE. … … 366 367 DO la=1,las 367 368 368 !--only 550, 670 and 865 nm are used 369 IF (la.NE.la550.AND.la.NE.la670.AND.la.NE.la865) CYCLE 369 !--only 443, 550, 670 and 865 nm are used 370 !--to save time 670 and AI are not computed for CMIP6 371 !IF (la.NE.la443.AND.la.NE.la550.AND.la.NE.la670.AND.la.NE.la865) CYCLE 372 IF (la.NE.la443.AND.la.NE.la550.AND.la.NE.la865) CYCLE 370 373 371 374 IF (soluble) THEN ! For soluble aerosol … … 433 436 434 437 !--AOD calculations for diagnostics 438 od443aer(:)=SUM(tausum(:,la443,:),dim=2) 435 439 od550aer(:)=SUM(tausum(:,la550,:),dim=2) 436 od670aer(:)=SUM(tausum(:,la670,:),dim=2)440 !od670aer(:)=SUM(tausum(:,la670,:),dim=2) 437 441 od865aer(:)=SUM(tausum(:,la865,:),dim=2) 438 442 … … 441 445 442 446 !--aerosol index 443 ai(:)=-LOG(MAX(od670aer(:),1.e-8)/MAX(od865aer(:),1.e-8))/LOG(670./865.) 447 ai(:)=0.0 448 !ai(:)=-LOG(MAX(od670aer(:),1.e-8)/MAX(od865aer(:),1.e-8))/LOG(670./865.) 444 449 445 450 od550lt1aer(:)=tausum(:,la550,id_ASSO4M_phy)+tausum(:,la550,id_ASBCM_phy) +tausum(:,la550,id_AIBCM_phy)+ & -
LMDZ5/branches/testing/libf/phylmd/rrtm/aeropt_6bands_rrtm.F90
r2787 r2839 566 566 soluble=.TRUE. 567 567 spsol=3 568 fac=1.375 ! (NH4)2-SO4/SO4 132/96 mass conversion factor for AOD 568 !fac=1.375 ! (NH4)2-SO4/SO4 132/96 mass conversion factor for AOD 569 fac=0.0 !--6 March 2017 - OB as Didier H said CSSO4 should not be used 569 570 ELSEIF (aerosol_name(m).EQ.id_ASSO4M_phy) THEN 570 571 soluble=.TRUE. -
LMDZ5/branches/testing/libf/phylmd/rrtm/read_rsun_rrtm.F90
r2787 r2839 10 10 USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_nowrite 11 11 12 USE phys_cal_mod, ONLY : day _cur, year_len12 USE phys_cal_mod, ONLY : days_elapsed, year_len 13 13 14 14 USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root … … 23 23 24 24 ! Input arguments 25 LOGICAL, INTENT(IN) 25 LOGICAL, INTENT(IN) :: debut 26 26 27 27 ! Local variables 28 INTEGER 28 INTEGER :: ncid, dimid, varid, ncerr, nbday 29 29 REAL, POINTER :: wlen(:), time(:) 30 REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) 30 REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: SSI_FRAC 31 31 !$OMP THREADPRIVATE(SSI_FRAC) 32 32 REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: TSI(:) … … 90 90 ENDIF 91 91 92 !--only read at beginning of month 93 IF (debut.OR.day_cur.NE.day_pre) THEN 92 !--only read at beginning of day 93 !--day in year is provided as days_elapsed since the beginning of the year +1 94 IF (debut.OR.days_elapsed+1.NE.day_pre) THEN 94 95 95 !--keep memory of previous month96 day_pre=day _cur96 !--keep memory of previous day 97 day_pre=days_elapsed+1 97 98 98 99 !--copy 99 RSUN(1:NSW)=SSI_FRAC(:,day _cur)100 solaire=TSI(day _cur)100 RSUN(1:NSW)=SSI_FRAC(:,days_elapsed+1) 101 solaire=TSI(days_elapsed+1) 101 102 102 print *,'READ_RSUN_RRTM day=', day _cur,' solaire=', solaire, ' RSUN=', RSUN(1:NSW)103 print *,'READ_RSUN_RRTM day=', days_elapsed+1,' solaire=', solaire, ' RSUN=', RSUN(1:NSW) 103 104 104 105 ENDIF !--fin allocation -
LMDZ5/branches/testing/libf/phylmd/rrtm/readaerosol_optic_rrtm.F90
r2787 r2839 17 17 USE phys_local_var_mod, only: sconcso4,sconcno3,sconcoa,sconcbc,sconcss,sconcdust, & 18 18 concso4,concno3,concoa,concbc,concss,concdust,loadso4,loadoa,loadbc,loadss,loaddust, & 19 load _tmp1,load_tmp2,load_tmp3,load_tmp4,load_tmp5,load_tmp6,load_tmp719 loadno3, load_tmp1,load_tmp2,load_tmp3 20 20 21 21 USE infotrac_phy … … 195 195 IF ( flag_aerosol .EQ. 3 .OR. flag_aerosol .EQ. 6 ) THEN 196 196 197 CALL readaerosol_interp(id_ASPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomsol, pomsol_pi, load_tmp 3)198 CALL readaerosol_interp(id_AIPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomins, pomins_pi, load_tmp 4)199 loadoa(:)=load_tmp 3(:)+load_tmp4(:)197 CALL readaerosol_interp(id_ASPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomsol, pomsol_pi, load_tmp1) 198 CALL readaerosol_interp(id_AIPOMM_phy, itap, pdtphys, rjourvrai, debut, pplay, paprs, t_seri, pomins, pomins_pi, load_tmp2) 199 loadoa(:)=load_tmp1(:)+load_tmp2(:) 200 200 ELSE 201 201 pomsol(:,:) = 0. ; pomsol_pi(:,:) = 0. … … 208 208 209 209 CALL readaerosol_interp(id_SSSSM_phy ,itap, pdtphys,rjourvrai, & 210 debut, pplay, paprs, t_seri, sssupco, sssupco_pi, load_tmp 5)210 debut, pplay, paprs, t_seri, sssupco, sssupco_pi, load_tmp1) 211 211 CALL readaerosol_interp(id_CSSSM_phy ,itap, pdtphys,rjourvrai, & 212 debut, pplay, paprs, t_seri, sscoarse,sscoarse_pi, load_tmp 6)213 CALL readaerosol_interp(id_ASSSM_phy ,itap, pdtphys, 214 debut, pplay, paprs, t_seri, ssacu, ssacu_pi, load_tmp 7)215 loadss(:)=load_tmp 5(:)+load_tmp6(:)+load_tmp7(:)212 debut, pplay, paprs, t_seri, sscoarse,sscoarse_pi, load_tmp2) 213 CALL readaerosol_interp(id_ASSSM_phy ,itap, pdtphys,rjourvrai, & 214 debut, pplay, paprs, t_seri, ssacu, ssacu_pi, load_tmp3) 215 loadss(:)=load_tmp1(:)+load_tmp2(:)+load_tmp3(:) 216 216 ELSE 217 217 sscoarse(:,:) = 0. ; sscoarse_pi(:,:) = 0. … … 231 231 ENDIF 232 232 ! 233 ! Read and interpolate cidustm 234 IF (flag_aerosol .EQ. 6) THEN 235 236 CALL readaerosol_interp(id_ASNO3M_phy, itap, pdtphys, rjourvrai, & 237 debut, pplay, paprs, t_seri, nitracc, nitracc_pi, load_tmp1) 238 CALL readaerosol_interp(id_CSNO3M_phy, itap, pdtphys, rjourvrai, & 239 debut, pplay, paprs, t_seri, nitrcoarse, nitrcoarse_pi, load_tmp2) 240 CALL readaerosol_interp(id_CINO3M_phy, itap, pdtphys, rjourvrai, & 241 debut, pplay, paprs, t_seri, nitrinscoarse, nitrinscoarse_pi, load_tmp3) 242 loadss(:)=load_tmp1(:)+load_tmp2(:)+load_tmp3(:) 243 244 ELSE 245 nitracc(:,:) = 0.0 ; nitracc_pi(:,:) = 0.0 246 nitrcoarse(:,:) = 0.0 ; nitrcoarse_pi(:,:) = 0.0 247 nitrinscoarse(:,:) = 0.0 ; nitrinscoarse_pi(:,:)= 0.0 248 loadno3(:)=0.0 249 ENDIF 250 ! 251 ! CSSO4M is set to 0 as not reliable 233 252 sulfcoarse(:,:) = 0.0 ! CSSO4M (=SO4) + CSMSAM (=MSA) 234 253 sulfcoarse_pi(:,:) = 0.0 ! CSSO4M (=SO4) + CSMSAM (=MSA) pre-ind 235 !236 !--placeholder for offline nitrate237 !238 nitracc(:,:) = 0.0239 nitracc_pi(:,:) = 0.0240 nitrcoarse(:,:) = 0.0241 nitrcoarse_pi(:,:) = 0.0242 nitrinscoarse(:,:) = 0.0243 nitrinscoarse_pi(:,:)= 0.0244 254 245 255 ENDIF !--not aerosol_couple -
LMDZ5/branches/testing/libf/phylmd/rrtm/suphec.F90
r2408 r2839 129 129 130 130 IF (LHOOK) CALL DR_HOOK('SUPHEC',0,ZHOOK_HANDLE) 131 !CALL GSTATS(1811,0) ! MPL 28.11.08 132 !RVTMP2=RCPV/RCPD-1.0_JPRB !use cp,moist 133 RVTMP2=0.0_JPRB !neglect cp,moist 134 RHOH2O=RATM/100._JPRB 135 R2ES=611.21_JPRB*RD/RV 136 R3LES=17.502_JPRB 137 R3IES=22.587_JPRB 138 R4LES=32.19_JPRB 139 R4IES=-0.7_JPRB 140 R5LES=R3LES*(RTT-R4LES) 141 R5IES=R3IES*(RTT-R4IES) 142 R5ALVCP=R5LES*RLVTT/RCPD 143 R5ALSCP=R5IES*RLSTT/RCPD 144 RALVDCP=RLVTT/RCPD 145 RALSDCP=RLSTT/RCPD 146 RALFDCP=RLMLT/RCPD 147 RTWAT=RTT 148 RTBER=RTT-5._JPRB 149 RTBERCU=RTT-5.0_JPRB 150 RTICE=RTT-23._JPRB 151 RTICECU=RTT-23._JPRB 152 153 RTWAT_RTICE_R=1.0_JPRB/(RTWAT-RTICE) 154 RTWAT_RTICECU_R=1.0_JPRB/(RTWAT-RTICECU) 155 IF(NPHYINT == 0) THEN 156 ISMAX=NSMAX 157 ELSE 158 ISMAX=PHYS_GRID%NSMAX 159 ENDIF 160 161 RKOOP1=2.583_JPRB 162 RKOOP2=0.48116E-2_JPRB 131 ! 132 IF (OK_BAD_ECMWF_THERMO) THEN 133 ! 134 ! Modify constants defined in suphel.F90 and set RVTMP2 to 0. 135 ! CALL GSTATS(1811,0) ! MPL 28.11.08 136 ! RVTMP2=RCPV/RCPD-1.0_JPRB !use cp,moist 137 RVTMP2=0.0_JPRB !neglect cp,moist 138 RHOH2O=RATM/100._JPRB 139 R2ES=611.21_JPRB*RD/RV 140 R3LES=17.502_JPRB 141 R3IES=22.587_JPRB 142 R4LES=32.19_JPRB 143 R4IES=-0.7_JPRB 144 R5LES=R3LES*(RTT-R4LES) 145 R5IES=R3IES*(RTT-R4IES) 146 R5ALVCP=R5LES*RLVTT/RCPD 147 R5ALSCP=R5IES*RLSTT/RCPD 148 RALVDCP=RLVTT/RCPD 149 RALSDCP=RLSTT/RCPD 150 RALFDCP=RLMLT/RCPD 151 RTWAT=RTT 152 RTBER=RTT-5._JPRB 153 RTBERCU=RTT-5.0_JPRB 154 RTICE=RTT-23._JPRB 155 RTICECU=RTT-23._JPRB 156 157 RTWAT_RTICE_R=1.0_JPRB/(RTWAT-RTICE) 158 RTWAT_RTICECU_R=1.0_JPRB/(RTWAT-RTICECU) 159 IF(NPHYINT == 0) THEN 160 ISMAX=NSMAX 161 ELSE 162 ISMAX=PHYS_GRID%NSMAX 163 ENDIF 164 165 RKOOP1=2.583_JPRB 166 RKOOP2=0.48116E-2_JPRB 167 168 ELSE 169 ! Keep constants defined in suphel.F90 170 RTICE=RTT-23._JPRB 171 ! 172 ENDIF ! (OK_BAD_ECMWF_THERMO) 163 173 164 174 ! ------------------------------------------------------------------ -
LMDZ5/branches/testing/libf/phylmd/time_phylmdz_mod.F90
-
Property
svn:keywords
set to
Id
r2594 r2839 1 1 ! 2 ! $Id :$2 ! $Id$ 3 3 ! 4 4 MODULE time_phylmdz_mod … … 28 28 INTEGER,SAVE :: itaufin_phy ! final iteration (in itau_phy steps) 29 29 !$OMP THREADPRIVATE(itaufin_phy) 30 REAL,SAVE :: current_time ! current elapsed time (fraction of day)from the begining of the run30 REAL,SAVE :: current_time ! current elapsed time in seconds from the begining of the run 31 31 !$OMP THREADPRIVATE(current_time) 32 32 … … 84 84 IMPLICIT NONE 85 85 INCLUDE 'YOMCST.h' 86 REAL,INTENT(IN) :: pdtphys_ 87 REAL :: julian_date 88 86 REAL,INTENT(IN) :: pdtphys_ 87 REAL :: julian_date 88 INTEGER :: cur_day 89 REAL :: cur_sec 90 89 91 ! Check if the physics timestep has changed 90 92 IF ( ABS( (pdtphys-pdtphys_) / ((pdtphys+pdtphys_)/2))> 10.*EPSILON(pdtphys_)) THEN … … 95 97 96 98 ! Update elapsed time since begining of run: 97 current_time=current_time+pdtphys/rday 99 current_time = current_time + pdtphys 100 cur_day = int(current_time/rday) 101 cur_sec = current_time - (cur_day * rday) 98 102 99 103 ! Compute corresponding Julian date and update calendar 100 CALL ymds2ju(annee_ref,1,day_ini,(start_time+current_time)*rday,julian_date) 104 cur_day = cur_day + day_ini 105 cur_sec = cur_sec + (start_time * rday) 106 CALL ymds2ju(annee_ref,1, cur_day, cur_sec, julian_date) 101 107 CALL phys_cal_update(julian_date) 102 108 -
Property
svn:keywords
set to
-
LMDZ5/branches/testing/libf/phylmd/yamada4.F90
r2729 r2839 57 57 ! -> the model can run with longer time-steps. 58 58 ! 2016/11/30 (EV etienne.vignon@univ-grenoble-alpes.fr) 59 ! On met tke (=q2/2) en entr ée plutôt que q259 ! On met tke (=q2/2) en entr??e plut??t que q2 60 60 ! On corrige l'update de la tke 61 61 ! … … 120 120 DATA first, ipas/.FALSE., 0/ 121 121 !$OMP THREADPRIVATE( first,ipas) 122 LOGICAL hboville 122 LOGICAL,SAVE :: hboville=.TRUE. 123 REAL,SAVE :: viscom,viscoh 124 !$OMP THREADPRIVATE( hboville,viscom,viscoh) 123 125 INTEGER ig, k 124 126 REAL ri, zrif, zalpha, zsm, zsn … … 130 132 REAL zz(klon, klev+1) 131 133 INTEGER iter 134 REAL dissip(klon,klev), tkeprov,tkeexp, shear(klon,klev), buoy(klon,klev) 132 135 REAL,SAVE :: ric0,ric,rifc, b1, kap 133 136 !$OMP THREADPRIVATE(ric0,ric,rifc,b1,kap) … … 138 141 !$OMP THREADPRIVATE(lmixmin) 139 142 LOGICAL, SAVE :: new_yamada4 140 !$OMP THREADPRIVATE(new_yamada4) 141 REAL, SAVE :: yun,ydeux 143 INTEGER, SAVE :: yamada4_num 144 !$OMP THREADPRIVATE(new_yamada4,yamada4_num) 145 REAL, SAVE :: yun,ydeux,disseff 142 146 !$OMP THREADPRIVATE(yun,ydeux) 143 147 REAL frif, falpha, fsm … … 161 165 new_yamada4=.false. 162 166 CALL getin_p('new_yamada4',new_yamada4) 163 ! Pour garantir la continuite dans la mise au point de CMIP6. 164 ! Eliminer l'option new_yamada4 des le printemps 2016 167 165 168 IF (new_yamada4) THEN 169 ! Corrections et reglages issus du travail de these d'Etienne Vignon. 166 170 ric=0.143 ! qui donne des valeurs proches des seuils proposes 167 171 ! dans YAMADA 1983 : sm=0.0845 (0.085 dans Y83) … … 169 173 CALL getin_p('yamada4_ric',ric) 170 174 ric0=0.19489 ! ric=0.195 originalement, mais produisait sm<0 171 ric=min(ric,ric0) ! Au del à de ric0, sm devient négatif175 ric=min(ric,ric0) ! Au dela de ric0, sm devient n??gatif 172 176 rifc=frif(ric) 173 177 seuilsm=fsm(frif(ric)) … … 175 179 yun=1. 176 180 ydeux=2. 177 ! yun=2. 178 ! ydeux=1. 181 hboville=.FALSE. 182 viscom=1.46E-5 183 viscoh=2.06E-5 184 lmixmin=0. 185 yamada4_num=5 179 186 ELSE 180 !! DATA ric, rifc, b1, kap/0.195, 0.191, 16.6, 0.4/181 187 ric=0.195 182 188 rifc=0.191 … … 185 191 yun=2. 186 192 ydeux=1. 193 hboville=.TRUE. 194 viscom=0. 195 viscoh=0. 196 lmixmin=1. 197 yamada4_num=0 187 198 ENDIF 199 188 200 PRINT*,'YAMADA4 RIc, RIfc, Sm_min, Alpha_min',ric,rifc,seuilsm,seuilalpha 189 201 firstcall = .FALSE. 190 lmixmin=1.191 202 CALL getin_p('lmixmin',lmixmin) 203 CALL getin_p('yamada4_hboville',hboville) 204 CALL getin_p('yamada4_num',yamada4_num) 192 205 END IF 193 206 … … 199 212 200 213 ! On utilise ou non la routine de Holstalg Boville pour les cas tres stables 201 hboville=.TRUE.202 214 203 215 … … 290 302 !======================================================================= 291 303 292 ! On commence par calcul é q2 àpartir de la tke304 ! On commence par calculer q2 a partir de la tke 293 305 294 306 IF (new_yamada4) THEN … … 400 412 ELSE IF (iflag_pbl>=10) THEN 401 413 414 IF (yamada4_num>=1) THEN 415 416 DO k = 2, klev - 1 417 DO ig=1,ngrid 418 q2(ig, k) = min(max(q2(ig,k),1.E-10), 1.E4) 419 km(ig, k) = l(ig, k)*sqrt(q2(ig,k))*sm(ig, k) 420 shear(ig,k)=km(ig, k)*m2(ig, k) 421 buoy(ig,k)=km(ig, k)*m2(ig, k)*(-1.*rif(ig,k)) 422 dissip(ig,k)=((sqrt(q2(ig,k)))**3)/(b1*l(ig,k)) 423 ENDDO 424 ENDDO 425 426 IF (yamada4_num==1) THEN ! Schema du MAR tel quel 427 DO k = 2, klev - 1 428 DO ig=1,ngrid 429 tkeprov=q2(ig,k)/ydeux 430 tkeprov= tkeprov* & 431 & (tkeprov+dt*(shear(ig,k)+max(0.,buoy(ig,k))))/ & 432 & (tkeprov+dt*((-1.)*min(0.,buoy(ig,k))+dissip(ig,k))) 433 q2(ig,k)=tkeprov*ydeux 434 ENDDO 435 ENDDO 436 ELSE IF (yamada4_num==2) THEN ! version modifiee avec integration exacte pour la dissipation 437 DO k = 2, klev - 1 438 DO ig=1,ngrid 439 tkeprov=q2(ig,k)/ydeux 440 disseff=dissip(ig,k)-min(0.,buoy(ig,k)) 441 tkeprov = tkeprov/(1.+dt*disseff/(2.*tkeprov))**2 442 tkeprov= tkeprov+dt*(shear(ig,k)+max(0.,buoy(ig,k))) 443 q2(ig,k)=tkeprov*ydeux 444 ! En cas stable, on traite la flotabilite comme la 445 ! dissipation, en supposant que buoy/q2^3 est constant. 446 ! Puis on prend la solution exacte 447 ENDDO 448 ENDDO 449 ELSE IF (yamada4_num==3) THEN ! version modifiee avec integration exacte pour la dissipation 450 DO k = 2, klev - 1 451 DO ig=1,ngrid 452 tkeprov=q2(ig,k)/ydeux 453 disseff=dissip(ig,k)-min(0.,buoy(ig,k)) 454 tkeprov=tkeprov*exp(-dt*disseff/tkeprov) 455 tkeprov= tkeprov+dt*(shear(ig,k)+max(0.,buoy(ig,k))) 456 q2(ig,k)=tkeprov*ydeux 457 ! En cas stable, on traite la flotabilite comme la 458 ! dissipation, en supposant que buoy/q2^3 est constant. 459 ! Puis on prend la solution exacte 460 ENDDO 461 ENDDO 462 ELSE IF (yamada4_num==4) THEN ! version modifiee avec integration exacte pour la dissipation 463 DO k = 2, klev - 1 464 DO ig=1,ngrid 465 tkeprov=q2(ig,k)/ydeux 466 tkeprov= tkeprov+dt*(shear(ig,k)+max(0.,buoy(ig,k))) 467 tkeprov= tkeprov* & 468 & tkeprov/ & 469 & (tkeprov+dt*((-1.)*min(0.,buoy(ig,k))+dissip(ig,k))) 470 q2(ig,k)=tkeprov*ydeux 471 ! En cas stable, on traite la flotabilite comme la 472 ! dissipation, en supposant que buoy/q2^3 est constant. 473 ! Puis on prend la solution exacte 474 ENDDO 475 ENDDO 476 ELSE IF (yamada4_num==5) THEN ! version modifiee avec integration exacte pour la dissipation 477 DO k = 2, klev - 1 478 DO ig=1,ngrid 479 tkeprov=q2(ig,k)/ydeux 480 disseff=dissip(ig,k)-min(0.,buoy(ig,k)) 481 tkeexp=exp(-dt*disseff/tkeprov) 482 tkeprov= shear(ig,k)*tkeprov/disseff*(1.-tkeexp)+tkeprov*tkeexp 483 q2(ig,k)=tkeprov*ydeux 484 ! En cas stable, on traite la flotabilite comme la 485 ! dissipation, en supposant que buoy/q2^3 est constant. 486 ! Puis on prend la solution exacte 487 ENDDO 488 ENDDO 489 ELSE IF (yamada4_num==6) THEN ! version modifiee avec integration exacte pour la dissipation 490 DO k = 2, klev - 1 491 DO ig=1,ngrid 492 tkeprov=q2(ig,k)/ydeux 493 tkeprov=tkeprov+max(buoy(ig,k)+shear(ig,k),0.)*dt 494 disseff=dissip(ig,k)-min(0.,buoy(ig,k)+shear(ig,k)) 495 tkeexp=exp(-dt*disseff/tkeprov) 496 tkeprov= tkeprov*tkeexp 497 q2(ig,k)=tkeprov*ydeux 498 ! En cas stable, on traite la flotabilite comme la 499 ! dissipation, en supposant que buoy/q2^3 est constant. 500 ! Puis on prend la solution exacte 501 ENDDO 502 ENDDO 503 ENDIF 504 505 DO k = 2, klev - 1 506 DO ig=1,ngrid 507 q2(ig, k) = min(max(q2(ig,k),1.E-10), 1.E4) 508 ENDDO 509 ENDDO 510 511 ELSE 512 402 513 DO k = 2, klev - 1 403 514 km(1:ngrid, k) = l(1:ngrid, k)*sqrt(q2(1:ngrid,k))*sm(1:ngrid, k) … … 410 521 END DO 411 522 523 ENDIF 412 524 413 525 ELSE … … 529 641 END IF ! hboville 530 642 643 ! Ajout d'une viscosite moleculaire 644 km(:,:)=km(:,:)+viscom 645 kn(:,:)=kn(:,:)+viscoh 646 kq(:,:)=kq(:,:)+viscoh 647 531 648 IF (prt_level>1) THEN 532 649 PRINT *, 'YAMADA4 1' … … 575 692 576 693 !============================================================================ 577 ! Mise àjour de la tke694 ! Mise a jour de la tke 578 695 !============================================================================ 579 696
Note: See TracChangeset
for help on using the changeset viewer.