Changeset 953 for codes/icosagcm/trunk/src/time
- Timestamp:
- 07/15/19 12:29:31 (5 years ago)
- Location:
- codes/icosagcm/trunk/src/time
- Files:
-
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/trunk/src/time/euler_scheme.F90
r933 r953 1 1 MODULE euler_scheme_mod 2 2 USE field_mod 3 USE abort_mod 3 4 IMPLICIT NONE 4 5 PRIVATE … … 45 46 46 47 IF(with_dps) THEN ! update ps/mass 48 CALL abort_acc("Euler_scheme/with_dps") 47 49 IF(caldyn_eta==eta_mass) THEN ! update ps 48 50 ps=f_ps(ind) ; dps=f_dps(ind) ; … … 71 73 du=f_du(ind) ; dtheta_rhodz=f_dtheta_rhodz(ind) 72 74 73 DO l=ll_begin,ll_end 75 CALL compute_euler_scheme(u, du, theta_rhodz, dtheta_rhodz) 76 ENDDO 77 78 CALL trace_end("Euler_scheme") 79 80 CONTAINS 81 82 SUBROUTINE compute_euler_scheme(u, du, theta_rhodz, dtheta_rhodz) 83 REAL(rstd),INTENT(INOUT) :: u(iim*3*jjm,llm) 84 REAL(rstd),INTENT(IN) :: du(iim*3*jjm,llm) 85 REAL(rstd),INTENT(INOUT) :: theta_rhodz(iim*jjm,llm,nqdyn) 86 REAL(rstd),INTENT(IN) :: dtheta_rhodz(iim*jjm,llm,nqdyn) 87 88 !$acc data present(theta_rhodz(:,:,:), u(:,:),du(:,:), dtheta_rhodz(:,:,:)) async 89 90 !$acc parallel loop async 91 DO l=ll_begin,ll_end 92 !$acc loop 74 93 !DIR$ SIMD 75 94 DO ij=ij_begin,ij_end … … 80 99 ENDDO 81 100 ENDDO 82 ENDDO83 84 CALL trace_end("Euler_scheme")101 102 !$acc end data 103 END SUBROUTINE compute_euler_scheme 85 104 86 105 END SUBROUTINE Euler_scheme … … 97 116 INTEGER :: l,ij 98 117 118 !$acc data present(hflux(:,:), wflux(:,:), hfluxt(:,:), wfluxt(:,:)) async 119 99 120 IF(fluxt_zero) THEN 100 121 101 122 fluxt_zero=.FALSE. 102 103 DO l=ll_begin,ll_end 123 !$acc parallel loop async 124 DO l=ll_begin,ll_end 125 !$acc loop 104 126 !DIR$ SIMD 105 127 DO ij=ij_begin_ext,ij_end_ext … … 111 133 112 134 IF(caldyn_eta==eta_mass) THEN ! no need for vertical fluxes if eta_lag 135 !$acc parallel loop async 113 136 DO l=ll_begin,ll_endp1 137 !$acc loop 114 138 !DIR$ SIMD 115 139 DO ij=ij_begin,ij_end … … 120 144 121 145 ELSE 122 123 DO l=ll_begin,ll_end 146 !$acc parallel loop async 147 DO l=ll_begin,ll_end 148 !$acc loop 124 149 !DIR$ SIMD 125 150 DO ij=ij_begin_ext,ij_end_ext … … 131 156 132 157 IF(caldyn_eta==eta_mass) THEN ! no need for vertical fluxes if eta_lag 158 !$acc parallel loop async 133 159 DO l=ll_begin,ll_endp1 160 !$acc loop 134 161 !DIR$ SIMD 135 162 DO ij=ij_begin,ij_end … … 138 165 ENDDO 139 166 END IF 140 141 167 END IF 142 168 !$acc end data 143 169 END SUBROUTINE accumulate_fluxes 144 170 145 171 SUBROUTINE legacy_to_DEC(f_ps, f_u) 172 USE icosa 173 USE disvert_mod 174 USE omp_para 175 USE trace 176 TYPE(t_field),POINTER :: f_ps(:), f_u(:) 177 REAL(rstd), POINTER :: ps(:), u(:,:) 178 INTEGER :: ind,ij,l 179 180 CALL trace_start("legacy_to_DEC") 181 182 DO ind=1,ndomain 183 IF (.NOT. assigned_domain(ind)) CYCLE 184 CALL swap_dimensions(ind) 185 CALL swap_geometry(ind) 186 187 IF(caldyn_eta==eta_mass .AND. is_omp_first_level) THEN ! update ps 188 ps=f_ps(ind) 189 !$acc parallel loop async default(present) 190 !DIR$ SIMD 191 DO ij=ij_begin,ij_end 192 ps(ij)=(ps(ij)-ptop)/g ! convert ps to column-integrated mass 193 ENDDO 194 END IF 195 196 u=f_u(ind) 197 !$acc parallel loop async default(present) 198 DO l=ll_begin,ll_end 199 !$acc loop 200 !DIR$ SIMD 201 DO ij=ij_begin,ij_end 202 u(ij+u_right,l)=u(ij+u_right,l)*de(ij+u_right) 203 u(ij+u_lup,l)=u(ij+u_lup,l)*de(ij+u_lup) 204 u(ij+u_ldown,l)=u(ij+u_ldown,l)*de(ij+u_ldown) 205 ENDDO 206 ENDDO 207 ENDDO 208 209 CALL trace_end("legacy_to_DEC") 210 211 END SUBROUTINE Legacy_to_DEC 212 213 SUBROUTINE DEC_to_legacy(f_ps, f_u) 146 214 USE icosa 147 215 USE disvert_mod … … 158 226 CALL swap_geometry(ind) 159 227 160 IF(caldyn_eta==eta_mass .AND. is_omp_first_level) THEN ! update ps161 ps=f_ps(ind)162 !DIR$ SIMD163 DO ij=ij_begin,ij_end164 ps(ij)=(ps(ij)-ptop)/g ! convert ps to column-integrated mass165 ENDDO166 END IF167 168 u=f_u(ind)169 DO l=ll_begin,ll_end170 !DIR$ SIMD171 DO ij=ij_begin,ij_end172 u(ij+u_right,l)=u(ij+u_right,l)*de(ij+u_right)173 u(ij+u_lup,l)=u(ij+u_lup,l)*de(ij+u_lup)174 u(ij+u_ldown,l)=u(ij+u_ldown,l)*de(ij+u_ldown)175 ENDDO176 ENDDO177 ENDDO178 179 CALL trace_end("legacy_to_DEC")180 END SUBROUTINE Legacy_to_DEC181 182 SUBROUTINE DEC_to_legacy(f_ps, f_u)183 USE icosa184 USE disvert_mod185 USE omp_para186 USE trace187 TYPE(t_field),POINTER :: f_ps(:), f_u(:)188 REAL(rstd), POINTER :: ps(:), u(:,:)189 INTEGER :: ind,ij,l190 CALL trace_start("legacy_to_DEC")191 192 DO ind=1,ndomain193 IF (.NOT. assigned_domain(ind)) CYCLE194 CALL swap_dimensions(ind)195 CALL swap_geometry(ind)196 197 228 IF(caldyn_eta==eta_mass .AND. is_omp_first_level) THEN 198 229 ps=f_ps(ind) 230 !$acc parallel loop async default(present) 199 231 !DIR$ SIMD 200 232 DO ij=ij_begin,ij_end … … 204 236 205 237 u=f_u(ind) 206 DO l=ll_begin,ll_end 238 !$acc parallel loop async default(present) 239 DO l=ll_begin,ll_end 240 !$acc loop 207 241 !DIR$ SIMD 208 242 DO ij=ij_begin,ij_end -
codes/icosagcm/trunk/src/time/hevi_scheme.F90
r933 r953 4 4 USE field_mod 5 5 USE euler_scheme_mod 6 USE abort_mod 6 7 IMPLICIT NONE 7 8 PRIVATE … … 13 14 14 15 CONTAINS 15 16 16 SUBROUTINE set_coefs_ark23(dt) 17 17 ! ARK2 scheme by Giraldo, Kelly, Constantinescu 2013 … … 60 60 61 61 CALL legacy_to_DEC(f_ps, f_u) 62 62 63 DO j=1,nb_stage 63 64 CALL caldyn_hevi((j==1) .AND. (MOD(it,itau_out)==0), taujj(j), & … … 76 77 wflux=f_wflux(ind); wfluxt=f_wfluxt(ind) 77 78 CALL accumulate_fluxes(hflux,wflux, hfluxt,wfluxt, wj(j), fluxt_zero(ind)) 79 78 80 END DO 79 81 ! update model state … … 88 90 CALL update_3D(cjl(l,j), f_u, f_du_fast(:,l)) 89 91 IF(.NOT. hydrostatic) THEN 92 CALL abort_acc("HEVI_scheme/!hydrostatic") 90 93 CALL update_3D(bjl(l,j), f_W, f_dW_slow(:,l)) 91 94 CALL update_3D(cjl(l,j), f_W, f_dW_fast(:,l)) … … 93 96 CALL update_3D(cjl(l,j), f_geopot, f_dPhi_fast(:,l)) 94 97 END IF 98 95 99 !$OMP BARRIER 96 100 END DO … … 142 146 INTENT(IN) :: dy 143 147 INTEGER :: l 148 !$acc kernels async default(present) 144 149 DO l=ll_begin,ll_end 145 150 y(:,l)=y(:,l)+w*dy(:,l) 146 151 ENDDO 152 !$acc end kernels 147 153 END SUBROUTINE compute_update_3D 148 154 … … 164 170 INTENT(INOUT) :: y 165 171 INTENT(IN) :: dy 172 !$acc kernels async default(present) 166 173 y(:)=y(:)+w*dy(:) 174 !$acc end kernels 167 175 END SUBROUTINE compute_update_2D 168 176 -
codes/icosagcm/trunk/src/time/timeloop_gcm.F90
r933 r953 94 94 END SELECT 95 95 96 IF (scheme_family /= hevi) THEN 97 CALL abort_acc("scheme_family /= hevi") 98 END IF 99 96 100 ! Time-independant orography 97 101 CALL allocate_field(f_phis,field_t,type_real,name='phis') … … 103 107 CALL allocate_field(f_u,field_u,type_real,llm,name='u') 104 108 CALL allocate_field(f_geopot,field_t,type_real,llm+1,name='geopot') 105 CALL allocate_field(f_W,field_t,type_real,llm+1,name='W') 109 CALL allocate_field(f_W,field_t,type_real,llm+1,name='W') ! used only if .not. hydrostatic 106 110 CALL allocate_field(f_q,field_t,type_real,llm,nqtot,'q') 107 111 ! Mass fluxes 108 CALL allocate_field(f_hflux,field_u,type_real,llm ) ! instantaneous mass fluxes109 CALL allocate_field(f_hfluxt,field_u,type_real,llm ) ! mass "fluxes" accumulated in time112 CALL allocate_field(f_hflux,field_u,type_real,llm, ondevice=.TRUE.) ! instantaneous mass fluxes 113 CALL allocate_field(f_hfluxt,field_u,type_real,llm,ondevice=.TRUE.) ! mass "fluxes" accumulated in time 110 114 CALL allocate_field(f_wflux,field_t,type_real,llm+1) ! vertical mass fluxes 111 CALL allocate_field(f_wfluxt,field_t,type_real,llm+1,name='wfluxt' )115 CALL allocate_field(f_wfluxt,field_t,type_real,llm+1,name='wfluxt',ondevice=.TRUE.) 112 116 113 117 SELECT CASE(scheme_family) … … 125 129 CASE(hevi) 126 130 ! Trends 127 CALL allocate_fields(nb_stage,f_dps_slow, field_t,type_real,name='dps_slow' )128 CALL allocate_fields(nb_stage,f_dmass_slow, field_t,type_real,llm, name='dmass_slow' )129 CALL allocate_fields(nb_stage,f_dtheta_rhodz_slow, field_t,type_real,llm,nqdyn,name='dtheta_rhodz_fast' )130 CALL allocate_fields(nb_stage,f_du_slow, field_u,type_real,llm,name='du_slow' )131 CALL allocate_fields(nb_stage,f_du_fast, field_u,type_real,llm,name='du_fast' )131 CALL allocate_fields(nb_stage,f_dps_slow, field_t,type_real,name='dps_slow', ondevice=.TRUE.) 132 CALL allocate_fields(nb_stage,f_dmass_slow, field_t,type_real,llm, name='dmass_slow', ondevice=.TRUE.) 133 CALL allocate_fields(nb_stage,f_dtheta_rhodz_slow, field_t,type_real,llm,nqdyn,name='dtheta_rhodz_fast', ondevice=.TRUE.) 134 CALL allocate_fields(nb_stage,f_du_slow, field_u,type_real,llm,name='du_slow', ondevice=.TRUE.) 135 CALL allocate_fields(nb_stage,f_du_fast, field_u,type_real,llm,name='du_fast', ondevice=.TRUE.) 132 136 CALL allocate_fields(nb_stage,f_dW_slow, field_t,type_real,llm+1,name='dW_slow') 133 137 CALL allocate_fields(nb_stage,f_dW_fast, field_t,type_real,llm+1,name='dW_fast') … … 172 176 173 177 SUBROUTINE timeloop 178 USE abort_mod 174 179 USE dissip_gcm_mod 175 180 USE sponge_mod … … 211 216 rhodz=f_rhodz(ind); mass=f_mass(ind); ps=f_ps(ind) 212 217 IF(caldyn_eta==eta_mass) THEN 213 CALL compute_rhodz(.TRUE., ps, rhodz ) ! save rhodz for transport scheme before dynamics update ps218 CALL compute_rhodz(.TRUE., ps, rhodz, ondevice=.FALSE.) ! save rhodz for transport scheme before dynamics update ps 214 219 ELSE 215 220 DO l=ll_begin,ll_end … … 244 249 CALL SYSTEM_CLOCK(start_clock, rate_clock) 245 250 !$OMP END MASTER 251 call update_device_field(f_ps) 252 call update_device_field(f_mass) 253 CALL update_device_field(f_theta_rhodz) 254 CALL update_device_field(f_u) 255 CALL update_device_field(f_q) 256 CALL update_device_field(f_geopot) 257 CALL update_device_field(f_wflux) 258 CALL update_device_field(f_rhodz) 259 246 260 247 261 DO it=itau0+1,itau0+itaumax … … 263 277 CALL wait_message(req_mass0) 264 278 CALL send_message(f_theta_rhodz,req_theta_rhodz0) 265 CALL wait_message(req_theta_rhodz0) 279 CALL wait_message(req_theta_rhodz0) 266 280 CALL send_message(f_u,req_u0) 267 281 CALL wait_message(req_u0) … … 281 295 SELECT CASE(scheme_family) 282 296 CASE(explicit) 297 CALL abort_acc("explicit_scheme") 283 298 CALL explicit_scheme(it, fluxt_zero) 284 299 CASE(hevi) … … 298 313 CALL swap_geometry(ind) 299 314 mass=f_mass(ind); ps=f_ps(ind); 300 CALL compute_rhodz(.TRUE., ps, mass )315 CALL compute_rhodz(.TRUE., ps, mass, ondevice=.TRUE.) 301 316 END DO 302 317 ENDIF … … 311 326 CALL euler_scheme(.FALSE.) ! update only u, theta 312 327 IF (iflag_sponge > 0) THEN 328 CALL abort_acc("iflag_sponge>0") 313 329 CALL sponge(f_u,f_du,f_theta_rhodz,f_dtheta_rhodz) 314 330 CALL euler_scheme(.FALSE.) ! update only u, theta … … 321 337 END IF 322 338 CALL exit_profile(id_dissip) 323 339 324 340 CALL enter_profile(id_adv) 325 341 IF(MOD(it,itau_adv)==0) THEN … … 329 345 ! At this point advect_tracer has obtained the halos of u and rhodz, 330 346 ! needed for correct computation of kinetic energy 347 IF(diagflux_on) CALL abort_acc("diagflux_on") 331 348 IF(diagflux_on) CALL diagflux_energy(adv_over_out, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta,f_buf_i, f_hfluxt) 332 349 … … 340 357 END DO 341 358 ENDIF 359 IF(positive_theta) CALL abort_acc("positive_theta") 342 360 IF(positive_theta) CALL copy_q_to_theta(f_theta_rhodz,f_rhodz,f_q) 343 361 END IF 344 362 CALL exit_profile(id_adv) 345 363 346 364 CALL enter_profile(id_diags) 347 365 ! IF (MOD(it,itau_physics)==0) THEN … … 360 378 361 379 IF (MOD(it,itau_check_conserv)==0) THEN 380 CALL update_host_field(f_ps) 381 CALL update_host_field(f_theta_rhodz) 382 CALL update_host_field(f_u) 383 CALL update_host_field(f_dps) 384 CALL update_host_field(f_q) 362 385 CALL check_conserve_detailed(it, AAM_dyn, & 363 386 f_ps,f_dps,f_u,f_theta_rhodz,f_phis) … … 367 390 IF (mod(it,itau_out)==0 ) THEN 368 391 CALL transfert_request(f_u,req_e1_vect) 392 CALL update_host_field(f_ps) 393 CALL update_host_field(f_mass) 394 CALL update_host_field(f_theta_rhodz) 395 CALL update_host_field(f_geopot) 396 CALL update_host_field(f_u) 397 CALL update_host_field(f_q) 369 398 CALL write_output_fields_basic(.FALSE.,f_phis, f_ps, f_mass, f_geopot, f_theta_rhodz, f_u, f_W, f_q) 370 399 ENDIF … … 374 403 END DO 375 404 405 CALL update_host_field(f_ps) 406 CALL update_host_field(f_theta_rhodz) 407 CALL update_host_field(f_u) 408 CALL update_host_field(f_q) 409 CALL update_host_field(f_geopot) 410 376 411 ! CALL write_etat0(itau0+itaumax,f_ps, f_phis,f_theta_rhodz,f_u,f_q) 377 412 CALL write_etat0(itau0+itaumax,f_ps, f_phis,f_theta_rhodz,f_u,f_q, f_geopot, f_W) 378 413 414 CALL update_host_field(f_dps) 379 415 CALL check_conserve_detailed(it, AAM_dyn, & 380 416 f_ps,f_dps,f_u,f_theta_rhodz,f_phis)
Note: See TracChangeset
for help on using the changeset viewer.