Changeset 295 for codes/icosagcm/trunk/src/theta_rhodz.f90
- Timestamp:
- 10/31/14 14:52:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/trunk/src/theta_rhodz.f90
r186 r295 1 1 MODULE theta2theta_rhodz_mod 2 USE field_mod 3 4 TYPE(t_field), POINTER, SAVE :: f_p(:) 5 TYPE(t_field), POINTER, SAVE :: f_pks(:) 6 TYPE(t_field), POINTER, SAVE :: f_pk(:) 7 8 PRIVATE :: f_p,f_pk,f_pks 2 9 3 10 CONTAINS 4 11 12 SUBROUTINE init_theta2theta_rhodz 13 USE icosa 14 USE field_mod 15 IMPLICIT NONE 16 CALL allocate_field(f_p,field_t,type_real,llm+1,name='p') 17 CALL allocate_field(f_pk,field_t,type_real,llm,name='pk') 18 CALL allocate_field(f_pks,field_t,type_real,name='pks') 19 20 END SUBROUTINE init_theta2theta_rhodz 21 22 23 5 24 SUBROUTINE theta_rhodz2theta(f_ps,f_theta_rhodz,f_theta) 6 25 USE icosa … … 15 34 INTEGER :: ind 16 35 36 !$OMP BARRIER 17 37 DO ind=1,ndomain 18 38 IF (.NOT. assigned_domain(ind)) CYCLE … … 24 44 CALL compute_theta_rhodz2theta(ps, theta_rhodz,theta,0) 25 45 ENDDO 46 !$OMP BARRIER 26 47 27 48 END SUBROUTINE theta_rhodz2theta … … 29 50 SUBROUTINE theta_rhodz2temperature(f_ps,f_theta_rhodz,f_temp) 30 51 USE icosa 52 USE pression_mod 53 USE exner_mod 31 54 IMPLICIT NONE 32 55 TYPE(t_field), POINTER :: f_ps(:) … … 37 60 REAL(rstd), POINTER :: theta_rhodz(:,:) 38 61 REAL(rstd), POINTER :: temp(:,:) 39 INTEGER :: ind 40 41 DO ind=1,ndomain 42 IF (.NOT. assigned_domain(ind)) CYCLE 43 CALL swap_dimensions(ind) 44 CALL swap_geometry(ind) 45 ps=f_ps(ind) 62 REAL(rstd), POINTER :: p(:) 63 REAL(rstd), POINTER :: pk(:,:) 64 REAL(rstd), POINTER :: pks(:,:) 65 INTEGER :: ind 66 67 DO ind=1,ndomain 68 IF (.NOT. assigned_domain(ind)) CYCLE 69 CALL swap_dimensions(ind) 70 CALL swap_geometry(ind) 71 ps=f_ps(ind) 72 p=f_p(ind) 73 pks=f_pks(ind) 74 pk=f_pk(ind) 46 75 theta_rhodz=f_theta_rhodz(ind) 47 76 temp=f_temp(ind) 48 CALL compute_theta_rhodz2temperature(ps, theta_rhodz,temp,0) 49 ENDDO 77 78 !$OMP BARRIER 79 CALL compute_pression(ps,p,0) 80 !$OMP BARRIER 81 CALL compute_exner(ps,p,pks,pk,0) 82 !$OMP BARRIER 83 CALL compute_theta_rhodz2temperature(p, pk, theta_rhodz,temp,0) 84 ENDDO 85 !$OMP BARRIER 50 86 51 87 END SUBROUTINE theta_rhodz2temperature 88 89 SUBROUTINE temperature2theta_rhodz(f_ps,f_temp,f_theta_rhodz) 90 USE icosa 91 USE pression_mod 92 USE exner_mod 93 IMPLICIT NONE 94 TYPE(t_field), POINTER :: f_ps(:) 95 TYPE(t_field), POINTER :: f_theta_rhodz(:) 96 TYPE(t_field), POINTER :: f_temp(:) 97 98 REAL(rstd), POINTER :: ps(:) 99 REAL(rstd), POINTER :: theta_rhodz(:,:) 100 REAL(rstd), POINTER :: temp(:,:) 101 REAL(rstd), POINTER :: p(:) 102 REAL(rstd), POINTER :: pk(:,:) 103 REAL(rstd), POINTER :: pks(:,:) 104 INTEGER :: ind 105 106 DO ind=1,ndomain 107 IF (.NOT. assigned_domain(ind)) CYCLE 108 CALL swap_dimensions(ind) 109 CALL swap_geometry(ind) 110 ps=f_ps(ind) 111 p=f_p(ind) 112 pks=f_pks(ind) 113 pk=f_pk(ind) 114 theta_rhodz=f_theta_rhodz(ind) 115 temp=f_temp(ind) 116 117 !$OMP BARRIER 118 CALL compute_pression(ps,p,0) 119 !$OMP BARRIER 120 CALL compute_exner(ps,p,pks,pk,0) 121 !$OMP BARRIER 122 CALL compute_temperature2theta_rhodz(p, pk, temp, theta_rhodz, 0) 123 ENDDO 124 !$OMP BARRIER 125 126 END SUBROUTINE temperature2theta_rhodz 127 128 52 129 53 130 SUBROUTINE theta2theta_rhodz(f_ps,f_theta,f_theta_rhodz) … … 63 140 INTEGER :: ind 64 141 142 !$OMP BARRIER 65 143 DO ind=1,ndomain 66 144 IF (.NOT. assigned_domain(ind)) CYCLE … … 72 150 CALL compute_theta2theta_rhodz(ps, theta, theta_rhodz,0) 73 151 ENDDO 152 !$OMP BARRIER 74 153 75 154 END SUBROUTINE theta2theta_rhodz … … 77 156 SUBROUTINE compute_theta2theta_rhodz(ps,theta, theta_rhodz,offset) 78 157 USE icosa 79 USE pression_mod 158 USE disvert_mod 159 USE omp_para 80 160 IMPLICIT NONE 81 161 REAL(rstd),INTENT(IN) :: ps(iim*jjm) … … 84 164 INTEGER,INTENT(IN) :: offset 85 165 INTEGER :: i,j,ij,l 86 REAL(rstd),ALLOCATABLE,SAVE :: p(:,:) 87 !$OMP THREADPRIVATE(p) 88 89 ALLOCATE( p(iim*jjm,llm+1)) 90 CALL compute_pression(ps,p,offset) 91 92 DO l = 1, llm 93 DO j=jj_begin-offset,jj_end+offset 94 DO i=ii_begin-offset,ii_end+offset 95 ij=(j-1)*iim+i 96 theta_rhodz(ij,l) = theta(ij,l) * (p(ij,l)-p(ij,l+1))/g 97 ENDDO 98 ENDDO 99 ENDDO 100 101 DEALLOCATE( p) 166 167 !$OMP BARRIER 168 DO l = ll_begin, ll_end 169 DO j=jj_begin-offset,jj_end+offset 170 DO i=ii_begin-offset,ii_end+offset 171 ij=(j-1)*iim+i 172 theta_rhodz(ij,l) = theta(ij,l) * ( (ap(l)-ap(l+1)) + ( bp(l)- bp(l+1))* ps(ij) )/g 173 ENDDO 174 ENDDO 175 ENDDO 176 !$OMP BARRIER 177 102 178 103 179 END SUBROUTINE compute_theta2theta_rhodz … … 105 181 SUBROUTINE compute_theta_rhodz2theta(ps,theta_rhodz,theta,offset) 106 182 USE icosa 107 USE pression_mod 183 USE disvert_mod 184 USE omp_para 108 185 IMPLICIT NONE 109 186 REAL(rstd),INTENT(IN) :: ps(iim*jjm) … … 112 189 INTEGER,INTENT(IN) :: offset 113 190 INTEGER :: i,j,ij,l 114 REAL(rstd),SAVE,ALLOCATABLE :: p(:,:) 115 !$OMP THREADPRIVATE(p) 116 117 ALLOCATE( p(iim*jjm,llm+1)) 118 119 CALL compute_pression(ps,p,offset) 120 121 DO l = 1, llm 122 DO j=jj_begin-offset,jj_end+offset 123 DO i=ii_begin-offset,ii_end+offset 124 ij=(j-1)*iim+i 125 theta(ij,l) = theta_rhodz(ij,l) / ((p(ij,l)-p(ij,l+1))/g) 126 ENDDO 127 ENDDO 128 ENDDO 129 130 DEALLOCATE( p) 191 192 !$OMP BARRIER 193 DO l = ll_begin, ll_end 194 DO j=jj_begin-offset,jj_end+offset 195 DO i=ii_begin-offset,ii_end+offset 196 ij=(j-1)*iim+i 197 theta(ij,l) = theta_rhodz(ij,l) / ( (ap(l)-ap(l+1)) + ( bp(l)- bp(l+1))* ps(ij) )/g 198 ENDDO 199 ENDDO 200 ENDDO 201 !$OMP BARRIER 202 131 203 132 204 END SUBROUTINE compute_theta_rhodz2theta 133 205 134 SUBROUTINE compute_theta_rhodz2temperature(ps,theta_rhodz,temp,offset) 135 USE icosa 136 USE pression_mod 137 USE exner_mod 138 IMPLICIT NONE 139 REAL(rstd),INTENT(IN) :: ps(iim*jjm) 206 207 208 209 210 211 SUBROUTINE compute_theta_rhodz2temperature(p,pk,theta_rhodz,temp,offset) 212 USE icosa 213 USE pression_mod 214 USE exner_mod 215 USE omp_para 216 IMPLICIT NONE 217 REAL(rstd),INTENT(IN) :: p(iim*jjm,llm+1) 218 REAL(rstd),INTENT(IN) :: pk(iim*jjm,llm) 140 219 REAL(rstd),INTENT(IN) :: theta_rhodz(iim*jjm,llm) 141 220 REAL(rstd),INTENT(OUT) :: temp(iim*jjm,llm) 142 221 INTEGER,INTENT(IN) :: offset 143 222 INTEGER :: i,j,ij,l 144 REAL(rstd) :: p(iim*jjm,llm+1)145 REAL(rstd) :: pk(iim*jjm,llm)146 REAL(rstd) :: pks(iim*jjm)147 148 CALL compute_pression(ps,p,offset)149 CALL compute_exner(ps,p,pks,pk,offset)150 223 151 DO l = 1, llm 224 ! flush p 225 !$OMP BARRIER 226 DO l = ll_begin, ll_end 152 227 DO j=jj_begin-offset,jj_end+offset 153 228 DO i=ii_begin-offset,ii_end+offset … … 157 232 ENDDO 158 233 ENDDO 234 !$OMP BARRIER 235 159 236 160 237 END SUBROUTINE compute_theta_rhodz2temperature 161 238 162 SUBROUTINE compute_temperature2theta_rhodz(ps,temp,theta_rhodz,offset) 163 USE icosa 164 USE pression_mod 165 USE exner_mod 166 IMPLICIT NONE 167 REAL(rstd),INTENT(IN) :: ps(iim*jjm) 239 SUBROUTINE compute_temperature2theta_rhodz(p,pk,temp,theta_rhodz,offset) 240 USE icosa 241 USE pression_mod 242 USE exner_mod 243 USE omp_para 244 IMPLICIT NONE 245 REAL(rstd),INTENT(IN) :: p(iim*jjm,llm+1) 246 REAL(rstd),INTENT(IN) :: pk(iim*jjm,llm) 168 247 REAL(rstd),INTENT(OUT) :: theta_rhodz(iim*jjm,llm) 169 REAL(rstd),INTENT(IN) :: temp(iim*jjm,llm) 170 INTEGER,INTENT(IN) :: offset 171 INTEGER :: i,j,ij,l 172 REAL(rstd) :: p(iim*jjm,llm+1) 173 REAL(rstd) :: pk(iim*jjm,llm) 174 REAL(rstd) :: pks(iim*jjm) 175 176 CALL compute_pression(ps,p,offset) 177 CALL compute_exner(ps,p,pks,pk,offset) 248 REAL(rstd),INTENT(IN) :: temp(iim*jjm,llm) 249 INTEGER,INTENT(IN) :: offset 250 INTEGER :: i,j,ij,l 251 178 252 179 DO l = 1, llm 253 ! flush p 254 !$OMP BARRIER 255 256 DO l = ll_begin, ll_end 180 257 DO j=jj_begin-offset,jj_end+offset 181 258 DO i=ii_begin-offset,ii_end+offset … … 185 262 ENDDO 186 263 ENDDO 264 !$OMP BARRIER 187 265 188 266 END SUBROUTINE compute_temperature2theta_rhodz
Note: See TracChangeset
for help on using the changeset viewer.