Changeset 4647 for LMDZ6/branches


Ignore:
Timestamp:
Aug 7, 2023, 1:42:51 PM (10 months ago)
Author:
idelkadi
Message:

Implementation in the LMDZ code of the double call of the ECRAD radiative transfer code to estimate the 3D radiative effect of clouds.

  • This double call of Ecrad is controlled by the ok_3Deffect logic key.
  • If this key is enabled, 2 files of parameter configuration "namelists" for ECRAD are required at runtime: namelist_ecrad and namelist_ecrad_s2.
  • If this key is deactivated, the configuration and initialization part (reading namelist and netcdf files) is performed only once during simulation (1st call to ECRAD). Otherwise, configuration and initialization are performed each time Ecrad is called.
Location:
LMDZ6/branches/LMDZ_ECRad/libf/phylmd
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/clesphys.h

    r4482 r4647  
    103103       INTEGER :: iflag_phytrac
    104104
     105!AI flags pour ECRAD
     106       LOGICAL :: ok_3Deffect
     107       CHARACTER(len=512) :: namelist_ecrad_file
     108
    105109       COMMON/clesphys/                                                 &
    106110! REAL FIRST
     
    151155     &     , ok_daily_climoz, ok_all_xml, ok_lwoff                      &
    152156     &     , iflag_phytrac, ok_new_lscp                                 &
    153      &     ,  iflag_thermals,nsplit_thermals, tau_thermals   
     157     &     , iflag_thermals,nsplit_thermals, tau_thermals               &
     158     &     , ok_3Deffect, namelist_ecrad_file   
    154159       save /clesphys/
    155160!$OMP THREADPRIVATE(/clesphys/)
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_aerosol_optics.F90

    r4444 r4647  
    5353        ! properties and average to the spectral intervals of the
    5454        ! current gas-optics scheme
    55 !        call setup_general_aerosol_optics(config)
    56         call setup_general_aerosol_optics_lmdz(config,trim(config%aerosol_optics_file_name))
     55        call setup_general_aerosol_optics(config)
    5756      else
    5857        ! Read file containing optical properties already in the bands
     
    334333
    335334  end subroutine setup_general_aerosol_optics
    336 
    337     !---------------------------------------------------------------------
    338   ! Read LMDZ file containing high spectral resolution optical properties
    339   ! and average to the spectral intervals of the current gas-optics
    340   ! scheme
    341   subroutine setup_general_aerosol_optics_lmdz(config,file_name)
    342 
    343     use parkind1,                      only : jprb
    344     use yomhook,                       only : lhook, dr_hook
    345 !    use easy_netcdf,                   only : netcdf_file
    346     use radiation_config,              only : config_type
    347     use radiation_aerosol_optics_data, only : aerosol_optics_type
    348     use radiation_spectral_definition, only : SolarReferenceTemperature, &
    349          &                                    TerrestrialReferenceTemperature
    350     use radiation_io,                  only : nulout
    351     use netcdf95, only: nf95_open, nf95_inq_grp_full_ncid, nf95_close, &
    352          nf95_inq_dimid, nf95_inq_varid, nf95_inquire_dimension, &
    353          nf95_get_var, nf95_gw_var
    354     use netcdf, only: nf90_nowrite
    355 
    356 
    357     type(config_type), intent(inout), target :: config
    358 
    359 !    ! The NetCDF file containing the aerosol optics data
    360 !    type(netcdf_file)  :: file
    361 
    362     character(len=*), intent(in):: file_name
    363     ! NetCDF file containing the aerosol optics data
    364 
    365     ! Wavenumber points in NetCDF file
    366     real(jprb), allocatable :: wavenumber(:) ! cm-1
    367 
    368     ! Hydrophilic aerosol properties
    369     real(jprb), allocatable :: mass_ext_philic(:,:,:)    ! Mass-ext coefficient (m2 kg-1)
    370     real(jprb), allocatable :: ssa_philic(:,:,:)         ! Single-scattering albedo
    371     real(jprb), allocatable :: g_philic(:,:,:)           ! Asymmetry factor
    372     real(jprb), allocatable :: lidar_ratio_philic(:,:,:) ! Lidar ratio (sr)
    373 
    374     ! Hydrophobic aerosol properties
    375     real(jprb), allocatable :: mass_ext_phobic(:,:)      ! Mass-ext coefficient (m2 kg-1)
    376     real(jprb), allocatable :: ssa_phobic(:,:)           ! Single-scattering albedo
    377     real(jprb), allocatable :: g_phobic(:,:)             ! Asymmetry factor
    378     real(jprb), allocatable :: lidar_ratio_phobic(:,:)   ! Lidar ratio (sr)
    379 
    380     ! Mapping matrix between optical properties at the wavenumbers in
    381     ! the file, and spectral intervals used by the gas-optics scheme
    382     real(jprb), allocatable :: mapping(:,:)
    383 
    384     ! Pointer to the aerosol optics coefficients for brevity of access
    385     type(aerosol_optics_type), pointer :: ao
    386 
    387     ! Target monochromatic wavenumber for interpolation (cm-1)
    388     real(jprb) :: wavenumber_target
    389 
    390     ! Number of spectral points describing aerosol properties in the
    391     ! shortwave and longwave
    392     integer    :: nspecsw, nspeclw
    393 
    394     ! Number of monochromatic wavelengths required
    395     integer    :: nmono
    396 
    397     integer    :: n_type_philic, n_type_phobic, nrh, nwn
    398     integer    :: jtype, jwl, iwn
    399 
    400     ! Weight of first point in interpolation
    401     real(jprb) :: weight1
    402 
    403     real(jprb) :: hook_handle
    404 
    405     ! Local:
    406     integer ncid, grpid, dimid, varid
    407 
    408     if (lhook) call dr_hook('radiation_aerosol_optics:setup_general_aerosol_optics',0,hook_handle)
    409 
    410     ao => config%aerosol_optics
    411 
    412     ao%use_hydrophilic = .true.
    413     ao%use_monochromatic = .true.
    414     print*,'file_name= ',file_name
    415     call nf95_open(file_name, nf90_nowrite, ncid)
    416     call nf95_inq_grp_full_ncid(ncid, "Hydrophilic", grpid)
    417     call nf95_inq_dimid(grpid, "hur", dimid)
    418     call nf95_inquire_dimension(grpid, dimid, nclen = ao%nrh)
    419 !    allocate(ao%rh_lower(ao%nrh))
    420     call nf95_inq_varid(grpid, "hur_bounds", varid)
    421     call nf95_get_var(grpid, varid, ao%rh_lower, count_nc = [1, ao%nrh])
    422 
    423     ! Hydrophilic/LW_bands:
    424     call nf95_inq_grp_full_ncid(ncid, "Hydrophilic/LW_bands", grpid)
    425     call nf95_inq_varid(grpid, "asymmetry", varid)
    426     call nf95_gw_var(grpid, varid, ao%g_lw_philic)
    427     call nf95_inq_varid(grpid, "single_scat_alb", varid)
    428     call nf95_gw_var(grpid, varid, ao%ssa_lw_philic)
    429     call nf95_inq_varid(grpid, "mass_ext", varid)
    430     call nf95_gw_var(grpid, varid, ao%mass_ext_lw_philic)
    431 
    432     ! Hydrophilic/SW_bands:
    433     call nf95_inq_grp_full_ncid(ncid, "Hydrophilic/SW_bands", grpid)
    434     call nf95_inq_varid(grpid, "asymmetry", varid)
    435     call nf95_gw_var(grpid, varid, ao%g_sw_philic)
    436     ao%g_sw_philic = cshift(ao%g_sw_philic, 1)
    437     call nf95_inq_varid(grpid, "single_scat_alb", varid)
    438     call nf95_gw_var(grpid, varid, ao%ssa_sw_philic)
    439     ao%g_sw_philic = cshift(ao%ssa_sw_philic, 1)
    440     call nf95_inq_varid(grpid, "mass_ext", varid)
    441     call nf95_gw_var(grpid, varid, ao%mass_ext_sw_philic)
    442     ao%g_sw_philic = cshift(ao%mass_ext_sw_philic, 1)
    443 
    444     ! Hydrophilic/Monochromatic:
    445     call nf95_inq_grp_full_ncid(ncid, "Hydrophilic/Monochromatic", grpid)
    446     call nf95_inq_varid(grpid, "mass_ext", varid)
    447     call nf95_gw_var(grpid, varid, ao%mass_ext_mono_philic)
    448 
    449     ! Hydrophobic/LW_bands:
    450     call nf95_inq_grp_full_ncid(ncid, "Hydrophobic/LW_bands", grpid)
    451     call nf95_inq_varid(grpid, "asymmetry", varid)
    452     call nf95_gw_var(grpid, varid, ao%g_lw_phobic)
    453     call nf95_inq_varid(grpid, "single_scat_alb", varid)
    454     call nf95_gw_var(grpid, varid, ao%ssa_lw_phobic)
    455     call nf95_inq_varid(grpid, "mass_ext", varid)
    456     call nf95_gw_var(grpid, varid, ao%mass_ext_lw_phobic)
    457 
    458     ! Hydrophobic/SW_bands:
    459     call nf95_inq_grp_full_ncid(ncid, "Hydrophobic/SW_bands", grpid)
    460     call nf95_inq_varid(grpid, "asymmetry", varid)
    461     call nf95_gw_var(grpid, varid, ao%g_sw_phobic)
    462     ao%g_sw_phobic = cshift(ao%g_sw_phobic, 1)
    463     call nf95_inq_varid(grpid, "single_scat_alb", varid)
    464     call nf95_gw_var(grpid, varid, ao%ssa_sw_phobic)
    465     ao%g_sw_phobic = cshift(ao%ssa_sw_phobic, 1)
    466     call nf95_inq_varid(grpid, "mass_ext", varid)
    467     call nf95_gw_var(grpid, varid, ao%mass_ext_sw_phobic)
    468     ao%g_sw_phobic = cshift(ao%mass_ext_sw_phobic, 1)
    469 ! AI ATTENTION   
    470     call nf95_inq_varid(grpid, "wavenumber", varid)
    471     call nf95_gw_var(grpid, varid, wavenumber)
    472 
    473     ! Hydrophobic/Monochromatic:
    474     call nf95_inq_grp_full_ncid(ncid, "Hydrophobic/Monochromatic", grpid)
    475     call nf95_inq_varid(grpid, "mass_ext", varid)
    476     call nf95_gw_var(grpid, varid, ao%mass_ext_mono_phobic)
    477 
    478 !    call file%get('wavenumber', wavenumber)
    479 !    nwn = size(wavenumber)
    480 
    481 !    call file%get_global_attribute('description_hydrophobic', &
    482 !         &                         ao%description_phobic_str)
    483 
    484 
    485 !      call file%get('relative_humidity1',      ao%rh_lower)
    486 
    487 !      call file%get_global_attribute('description_hydrophilic', &
    488 !           &                         ao%description_philic_str)
    489 
    490     ! Close aerosol scattering file
    491 !    call file%close()
    492 
    493     call nf95_close(ncid)
    494 
    495     ! Get array sizes
    496 !    ao%n_bands_lw = size(ao%mass_ext_lw_phobic, 1)
    497 !    ao%n_bands_sw = size(ao%mass_ext_sw_phobic, 1)
    498 !    ao%n_mono_wl = size(ao%mass_ext_mono_phobic, 1)
    499 !    ao%n_type_phobic = size(ao%mass_ext_lw_phobic, 2)
    500 !    ao%n_type_philic = size(ao%mass_ext_lw_philic, 3)
    501 
    502     ! Allocate memory for mapping arrays
    503 !    ao%ntype = ao%n_type_phobic + ao%n_type_philic
    504 !    allocate(ao%iclass(ao%ntype))
    505 !    allocate(ao%itype(ao%ntype))
    506 
    507 !    ao%iclass = IAerosolClassUndefined
    508 !    ao%itype  = 0
    509 
    510     n_type_phobic = size(mass_ext_phobic, 2)
    511     if (ao%use_hydrophilic) then
    512       n_type_philic = size(mass_ext_philic, 3)
    513       nrh = size(ao%rh_lower)
    514     else
    515       n_type_philic = 0
    516       nrh = 0
    517     end if
    518 
    519     if (config%do_cloud_aerosol_per_sw_g_point) then
    520       nspecsw = config%gas_optics_sw%spectral_def%ng
    521     else
    522       nspecsw = config%gas_optics_sw%spectral_def%nband
    523     end if
    524 
    525     if (config%do_cloud_aerosol_per_lw_g_point) then
    526       nspeclw = config%gas_optics_lw%spectral_def%ng
    527     else
    528       nspeclw = config%gas_optics_lw%spectral_def%nband
    529     end if
    530 
    531     if (allocated(ao%wavelength_mono)) then
    532       ! Monochromatic wavelengths also required
    533       nmono = size(ao%wavelength_mono)
    534     else
    535       nmono = 0
    536     end if
    537 
    538     call ao%allocate(n_type_phobic, n_type_philic, nrh, nspeclw, nspecsw, nmono)
    539 
    540     if (config%do_sw) then
    541       call config%gas_optics_sw%spectral_def%calc_mapping(SolarReferenceTemperature, &
    542            &  wavenumber, mapping, use_bands=(.not. config%do_cloud_aerosol_per_sw_g_point))
    543 
    544       ao%mass_ext_sw_phobic = matmul(mapping, mass_ext_phobic)
    545       ao%ssa_sw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic) &
    546            &           / ao%mass_ext_sw_phobic
    547       ao%g_sw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic*g_phobic) &
    548            &         / (ao%mass_ext_sw_phobic*ao%ssa_sw_phobic)
    549 
    550       if (ao%use_hydrophilic) then
    551         do jtype = 1,n_type_philic
    552           ao%mass_ext_sw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype))
    553           ao%ssa_sw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
    554                &                                        *ssa_philic(:,:,jtype)) &
    555                &           / ao%mass_ext_sw_philic(:,:,jtype)
    556           ao%g_sw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
    557                &                       *ssa_philic(:,:,jtype)*g_philic(:,:,jtype)) &
    558                &         / (ao%mass_ext_sw_philic(:,:,jtype)*ao%ssa_sw_philic(:,:,jtype))
    559         end do
    560       end if
    561     end if
    562     if (config%do_lw) then
    563       call config%gas_optics_lw%spectral_def%calc_mapping(TerrestrialReferenceTemperature, &
    564            &  wavenumber, mapping, use_bands=(.not. config%do_cloud_aerosol_per_lw_g_point))
    565 
    566       ao%mass_ext_lw_phobic = matmul(mapping, mass_ext_phobic)
    567       ao%ssa_lw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic) &
    568            &           / ao%mass_ext_lw_phobic
    569       ao%g_lw_phobic = matmul(mapping, mass_ext_phobic*ssa_phobic*g_phobic) &
    570            &         / (ao%mass_ext_lw_phobic*ao%ssa_lw_phobic)
    571 
    572       if (ao%use_hydrophilic) then
    573         do jtype = 1,n_type_philic
    574           ao%mass_ext_lw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype))
    575           ao%ssa_lw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
    576                &                                        *ssa_philic(:,:,jtype)) &
    577                &           / ao%mass_ext_lw_philic(:,:,jtype)
    578           ao%g_lw_philic(:,:,jtype) = matmul(mapping, mass_ext_philic(:,:,jtype) &
    579                &                       *ssa_philic(:,:,jtype)*g_philic(:,:,jtype)) &
    580                &         / (ao%mass_ext_lw_philic(:,:,jtype)*ao%ssa_lw_philic(:,:,jtype))
    581         end do
    582       end if
    583     end if
    584 
    585     if (allocated(ao%wavelength_mono)) then
    586       ! Monochromatic wavelengths also required
    587       do jwl = 1,nmono
    588         ! Wavelength (m) to wavenumber (cm-1)
    589         wavenumber_target = 0.01_jprb / ao%wavelength_mono(jwl)
    590         ! Find index to first interpolation point, and its weight
    591         if (wavenumber_target <= wavenumber(1)) then
    592           weight1 = 1.0_jprb
    593           iwn = 1
    594         else if (wavenumber_target >= wavenumber(nwn)) then
    595           iwn = nwn-1
    596           weight1 = 0.0_jprb
    597         else
    598           iwn = 1
    599           do while (wavenumber(iwn+1) < wavenumber_target .and. iwn < nwn-1)
    600             iwn = iwn + 1
    601           end do
    602           weight1 = (wavenumber(iwn+1)-wavenumber_target) &
    603                &  / (wavenumber(iwn+1)-wavenumber(iwn))
    604         end if
    605         ! Linear interpolation
    606         ao%mass_ext_mono_phobic(jwl,:) = weight1 * mass_ext_phobic(iwn,:) &
    607              &             + (1.0_jprb - weight1)* mass_ext_phobic(iwn+1,:)
    608         ao%ssa_mono_phobic(jwl,:)      = weight1 * ssa_phobic(iwn,:) &
    609              &             + (1.0_jprb - weight1)* ssa_phobic(iwn+1,:)
    610         ao%g_mono_phobic(jwl,:)        = weight1 * g_phobic(iwn,:) &
    611              &             + (1.0_jprb - weight1)* g_phobic(iwn+1,:)
    612         ao%lidar_ratio_mono_phobic(jwl,:) = weight1 * lidar_ratio_phobic(iwn,:) &
    613              &                + (1.0_jprb - weight1)* lidar_ratio_phobic(iwn+1,:)
    614         if (ao%use_hydrophilic) then
    615           ao%mass_ext_mono_philic(jwl,:,:) = weight1 * mass_ext_philic(iwn,:,:) &
    616                &               + (1.0_jprb - weight1)* mass_ext_philic(iwn+1,:,:)
    617           ao%ssa_mono_philic(jwl,:,:)      = weight1 * ssa_philic(iwn,:,:) &
    618                &               + (1.0_jprb - weight1)* ssa_philic(iwn+1,:,:)
    619           ao%g_mono_philic(jwl,:,:)        = weight1 * g_philic(iwn,:,:) &
    620                &               + (1.0_jprb - weight1)* g_philic(iwn+1,:,:)
    621           ao%lidar_ratio_mono_philic(jwl,:,:) = weight1 * lidar_ratio_philic(iwn,:,:) &
    622                &                  + (1.0_jprb - weight1)* lidar_ratio_philic(iwn+1,:,:)
    623         end if
    624       end do
    625     end if
    626 
    627     ! Deallocate memory local to this routine
    628     deallocate(mass_ext_phobic)
    629     deallocate(ssa_phobic)
    630     deallocate(g_phobic)
    631     deallocate(lidar_ratio_phobic)
    632     if (ao%use_hydrophilic) then
    633       deallocate(mass_ext_philic)
    634       deallocate(ssa_philic)
    635       deallocate(g_philic)
    636       deallocate(lidar_ratio_philic)
    637     end if
    638 
    639     if (lhook) call dr_hook('radiation_aerosol_optics:setup_general_aerosol_optics',1,hook_handle)
    640 
    641   end subroutine setup_general_aerosol_optics_lmdz
    642    
    643335
    644336  !---------------------------------------------------------------------
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_cloud_generator.F90

    r4444 r4647  
    541541    use radiation_pdf_sampler, only : pdf_sampler_type
    542542    implicit none
    543 #if defined(__GFORTRAN__) || defined(__PGI) || defined(__NEC__)
    544 #else
    545     !$omp declare simd(sample_from_pdf_simd) uniform(this) &
    546     !$omp linear(ref(fsd)) linear(ref(cdf))
    547 #endif
    548543    type(pdf_sampler_type), intent(in)  :: this
    549544
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_ecckd.F90

    r4444 r4647  
    147147    this%d_log_pressure = log(pressure_lut(2)) - this%log_pressure1
    148148    call file%get('temperature', temperature_full)
     149    if (allocated(this%temperature1)) deallocate(this%temperature1)
    149150    allocate(this%temperature1(this%npress));
    150151    this%temperature1 = temperature_full(:,1)
     
    179180    ! Read gases
    180181    call file%get('n_gases', this%ngas)
     182    if (allocated(this%single_gas)) deallocate(this%single_gas) 
    181183    allocate(this%single_gas(this%ngas))
    182184    call file%get_global_attribute('constituent_id', constituent_id)
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_ecckd_interface.F90

    r4444 r4647  
    5252      end if
    5353
    54       allocate(config%i_band_from_g_sw          (config%n_g_sw))
     54      if (allocated(config%i_band_from_g_sw)) deallocate(config%i_band_from_g_sw)
     55      allocate(config%i_band_from_g_sw(config%n_g_sw))
     56      if (allocated(config%i_band_from_reordered_g_sw)) deallocate(config%i_band_from_reordered_g_sw)
    5557      allocate(config%i_band_from_reordered_g_sw(config%n_g_sw))
    56       allocate(config%i_g_from_reordered_g_sw   (config%n_g_sw))
     58      if (allocated(config%i_g_from_reordered_g_sw)) deallocate(config%i_g_from_reordered_g_sw)
     59      allocate(config%i_g_from_reordered_g_sw(config%n_g_sw))
    5760       
    5861      if (config%do_cloud_aerosol_per_sw_g_point) then
     
    9194      end if
    9295
     96      if (allocated(config%i_band_from_g_lw)) deallocate(config%i_band_from_g_lw)
    9397      allocate(config%i_band_from_g_lw          (config%n_g_lw))
     98      if (allocated(config%i_band_from_reordered_g_lw)) deallocate(config%i_band_from_reordered_g_lw)
    9499      allocate(config%i_band_from_reordered_g_lw(config%n_g_lw))
     100      if (allocated(config%i_g_from_reordered_g_lw)) deallocate(config%i_g_from_reordered_g_lw)
    95101      allocate(config%i_g_from_reordered_g_lw   (config%n_g_lw))
    96102
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_general_cloud_optics.F90

    r4444 r4647  
    7575    ! Allocate structures
    7676    if (config%do_sw) then
     77      if (allocated(config%cloud_optics_sw)) deallocate(config%cloud_optics_sw)     
    7778      allocate(config%cloud_optics_sw(config%n_cloud_types))
    7879    end if
    7980
    8081    if (config%do_lw) then
     82      if (allocated(config%cloud_optics_lw)) deallocate(config%cloud_optics_lw)       
    8183      allocate(config%cloud_optics_lw(config%n_cloud_types))
    8284    end if
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_general_cloud_optics_data.F90

    r4444 r4647  
    185185    call delta_eddington(mass_ext, ssa, asymmetry)
    186186
     187
    187188    ! Thin averaging
     189   ! AI juillet 2023
     190    allocate(this%mass_ext(nre,nwav))
    188191    this%mass_ext  = matmul(mapping, mass_ext)
    189192    this%ssa       = matmul(mapping, mass_ext*ssa) / this%mass_ext
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_scheme.F90

    r4646 r4647  
    99!             3. Configuration a partir de namelist
    1010!             4. frac_std = 0.75     
     11! Juillet 2023 :
     12!             
    1113! ============================================================================
    1214
     
    1416! Inputs
    1517     & (KIDIA, KFDIA, KLON, KLEV, KAEROSOL, NSW, &
    16      &  IDAY, TIME, &
     18     &  namelist_file, ok_3Deffect, IDAY, TIME, &
    1719     &  PSOLAR_IRRADIANCE, &
    1820     &  PMU0, PTEMPERATURE_SKIN, &
     
    9799USE mod_phys_lmdz_para
    98100USE setup_config_from_lmdz,   ONLY : driver_config_type
     101!USE RADIATION_SETUP, ONLY : config_type, driver_config_type
    99102
    100103IMPLICIT NONE
     
    220223! AI ATTENTION
    221224type(config_type),save         :: rad_config
     225!!$OMP THREADPRIVATE(rad_config)
    222226type(driver_config_type),save  :: driver_config
     227!!$OMP THREADPRIVATE(driver_config)
     228!type(config_type)        :: rad_config
     229!type(driver_config_type)  :: driver_config
    223230TYPE(single_level_type)   :: single_level
    224231TYPE(thermodynamics_type) :: thermodynamics
     
    261268
    262269! Name of file names specified on command line
    263 character(len=512) :: file_name
     270character(len=512) :: namelist_file
    264271
    265272logical :: loutput=.true.
     
    269276!$OMP THREADPRIVATE(debut_ecrad)
    270277integer, save :: itap_ecrad=1
     278logical :: ok_3Deffect
    271279
    272280IF (LHOOK) CALL DR_HOOK('RADIATION_SCHEME',0,ZHOOK_HANDLE)
    273 print*,'Entree dans radiation_scheme'
    274281
    275282! A.I juillet 2023 :
    276283! Initialisation dans radiation_setup au 1er passage dans Ecrad
    277284!$OMP MASTER
    278 if (debut_ecrad) then
    279 ! AI appel radiation_setup
    280  call SETUP_RADIATION_SCHEME(loutput,rad_config,driver_config)
    281  debut_ecrad=.false.
    282 endif
     285if (.not.ok_3Deffect) then
     286  if (debut_ecrad) then
     287   call SETUP_RADIATION_SCHEME(loutput,namelist_file,rad_config,driver_config)
     288   debut_ecrad=.false.
     289  endif
     290else
     291   call SETUP_RADIATION_SCHEME(loutput,namelist_file,rad_config,driver_config)
     292endif
    283293!$OMP END MASTER
    284294!$OMP BARRIER
     
    287297!AI juillet 2023 : verif des param de config :
    288298if (lprint_config) then
     299 IF (is_master) THEN       
    289300   print*,'Parametres de configuration de ecrad, etape ',itap_ecrad     
     301   print*,'Entree dans radiation_scheme'
     302   print*,'ok_3Deffect = ',ok_3Deffect
     303   print*,'Fichier namelist = ',namelist_file
     304
    290305   print*,'do_sw, do_lw, do_sw_direct, do_3d_effects = ', &
    291306           rad_config%do_sw, rad_config%do_lw, rad_config%do_sw_direct, rad_config%do_3d_effects
     
    362377
    363378           itap_ecrad=itap_ecrad+1
     379   ENDIF         
    364380endif           
    365381
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation_setup.F90

    r4646 r4647  
    4646! AI At the end of the routine, the parameters are read in namelist
    4747!   
    48   SUBROUTINE SETUP_RADIATION_SCHEME(LOUTPUT,rad_config,driver_config)
     48  SUBROUTINE SETUP_RADIATION_SCHEME(LOUTPUT,file_name,rad_config,driver_config)
    4949
    5050    USE radiation_config, ONLY : config_type, &
     
    8686
    8787! AI ATTENTION (parameters read in namelist file)
    88     file_name="namelist_ecrad"
     88!    file_name="namelist_ecrad"
    8989    call rad_config%read(file_name=file_name)
    9090    call driver_config%read(file_name)
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/setup_aerosol_optics_lmdz_m.F90

    r4188 r4647  
    2929    use netcdf95, only: nf95_open, nf95_inq_grp_full_ncid, nf95_close, &
    3030         nf95_inq_dimid, nf95_inq_varid, nf95_inquire_dimension, &
    31          nf95_get_var, nf95_gw_var
    32     use netcdf, only: nf90_nowrite
     31         nf95_get_var, nf95_gw_var, nf95_nowrite
    3332
    3433    type(aerosol_optics_type), intent(out):: ao
     
    4443    ao%use_hydrophilic = .true.
    4544    ao%use_monochromatic = .true.
    46     print*,'file_name= ',file_name
    47     call nf95_open(file_name, nf90_nowrite, ncid)
     45    call nf95_open(file_name, nf95_nowrite, ncid)
    4846    call nf95_inq_grp_full_ncid(ncid, "Hydrophilic", grpid)
    4947    call nf95_inq_dimid(grpid, "hur", dimid)
     
    6967    call nf95_inq_varid(grpid, "single_scat_alb", varid)
    7068    call nf95_gw_var(grpid, varid, ao%ssa_sw_philic)
    71     ao%g_sw_philic = cshift(ao%ssa_sw_philic, 1)
     69    ao%ssa_sw_philic = cshift(ao%ssa_sw_philic, 1)
    7270    call nf95_inq_varid(grpid, "mass_ext", varid)
    7371    call nf95_gw_var(grpid, varid, ao%mass_ext_sw_philic)
    74     ao%g_sw_philic = cshift(ao%mass_ext_sw_philic, 1)
     72    ao%mass_ext_sw_philic = cshift(ao%mass_ext_sw_philic, 1)
    7573
    7674    ! Hydrophilic/Monochromatic:
     
    9593    call nf95_inq_varid(grpid, "single_scat_alb", varid)
    9694    call nf95_gw_var(grpid, varid, ao%ssa_sw_phobic)
    97     ao%g_sw_phobic = cshift(ao%ssa_sw_phobic, 1)
     95    ao%ssa_sw_phobic = cshift(ao%ssa_sw_phobic, 1)
    9896    call nf95_inq_varid(grpid, "mass_ext", varid)
    9997    call nf95_gw_var(grpid, varid, ao%mass_ext_sw_phobic)
    100     ao%g_sw_phobic = cshift(ao%mass_ext_sw_phobic, 1)
     98    ao%mass_ext_sw_phobic = cshift(ao%mass_ext_sw_phobic, 1)
    10199
    102100    ! Hydrophobic/Monochromatic:
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/phys_local_var_mod.F90

    r4188 r4647  
    141141      REAL, SAVE, ALLOCATABLE :: toplwad0_aero(:), sollwad0_aero(:)     ! diag
    142142      !$OMP THREADPRIVATE(toplwad0_aero,sollwad0_aero)
     143
     144!AI 08 2023 ajout pour Ecrad
     145      REAL,ALLOCATABLE,SAVE :: topswad_aero_s2(:), solswad_aero_s2(:)
     146!$OMP THREADPRIVATE(topswad_aero_s2, solswad_aero_s2)
     147      REAL,ALLOCATABLE,SAVE :: topswai_aero_s2(:), solswai_aero_s2(:)
     148!$OMP THREADPRIVATE(topswai_aero_s2, solswai_aero_s2)
     149      REAL,ALLOCATABLE,SAVE :: topswad0_aero_s2(:), solswad0_aero_s2(:)
     150!$OMP THREADPRIVATE(topswad0_aero_s2, solswad0_aero_s2)
     151      REAL,ALLOCATABLE,SAVE :: topsw_aero_s2(:,:), topsw0_aero_s2(:,:)
     152!$OMP THREADPRIVATE(topsw_aero_s2, topsw0_aero_s2)
     153      REAL,ALLOCATABLE,SAVE :: solsw_aero_s2(:,:), solsw0_aero_s2(:,:)
     154!$OMP THREADPRIVATE(solsw_aero_s2, solsw0_aero_s2)
     155      REAL,ALLOCATABLE,SAVE :: topswcf_aero_s2(:,:), solswcf_aero_s2(:,:)
     156!$OMP THREADPRIVATE(topswcf_aero_s2, solswcf_aero_s2)
     157! additional LW variables CK
     158      REAL,ALLOCATABLE,SAVE :: toplwad_aero_s2(:), sollwad_aero_s2(:)
     159!$OMP THREADPRIVATE(toplwad_aero_s2, sollwad_aero_s2)
     160      REAL,ALLOCATABLE,SAVE :: toplwai_aero_s2(:), sollwai_aero_s2(:)
     161!$OMP THREADPRIVATE(toplwai_aero_s2, sollwai_aero_s2)
     162      REAL,ALLOCATABLE,SAVE :: toplwad0_aero_s2(:), sollwad0_aero_s2(:)
     163!$OMP THREADPRIVATE(toplwad0_aero_s2, sollwad0_aero_s2)
     164     
    143165! Special RRTM
    144166      REAL, SAVE, ALLOCATABLE :: ZLWFT0_i(:,:),  ZSWFT0_i(:,:)      ! diag
     
    740762      ALLOCATE(solsw_aerop(klon,naero_grp), solsw0_aerop(klon,naero_grp))
    741763      ALLOCATE(topswcf_aerop(klon,naero_grp), solswcf_aerop(klon,naero_grp))
     764
     765!AI Ajout Ecrad (3Deffect)
     766      ALLOCATE(topswad_aero_s2(klon), solswad_aero_s2(klon))
     767      ALLOCATE(topswai_aero_s2(klon), solswai_aero_s2(klon))
     768      ALLOCATE(topswad0_aero_s2(klon), solswad0_aero_s2(klon))
     769      ALLOCATE(topsw_aero_s2(klon,naero_grp), topsw0_aero_s2(klon,naero_grp))
     770      ALLOCATE(solsw_aero_s2(klon,naero_grp), solsw0_aero_s2(klon,naero_grp))
     771      ALLOCATE(topswcf_aero_s2(klon,naero_grp), solswcf_aero_s2(klon,naero_grp))
     772! additional LW variables CK
     773      ALLOCATE(toplwad_aero_s2(klon), sollwad_aero_s2(klon))
     774      ALLOCATE(toplwai_aero_s2(klon), sollwai_aero_s2(klon))
     775      ALLOCATE(toplwad0_aero_s2(klon), sollwad0_aero_s2(klon))
    742776
    743777! additional LW variables CK
     
    10561090      DEALLOCATE(solsw_aerop, solsw0_aerop)
    10571091      DEALLOCATE(topswcf_aerop, solswcf_aerop)
     1092
     1093!AI Ajout pour Ecrad (3Deffect)
     1094      DEALLOCATE(topswad_aero_s2, solswad_aero_s2)
     1095      DEALLOCATE(topswai_aero_s2, solswai_aero_s2)
     1096      DEALLOCATE(topswad0_aero_s2, solswad0_aero_s2)
     1097      DEALLOCATE(topsw_aero_s2, topsw0_aero_s2)
     1098      DEALLOCATE(solsw_aero_s2, solsw0_aero_s2)
     1099      DEALLOCATE(topswcf_aero_s2, solswcf_aero_s2)
     1100!CK LW diagnostics
     1101      DEALLOCATE(toplwad_aero_s2, sollwad_aero_s2)
     1102      DEALLOCATE(toplwai_aero_s2, sollwai_aero_s2)
     1103      DEALLOCATE(toplwad0_aero_s2, sollwad0_aero_s2)
     1104     
    10581105!AI Aerosols
    10591106      DEALLOCATE(m_allaer)
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/phys_output_ctrlout_mod.F90

    r4482 r4647  
    529529  TYPE(ctrl_out), SAVE :: o_tauy = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    530530    'tauy', 'Meridional wind stress', 'Pa', (/ ('', i=1, 10) /))
     531
     532!AI Ecrad 3Deffect
     533#ifdef CPP_ECRAD
     534  TYPE(ctrl_out), SAVE :: o_sols_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     535    'sols_s2', 'Solar rad. at surf.', 'W/m2', (/ ('', i=1, 10) /))
     536  TYPE(ctrl_out), SAVE :: o_sols0_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     537    'sols0_s2', 'Solar rad. at surf.', 'W/m2', (/ ('', i=1, 10) /))
     538  TYPE(ctrl_out), SAVE :: o_soll_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     539    'soll_s2', 'IR rad. at surface', 'W/m2', (/ ('', i=1, 10) /))
     540  TYPE(ctrl_out), SAVE :: o_soll0_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     541    'soll0_s2', 'IR rad. at surface', 'W/m2', (/ ('', i=1, 10) /))
     542  TYPE(ctrl_out), SAVE :: o_tops_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     543    'tops_s2', 'Solar rad. at TOA', 'W/m2', (/ ('', i=1, 10) /))
     544  TYPE(ctrl_out), SAVE :: o_tops0_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     545    'tops0_s2', 'CS Solar rad. at TOA', 'W/m2', (/ ('', i=1, 10) /))
     546  TYPE(ctrl_out), SAVE :: o_topl_s2 = ctrl_out((/ 11, 11, 10, 11, 10, 10, 11, 11, 11, 11/), &
     547    'topl_s2', 'IR rad. at TOA', 'W/m2', (/ ('', i=1, 10) /))
     548  TYPE(ctrl_out), SAVE :: o_topl0_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     549    'topl0_s2', 'IR rad. at TOA', 'W/m2', (/ ('', i=1, 10) /))
     550  TYPE(ctrl_out), SAVE :: o_SWupTOA_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     551    'SWupTOA_s2', 'SWup at TOA', 'W/m2', (/ ('', i=1, 10) /))
     552  TYPE(ctrl_out), SAVE :: o_SWupTOAclr_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     553    'SWupTOAclr_s2', 'SWup clear sky at TOA', 'W/m2', (/ ('', i=1, 10) /))
     554  TYPE(ctrl_out), SAVE :: o_SWupTOAcleanclr_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     555    'SWupTOAcleanclr_s2', 'SWup clear sky clean (no aerosol) at TOA', 'W/m2', (/ ('', i=1, 10) /))
     556  TYPE(ctrl_out), SAVE :: o_SWdnTOA_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     557    'SWdnTOA_s2', 'SWdn at TOA', 'W/m2', (/ ('', i=1, 10) /))
     558  TYPE(ctrl_out), SAVE :: o_SWdnTOAclr_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     559    'SWdnTOAclr_s2', 'SWdn clear sky at TOA', 'W/m2', (/ ('', i=1, 10) /))
     560  TYPE(ctrl_out), SAVE :: o_nettop_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     561    'nettop_s2', 'Net dn radiatif flux at TOA', 'W/m2', (/ ('', i=1, 10) /))
     562  TYPE(ctrl_out), SAVE :: o_LWdnSFC_s2 = ctrl_out((/ 11, 11, 10, 10, 11, 10, 11, 11, 11, 11/), &
     563    'LWdnSFC_s2', 'Down. IR rad. at surface', 'W/m2', (/ ('', i=1, 10) /))
     564  TYPE(ctrl_out), SAVE :: o_LWdnSFCclr_s2 = ctrl_out((/ 11, 11, 10, 10, 11, 10, 11, 11, 11, 11/), &
     565    'LWdnSFCclr_s2', 'Down. CS IR rad. at surface', 'W/m2', (/ ('', i=1, 10) /))
     566  TYPE(ctrl_out), SAVE :: o_SWupSFC_s2 = ctrl_out((/ 11, 11, 10, 10, 11, 10, 11, 11, 11, 11/), &
     567    'SWupSFC_s2', 'SWup at surface', 'W/m2', (/ ('', i=1, 10) /))
     568  TYPE(ctrl_out), SAVE :: o_SWupSFCclr_s2 = ctrl_out((/ 11, 11, 10, 10, 11, 10, 11, 11, 11, 11/), &
     569    'SWupSFCclr_s2', 'SWup clear sky at surface', 'W/m2', (/ ('', i=1, 10) /))
     570  TYPE(ctrl_out), SAVE :: o_SWupSFCcleanclr_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     571    'SWupSFCcleanclr_s2', 'SWup clear sky clean (no aerosol) at surface', 'W/m2', (/ ('', i=1, 10) /))
     572  TYPE(ctrl_out), SAVE :: o_fdiffSWdnSFC_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     573    'fdiffSWdnSFC_s2', 'Fraction of diffuse SWdn at surface', 'W/m2', (/ ('', i=1, 10) /))
     574  TYPE(ctrl_out), SAVE :: o_SWdnSFC_s2 = ctrl_out((/ 11, 11, 11, 10, 11, 10, 11, 11, 11, 11/), &
     575    'SWdnSFC_s2', 'SWdn at surface', 'W/m2', (/ ('', i=1, 10) /))
     576  TYPE(ctrl_out), SAVE :: o_SWdnSFCclr_s2 = ctrl_out((/ 11, 11, 10, 10, 11, 10, 11, 11, 11, 11/), &
     577    'SWdnSFCclr_s2', 'SWdn clear sky at surface', 'W/m2', (/ ('', i=1, 10) /))
     578  TYPE(ctrl_out), SAVE :: o_SWdnSFCcleanclr_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     579    'SWdnSFCcleanclr_s2', 'SWdn clear sky clean (no aerosol) at surface', 'W/m2', (/ ('', i=1, 10) /))
     580  TYPE(ctrl_out), SAVE :: o_LWupSFC_s2 = ctrl_out((/ 11, 11, 10, 10, 11, 10, 11, 11, 11, 11/), &
     581    'LWupSFC_s2', 'Upwd. IR rad. at surface', 'W/m2', (/ ('', i=1, 10) /))
     582  TYPE(ctrl_out), SAVE :: o_LWupSFCclr_s2 = ctrl_out((/ 11, 11, 10, 10, 10, 10, 11, 11, 11, 11/), &
     583    'LWupSFCclr_s2', 'CS Upwd. IR rad. at surface', 'W/m2', (/ ('', i=1, 10) /))
     584  TYPE(ctrl_out), SAVE :: o_LWupTOAcleanclr_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     585    'LWupTOAcleanclr_s2', 'Upward CS clean (no aerosol) IR rad. at TOA', 'W/m2', (/ ('', i=1, 10) /))
     586  TYPE(ctrl_out), SAVE :: o_LWdnSFCcleanclr_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     587    'LWdnSFCcleanclr_s2', 'Downward CS clean (no aerosol) IR rad. at surface', 'W/m2', (/ ('', i=1, 10) /))
     588  TYPE(ctrl_out), SAVE :: o_rsu_s2 = ctrl_out((/ 11, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
     589    'rsu_s2', 'SW upward radiation', 'W m-2', (/ ('', i=1, 10) /))
     590  TYPE(ctrl_out), SAVE :: o_rsd_s2 = ctrl_out((/ 11, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
     591    'rsd_s2', 'SW downward radiation', 'W m-2', (/ ('', i=1, 10) /))
     592  TYPE(ctrl_out), SAVE :: o_rlu_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     593    'rlu_s2', 'LW upward radiation', 'W m-2', (/ ('', i=1, 10) /))
     594  TYPE(ctrl_out), SAVE :: o_rld_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     595    'rld_s2', 'LW downward radiation', 'W m-2', (/ ('', i=1, 10) /))
     596  TYPE(ctrl_out), SAVE :: o_rsucs_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     597    'rsucs_s2', 'SW CS upward radiation', 'W m-2', (/ ('', i=1, 10) /))
     598  TYPE(ctrl_out), SAVE :: o_rsdcs_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     599    'rsdcs_s2', 'SW CS downward radiation', 'W m-2', (/ ('', i=1, 10) /))
     600  TYPE(ctrl_out), SAVE :: o_rlucs_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     601    'rlucs_s2', 'LW CS upward radiation', 'W m-2', (/ ('', i=1, 10) /))
     602  TYPE(ctrl_out), SAVE :: o_rldcs_s2 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     603    'rldcs_s2', 'LW CS downward radiation', 'W m-2', (/ ('', i=1, 10) /))
     604#endif
    531605
    532606  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_taux_srf = (/           &
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/phys_output_write_mod.F90

    r4482 r4647  
    236236#endif
    237237
     238#ifdef CPP_ECRAD
     239    USE phys_output_ctrlout_mod, ONLY:  &
     240         o_soll0_s2,o_soll_s2,o_sols0_s2,o_sols_s2, &
     241         o_topl0_s2,o_topl_s2,o_tops0_s2,o_tops_s2
     242#endif
     243
    238244    USE ice_sursat_mod, ONLY: flight_m, flight_h2o
    239245   
     
    272278#endif
    273279         dt_ns, delta_sst, dter, dser
     280
     281! AI 08 2023 pour ECRAD 3Deffect
     282#ifdef CPP_ECRAD
     283    USE phys_state_var_mod, ONLY: &
     284        sollw0_s2,sollw_s2,solsw0_s2,solsw_s2, &
     285        toplw0_s2,toplw_s2,topsw0_s2,topsw_s2
     286#endif
    274287
    275288    USE phys_local_var_mod, ONLY: zxfluxlat, slp, ptstar, pt0, zxtsol, zt2m, &
     
    10681081       ENDIF
    10691082
     1083!AI 08 2023 Ecrad 3Deffect
     1084#ifdef CPP_ECRAD
     1085     if (ok_3Deffect) then
     1086        IF (vars_defined) THEN
     1087          zx_tmp_fi2d = solsw_s2*swradcorr
     1088       ENDIF
     1089       CALL histwrite_phy(o_sols_s2, zx_tmp_fi2d)
     1090       IF (vars_defined) THEN
     1091          zx_tmp_fi2d = solsw0_s2*swradcorr
     1092       ENDIF
     1093       CALL histwrite_phy(o_sols0_s2, zx_tmp_fi2d)
     1094       CALL histwrite_phy(o_soll_s2, sollw_s2)
     1095       CALL histwrite_phy(o_soll0_s2, sollw0_s2)
     1096       IF (vars_defined) THEN
     1097         zx_tmp_fi2d = topsw_s2*swradcorr
     1098       ENDIF
     1099       CALL histwrite_phy(o_tops_s2, zx_tmp_fi2d)
     1100
     1101       IF (vars_defined) THEN
     1102         zx_tmp_fi2d = topsw0_s2*swradcorr
     1103       ENDIF
     1104       CALL histwrite_phy(o_tops0_s2, zx_tmp_fi2d)
     1105
     1106       CALL histwrite_phy(o_topl_s2, toplw_s2)
     1107       CALL histwrite_phy(o_topl0_s2, toplw0_s2)
     1108     endif
     1109#endif       
     1110
    10701111       CALL histwrite_phy(o_bils, bils)
    10711112       CALL histwrite_phy(o_bils_diss, bils_diss)
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/phys_state_var_mod.F90

    r4482 r4647  
    397397!$OMP THREADPRIVATE(swdnc0p, swdn0p, swdnp, swupc0p, swup0p, swupp)
    398398
     399!AI ajout variables double appel Ecrad (3Deffect)
     400      REAL,ALLOCATABLE,SAVE :: heat_s2(:,:), cool_s2(:,:)
     401!$OMP THREADPRIVATE(heat_s2, cool_s2)
     402      REAL,ALLOCATABLE,SAVE :: heat0_s2(:,:), cool0_s2(:,:)
     403!$OMP THREADPRIVATE(heat0_s2, cool0_s2)
     404      REAL,ALLOCATABLE,SAVE :: radsol_s2(:), topsw_s2(:), toplw_s2(:)
     405!$OMP THREADPRIVATE(radsol_s2, topsw_s2, toplw_s2)
     406      REAL,ALLOCATABLE,SAVE :: albpla_s2(:)
     407!$OMP THREADPRIVATE(albpla_s2)
     408      REAL,ALLOCATABLE,SAVE :: solsw_s2(:), solswfdiff_s2(:), sollw_s2(:)
     409!$OMP THREADPRIVATE(solsw_s2, solswfdiff_s2, sollw_s2)
     410      REAL,ALLOCATABLE,SAVE :: sollwdown_s2(:)
     411!$OMP THREADPRIVATE(sollwdown_s2)
     412      REAL,ALLOCATABLE,SAVE :: topsw0_s2(:),toplw0_s2(:)
     413      REAL,ALLOCATABLE,SAVE :: solsw0_s2(:),sollw0_s2(:)
     414!$OMP THREADPRIVATE(topsw0_s2,toplw0_s2,solsw0_s2,sollw0_s2)
     415      REAL,ALLOCATABLE,SAVE :: lwdnc0_s2(:,:), lwdn0_s2(:,:), lwdn_s2(:,:)
     416      REAL,ALLOCATABLE,SAVE :: lwupc0_s2(:,:), lwup0_s2(:,:), lwup_s2(:,:)
     417!$OMP THREADPRIVATE(lwdnc0_s2,lwdn0_s2,lwdn_s2,lwupc0_s2,lwup0_s2,lwup_s2)       
     418      REAL,ALLOCATABLE,SAVE :: swdnc0_s2(:,:), swdn0_s2(:,:), swdn_s2(:,:)
     419      REAL,ALLOCATABLE,SAVE :: swupc0_s2(:,:), swup0_s2(:,:), swup_s2(:,:)
     420!$OMP THREADPRIVATE(swdnc0_s2, swdn0_s2, swdn_s2, swupc0_s2, swup0_s2, swup_s2)
     421
    399422! pbase : cloud base pressure
    400423! bbase : cloud base buoyancy
     
    693716      ALLOCATE(swdnc0p(klon,klevp1), swdn0p(klon,klevp1), swdnp(klon,klevp1))
    694717      ALLOCATE(swupc0p(klon,klevp1), swup0p(klon,klevp1), swupp(klon,klevp1))
     718
     719!AI Ajout pour Ecrad (3Deffect)       
     720      ALLOCATE(heat_s2(klon,klev), cool_s2(klon,klev))
     721      ALLOCATE(heat0_s2(klon,klev), cool0_s2(klon,klev))
     722      ALLOCATE(radsol_s2(klon), topsw_s2(klon), toplw_s2(klon))
     723      ALLOCATE(albpla_s2(klon))
     724      ALLOCATE(solsw_s2(klon), solswfdiff_s2(klon), sollw_s2(klon))
     725      ALLOCATE(sollwdown_s2(klon))
     726      ALLOCATE(topsw0_s2(klon),toplw0_s2(klon))
     727      ALLOCATE(solsw0_s2(klon),sollw0_s2(klon))
     728      ALLOCATE(lwdnc0_s2(klon,klevp1), lwdn0_s2(klon,klevp1), lwdn_s2(klon,klevp1))
     729      ALLOCATE(lwupc0_s2(klon,klevp1), lwup0_s2(klon,klevp1), lwup_s2(klon,klevp1))
     730      ALLOCATE(swdnc0_s2(klon,klevp1), swdn0_s2(klon,klevp1), swdn_s2(klon,klevp1))
     731      ALLOCATE(swupc0_s2(klon,klevp1), swup0_s2(klon,klevp1), swup_s2(klon,klevp1))
    695732
    696733      ALLOCATE(cape(klon))
     
    851888      DEALLOCATE(topsw0,toplw0,solsw0,sollw0)
    852889      DEALLOCATE(albpla)
     890
     891!AI Ajout pour Ecrad (3Deffect)
     892      DEALLOCATE(heat_s2, cool_s2)
     893      DEALLOCATE(heat0_s2, cool0_s2)
     894      DEALLOCATE(radsol_s2, topsw_s2, toplw_s2)
     895      DEALLOCATE(albpla_s2)
     896      DEALLOCATE(solsw_s2, solswfdiff_s2, sollw_s2)
     897      DEALLOCATE(sollwdown_s2)
     898      DEALLOCATE(topsw0_s2,toplw0_s2)
     899      DEALLOCATE(solsw0_s2,sollw0_s2)
     900      DEALLOCATE(lwdnc0_s2, lwdn0_s2, lwdn_s2)
     901      DEALLOCATE(lwupc0_s2, lwup0_s2, lwup_s2)
     902      DEALLOCATE(swdnc0_s2, swdn0_s2, swdn_s2)
     903      DEALLOCATE(swupc0_s2, swup0_s2, swup_s2)
     904     
    853905!IM ajout variables CFMIP2/CMIP5
    854906      DEALLOCATE(heatp, coolp)
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/physiq_mod.F90

    r4482 r4647  
    209209       toplwai_aerop, sollwai_aerop,   &
    210210       toplwad0_aerop, sollwad0_aerop, &
    211        !
     211!
     212       !pour Ecrad
     213       topswad_aero_s2, solswad_aero_s2,   &
     214       topswai_aero_s2, solswai_aero_s2,   &
     215       topswad0_aero_s2, solswad0_aero_s2, &
     216       topsw_aero_s2, topsw0_aero_s2,      &
     217       solsw_aero_s2, solsw0_aero_s2,      &
     218       topswcf_aero_s2, solswcf_aero_s2,   &
     219       !LW diagnostics
     220       toplwad_aero_s2, sollwad_aero_s2,   &
     221       toplwai_aero_s2, sollwai_aero_s2,   &
     222       toplwad0_aero_s2, sollwad0_aero_s2, &
     223!
    212224       ptstar, pt0, slp, &
    213225       !
     
    14351447       WRITE(lunout,*) 'Call to infocfields from physiq'
    14361448       CALL infocfields_init
     1449
     1450!AI 08 2023       
     1451#ifdef CPP_ECRAD
     1452       ok_3Deffect=.false.
     1453       CALL getin_p('ok_3Deffect',ok_3Deffect)
     1454       namelist_ecrad_file='namelist_ecrad'
     1455#endif           
    14371456
    14381457    ENDIF
     
    44504469                     ZSWFT0_i, ZFSDN0, ZFSUP0)
    44514470          ENDIF !ok_4xCO2atm
     4471
     4472! A.I aout 2023
     4473! Effet 3D des nuages Ecrad
     4474#ifdef CPP_ECRAD
     4475          IF (ok_3Deffect) then
     4476                namelist_ecrad_file='namelist_ecrad_s2'
     4477                CALL radlwsw &
     4478                     (dist, rmu0, fract,  &
     4479                     paprs, pplay,zxtsol,SFRWL,albsol_dir, albsol_dif, &
     4480                     t_seri,q_seri,wo, &
     4481                     cldfrarad, cldemirad, cldtaurad, &
     4482                     ok_ade.OR.flag_aerosol_strat.GT.0, ok_aie,  ok_volcan, flag_volc_surfstrat, &
     4483                     flag_aerosol, flag_aerosol_strat, flag_aer_feedback, &
     4484                     tau_aero, piz_aero, cg_aero, &
     4485                     tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm, &
     4486                     tau_aero_lw_rrtm, &
     4487                     cldtaupi, &
     4488                     zqsat, flwc, fiwc, &
     4489                     ref_liq, ref_ice, ref_liq_pi, ref_ice_pi, &
     4490                     heat_s2,heat0_s2,cool_s2,cool0_s2,albpla_s2, &
     4491                     heat_volc,cool_volc, &
     4492                     topsw_s2,toplw_s2,solsw_s2,solswfdiff_s2,sollw_s2, &
     4493                     sollwdown_s2, &
     4494                     topsw0_s2,toplw0_s2,solsw0_s2,sollw0_s2, &
     4495                     lwdnc0_s2, lwdn0_s2, lwdn_s2, lwupc0_s2, lwup0_s2, lwup_s2,  &
     4496                     swdnc0_s2, swdn0_s2, swdn_s2, swupc0_s2, swup0_s2, swup_s2, &
     4497                     topswad_aero_s2, solswad_aero_s2, &
     4498                     topswai_aero_s2, solswai_aero_s2, &
     4499                     topswad0_aero_s2, solswad0_aero_s2, &
     4500                     topsw_aero_s2, topsw0_aero_s2, &
     4501                     solsw_aero_s2, solsw0_aero_s2, &
     4502                     topswcf_aero_s2, solswcf_aero_s2, &
     4503                                !-C. Kleinschmitt for LW diagnostics
     4504                     toplwad_aero_s2, sollwad_aero_s2,&
     4505                     toplwai_aero_s2, sollwai_aero_s2, &
     4506                     toplwad0_aero_s2, sollwad0_aero_s2,&
     4507                                !-end
     4508                     ZLWFT0_i, ZFLDN0, ZFLUP0, &
     4509                     ZSWFT0_i, ZFSDN0, ZFSUP0)
     4510                namelist_ecrad_file='namelist_ecrad'
     4511          ENDIF ! ok_3Deffect
     4512#endif                 
     4513         
    44524514       ENDIF ! aerosol_couple
    44534515       itaprad = 0
  • LMDZ6/branches/LMDZ_ECRad/libf/phylmd/radlwsw_m.F90

    r4482 r4647  
    13481348      CALL RADIATION_SCHEME &
    13491349      & (ist, iend, klon, klev, naero_grp, NSW, &
     1350      & namelist_ecrad_file, ok_3Deffect, &
    13501351      & day_cur, current_time, &
    13511352!       Cste solaire/(d_Terre-Soleil)**2
Note: See TracChangeset for help on using the changeset viewer.