Ignore:
Timestamp:
Mar 19, 2024, 3:34:21 PM (2 months ago)
Author:
idelkadi
Message:

Ecrad update in LMDZ / Implementation of Ecrad double call in LMDZ

  • version 1.6.1 (commit 210d7911380f53a788c3cad73b3cf9b4e022ef87)
  • interface routines between lmdz and ecrad grouped in a new "lmdz" directory
  • double call method redesigned so as to go through the Ecrad initialization and configuration part only once for the entire simulation
  • clean-up in the read.F routine: delete unitules arguments
  • modification of default gas model in namelist (default: ECCKD)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/ecrad/radiation/radiation_tripleclouds_sw.F90

    r4773 r4853  
    7474    ! Gas and aerosol optical depth, single-scattering albedo and
    7575    ! 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
    7978
    8079    ! Cloud and precipitation optical depth, single-scattering albedo and
    8180    ! 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_cloud
     81    real(jprb), intent(in), dimension(config%n_bands_sw,nlev,istartcol:iendcol) &
     82         &  :: od_cloud, ssa_cloud, g_cloud
    8483
    8584    ! Optical depth, single scattering albedo and asymmetry factor in
     
    9291    ! flux into a plane perpendicular to the incoming radiation at
    9392    ! 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_sw
     93    real(jprb), intent(in), dimension(config%n_g_sw,istartcol:iendcol) &
     94         &  :: albedo_direct, albedo_diffuse, incoming_sw
    9695
    9796    ! Output
     
    166165    real(jprb) :: scat_od, scat_od_cloud
    167166
     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
    168171    real(jprb) :: mu0
    169172
     
    444447      end if
    445448     
    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
    449465      if (allocated(flux%sw_dn_direct)) then
    450466        flux%sw_dn_direct(jcol,1) = flux%sw_dn(jcol,1)
    451467      end if
    452468      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
    455478        if (allocated(flux%sw_dn_direct_clear)) then
    456479          flux%sw_dn_direct_clear(jcol,1) = flux%sw_dn_clear(jcol,1)
     
    467490             &           config%i_spec_from_reordered_g_sw, &
    468491             &           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)
    471493        if (allocated(flux%sw_dn_direct_band)) then
    472494          flux%sw_dn_direct_band(:,jcol,1) = flux%sw_dn_band(:,jcol,1)
     
    549571               ! nothing to do
    550572
    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
    553590        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
    559592        end if
    560593        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
    562605          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
    569607          end if
    570608        end if
     
    605643          end if
    606644        end if
    607 
    608645      end do ! Final loop over levels
    609646     
Note: See TracChangeset for help on using the changeset viewer.