Ignore:
Timestamp:
Mar 31, 2023, 8:42:57 PM (18 months ago)
Author:
lguez
Message:

Merge LMDZ_ECRad branch back into trunk!

Location:
LMDZ6/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk

  • LMDZ6/trunk/libf/phylmd/ecrad/radiation_ifs_rrtm.F90

    r4115 r4489  
    6868    real(jprb) :: hook_handle
    6969
    70 #include "surdi.intfb.h"
     70!#include "surdi.intfb.h"
    7171#include "surrtab.intfb.h"
    7272#include "surrtpk.intfb.h"
     
    8181    ! up now.
    8282    if (config%do_setup_ifsrrtm) then
    83       call SURDI
     83      !call SURDI
    8484      call SURRTAB
    8585      call SURRTPK
     
    8989    end if
    9090
     91    ! Cloud and aerosol properties can only be defined per band
     92    config%do_cloud_aerosol_per_sw_g_point = .false.
     93    config%do_cloud_aerosol_per_lw_g_point = .false.
     94
    9195    config%n_g_sw = jpgsw
    9296    config%n_g_lw = jpglw
     
    97101    ! can compute UV and photosynthetically active radiation for a
    98102    ! particular wavelength range
    99     allocate(config%wavenumber1_sw(config%n_bands_sw))
    100     allocate(config%wavenumber2_sw(config%n_bands_sw))
    101     allocate(config%wavenumber1_lw(config%n_bands_lw))
    102     allocate(config%wavenumber2_lw(config%n_bands_lw))
    103     config%wavenumber1_lw = (/ 10, 350, 500, 630, 700, 820, 980, 1080, 1180, 1390, 1480, &
    104          &  1800, 2080, 2250, 2380, 2600 /)
    105     config%wavenumber2_lw = (/ 350, 500, 630, 700, 820, 980, 1080, 1180, 1390, 1480, 1800, &
    106          &  2080, 2250, 2380, 2600, 3250 /)
    107     config%wavenumber1_sw = (/ 2600, 3250, 4000, 4650, 5150, 6150, 7700, 8050, 12850, &
    108          &  16000 , 22650, 29000, 38000, 820 /)
    109     config%wavenumber2_sw = (/ 3250, 4000, 4650, 5150, 6150, 7700, 8050, 12850, 16000, &
    110          &  22650, 29000, 38000, 50000, 2600 /)
    111     print*,'allocate dans ifs_rrtm'
     103    call config%gas_optics_sw%spectral_def%allocate_bands_only( &
     104         &  [2600.0_jprb, 3250.0_jprb, 4000.0_jprb, 4650.0_jprb, 5150.0_jprb, 6150.0_jprb, 7700.0_jprb, &
     105         &   8050.0_jprb, 12850.0_jprb, 16000.0_jprb, 22650.0_jprb, 29000.0_jprb, 38000.0_jprb, 820.0_jprb], &
     106         &  [3250.0_jprb, 4000.0_jprb, 4650.0_jprb, 5150.0_jprb, 6150.0_jprb, 7700.0_jprb, 8050.0_jprb, &
     107         &   12850.0_jprb, 16000.0_jprb, 22650.0_jprb, 29000.0_jprb, 38000.0_jprb, 50000.0_jprb, 2600.0_jprb])
     108    call config%gas_optics_lw%spectral_def%allocate_bands_only( &
     109         &  [10.0_jprb, 350.0_jprb, 500.0_jprb, 630.0_jprb, 700.0_jprb, 820.0_jprb, 980.0_jprb, 1080.0_jprb, &
     110         &   1180.0_jprb, 1390.0_jprb, 1480.0_jprb, 1800.0_jprb, 2080.0_jprb, 2250.0_jprb, 2380.0_jprb, 2600.0_jprb], &
     111         &  [350.0_jprb, 500.0_jprb, 630.0_jprb, 700.0_jprb, 820.0_jprb, 980.0_jprb, 1080.0_jprb, 1180.0_jprb, &
     112         &   1390.0_jprb, 1480.0_jprb, 1800.0_jprb, 2080.0_jprb, 2250.0_jprb, 2380.0_jprb, 2600.0_jprb, 3250.0_jprb])
     113
    112114    allocate(config%i_band_from_g_sw          (config%n_g_sw))
    113115    allocate(config%i_band_from_g_lw          (config%n_g_lw))
     
    360362!    end if
    361363
    362     pressure_fl(istartcol:iendcol,:) &
    363          &  = 0.5_jprb * (thermodynamics%pressure_hl(istartcol:iendcol,istartlev:iendlev) &
    364          &               +thermodynamics%pressure_hl(istartcol:iendcol,istartlev+1:iendlev+1))
    365     temperature_fl(istartcol:iendcol,:) &
    366          &  = 0.5_jprb * (thermodynamics%temperature_hl(istartcol:iendcol,istartlev:iendlev) &
    367          &               +thermodynamics%temperature_hl(istartcol:iendcol,istartlev+1:iendlev+1))
     364    do jlev=1,nlev
     365      do jcol= istartcol,iendcol
     366        pressure_fl(jcol,jlev) &
     367            &  = 0.5_jprb * (thermodynamics%pressure_hl(jcol,jlev+istartlev-1) &
     368            &               +thermodynamics%pressure_hl(jcol,jlev+istartlev))
     369        temperature_fl(jcol,jlev) &
     370            &  = 0.5_jprb * (thermodynamics%temperature_hl(jcol,jlev+istartlev-1) &
     371            &               +thermodynamics%temperature_hl(jcol,jlev+istartlev))
     372      end do
     373    end do
    368374   
    369375    ! Check we have gas mixing ratios in the right units
     
    402408         &  ZRAT_N2OCO2, ZRAT_N2OCO2_1, ZRAT_O3CO2, ZRAT_O3CO2_1)   
    403409
    404     ZTAUAERL = 0.0_jprb
     410    ZTAUAERL(istartcol:iendcol,:,:) = 0.0_jprb
    405411
    406412    CALL RRTM_GAS_OPTICAL_DEPTH &
     
    434440        lw_emission = lw_emission * (1.0_jprb - lw_albedo)
    435441      else
    436       ! Longwave emission has already been computed
     442        ! Longwave emission has already been computed
    437443        if (config%use_canopy_full_spectrum_lw) then
    438444          lw_emission = transpose(single_level%lw_emission(istartcol:iendcol,:))
     
    509515    ! Scale the incoming solar per band, if requested
    510516    if (config%use_spectral_solar_scaling) then
    511       ZINCSOL(istartcol:iendcol,:) = ZINCSOL(istartcol:iendcol,:) &
    512          & * spread(single_level%spectral_solar_scaling(config%i_band_from_reordered_g_sw), &
    513          &                                              1,iendcol-istartcol+1)
     517      do jg = 1,JPGPT_SW
     518        do jcol = istartcol,iendcol
     519          ZINCSOL(jcol,jg) = ZINCSOL(jcol,jg) * &
     520            &   single_level%spectral_solar_scaling(config%i_band_from_reordered_g_sw(jg))
     521        end do
     522      end do
    514523    end if
    515524
     
    518527    ! ZINCSOL will be zero.
    519528    if (present(incoming_sw)) then
    520       incoming_sw_scale = 1.0_jprb
    521529      do jcol = istartcol,iendcol
    522530        if (single_level%cos_sza(jcol) > 0.0_jprb) then
     531! Added for DWD (2020)
     532!NEC$ nounroll
    523533          incoming_sw_scale(jcol) = single_level%solar_irradiance / sum(ZINCSOL(jcol,:))
     534        else
     535          incoming_sw_scale(jcol) = 1.0_jprb
    524536        end if
    525537      end do
     
    546558    else
    547559      ! G points have not been reordered
    548       do jg = 1,config%n_g_sw
     560      do jcol = istartcol,iendcol
    549561        do jlev = 1,nlev
    550           do jcol = istartcol,iendcol
     562          do jg = 1,config%n_g_sw
    551563            ! Check for negative optical depth
    552564            od_sw (jg,nlev+1-jlev,jcol) = max(config%min_gas_od_sw, ZOD_SW(jcol,jlev,jg))
     
    555567        end do
    556568        if (present(incoming_sw)) then
    557           incoming_sw(jg,:) &
    558                &  = incoming_sw_scale(:) * ZINCSOL(:,jg)
     569          do jg = 1,config%n_g_sw
     570            incoming_sw(jg,jcol) = incoming_sw_scale(jcol) * ZINCSOL(jcol,jg)
     571          end do
    559572        end if
    560573      end do
     
    604617    real(jprb) :: temperature
    605618
    606     real(jprb) :: factor
     619    real(jprb) :: factor, planck_tmp(istartcol:iendcol,config%n_g_lw)
    607620    real(jprb) :: ZFLUXFAC
    608621
     
    689702          do jg = 1,config%n_g_lw
    690703            iband = config%i_band_from_g_lw(jg)
    691             planck_hl(jg,jlev,:) = planck_store(:,iband) * PFRAC(:,jg,nlev+2-jlev)
     704            planck_tmp(:,jg) = planck_store(:,iband) * PFRAC(:,jg,nlev+2-jlev)
     705          end do
     706          do jcol = istartcol,iendcol
     707            planck_hl(:,jlev,jcol) = planck_tmp(jcol,:)
    692708          end do
    693709        end if
Note: See TracChangeset for help on using the changeset viewer.