Changeset 344
- Timestamp:
- 07/31/15 17:29:55 (9 years ago)
- Location:
- codes/icosagcm/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/trunk/src/etat0.f90
r327 r344 1 1 MODULE etat0_mod 2 2 USE icosa 3 IMPLICIT NONE 3 4 PRIVATE 4 5 … … 16 17 USE disvert_mod 17 18 ! New interface 19 USE etat0_dcmip1_mod, ONLY : getin_etat0_dcmip1=>getin_etat0 20 USE etat0_dcmip2_mod, ONLY : getin_etat0_dcmip2=>getin_etat0 18 21 USE etat0_dcmip5_mod, ONLY : getin_etat0_dcmip5=>getin_etat0 19 22 USE etat0_williamson_mod, ONLY : getin_etat0_williamson=>getin_etat0 … … 21 24 ! Old interface 22 25 USE etat0_academic_mod, ONLY : etat0_academic=>etat0 23 USE etat0_dcmip1_mod, ONLY : etat0_dcmip1=>etat024 USE etat0_dcmip2_mod, ONLY : etat0_dcmip2=>etat025 26 USE etat0_dcmip3_mod, ONLY : etat0_dcmip3=>etat0 26 27 USE etat0_dcmip4_mod, ONLY : etat0_dcmip4=>etat0 … … 38 39 39 40 REAL(rstd),POINTER :: ps(:), mass(:,:) 40 LOGICAL :: init_mass 41 LOGICAL :: init_mass, collocated 41 42 INTEGER :: ind,i,j,ij,l 42 43 … … 52 53 CALL getin("etat0",etat0_type) 53 54 55 !------------------- New interface --------------------- 56 collocated=.TRUE. 54 57 SELECT CASE (TRIM(etat0_type)) 55 !------------------- New interface ---------------------56 58 CASE ('isothermal') 57 59 CALL getin_etat0_isothermal 58 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q)59 60 CASE ('temperature_profile') 60 61 CALL getin_etat0_temperature 61 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q)62 62 CASE ('jablonowsky06') 63 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 64 CASE ('dcmip5') 63 CASE ('dcmip1') 64 CALL getin_etat0_dcmip1 65 CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear') 66 CALL getin_etat0_dcmip2 67 CASE ('dcmip5') 65 68 CALL getin_etat0_dcmip5 66 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q)67 69 CASE ('williamson91.6') 68 70 init_mass=.FALSE. 69 71 CALL getin_etat0_williamson 70 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 71 !------------------- Old interface -------------------- 72 CASE DEFAULT 73 collocated=.FALSE. 74 END SELECT 75 76 !------------------- Old interface -------------------- 77 SELECT CASE (TRIM(etat0_type)) 72 78 CASE ('start_file') 73 79 CALL etat0_start_file(f_ps,f_phis,f_theta_rhodz,f_u, f_q) … … 80 86 CALL etat0_venus(f_ps, f_phis, f_theta_rhodz, f_u, f_q) 81 87 PRINT *, "Venus (Lebonnois et al., 2012) test case" 82 CASE ('dcmip1')83 CALL etat0_dcmip1(f_ps,f_phis,f_theta_rhodz,f_u, f_q)84 CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear')85 CALL etat0_dcmip2(f_ps,f_phis,f_theta_rhodz,f_u, f_q)86 88 CASE ('dcmip3') 87 89 CALL etat0_dcmip3(f_ps,f_phis,f_theta_rhodz,f_u, f_q) … … 95 97 CALL etat0_dcmip4(f_ps,f_phis,f_theta_rhodz,f_u, f_q) 96 98 CASE DEFAULT 97 PRINT*, 'Bad selector for variable etat0 <',etat0_type, & 98 '> options are <jablonowsky06>, <academic>, <dcmip[1-4]> ' 99 STOP 99 IF(collocated) THEN 100 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 101 ELSE 102 PRINT*, 'Bad selector for variable etat0 <',etat0_type, & 103 '> options are <jablonowsky06>, <academic>, <dcmip[1-4]> ' 104 STOP 105 END IF 100 106 END SELECT 101 107 … … 163 169 USE wind_mod 164 170 USE etat0_jablonowsky06_mod, ONLY : compute_jablonowsky06 => compute_etat0 171 USE etat0_dcmip1_mod, ONLY : compute_dcmip1 => compute_etat0 172 USE etat0_dcmip2_mod, ONLY : compute_dcmip2 => compute_etat0 165 173 USE etat0_dcmip5_mod, ONLY : compute_dcmip5 => compute_etat0 166 174 USE etat0_williamson_mod, ONLY : compute_w91_6 => compute_etat0 … … 197 205 CALL compute_jablonowsky06(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i) 198 206 CALL compute_jablonowsky06(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e) 207 CASE('dcmip1') 208 CALL compute_dcmip1(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) 209 CALL compute_dcmip1(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) 210 CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear') 211 CALL compute_dcmip2(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i) 212 CALL compute_dcmip2(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e) 199 213 CASE('dcmip5') 200 214 CALL compute_dcmip5(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) -
codes/icosagcm/trunk/src/etat0_dcmip1.f90
r286 r344 1 1 MODULE etat0_dcmip1_mod 2 2 USE icosa 3 IMPLICIT NONE 3 4 PRIVATE 5 6 INTEGER, PARAMETER :: const=1, cos_bell=2, slotted_cyl=3, & 7 dbl_cos_bell_q1=4, dbl_cos_bell_q2=5, complement=6, hadley=7, & 8 dcmip11=-1 9 INTEGER, SAVE :: shape 10 !$OMP THREADPRIVATE(shape) 4 11 5 12 REAL(rstd), SAVE :: h0=1. … … 36 43 !$OMP THREADPRIVATE(zc) 37 44 38 PUBLIC etat045 PUBLIC getin_etat0, compute_etat0 39 46 40 47 CONTAINS 41 42 SUBROUTINE etat0(f_ps,f_phis,f_theta_rhodz,f_u,f_q) 43 USE icosa 44 IMPLICIT NONE 45 TYPE(t_field),POINTER :: f_ps(:) 46 TYPE(t_field),POINTER :: f_phis(:) 47 TYPE(t_field),POINTER :: f_theta_rhodz(:) 48 TYPE(t_field),POINTER :: f_u(:) 49 TYPE(t_field),POINTER :: f_q(:) 50 51 REAL(rstd),POINTER :: ps(:) 52 REAL(rstd),POINTER :: phis(:) 53 REAL(rstd),POINTER :: theta_rhodz(:,:) 54 REAL(rstd),POINTER :: u(:,:) 55 REAL(rstd),POINTER :: q(:,:,:) 48 49 SUBROUTINE getin_etat0 56 50 CHARACTER(len=255) :: dcmip1_adv_shape 57 INTEGER :: ind58 59 51 R0=radius*0.5 60 52 rt=radius*0.5 61 53 dcmip1_adv_shape='cos_bell' 62 54 CALL getin('dcmip1_shape',dcmip1_adv_shape) 63 64 DO ind=1,ndomain 65 IF (.NOT. assigned_domain(ind)) CYCLE 66 CALL swap_dimensions(ind) 67 CALL swap_geometry(ind) 68 ps=f_ps(ind) 69 phis=f_phis(ind) 70 theta_rhodz=f_theta_rhodz(ind) 71 u=f_u(ind) 72 q=f_q(ind) 73 74 75 SELECT CASE(TRIM(dcmip1_adv_shape)) 76 CASE('const') 77 CALL compute_etat0_ncar(1,ps, phis, theta_rhodz, u, q(:,:,1)) 78 CASE('cos_bell') 79 CALL compute_etat0_ncar(2,ps, phis, theta_rhodz, u, q(:,:,1)) 80 CASE('slotted_cyl') 81 CALL compute_etat0_ncar(3,ps, phis, theta_rhodz, u, q(:,:,1)) 82 CASE('dbl_cos_bell_q1') 83 CALL compute_etat0_ncar(4,ps, phis, theta_rhodz, u, q(:,:,1)) 84 CASE('dbl_cos_bell_q2') 85 CALL compute_etat0_ncar(5,ps, phis, theta_rhodz, u, q(:,:,1)) 86 CASE('complement') 87 CALL compute_etat0_ncar(6,ps, phis, theta_rhodz, u, q(:,:,1)) 88 CASE('hadley') ! hadley like meridional circulation 89 CALL compute_etat0_ncar(7,ps, phis, theta_rhodz, u, q(:,:,1)) 90 CASE('dcmip11') 91 IF(nqtot==5) THEN 92 CALL compute_etat0_ncar(4,ps, phis, theta_rhodz, u, q(:,:,1)) 93 CALL compute_etat0_ncar(5,ps, phis, theta_rhodz, u, q(:,:,2)) 94 CALL compute_etat0_ncar(3,ps, phis, theta_rhodz, u, q(:,:,3)) 95 CALL compute_etat0_ncar(6,ps, phis, theta_rhodz, u, q(:,:,4)) 96 CALL compute_etat0_ncar(1,ps, phis, theta_rhodz, u, q(:,:,5)) 97 ELSE 98 PRINT *,'Error : etat0_dcmip=dcmip11 and nqtot = ',nqtot,' .' 99 PRINT *,'nqtot must be equal to 5 when etat0_dcmip=dcmip11' 100 STOP 101 END IF 102 CASE DEFAULT 103 PRINT *, 'Bad selector for variable dcmip1_adv_shape : <', TRIM(dcmip1_adv_shape), & 104 '> options are <const>, <slotted_cyl>, <cos_bell>, <dbl_cos_bell_q1>', & 105 '<dbl_cos_bell_q2>, <complement>, <hadley>' 106 STOP 107 END SELECT 108 109 ENDDO 110 111 END SUBROUTINE etat0 112 113 SUBROUTINE compute_etat0_ncar(icase, ps, phis, theta_rhodz, u, q) 55 SELECT CASE(TRIM(dcmip1_adv_shape)) 56 CASE('const') 57 shape=const 58 CASE('cos_bell') 59 shape=cos_bell 60 CASE('slotted_cyl') 61 shape=slotted_cyl 62 CASE('dbl_cos_bell_q1') 63 shape=dbl_cos_bell_q1 64 CASE('dbl_cos_bell_q2') 65 shape=dbl_cos_bell_q2 66 CASE('complement') 67 shape=complement 68 CASE('hadley') ! hadley like meridional circulation 69 shape=hadley 70 CASE('dcmip11') 71 IF(nqtot<5) THEN 72 PRINT *,'Error : etat0_dcmip=dcmip11 and nqtot = ',nqtot,' .' 73 PRINT *,'nqtot must be equal to 5 when etat0_dcmip=dcmip11' 74 STOP 75 END IF 76 shape=dcmip11 77 CASE DEFAULT 78 PRINT *, 'Bad selector for variable dcmip1_adv_shape : <', TRIM(dcmip1_adv_shape), & 79 '> options are <const>, <slotted_cyl>, <cos_bell>, <dbl_cos_bell_q1>', & 80 '<dbl_cos_bell_q2>, <complement>, <hadley>' 81 STOP 82 END SELECT 83 END SUBROUTINE getin_etat0 84 85 SUBROUTINE compute_etat0(ngrid,lon,lat, phis,ps,temp,ulon,ulat,q) 86 INTEGER, INTENT(IN) :: ngrid 87 REAL(rstd),INTENT(IN) :: lon(ngrid),lat(ngrid) 88 REAL(rstd),INTENT(OUT) :: ps(ngrid),phis(ngrid) 89 REAL(rstd),INTENT(OUT) :: temp(ngrid,llm),ulon(ngrid,llm),ulat(ngrid,llm) 90 REAL(rstd),INTENT(OUT) :: q(ngrid,llm,nqtot) 91 ps = ncar_p0 92 phis = 0. ; temp = 0. ; 93 ulon = 0. ; ulat=0. 94 SELECT CASE(shape) 95 CASE(dcmip11) 96 CALL compute_etat0_ncar(4,ngrid,lon,lat,q(:,:,1)) 97 CALL compute_etat0_ncar(5,ngrid,lon,lat,q(:,:,2)) 98 CALL compute_etat0_ncar(3,ngrid,lon,lat,q(:,:,3)) 99 CALL compute_etat0_ncar(6,ngrid,lon,lat,q(:,:,4)) 100 CALL compute_etat0_ncar(1,ngrid,lon,lat,q(:,:,5)) 101 CASE DEFAULT 102 CALL compute_etat0_ncar(shape,ngrid,lon,lat,q(:,:,1)) 103 END SELECT 104 END SUBROUTINE compute_etat0 105 106 SUBROUTINE compute_etat0_ncar(icase,ngrid,lon,lat, q) 114 107 USE icosa 115 108 USE disvert_mod 116 USE pression_mod117 USE exner_mod118 USE geopotential_mod119 USE theta2theta_rhodz_mod120 109 IMPLICIT NONE 121 INTEGER, INTENT(in) :: icase 122 REAL(rstd),INTENT(OUT) :: ps(iim*jjm) 123 REAL(rstd),INTENT(OUT) :: phis(iim*jjm) 124 REAL(rstd),INTENT(OUT) :: theta_rhodz(iim*jjm,llm) 125 REAL(rstd),INTENT(OUT) :: u(3*iim*jjm,llm) 126 REAL(rstd),INTENT(OUT) :: q(iim*jjm,llm) 127 128 REAL(rstd) :: qxt1(iim*jjm,llm) 129 REAL(rstd) :: lon, lat 130 REAL(rstd) ::dd1,dd2,dd1t1,dd1t2,dd2t1 131 REAL(rstd) :: pr, zr(llm+1), zrl(llm) 132 REAL(rstd) :: rr1,rr2,bb,cc,aa,hmx 133 REAL(rstd) :: X2(3),X1(3) 134 INTEGER :: i,j,n,l 135 136 u = 0.0 ; phis = 0 ; theta_rhodz = 0 ; ps = ncar_p0 110 INTEGER, INTENT(IN) :: icase, ngrid 111 REAL(rstd),INTENT(IN) :: lon(ngrid),lat(ngrid) 112 REAL(rstd),INTENT(OUT) :: q(ngrid,llm) 113 REAL(rstd) :: zr(llm+1), zrl(llm), qxt1(ngrid,llm) 114 REAL(rstd) :: pr 115 ! REAL(rstd) :: lon, lat 116 INTEGER :: n,l 137 117 138 118 DO l=1, llm+1 … … 149 129 q=1 150 130 CASE(2) 151 !--------------------------------------------- SINGLE COSINE BELL152 131 CALL cosine_bell_1(q) 153 132 CASE(3) 154 133 CALL slotted_cylinders(q) 155 134 CASE(4) 156 PRINT *, 'Double cosine bell'157 135 CALL cosine_bell_2(q) 158 136 CASE(5) … … 176 154 END SELECT 177 155 178 CONTAINS 179 156 CONTAINS 180 157 !====================================================================== 181 158 182 159 SUBROUTINE cosine_bell_1(hx) 183 160 IMPLICIT NONE 184 REAL(rstd) :: hx(iim*jjm,llm) 161 REAL(rstd) :: hx(ngrid,llm) 162 REAL(rstd) :: rr1,rr2 163 INTEGER :: n,l 164 DO l=1,llm 165 DO n=1,ngrid 166 CALL dist_lonlat(lon0,lat0,lon(n),lat(n),rr1) ! GC distance from center 167 rr1 = radius*rr1 168 IF ( rr1 .LT. R0 ) then 169 hx(n,l)= 0.5*h0*(1+cos(pi*rr1/R0)) 170 ELSE 171 hx(n,l)=0.0 172 END IF 173 END DO 174 END DO 175 END SUBROUTINE cosine_bell_1 176 177 !============================================================================== 178 179 SUBROUTINE cosine_bell_2(hx) 180 REAL(rstd) :: hx(ngrid,llm) 181 REAL(rstd) :: rr1,rr2,dd1,dd2,dd1t1,dd1t2,dd2t1 182 INTEGER :: n,l 183 DO l=1,llm 184 DO n=1,ngrid 185 CALL dist_lonlat(lonc1,latc1,lon(n),lat(n),rr1) ! GC distance from center 186 rr1 = radius*rr1 187 CALL dist_lonlat(lonc2,latc2,lon(n),lat(n),rr2) ! GC distance from center 188 rr2 = radius*rr2 189 dd1t1 = rr1/rt 190 dd1t1 = dd1t1*dd1t1 191 dd1t2 = (zrl(l) - zc)/zt 192 dd1t2 = dd1t2*dd1t2 193 dd1 = dd1t1 + dd1t2 194 dd1 = Min(1.0,dd1) 195 dd2t1 = rr2/rt 196 dd2t1 = dd2t1*dd2t1 197 dd2 = dd2t1 + dd1t2 198 dd2 = Min(1.0,dd2) 199 hx(n,l)= 0.5*(1. + cos(pi*dd1))+0.5*(1.+cos(pi*dd2)) 200 END DO 201 END DO 202 END SUBROUTINE cosine_bell_2 203 204 !============================================================================= 205 206 SUBROUTINE slotted_cylinders(hx) 207 REAL(rstd) :: hx(ngrid,llm) 208 REAL(rstd) :: rr1,rr2,dd1,dd2,dd1t1,dd1t2,dd2t1 209 INTEGER :: n,l 210 DO l=1,llm 211 DO n=1,ngrid 212 CALL dist_lonlat(lonc1,latc1,lon(n),lat(n),rr1) ! GC distance from center 213 rr1 = radius*rr1 214 CALL dist_lonlat(lonc2,latc2,lon(n),lat(n),rr2) ! GC distance from center 215 rr2 = radius*rr2 216 dd1t1 = rr1/rt 217 dd1t1 = dd1t1*dd1t1 218 dd1t2 = (zrl(l) - zc)/zt 219 dd1t2 = dd1t2*dd1t2 220 dd1 = dd1t1 + dd1t2 221 dd2t1 = rr2/rt 222 dd2t1 = dd2t1*dd2t1 223 dd2 = dd2t1 + dd1t2 224 IF ( dd1 .LT. 0.5 ) Then 225 hx(n,l) = 1.0 226 ELSEIF ( dd2 .LT. 0.5 ) Then 227 hx(n,l) = 1.0 228 ELSE 229 hx(n,l) = 0.1 230 END IF 231 IF ( zrl(l) .GT. zc ) Then 232 IF ( ABS(latc1 - lat_i(n)) .LT. 0.125 ) Then 233 hx(n,l)= 0.1 234 ENDIF 235 ENDIF 236 END DO 237 END DO 238 END SUBROUTINE slotted_cylinders 185 239 186 DO l=1,llm187 DO j=jj_begin-1,jj_end+1188 DO i=ii_begin-1,ii_end+1189 n=(j-1)*iim+i190 CALL dist_lonlat(lon0,lat0,lon_i(n),lat_i(n),rr1) ! GC distance from center191 rr1 = radius*rr1192 IF ( rr1 .LT. R0 ) then193 hx(n,l)= 0.5*h0*(1+cos(pi*rr1/R0))194 ELSE195 hx(n,l)=0.0196 END IF197 END DO198 END DO199 END DO200 201 END SUBROUTINE cosine_bell_1202 203 240 !============================================================================== 204 241 205 SUBROUTINE cosine_bell_2(hx)206 IMPLICIT NONE207 REAL(rstd) :: hx(iim*jjm,llm)208 209 DO l=1,llm210 DO j=jj_begin-1,jj_end+1211 DO i=ii_begin-1,ii_end+1212 n=(j-1)*iim+i213 CALL dist_lonlat(lonc1,latc1,lon_i(n),lat_i(n),rr1) ! GC distance from center214 rr1 = radius*rr1215 CALL dist_lonlat(lonc2,latc2,lon_i(n),lat_i(n),rr2) ! GC distance from center216 rr2 = radius*rr2217 dd1t1 = rr1/rt218 dd1t1 = dd1t1*dd1t1219 dd1t2 = (zrl(l) - zc)/zt220 dd1t2 = dd1t2*dd1t2221 dd1 = dd1t1 + dd1t2222 dd1 = Min(1.0,dd1)223 dd2t1 = rr2/rt224 dd2t1 = dd2t1*dd2t1225 dd2 = dd2t1 + dd1t2226 dd2 = Min(1.0,dd2)227 hx(n,l)= 0.5*(1. + cos(pi*dd1))+0.5*(1.+cos(pi*dd2))228 END DO229 END DO230 END DO231 232 END SUBROUTINE cosine_bell_2233 234 !=============================================================================235 236 SUBROUTINE slotted_cylinders(hx)237 IMPLICIT NONE238 REAL(rstd) :: hx(iim*jjm,llm)239 240 DO l=1,llm241 DO j=jj_begin-1,jj_end+1242 DO i=ii_begin-1,ii_end+1243 n=(j-1)*iim+i244 CALL dist_lonlat(lonc1,latc1,lon_i(n),lat_i(n),rr1) ! GC distance from center245 rr1 = radius*rr1246 CALL dist_lonlat(lonc2,latc2,lon_i(n),lat_i(n),rr2) ! GC distance from center247 rr2 = radius*rr2248 dd1t1 = rr1/rt249 dd1t1 = dd1t1*dd1t1250 dd1t2 = (zrl(l) - zc)/zt251 dd1t2 = dd1t2*dd1t2252 dd1 = dd1t1 + dd1t2253 dd2t1 = rr2/rt254 dd2t1 = dd2t1*dd2t1255 dd2 = dd2t1 + dd1t2256 257 IF ( dd1 .LT. 0.5 ) Then258 hx(n,l) = 1.0259 ELSEIF ( dd2 .LT. 0.5 ) Then260 hx(n,l) = 1.0261 ELSE262 hx(n,l) = 0.1263 END IF264 265 IF ( zrl(l) .GT. zc ) Then266 IF ( ABS(latc1 - lat) .LT. 0.125 ) Then267 hx(n,l)= 0.1268 ENDIF269 ENDIF270 271 ENDDO272 END DO273 END DO274 275 END SUBROUTINE slotted_cylinders276 277 !==============================================================================278 279 242 SUBROUTINE hadleyq(hx) 280 IMPLICIT NONE 281 REAL(rstd)::hx(iim*jjm,llm) 243 REAL(rstd)::hx(ngrid,llm) 282 244 REAL(rstd),PARAMETER:: zz1=2000.,zz2=5000.,zz0=0.5*(zz1+zz2) 245 INTEGER :: n,l 283 246 284 247 DO l=1,llm -
codes/icosagcm/trunk/src/etat0_dcmip2.f90
r295 r344 3 3 ! test cases DCMIP 2012, category 2 : Orographic gravity waves 4 4 5 USE genmod 6 5 USE icosa 7 6 PRIVATE 8 7 9 PUBLIC etat0 8 INTEGER, SAVE :: testcase 9 INTEGER, PARAMETER :: mountain=0, schaer_noshear=1, schaer_shear=2 10 11 PUBLIC getin_etat0, compute_etat0 10 12 11 13 CONTAINS 12 14 13 14 SUBROUTINE etat0(f_ps,f_phis,f_theta_rhodz,f_u, f_q) 15 USE icosa 16 USE theta2theta_rhodz_mod 17 IMPLICIT NONE 18 TYPE(t_field),POINTER :: f_ps(:) 19 TYPE(t_field),POINTER :: f_phis(:) 20 TYPE(t_field),POINTER :: f_theta_rhodz(:) 21 TYPE(t_field),POINTER :: f_u(:) 22 TYPE(t_field),POINTER :: f_q(:) 23 24 TYPE(t_field),POINTER,SAVE :: f_temp(:) 25 REAL(rstd),POINTER :: ps(:) 26 REAL(rstd),POINTER :: phis(:) 27 REAL(rstd),POINTER :: u(:,:) 28 REAL(rstd),POINTER :: Temp(:,:) 29 REAL(rstd),POINTER :: q(:,:,:) 30 31 INTEGER :: ind, icase 15 SUBROUTINE getin_etat0 32 16 CHARACTER(len=255) :: etat0_type 33 17 etat0_type='jablonowsky06' 34 18 CALL getin("etat0",etat0_type) 35 36 19 SELECT CASE (TRIM(etat0_type)) 37 20 CASE('dcmip2_mountain') 38 icase=021 testcase = mountain 39 22 CASE('dcmip2_schaer_noshear') 40 icase=123 testcase = schaer_noshear 41 24 CASE('dcmip2_schaer_shear') 42 icase=225 testcase = schaer_shear 43 26 CASE DEFAULT 44 27 PRINT *, 'This should not happen : etat0_type =', TRIM(etat0_type), ' in etat0_dcmip2.f90/etat0' … … 46 29 END SELECT 47 30 PRINT *, 'Orographic gravity-wave test case :', TRIM(etat0_type) 31 END SUBROUTINE getin_etat0 48 32 49 CALL allocate_field(f_temp,field_t,type_real,llm,name='temp') 33 SUBROUTINE compute_etat0(ngrid,lon,lat, phis, ps, Temp, ulon, ulat) 34 USE disvert_mod 35 IMPLICIT NONE 36 INTEGER, INTENT(IN) :: ngrid 37 REAL(rstd),INTENT(IN) :: lon(ngrid) 38 REAL(rstd),INTENT(IN) :: lat(ngrid) 39 REAL(rstd),INTENT(OUT) :: ps(ngrid) 40 REAL(rstd),INTENT(OUT) :: phis(ngrid) 41 REAL(rstd),INTENT(OUT) :: Temp(ngrid,llm) 42 REAL(rstd),INTENT(OUT) :: ulon(ngrid,llm) 43 REAL(rstd),INTENT(OUT) :: ulat(ngrid,llm) 44 INTEGER :: l,ij 45 REAL(rstd) :: hyam, hybm 50 46 51 DO ind=1,ndomain52 IF (.NOT. assigned_domain(ind)) CYCLE53 CALL swap_dimensions(ind)54 CALL swap_geometry(ind)55 56 ps=f_ps(ind)57 phis=f_phis(ind)58 u=f_u(ind)59 q=f_q(ind)60 temp=f_temp(ind)61 CALL compute_etat0_DCMIP2(icase,ps,phis,u,Temp,q)62 ENDDO63 64 CALL temperature2theta_rhodz(f_ps,f_temp,f_theta_rhodz)65 66 CALL deallocate_field(f_temp)67 68 END SUBROUTINE etat069 70 SUBROUTINE compute_etat0_DCMIP2(icase, ps, phis, u, temp,q)71 USE icosa72 USE disvert_mod, ONLY : ap,bp73 USE pression_mod74 USE theta2theta_rhodz_mod75 USE wind_mod76 IMPLICIT NONE77 INTEGER, INTENT(IN) :: icase78 REAL(rstd), INTENT(OUT) :: ps(iim*jjm)79 REAL(rstd), INTENT(OUT) :: phis(iim*jjm)80 REAL(rstd), INTENT(OUT) :: u(3*iim*jjm,llm)81 REAL(rstd), INTENT(OUT) :: temp(iim*jjm,llm)82 REAL(rstd), INTENT(OUT) :: q(iim*jjm,llm)83 REAL(rstd) :: ulon(3*iim*jjm,llm), ulat(3*iim*jjm,llm)84 85 INTEGER :: i,j,l,ij86 REAL(rstd) :: hyam, hybm, pp, dummy1, dummy2, dummy387 88 47 ! Hexagons : ps,phis,temp 89 48 DO l=1,llm … … 91 50 hyam = .5*(ap(l)+ap(l+1))/preff 92 51 hybm = .5*(bp(l)+bp(l+1)) 93 DO j=jj_begin,jj_end 94 DO i=ii_begin,ii_end 95 ij=(j-1)*iim+i 96 CALL comp_all(lon_i(ij),lat_i(ij), ps(ij),phis(ij),temp(ij,l), dummy1,dummy2) 97 END DO 52 DO ij=1,ngrid 53 CALL comp_all(hyam,hybm,lon(ij),lat(ij), & 54 ps(ij),phis(ij), Temp(ij,l),ulon(ij,l), ulat(ij,l) ) 98 55 END DO 99 56 END DO 100 101 ! Edges : ulon,ulat 102 DO l=1,llm 103 ! The surface pressure is not set yet so we provide the hybrid coefficients 104 hyam = .5*(ap(l)+ap(l+1))/preff 105 hybm = .5*(bp(l)+bp(l+1)) 106 DO j=jj_begin,jj_end 107 DO i=ii_begin,ii_end 108 ij=(j-1)*iim+i 109 CALL comp_all(lon_e(ij+u_right), lat_e(ij+u_right), & 110 dummy1,dummy2,dummy3, ulon(ij+u_right,l),ulat(ij+u_right,l)) 111 CALL comp_all(lon_e(ij+u_lup), lat_e(ij+u_lup), & 112 dummy1,dummy2,dummy3, ulon(ij+u_lup,l),ulat(ij+u_lup,l)) 113 CALL comp_all(lon_e(ij+u_ldown), lat_e(ij+u_ldown), & 114 dummy1,dummy2,dummy3, ulon(ij+u_ldown,l),ulat(ij+u_ldown,l)) 115 END DO 116 END DO 117 END DO 118 CALL compute_wind_perp_from_lonlat_compound(ulon,ulat,u) 57 END SUBROUTINE compute_etat0 119 58 120 q=1. 121 122 CONTAINS 123 124 SUBROUTINE comp_all(lon,lat, psj,phisj,tempj, ulonj,ulatj) 125 USE dcmip_initial_conditions_test_1_2_3 126 REAL(rstd), INTENT(IN) :: lon, lat 127 REAL(rstd), INTENT(OUT) :: psj,phisj,tempj,ulonj,ulatj 128 REAL :: dummy 129 dummy=0. 130 SELECT CASE (icase) 131 CASE(0) 132 CALL test2_steady_state_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm, & 133 ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy) 134 CASE(1) 135 CALL test2_schaer_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm,0,& 136 ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy) 137 CASE(2) 138 CALL test2_schaer_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm,1, & 139 ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy) 140 END SELECT 141 END SUBROUTINE comp_all 142 143 END SUBROUTINE compute_etat0_DCMIP2 144 59 SUBROUTINE comp_all(hyam,hybm,lon,lat, psj,phisj,tempj, ulonj,ulatj) 60 USE dcmip_initial_conditions_test_1_2_3 61 REAL(rstd), INTENT(IN) :: hyam, hybm, lon, lat 62 REAL(rstd), INTENT(OUT) :: psj,phisj,tempj,ulonj,ulatj 63 REAL :: dummy 64 dummy=0. 65 SELECT CASE (testcase) 66 CASE(mountain) 67 CALL test2_steady_state_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm, & 68 ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy) 69 CASE(schaer_noshear) 70 CALL test2_schaer_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm,0,& 71 ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy) 72 CASE(schaer_shear) 73 CALL test2_schaer_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm,1, & 74 ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy) 75 END SELECT 76 END SUBROUTINE comp_all 145 77 146 78 END MODULE etat0_dcmip2_mod
Note: See TracChangeset
for help on using the changeset viewer.