Changeset 125
- Timestamp:
- 02/01/13 01:52:22 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/trunk/src/caldyn_gcm.f90
r123 r125 2 2 USE icosa 3 3 4 TYPE(t_field),POINTER :: f_out_u(:) 5 REAL(rstd),POINTER :: out_u(:,:) 4 TYPE(t_field),POINTER :: f_out_u(:), f_p(:), f_rhodz(:), f_qu(:) 5 REAL(rstd),POINTER :: out_u(:,:), p(:,:), rhodz(:,:), qu(:,:) 6 6 7 7 TYPE(t_field),POINTER :: f_buf_i(:), f_buf_ulon(:), f_buf_ulat(:), f_buf_u3d(:) … … 10 10 PUBLIC init_caldyn, caldyn, write_output_fields 11 11 12 INTEGER :: caldyn_hydrostat 12 INTEGER :: caldyn_hydrostat, caldyn_conserv 13 13 14 14 CONTAINS … … 20 20 CHARACTER(len=255) :: def 21 21 22 def='direct' 23 CALL getin('caldyn_conserv',def) 24 SELECT CASE(TRIM(def)) 25 CASE('energy') 26 caldyn_conserv=1 27 CASE('direct') 28 caldyn_conserv=2 29 CASE DEFAULT 30 PRINT*,'Bad selector for variable caldyn_conserv : <', TRIM(def),'> options are <energy>, <enstrophy>' 31 STOP 32 END SELECT 33 22 34 def='direct' 23 35 CALL getin('caldyn_exner',def) … … 53 65 54 66 CALL allocate_field(f_out_u,field_u,type_real,llm) 67 CALL allocate_field(f_p,field_t,type_real,llm+1) 68 CALL allocate_field(f_rhodz,field_t,type_real,llm) 69 CALL allocate_field(f_qu,field_u,type_real,llm) 55 70 56 71 CALL allocate_field(f_buf_i,field_t,type_real,llm) … … 118 133 TYPE(t_field),POINTER :: f_du(:) 119 134 120 REAL(rstd),POINTER :: phis(:) 121 REAL(rstd),POINTER :: ps(:) 122 REAL(rstd),POINTER :: theta_rhodz(:,:) 123 REAL(rstd),POINTER :: u(:,:) 124 REAL(rstd),POINTER :: dps(:) 125 REAL(rstd),POINTER :: dtheta_rhodz(:,:) 126 REAL(rstd),POINTER :: du(:,:) 135 REAL(rstd),POINTER :: phis(:), ps(:), dps(:) 136 REAL(rstd),POINTER :: theta_rhodz(:,:), dtheta_rhodz(:,:) 137 REAL(rstd),POINTER :: u(:,:), du(:,:) 138 REAL(rstd),POINTER :: p(:,:), rhodz(:,:), qu(:,:) 127 139 INTEGER :: ind,ij 128 140 … … 137 149 CALL swap_geometry(ind) 138 150 139 out_u=f_out_u(ind)140 151 phis=f_phis(ind) 141 152 ps=f_ps(ind) 153 dps=f_dps(ind) 142 154 theta_rhodz=f_theta_rhodz(ind) 155 dtheta_rhodz=f_dtheta_rhodz(ind) 156 rhodz=f_rhodz(ind) 157 p=f_p(ind) 158 qu=f_qu(ind) 143 159 u=f_u(ind) 144 dps=f_dps(ind)145 dtheta_rhodz=f_dtheta_rhodz(ind)146 160 du=f_du(ind) 161 out_u=f_out_u(ind) 147 162 !$OMP PARALLEL DEFAULT(SHARED) 148 CALL compute_caldyn(p his, ps, theta_rhodz, u, dps, dtheta_rhodz, du)163 CALL compute_caldyn(ps, u, p,rhodz,qu, phis, theta_rhodz, dps, dtheta_rhodz, du) 149 164 !$OMP END PARALLEL 150 165 ENDDO … … 161 176 162 177 163 SUBROUTINE compute_caldyn(p his, ps, theta_rhodz, u, dps, dtheta_rhodz, du)178 SUBROUTINE compute_caldyn(ps, u, p,rhodz,qu, phis, theta_rhodz, dps, dtheta_rhodz, du) 164 179 USE icosa 165 180 USE disvert_mod 166 181 USE exner_mod 167 182 IMPLICIT NONE 168 REAL(rstd),INTENT(IN) :: phis(iim*jjm) 169 REAL(rstd),INTENT(IN) :: u(iim*3*jjm,llm) 170 REAL(rstd),INTENT(IN) :: theta_rhodz(iim*jjm,llm) 171 REAL(rstd),INTENT(IN) :: ps(iim*jjm) 183 REAL(rstd),INTENT(IN) :: phis(iim*jjm) 184 REAL(rstd),INTENT(IN) :: u(iim*3*jjm,llm) 185 REAL(rstd),INTENT(IN) :: theta_rhodz(iim*jjm,llm) 186 REAL(rstd),INTENT(IN) :: ps(iim*jjm) 187 188 REAL(rstd),INTENT(OUT) :: p(iim*jjm,llm+1) 189 REAL(rstd),INTENT(OUT) :: rhodz(iim*jjm,llm) 190 REAL(rstd),INTENT(OUT) :: qu(iim*3*jjm,llm) 191 172 192 REAL(rstd),INTENT(OUT) :: du(iim*3*jjm,llm) 173 REAL(rstd),INTENT(OUT) :: dtheta_rhodz(iim*jjm,llm)174 REAL(rstd),INTENT(OUT) :: dps(iim*jjm)193 REAL(rstd),INTENT(OUT) :: dtheta_rhodz(iim*jjm,llm) 194 REAL(rstd),INTENT(OUT) :: dps(iim*jjm) 175 195 176 196 INTEGER :: i,j,ij,l … … 180 200 181 201 REAL(rstd),ALLOCATABLE,SAVE :: theta(:,:) ! potential temperature 182 REAL(rstd),ALLOCATABLE,SAVE :: p(:,:) ! pression183 202 REAL(rstd),ALLOCATABLE,SAVE :: pk(:,:) ! Exner function 184 203 REAL(rstd),ALLOCATABLE,SAVE :: pks(:) 185 204 ! Intermediate variable to compute exner function 186 205 REAL(rstd),ALLOCATABLE,SAVE :: alpha(:,:) 187 206 REAL(rstd),ALLOCATABLE,SAVE :: beta(:,:) 188 !207 189 208 REAL(rstd),ALLOCATABLE,SAVE :: phi(:,:) ! geopotential 190 REAL(rstd),ALLOCATABLE,SAVE :: rhodz(:,:) ! mass density191 209 REAL(rstd),ALLOCATABLE,SAVE :: Fe(:,:) ! mass flux 192 210 REAL(rstd),ALLOCATABLE,SAVE :: Ftheta(:,:) ! theta flux … … 202 220 !$OMP MASTER 203 221 ! IF (first) THEN 204 ALLOCATE(theta(iim*jjm,llm)) ! potential temperature 205 ALLOCATE(p(iim*jjm,llm+1)) ! pression 206 ALLOCATE(pk(iim*jjm,llm)) ! Exner function 222 ALLOCATE(theta(iim*jjm,llm)) ! potential temperature 223 ALLOCATE(pk(iim*jjm,llm)) ! Exner function 207 224 ALLOCATE(pks(iim*jjm)) 208 225 ALLOCATE(alpha(iim*jjm,llm)) 209 226 ALLOCATE(beta(iim*jjm,llm)) 210 ALLOCATE(phi(iim*jjm,llm)) ! geopotential 211 ALLOCATE(rhodz(iim*jjm,llm)) ! mass density 212 ALLOCATE(Fe(3*iim*jjm,llm)) ! mass flux 227 ALLOCATE(phi(iim*jjm,llm)) ! geopotential 228 ALLOCATE(Fe(3*iim*jjm,llm)) ! mass flux 213 229 ALLOCATE(Ftheta(3*iim*jjm,llm)) ! theta flux 214 230 ALLOCATE(convm(iim*jjm,llm)) ! mass flux convergence 215 ALLOCATE(w(iim*jjm,llm)) ! vertical velocity216 ALLOCATE(qv(2*iim*jjm,llm)) 217 ALLOCATE(berni(iim*jjm,llm)) ! bernouilli term231 ALLOCATE(w(iim*jjm,llm)) ! vertical velocity 232 ALLOCATE(qv(2*iim*jjm,llm)) ! potential velocity 233 ALLOCATE(berni(iim*jjm,llm)) ! bernouilli term 218 234 ! first=.FALSE. 219 235 ! ENDIF … … 292 308 ENDDO 293 309 ENDDO 294 ENDDO 295 310 311 DO j=jj_begin,jj_end 312 DO i=ii_begin,ii_end 313 ij=(j-1)*iim+i 314 qu(ij+u_right,l) = 0.5*(qv(ij+z_rdown,l)+qv(ij+z_rup,l)) 315 qu(ij+u_lup,l) = 0.5*(qv(ij+z_up,l)+qv(ij+z_lup,l)) 316 qu(ij+u_ldown,l) = 0.5*(qv(ij+z_ldown,l)+qv(ij+z_down,l)) 317 END DO 318 END DO 319 320 ENDDO 321 322 !----------- needed next : rhodz, p --------------! 296 323 297 324 DO l = 1, llm … … 378 405 ij=(j-1)*iim+i 379 406 380 du(ij+u_right,l) = 0.5*(qv(ij+z_rdown,l)+qv(ij+z_rup,l))/de(ij+u_right) * &407 du(ij+u_right,l) = qu(ij+u_right,l)/de(ij+u_right) * & 381 408 ( wee(ij+u_right,1,1)*Fe(ij+u_rup,l)+ & 382 409 wee(ij+u_right,2,1)*Fe(ij+u_lup,l)+ & … … 391 418 392 419 393 du(ij+u_lup,l) = 0.5*(qv(ij+z_up,l)+qv(ij+z_lup,l))/de(ij+u_lup) * &420 du(ij+u_lup,l) = qu(ij+u_lup,l)/de(ij+u_lup) * & 394 421 ( wee(ij+u_lup,1,1)*Fe(ij+u_left,l)+ & 395 422 wee(ij+u_lup,2,1)*Fe(ij+u_ldown,l)+ & … … 404 431 405 432 406 du(ij+u_ldown,l) = 0.5*(qv(ij+z_ldown,l)+qv(ij+z_down,l))/de(ij+u_ldown) * &433 du(ij+u_ldown,l) = qu(ij+u_ldown,l)/de(ij+u_ldown) * & 407 434 ( wee(ij+u_ldown,1,1)*Fe(ij+u_rdown,l)+ & 408 435 wee(ij+u_ldown,2,1)*Fe(ij+u_right,l)+ & … … 536 563 !!$OMP MASTER 537 564 DEALLOCATE(theta) ! potential temperature 538 DEALLOCATE(p) ! pression539 565 DEALLOCATE(pk) ! Exner function 540 566 DEALLOCATE(pks) … … 542 568 DEALLOCATE(beta) 543 569 DEALLOCATE(phi) ! geopotential 544 ! DEALLOCATE(mass) ! mass545 DEALLOCATE(rhodz) ! mass density546 570 DEALLOCATE(Fe) ! mass flux 547 571 DEALLOCATE(Ftheta) ! theta flux
Note: See TracChangeset
for help on using the changeset viewer.