- Timestamp:
- Mar 19, 2024, 3:34:21 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/phylmd/ecrad/radiation/radiation_tripleclouds_sw.F90
r4773 r4853 74 74 ! Gas and aerosol optical depth, single-scattering albedo and 75 75 ! asymmetry factor at each shortwave g-point 76 ! real(jprb), intent(in), dimension(istartcol:iendcol,nlev,config%n_g_sw) :: & 77 real(jprb), intent(in), dimension(config%n_g_sw,nlev,istartcol:iendcol) :: & 78 & od, ssa, g 76 real(jprb), intent(in), dimension(config%n_g_sw,nlev,istartcol:iendcol) & 77 & :: od, ssa, g 79 78 80 79 ! Cloud and precipitation optical depth, single-scattering albedo and 81 80 ! asymmetry factor in each shortwave band 82 real(jprb), intent(in), dimension(config%n_bands_sw,nlev,istartcol:iendcol) ::&83 & od_cloud, ssa_cloud, g_cloud81 real(jprb), intent(in), dimension(config%n_bands_sw,nlev,istartcol:iendcol) & 82 & :: od_cloud, ssa_cloud, g_cloud 84 83 85 84 ! Optical depth, single scattering albedo and asymmetry factor in … … 92 91 ! flux into a plane perpendicular to the incoming radiation at 93 92 ! top-of-atmosphere in each of the shortwave g points 94 real(jprb), intent(in), dimension(config%n_g_sw,istartcol:iendcol) ::&95 & albedo_direct, albedo_diffuse, incoming_sw93 real(jprb), intent(in), dimension(config%n_g_sw,istartcol:iendcol) & 94 & :: albedo_direct, albedo_diffuse, incoming_sw 96 95 97 96 ! Output … … 166 165 real(jprb) :: scat_od, scat_od_cloud 167 166 167 ! Temporaries to speed up summations 168 real(jprb) :: sum_dn_diff, sum_dn_dir, sum_up 169 170 ! Local cosine of solar zenith angle 168 171 real(jprb) :: mu0 169 172 … … 444 447 end if 445 448 446 ! Store the TOA broadband fluxes 447 flux%sw_up(jcol,1) = sum(sum(flux_up,1)) 448 flux%sw_dn(jcol,1) = mu0 * sum(sum(direct_dn,1)) 449 ! Store the TOA broadband fluxes, noting that there is no 450 ! diffuse downwelling at TOA. The intrinsic "sum" command has 451 ! been found to be very slow; better performance is found on 452 ! x86-64 architecture with explicit loops and the "omp simd 453 ! reduction" directive. 454 sum_up = 0.0_jprb 455 sum_dn_dir = 0.0_jprb 456 do jreg = 1,nregions 457 !$omp simd reduction(+:sum_up, sum_dn_dir) 458 do jg = 1,ng 459 sum_up = sum_up + flux_up(jg,jreg) 460 sum_dn_dir = sum_dn_dir + direct_dn(jg,jreg) 461 end do 462 end do 463 flux%sw_up(jcol,1) = sum_up 464 flux%sw_dn(jcol,1) = mu0 * sum_dn_dir 449 465 if (allocated(flux%sw_dn_direct)) then 450 466 flux%sw_dn_direct(jcol,1) = flux%sw_dn(jcol,1) 451 467 end if 452 468 if (config%do_clear) then 453 flux%sw_up_clear(jcol,1) = sum(flux_up_clear) 454 flux%sw_dn_clear(jcol,1) = mu0 * sum(direct_dn_clear) 469 sum_up = 0.0_jprb 470 sum_dn_dir = 0.0_jprb 471 !$omp simd reduction(+:sum_up, sum_dn_dir) 472 do jg = 1,ng 473 sum_up = sum_up + flux_up_clear(jg) 474 sum_dn_dir = sum_dn_dir + direct_dn_clear(jg) 475 end do 476 flux%sw_up_clear(jcol,1) = sum_up 477 flux%sw_dn_clear(jcol,1) = mu0 * sum_dn_dir 455 478 if (allocated(flux%sw_dn_direct_clear)) then 456 479 flux%sw_dn_direct_clear(jcol,1) = flux%sw_dn_clear(jcol,1) … … 467 490 & config%i_spec_from_reordered_g_sw, & 468 491 & flux%sw_dn_band(:,jcol,1)) 469 flux%sw_dn_band(:,jcol,1) = & 470 & mu0 * flux%sw_dn_band(:,jcol,1) 492 flux%sw_dn_band(:,jcol,1) = mu0 * flux%sw_dn_band(:,jcol,1) 471 493 if (allocated(flux%sw_dn_direct_band)) then 472 494 flux%sw_dn_direct_band(:,jcol,1) = flux%sw_dn_band(:,jcol,1) … … 549 571 ! nothing to do 550 572 551 ! Store the broadband fluxes 552 flux%sw_up(jcol,jlev+1) = sum(sum(flux_up,1)) 573 ! Store the broadband fluxes. The intrinsic "sum" command has 574 ! been found to be very slow; better performance is found on 575 ! x86-64 architecture with explicit loops and the "omp simd 576 ! reduction" directive. 577 sum_up = 0.0_jprb 578 sum_dn_dir = 0.0_jprb 579 sum_dn_diff = 0.0_jprb 580 do jreg = 1,nregions 581 !$omp simd reduction(+:sum_up, sum_dn_diff, sum_dn_dir) 582 do jg = 1,ng 583 sum_up = sum_up + flux_up(jg,jreg) 584 sum_dn_diff = sum_dn_diff + flux_dn(jg,jreg) 585 sum_dn_dir = sum_dn_dir + direct_dn(jg,jreg) 586 end do 587 end do 588 flux%sw_up(jcol,jlev+1) = sum_up 589 flux%sw_dn(jcol,jlev+1) = mu0 * sum_dn_dir + sum_dn_diff 553 590 if (allocated(flux%sw_dn_direct)) then 554 flux%sw_dn_direct(jcol,jlev+1) = mu0 * sum(sum(direct_dn,1)) 555 flux%sw_dn(jcol,jlev+1) & 556 & = flux%sw_dn_direct(jcol,jlev+1) + sum(sum(flux_dn,1)) 557 else 558 flux%sw_dn(jcol,jlev+1) = mu0 * sum(sum(direct_dn,1)) + sum(sum(flux_dn,1)) 591 flux%sw_dn_direct(jcol,jlev+1) = mu0 * sum_dn_dir 559 592 end if 560 593 if (config%do_clear) then 561 flux%sw_up_clear(jcol,jlev+1) = sum(flux_up_clear) 594 sum_up = 0.0_jprb 595 sum_dn_dir = 0.0_jprb 596 sum_dn_diff = 0.0_jprb 597 !$omp simd reduction(+:sum_up, sum_dn_diff, sum_dn_dir) 598 do jg = 1,ng 599 sum_up = sum_up + flux_up_clear(jg) 600 sum_dn_diff = sum_dn_diff + flux_dn_clear(jg) 601 sum_dn_dir = sum_dn_dir + direct_dn_clear(jg) 602 end do 603 flux%sw_up_clear(jcol,jlev+1) = sum_up 604 flux%sw_dn_clear(jcol,jlev+1) = mu0 * sum_dn_dir + sum_dn_diff 562 605 if (allocated(flux%sw_dn_direct_clear)) then 563 flux%sw_dn_direct_clear(jcol,jlev+1) = mu0 * sum(direct_dn_clear) 564 flux%sw_dn_clear(jcol,jlev+1) & 565 & = flux%sw_dn_direct_clear(jcol,jlev+1) + sum(flux_dn_clear) 566 else 567 flux%sw_dn_clear(jcol,jlev+1) = mu0 * sum(direct_dn_clear) & 568 & + sum(flux_dn_clear) 606 flux%sw_dn_direct_clear(jcol,jlev+1) = mu0 * sum_dn_dir 569 607 end if 570 608 end if … … 605 643 end if 606 644 end if 607 608 645 end do ! Final loop over levels 609 646
Note: See TracChangeset
for help on using the changeset viewer.