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

    r4773 r4853  
    1515!
    1616
     17#include "ecrad_config.h"
     18
    1719module radiation_ecckd
    1820
     
    105107! Vectorized version of the optical depth look-up performs better on
    106108! NEC, but slower on x86
    107 #ifdef __SX__
     109#ifdef DWD_VECTOR_OPTIMIZATIONS
    108110    procedure :: calc_optical_depth => calc_optical_depth_ckd_model_vec
    109111#else
     
    125127  subroutine read_ckd_model(this, filename, iverbose)
    126128
    127     use easy_netcdf,  only : netcdf_file
     129#ifdef EASY_NETCDF_READ_MPI
     130    use easy_netcdf_read_mpi, only : netcdf_file
     131#else
     132    use easy_netcdf,          only : netcdf_file
     133#endif
    128134    !use radiation_io, only : nulerr, radiation_abort
    129     use yomhook,      only : lhook, dr_hook, jphook
     135    use yomhook,              only : lhook, dr_hook, jphook
    130136
    131137    class(ckd_model_type), intent(inout) :: this
     
    166172    this%d_log_pressure = log(pressure_lut(2)) - this%log_pressure1
    167173    call file%get('temperature', temperature_full)
    168     ! AI oct 2023 ajout pour le double appel de ecrad   
    169     if (allocated(this%temperature1)) deallocate(this%temperature1)
    170174    allocate(this%temperature1(this%npress));
    171175    this%temperature1 = temperature_full(:,1)
     
    200204    ! Read gases
    201205    call file%get('n_gases', this%ngas)
    202     if (allocated(this%single_gas)) deallocate(this%single_gas)
    203206    allocate(this%single_gas(this%ngas))
    204207    call file%get_global_attribute('constituent_id', constituent_id)
     
    292295  subroutine read_spectral_solar_cycle(this, filename, iverbose, use_updated_solar_spectrum)
    293296
    294     use easy_netcdf,  only : netcdf_file
    295     use radiation_io, only : nulout, nulerr, radiation_abort
    296     use yomhook,      only : lhook, dr_hook, jphook
     297#ifdef EASY_NETCDF_READ_MPI
     298    use easy_netcdf_read_mpi, only : netcdf_file
     299#else
     300    use easy_netcdf,          only : netcdf_file
     301#endif
     302    use radiation_io,         only : nulout, nulerr, radiation_abort
     303    use yomhook,              only : lhook, dr_hook, jphook
    297304
    298305    ! Reference total solar irradiance (W m-2)
     
    450457  subroutine calc_optical_depth_ckd_model(this, ncol, nlev, istartcol, iendcol, nmaxgas, &
    451458       &  pressure_hl, temperature_fl, mole_fraction_fl, &
    452        &  optical_depth_fl, rayleigh_od_fl)
     459       &  optical_depth_fl, rayleigh_od_fl, concentration_scaling)
    453460
    454461    use yomhook,             only : lhook, dr_hook, jphook
     
    466473    ! Gas mole fractions at full levels (mol mol-1), dimensioned (ncol,nlev,nmaxgas)
    467474    real(jprb),            intent(in)  :: mole_fraction_fl(ncol,nlev,nmaxgas)
     475    ! Optional concentration scaling of each gas
     476    real(jprb), optional,  intent(in)  :: concentration_scaling(nmaxgas)
    468477   
    469478    ! Output variables
     
    486495
    487496    real(jprb) :: multiplier(nlev), simple_multiplier(nlev), global_multiplier, temperature1
     497    real(jprb) :: scaling
    488498
    489499    ! Indices and weights in temperature, pressure and concentration interpolation
     
    547557            multiplier = simple_multiplier * mole_fraction_fl(jcol,:,igascode)
    548558
     559            if (present(concentration_scaling)) then
     560              multiplier = multiplier * concentration_scaling(igascode)
     561            end if
     562           
    549563            do jlev = 1,nlev
    550564              optical_depth_fl(:,jlev,jcol) = optical_depth_fl(:,jlev,jcol) &
     
    557571          case (IConcDependenceRelativeLinear)
    558572            molar_abs => this%single_gas(jgas)%molar_abs
    559             multiplier = simple_multiplier  * (mole_fraction_fl(jcol,:,igascode) &
    560                  &                            - single_gas%reference_mole_frac)
     573
     574            if (present(concentration_scaling)) then
     575              multiplier = simple_multiplier &
     576                   &  * (mole_fraction_fl(jcol,:,igascode)*concentration_scaling(igascode) &
     577                   &     - single_gas%reference_mole_frac)
     578            else
     579              multiplier = simple_multiplier  * (mole_fraction_fl(jcol,:,igascode) &
     580                   &                            - single_gas%reference_mole_frac)
     581            end if
     582           
    561583            do jlev = 1,nlev
    562584              optical_depth_fl(:,jlev,jcol) = optical_depth_fl(:,jlev,jcol) &
     
    579601
    580602          case (IConcDependenceLUT)
     603
     604            if (present(concentration_scaling)) then
     605              scaling = concentration_scaling(igascode)
     606            else
     607              scaling = 1.0_jprb
     608            end if
     609           
    581610            ! Logarithmic interpolation in concentration space
    582611            molar_abs_conc => this%single_gas(jgas)%molar_abs_conc
     
    584613            do jlev = 1,nlev
    585614              ! Take care of mole_fraction == 0
    586               log_conc = log(max(mole_fraction_fl(jcol,jlev,igascode), mole_frac1))
     615              log_conc = log(max(mole_fraction_fl(jcol,jlev,igascode)*scaling, mole_frac1))
    587616              cindex1  = (log_conc - single_gas%log_mole_frac1) / single_gas%d_log_mole_frac
    588617              cindex1  = 1.0_jprb + max(0.0_jprb, min(cindex1, single_gas%n_mole_frac-1.0001_jprb))
     
    601630            do jlev = 1,nlev
    602631              optical_depth_fl(:,jlev,jcol) = optical_depth_fl(:,jlev,jcol) &
    603                    &  + (simple_multiplier(jlev) * mole_fraction_fl(jcol,jlev,igascode)) * ( &
     632                   &  + (simple_multiplier(jlev) * mole_fraction_fl(jcol,jlev,igascode) * scaling) * ( &
    604633                   &      (cw1(jlev) * tw1(jlev) * pw1(jlev)) * molar_abs_conc(:,ip1(jlev),it1(jlev),ic1(jlev)) &
    605634                   &     +(cw1(jlev) * tw1(jlev) * pw2(jlev)) * molar_abs_conc(:,ip1(jlev)+1,it1(jlev),ic1(jlev)) &
Note: See TracChangeset for help on using the changeset viewer.