Changeset 555 for codes/icosagcm/trunk/src
- Timestamp:
- 09/18/17 17:03:05 (7 years ago)
- Location:
- codes/icosagcm/trunk/src/dynamics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/trunk/src/dynamics/caldyn_kernels_base.F90
r548 r555 35 35 36 36 INTEGER :: i,j,ij,l 37 REAL(rstd) :: Rd, p_ik, exner_ik, temp_ik, qv, chi, Rmix 37 REAL(rstd) :: Rd, p_ik, exner_ik, temp_ik, qv, chi, Rmix, gv 38 38 INTEGER :: ij_omp_begin_ext, ij_omp_end_ext 39 39 … … 47 47 48 48 Rd = kappa*cpp 49 50 #ifdef CPP_DYSL 51 !#if 0 52 #include "../kernels/compute_geopot.k90" 53 #else 49 54 50 55 ! Pressure is computed first top-down (temporarily stored in pk) … … 158 163 END IF 159 164 165 #endif 166 160 167 !ym flush geopot 161 168 !$OMP BARRIER … … 297 304 REAL(rstd),INTENT(INOUT) :: dW(iim*jjm,llm+1) 298 305 ! local arrays 299 REAL(rstd) :: eta_dot(iim*jjm ) ! eta_dot in full layers300 REAL(rstd) :: wcov(iim*jjm ) ! covariant vertical momentum in full layers306 REAL(rstd) :: eta_dot(iim*jjm, llm) ! eta_dot in full layers 307 REAL(rstd) :: wcov(iim*jjm,llm) ! covariant vertical momentum in full layers 301 308 REAL(rstd) :: W_etadot(iim*jjm,llm) ! vertical flux of vertical momentum 302 309 ! indices and temporary values … … 306 313 CALL trace_start("compute_caldyn_vert_nh") 307 314 315 #ifdef CPP_DYSL 316 !#if 0 317 #include "../kernels/caldyn_vert_NH.k90" 318 #else 319 #define ETA_DOT(ij) eta_dot(ij,1) 320 #define WCOV(ij) wcov(ij,1) 321 308 322 DO l=ll_begin,ll_end 309 323 ! compute the local arrays … … 313 327 w_ij = .5*(W(ij,l)+W(ij,l+1))/mass(ij,l) 314 328 W_etadot(ij,l) = wflux_ij*w_ij 315 eta_dot(ij) = wflux_ij / mass(ij,l)316 wcov(ij) = w_ij*(geopot(ij,l+1)-geopot(ij,l))329 ETA_DOT(ij) = wflux_ij / mass(ij,l) 330 WCOV(ij) = w_ij*(geopot(ij,l+1)-geopot(ij,l)) 317 331 ENDDO 318 332 ! add NH term to du … … 320 334 DO ij=ij_begin,ij_end 321 335 du(ij+u_right,l) = du(ij+u_right,l) & 322 - .5*( wcov(ij+t_right)+wcov(ij)) &323 *ne_right*( eta_dot(ij+t_right)-eta_dot(ij))336 - .5*(WCOV(ij+t_right)+WCOV(ij)) & 337 *ne_right*(ETA_DOT(ij+t_right)-ETA_DOT(ij)) 324 338 du(ij+u_lup,l) = du(ij+u_lup,l) & 325 - .5*( wcov(ij+t_lup)+wcov(ij)) &326 *ne_lup*( eta_dot(ij+t_lup)-eta_dot(ij))339 - .5*(WCOV(ij+t_lup)+WCOV(ij)) & 340 *ne_lup*(ETA_DOT(ij+t_lup)-ETA_DOT(ij)) 327 341 du(ij+u_ldown,l) = du(ij+u_ldown,l) & 328 - .5*( wcov(ij+t_ldown)+wcov(ij)) &329 *ne_ldown*( eta_dot(ij+t_ldown)-eta_dot(ij))342 - .5*(WCOV(ij+t_ldown)+WCOV(ij)) & 343 *ne_ldown*(ETA_DOT(ij+t_ldown)-ETA_DOT(ij)) 330 344 END DO 331 345 ENDDO … … 346 360 END DO 347 361 END DO 362 363 #undef ETA_DOT 364 #undef WCOV 365 #endif 366 348 367 CALL trace_end("compute_caldyn_vert_nh") 349 368 -
codes/icosagcm/trunk/src/dynamics/caldyn_kernels_hevi.F90
r548 r555 11 11 REAL(rstd), PARAMETER :: pbot=1e5, Phi_bot=0., rho_bot=1e6 ! FIXME 12 12 13 LOGICAL, PARAMETER :: debug_hevi_solver = .FALSE. 13 LOGICAL, SAVE :: debug_hevi_solver = .FALSE. 14 LOGICAL, PARAMETER :: rigid=.TRUE. 14 15 15 16 PUBLIC :: compute_theta, compute_pvort_only, compute_caldyn_Coriolis, & … … 61 62 CALL trace_start("compute_pvort_only") 62 63 !!! Compute shallow-water potential vorticity 64 #ifdef CPP_DYSL 65 #include "../kernels/pvort_only.k90" 66 #else 63 67 radius_m2=radius**(-2) 64 68 DO l = ll_begin,ll_end … … 90 94 91 95 ENDDO 92 96 #endif 93 97 CALL trace_end("compute_pvort_only") 94 98 … … 114 118 REAL(rstd) :: wil, tau2_g, g2, gm2, ml_g2, c2_mik 115 119 116 INTEGER :: iter, ij, l 120 INTEGER :: iter, ij, l, ij_omp_begin_ext, ij_omp_end_ext 121 122 CALL distrib_level(ij_end_ext-ij_begin_ext+1,ij_omp_begin_ext,ij_omp_end_ext) 123 ij_omp_begin_ext=ij_omp_begin_ext+ij_begin_ext-1 124 ij_omp_end_ext=ij_omp_end_ext+ij_begin_ext-1 125 126 #ifdef CPP_DYSL 127 !#if 0 128 #include "../kernels/compute_NH_geopot.k90" 129 #else 117 130 118 131 ! FIXME : vertical OpenMP parallelism will not work … … 248 261 249 262 END DO ! Newton-Raphson 263 264 #endif 250 265 251 266 END SUBROUTINE compute_NH_geopot … … 254 269 REAL(rstd),INTENT(IN) :: tau ! "solve" Phi-tau*dPhi/dt = Phi_rhs 255 270 REAL(rstd),INTENT(IN) :: rhodz(iim*jjm,llm) 256 REAL(rstd),INTENT(IN) :: theta(iim*jjm,llm )271 REAL(rstd),INTENT(IN) :: theta(iim*jjm,llm,nqdyn) 257 272 REAL(rstd),INTENT(OUT) :: pk(iim*jjm,llm) 258 273 REAL(rstd),INTENT(INOUT) :: geopot(iim*jjm,llm+1) … … 263 278 264 279 REAL(rstd) :: m_il(iim*jjm,llm+1) ! rhodz averaged to interfaces 265 REAL(rstd) :: berni(iim*jjm) ! (W/m_il)^2 266 REAL(rstd) :: gamma, rho_ij, X_ij, Y_ij 280 REAL(rstd) :: pres(iim*jjm,llm) ! pressure 281 REAL(rstd) :: berni(iim*jjm,llm) ! (W/m_il)^2 282 REAL(rstd) :: gamma, rho_ij, T_ij, X_ij, Y_ij, vreff, Rd, Cvd 267 283 INTEGER :: ij, l 268 284 269 285 CALL trace_start("compute_caldyn_solver") 270 286 287 Rd=cpp*kappa 288 289 #ifdef CPP_DYSL 290 !#if 0 291 #include "../kernels/caldyn_solver.k90" 292 #else 293 #define BERNI(ij) berni(ij,1) 271 294 ! FIXME : vertical OpenMP parallelism will not work 272 295 … … 300 323 DO ij=ij_begin_ext,ij_end_ext 301 324 rho_ij = (g*rhodz(ij,l))/(geopot(ij,l+1)-geopot(ij,l)) 302 X_ij = (cpp/preff)*kappa*theta(ij,l )*rho_ij325 X_ij = (cpp/preff)*kappa*theta(ij,l,1)*rho_ij 303 326 ! kappa.theta.rho = p/exner 304 327 ! => X = (p/p0)/(exner/Cp) … … 339 362 DO ij=ij_begin_ext,ij_end_ext 340 363 pk(ij,l) = cpp*((pk(ij,l)/preff)**kappa) ! other formulae possible if exponentiation is slow 341 berni(ij) = (-.25*g*g)*( &364 BERNI(ij) = (-.25*g*g)*( & 342 365 (W(ij,l)/m_il(ij,l))**2 & 343 366 + (W(ij,l+1)/m_il(ij,l+1))**2 ) 344 367 ENDDO 345 368 DO ij=ij_begin,ij_end 346 du(ij+u_right,l) = ne_right*( berni(ij)-berni(ij+t_right))347 du(ij+u_lup,l) = ne_lup *( berni(ij)-berni(ij+t_lup))348 du(ij+u_ldown,l) = ne_ldown*( berni(ij)-berni(ij+t_ldown))369 du(ij+u_right,l) = ne_right*(BERNI(ij)-BERNI(ij+t_right)) 370 du(ij+u_lup,l) = ne_lup *(BERNI(ij)-BERNI(ij+t_lup)) 371 du(ij+u_ldown,l) = ne_ldown*(BERNI(ij)-BERNI(ij+t_ldown)) 349 372 ENDDO 350 373 ENDDO 351 374 #undef BERNI 375 #endif 376 352 377 CALL trace_end("compute_caldyn_solver") 353 378 … … 366 391 367 392 INTEGER :: i,j,ij,l 368 REAL(rstd) :: Rd, qv, temp, chi, nu, due _right, due_lup, due_ldown393 REAL(rstd) :: Rd, qv, temp, chi, nu, due, due_right, due_lup, due_ldown 369 394 370 395 CALL trace_start("compute_caldyn_fast") … … 372 397 Rd=cpp*kappa 373 398 399 #ifdef CPP_DYSL 400 #include "../kernels/caldyn_fast.k90" 401 #else 374 402 ! Compute Bernoulli term 375 403 IF(boussinesq) THEN … … 469 497 END IF 470 498 END DO 471 499 #endif 472 500 CALL trace_end("compute_caldyn_fast") 473 501 … … 482 510 REAL(rstd),INTENT(INOUT) :: du(3*iim*jjm,llm) 483 511 484 REAL(rstd) :: Ftheta(3*iim*jjm ) ! potential temperature flux485 REAL(rstd) :: uu_right, uu_lup, uu_ldown 512 REAL(rstd) :: Ftheta(3*iim*jjm,llm) ! potential temperature flux 513 REAL(rstd) :: uu_right, uu_lup, uu_ldown, du_trisk, divF 486 514 INTEGER :: ij,iq,l,kdown 487 515 488 516 CALL trace_start("compute_caldyn_Coriolis") 517 518 #ifdef CPP_DYSL 519 !#if 0 520 #include "../kernels/coriolis.k90" 521 #else 522 #define FTHETA(ij) Ftheta(ij,1) 489 523 490 524 DO l=ll_begin, ll_end … … 493 527 !DIR$ SIMD 494 528 DO ij=ij_begin_ext,ij_end_ext 495 F theta(ij+u_right) = 0.5*(theta(ij,l,iq)+theta(ij+t_right,l,iq)) &529 FTHETA(ij+u_right) = 0.5*(theta(ij,l,iq)+theta(ij+t_right,l,iq)) & 496 530 * hflux(ij+u_right,l) 497 F theta(ij+u_lup) = 0.5*(theta(ij,l,iq)+theta(ij+t_lup,l,iq)) &531 FTHETA(ij+u_lup) = 0.5*(theta(ij,l,iq)+theta(ij+t_lup,l,iq)) & 498 532 * hflux(ij+u_lup,l) 499 F theta(ij+u_ldown) = 0.5*(theta(ij,l,iq)+theta(ij+t_ldown,l,iq)) &533 FTHETA(ij+u_ldown) = 0.5*(theta(ij,l,iq)+theta(ij+t_ldown,l,iq)) & 500 534 * hflux(ij+u_ldown,l) 501 535 END DO … … 505 539 ! dtheta_rhodz = -div(flux.theta) 506 540 dtheta_rhodz(ij,l,iq)= & 507 -1./Ai(ij)*(ne_right*F theta(ij+u_right) + &508 ne_rup*F theta(ij+u_rup) + &509 ne_lup*F theta(ij+u_lup) + &510 ne_left*F theta(ij+u_left) + &511 ne_ldown*F theta(ij+u_ldown) + &512 ne_rdown*F theta(ij+u_rdown) )541 -1./Ai(ij)*(ne_right*FTHETA(ij+u_right) + & 542 ne_rup*FTHETA(ij+u_rup) + & 543 ne_lup*FTHETA(ij+u_lup) + & 544 ne_left*FTHETA(ij+u_left) + & 545 ne_ldown*FTHETA(ij+u_ldown) + & 546 ne_rdown*FTHETA(ij+u_rdown) ) 513 547 END DO 514 548 END DO … … 620 654 STOP 621 655 END SELECT 656 #undef FTHETA 657 #endif 622 658 623 659 CALL trace_end("compute_caldyn_Coriolis") … … 632 668 REAL(rstd),INTENT(INOUT) :: du(3*iim*jjm,llm) 633 669 634 REAL(rstd) :: berni(iim*jjm ) ! Bernoulli function635 REAL(rstd) :: uu_right, uu_lup, uu_ldown 670 REAL(rstd) :: berni(iim*jjm,llm) ! Bernoulli function 671 REAL(rstd) :: uu_right, uu_lup, uu_ldown, ke, uu 636 672 INTEGER :: ij,l 637 673 638 674 CALL trace_start("compute_caldyn_slow_hydro") 639 675 640 le_de(:) = le(:)/de(:) ! FIXME - make sure le_de is what we expect 676 #ifdef CPP_DYSL 677 !#if 0 678 #define BERNI(ij,l) berni(ij,l) 679 #include "../kernels/caldyn_slow_hydro.k90" 680 #undef BERNI 681 #else 682 #define BERNI(ij) berni(ij,1) 641 683 642 684 DO l = ll_begin, ll_end … … 658 700 !DIR$ SIMD 659 701 DO ij=ij_begin,ij_end 660 berni(ij) = &702 BERNI(ij) = & 661 703 1/(4*Ai(ij))*(le_de(ij+u_right)*u(ij+u_right,l)**2 + & 662 704 le_de(ij+u_rup)*u(ij+u_rup,l)**2 + & … … 670 712 !DIR$ SIMD 671 713 DO ij=ij_begin,ij_end 672 du(ij+u_right,l) = ne_right*( berni(ij)-berni(ij+t_right))673 du(ij+u_lup,l) = ne_lup*( berni(ij)-berni(ij+t_lup))674 du(ij+u_ldown,l) = ne_ldown*( berni(ij)-berni(ij+t_ldown))714 du(ij+u_right,l) = ne_right*(BERNI(ij)-BERNI(ij+t_right)) 715 du(ij+u_lup,l) = ne_lup*(BERNI(ij)-BERNI(ij+t_lup)) 716 du(ij+u_ldown,l) = ne_ldown*(BERNI(ij)-BERNI(ij+t_ldown)) 675 717 END DO 676 718 ELSE … … 678 720 DO ij=ij_begin,ij_end 679 721 du(ij+u_right,l) = du(ij+u_right,l) + & 680 ne_right*( berni(ij)-berni(ij+t_right))722 ne_right*(BERNI(ij)-BERNI(ij+t_right)) 681 723 du(ij+u_lup,l) = du(ij+u_lup,l) + & 682 ne_lup*( berni(ij)-berni(ij+t_lup))724 ne_lup*(BERNI(ij)-BERNI(ij+t_lup)) 683 725 du(ij+u_ldown,l) = du(ij+u_ldown,l) + & 684 ne_ldown*( berni(ij)-berni(ij+t_ldown))726 ne_ldown*(BERNI(ij)-BERNI(ij+t_ldown)) 685 727 END DO 686 728 END IF 687 729 END DO 688 730 #undef BERNI 731 #endif 689 732 CALL trace_end("compute_caldyn_slow_hydro") 690 733 END SUBROUTINE compute_caldyn_slow_hydro … … 705 748 REAL(rstd) :: GradPhi2(3*iim*jjm,llm+1) ! grad_Phi**2 706 749 REAL(rstd) :: DePhil(3*iim*jjm,llm+1) ! grad(Phi) 750 751 INTEGER :: ij,l,kdown,kup 752 REAL(rstd) :: W_el, W2_el, uu_right, uu_lup, uu_ldown, gPhi2, dP, divG, u2, uu 753 754 #ifdef CPP_DYSL 755 REAL(rstd) :: berni(iim*jjm,llm) ! Bernoulli function 756 REAL(rstd) :: G_el(3*iim*jjm,llm+1) ! horizontal flux of W 757 REAL(rstd) :: v_el(3*iim*jjm,llm+1) 758 #else 707 759 REAL(rstd) :: berni(iim*jjm) ! Bernoulli function 708 760 REAL(rstd) :: G_el(3*iim*jjm) ! horizontal flux of W 709 761 REAL(rstd) :: v_el(3*iim*jjm) 710 711 INTEGER :: ij,l,kdown,kup 712 REAL(rstd) :: uu_right, uu_lup, uu_ldown, W_el, W2_el 762 #endif 713 763 714 764 CALL trace_start("compute_caldyn_slow_NH") 715 765 716 le_de(:) = le(:)/de(:) ! FIXME - make sure le_de is what we expect 717 766 #ifdef CPP_DYSL 767 #include "../kernels/caldyn_slow_NH.k90" 768 #else 718 769 DO l=ll_begin, ll_endp1 ! compute on l levels (interfaces) 719 770 IF(l==1) THEN … … 789 840 END DO 790 841 END DO 791 ! FIXME !!792 ! F_el(:,:)=0.793 ! dPhi(:,:)=0.794 ! dW(:,:)=0.795 842 796 843 DO l=ll_begin, ll_end ! compute on k levels (layers) … … 827 874 END DO 828 875 END DO 829 ! FIXME !! 830 ! du(:,:)=0. 831 ! hflux(:,:)=0. 876 #endif 832 877 833 878 CALL trace_end("compute_caldyn_slow_NH")
Note: See TracChangeset
for help on using the changeset viewer.