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_ecckd_interface.F90

    r4773 r4853  
    3939    if (lhook) call dr_hook('radiation_ecckd_interface:setup_gas_optics',0,hook_handle)
    4040
    41     if (config%do_sw) then
     41    if (config%do_sw .and. config%i_gas_model_sw == IGasModelECCKD) then
    4242
    4343      ! Read shortwave ecCKD gas optics NetCDF file
     
    5757      end if
    5858
    59 !      if (allocated(config%i_band_from_g_sw)) deallocate(config%i_band_from_g_sw)
    60 !      allocate(config%i_band_from_g_sw(config%n_g_sw))
    61 !      if (allocated(config%i_band_from_reordered_g_sw)) deallocate(config%i_band_from_reordered_g_sw)
    62 !      allocate(config%i_band_from_reordered_g_sw(config%n_g_sw))
    63 !      if (allocated(config%i_g_from_reordered_g_sw)) deallocate(config%i_g_from_reordered_g_sw)
    64 !      allocate(config%i_g_from_reordered_g_sw(config%n_g_sw))
    65       if (.not.allocated(config%i_band_from_g_sw)) &
    66               allocate(config%i_band_from_g_sw(config%n_g_sw))
    67       if (.not.allocated(config%i_band_from_reordered_g_sw)) &
    68               allocate(config%i_band_from_reordered_g_sw(config%n_g_sw))
    69       if (.not.allocated(config%i_g_from_reordered_g_sw)) &
    70               allocate(config%i_g_from_reordered_g_sw(config%n_g_sw))
     59      allocate(config%i_band_from_g_sw          (config%n_g_sw))
     60      allocate(config%i_band_from_reordered_g_sw(config%n_g_sw))
     61      allocate(config%i_g_from_reordered_g_sw   (config%n_g_sw))
    7162       
    7263      if (config%do_cloud_aerosol_per_sw_g_point) then
     
    9384    end if
    9485
    95     if (config%do_lw) then
     86    if (config%do_lw .and. config%i_gas_model_lw == IGasModelECCKD) then
    9687
    9788      ! Read longwave ecCKD gas optics NetCDF file
     
    111102      end if
    112103
    113 !      if (allocated(config%i_band_from_g_lw)) deallocate(config%i_band_from_g_lw)
    114 !      allocate(config%i_band_from_g_lw          (config%n_g_lw))
    115 !      if (allocated(config%i_band_from_reordered_g_lw)) deallocate(config%i_band_from_reordered_g_lw)
    116 !      allocate(config%i_band_from_reordered_g_lw(config%n_g_lw))
    117 !      if (allocated(config%i_g_from_reordered_g_lw)) deallocate(config%i_g_from_reordered_g_lw)
    118 !      allocate(config%i_g_from_reordered_g_lw   (config%n_g_lw))
    119       if (.not.allocated(config%i_band_from_g_lw)) &
    120          allocate(config%i_band_from_g_lw          (config%n_g_lw))
    121       if (.not.allocated(config%i_band_from_reordered_g_lw)) &
    122          allocate(config%i_band_from_reordered_g_lw(config%n_g_lw))
    123       if (.not.allocated(config%i_g_from_reordered_g_lw)) &
    124          allocate(config%i_g_from_reordered_g_lw   (config%n_g_lw))
    125 
     104      allocate(config%i_band_from_g_lw          (config%n_g_lw))
     105      allocate(config%i_band_from_reordered_g_lw(config%n_g_lw))
     106      allocate(config%i_g_from_reordered_g_lw   (config%n_g_lw))
    126107
    127108      if (config%do_cloud_aerosol_per_lw_g_point) then
     
    199180    use yomhook,  only : lhook, dr_hook, jphook
    200181
    201     use radiation_config,         only : config_type
     182    use radiation_config,         only : config_type, IGasModelECCKD
    202183    use radiation_thermodynamics, only : thermodynamics_type
    203184    use radiation_single_level,   only : single_level_type
     
    242223    real(jprb) :: temperature_fl(istartcol:iendcol,nlev)
    243224
    244     integer :: jcol
     225    real(jprb) :: concentration_scaling(NMaxGases)
     226   
     227    logical :: is_volume_mixing_ratio
     228   
     229    integer :: jcol, jlev, jg
    245230
    246231    real(jphook) :: hook_handle
     
    259244         &  / (thermodynamics%pressure_hl(istartcol:iendcol,1:nlev) &
    260245         &    +thermodynamics%pressure_hl(istartcol:iendcol,2:nlev+1))
    261  
    262     if (config%do_sw) then
    263 
    264       call config%gas_optics_sw%calc_optical_depth(ncol,nlev,istartcol,iendcol, &
    265            &  NMaxGases, thermodynamics%pressure_hl, &
    266            &  temperature_fl, &
    267            &  gas%mixing_ratio, &
    268 !           &  reshape(gas%mixing_ratio(istartcol:iendcol,:,:), &
    269 !           &          [nlev,iendcol-istartcol+1,NMaxGases],order=[2,1,3]), &
    270            &  od_sw, rayleigh_od_fl=ssa_sw)
     246
     247    ! Check that the gas concentrations are stored in volume mixing
     248    ! ratio with no scaling; if not, return a vector of scalings
     249    call gas%assert_units(IVolumeMixingRatio, scale_factor=1.0_jprb, &
     250         &                istatus=is_volume_mixing_ratio)
     251    if (.not. is_volume_mixing_ratio) then
     252      call gas%get_scaling(IVolumeMixingRatio, concentration_scaling)
     253    else
     254      concentration_scaling = 1.0_jprb
     255    end if
     256   
     257    if (config%do_sw .and. config%i_gas_model_sw == IGasModelECCKD) then
     258
     259      if (is_volume_mixing_ratio) then
     260        call config%gas_optics_sw%calc_optical_depth(ncol,nlev,istartcol,iendcol, &
     261             &  NMaxGases, thermodynamics%pressure_hl, &
     262             &  temperature_fl, gas%mixing_ratio, &
     263             &  od_sw, rayleigh_od_fl=ssa_sw)
     264      else
     265        call config%gas_optics_sw%calc_optical_depth(ncol,nlev,istartcol,iendcol, &
     266             &  NMaxGases, thermodynamics%pressure_hl, &
     267             &  temperature_fl, gas%mixing_ratio, &
     268             &  od_sw, rayleigh_od_fl=ssa_sw, concentration_scaling=concentration_scaling)
     269      end if
     270     
    271271      ! At this point od_sw = absorption optical depth and ssa_sw =
    272272      ! rayleigh optical depth: convert to total optical depth and
    273273      ! single-scattering albedo
    274       od_sw = od_sw + ssa_sw
    275       ssa_sw = ssa_sw / od_sw
     274      do jcol = istartcol,iendcol
     275        do jlev = 1, nlev
     276          do jg = 1, config%n_g_sw
     277            od_sw(jg,jlev,jcol)  = od_sw(jg,jlev,jcol) + ssa_sw(jg,jlev,jcol)
     278            ssa_sw(jg,jlev,jcol) = ssa_sw(jg,jlev,jcol) / od_sw(jg,jlev,jcol)
     279          end do
     280        end do
     281      end do
    276282
    277283      if (present(incoming_sw)) then
     
    287293    end if
    288294
    289     if (config%do_lw) then
    290 
    291       call config%gas_optics_lw%calc_optical_depth(ncol,nlev,istartcol,iendcol, &
    292            &  NMaxGases, thermodynamics%pressure_hl, &
    293            &  temperature_fl, &
    294            &  gas%mixing_ratio, &
    295 !           &  reshape(gas%mixing_ratio(istartcol:iendcol,:,:), &
    296 !           &          [nlev,iendcol-istartcol+1,NMaxGases],order=[2,1,3]), &
    297            &  od_lw)
     295    if (config%do_lw .and. config%i_gas_model_lw == IGasModelECCKD) then
     296
     297      if (is_volume_mixing_ratio) then
     298        call config%gas_optics_lw%calc_optical_depth(ncol,nlev,istartcol,iendcol, &
     299             &  NMaxGases, thermodynamics%pressure_hl, &
     300             &  temperature_fl, gas%mixing_ratio, &
     301             &  od_lw)
     302      else
     303        call config%gas_optics_lw%calc_optical_depth(ncol,nlev,istartcol,iendcol, &
     304             &  NMaxGases, thermodynamics%pressure_hl, &
     305             &  temperature_fl, gas%mixing_ratio, &
     306             &  od_lw, concentration_scaling=concentration_scaling)
     307      end if
    298308
    299309      ! Calculate the Planck function for each g point
     
    305315           &  single_level%skin_temperature(istartcol:iendcol), &
    306316           &  lw_emission(:,:))
     317!NEC$ forced_collapse
    307318      lw_emission = lw_emission * (1.0_jprb - lw_albedo)
    308319
Note: See TracChangeset for help on using the changeset viewer.