Ignore:
Timestamp:
Feb 17, 2020, 5:44:12 PM (5 years ago)
Author:
jvatant
Message:

+ Update the interface with YAMMS so it now correctly handles the small values of the moments,
requiring dynamics to have a threshold quite low (set to 1D-200) and a sanity check in calmufi
corresponding to this value. Thus it removes 'most' of the unphysical radius obtained in
YAMMS. There are still some, but at least there is no more problem of model stability for the moments
and the code can run.
Still, take care the day you want to calculate opacities from the radii and not the moments.
Although, note that there are some negative values, in the output files, but theses negatives are

harmless, as they are only present in output files, dynamics reseting to epsilon after.

+ Given theses pbs with the radii, also update the optics so that it computes the opacities in
a simpler way, directly for M3, through look-up tables, M3 being a good proxy.
--JVO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/phytitan/optci.F90

    r2133 r2242  
    66                         tgasref,pfgasref,wnoi,scalep,indi
    77  use gases_h
     8  use datafile_mod, only: haze_opt_file
    89  use comcstfi_mod, only: r
    910  use callkeys_mod, only: continuum,graybody,corrk_recombin,               &
    1011                          callclouds,callmufi,seashaze,uncoupl_optic_haze
    1112  use tracer_h, only : nmicro,nice
    12   use MMP_OPTICS
    1313
    1414  implicit none
     
    8383  ! variables for k in units m^-1
    8484  real*8 dz(L_LEVELS)
    85   !real*8 rho !! see test below
    8685
    8786  integer igas, jgas, ilay
     
    8988  integer interm
    9089
    91   real*8 m0as,m3as,m0af,m3af
    92   real*8 ext_s,sca_s,ssa_s,asf_s
    93   real*8 ext_f,sca_f,ssa_f,asf_f
     90  ! Variables for haze optics
     91  character(len=200) file_path
     92  logical file_ok
     93  integer dumch
     94  real*8  dumwvl
     95
     96  real*8 m3as,m3af
     97  real*8 dtauaer_s,dtauaer_f
     98  real*8,save :: rhoaer_s(L_NSPECTI),ssa_s(L_NSPECTI),asf_s(L_NSPECTI)
     99  real*8,save :: rhoaer_f(L_NSPECTI),ssa_f(L_NSPECTI),asf_f(L_NSPECTI)
     100!$OMP THREADPRIVATE(rhoaer_s,rhoaer_f,ssa_s,ssa_f,asf_s,asf_f)
     101
    94102  logical,save :: firstcall=.true.
    95   !$OMP THREADPRIVATE(firstcall)
     103!$OMP THREADPRIVATE(firstcall)
     104
    96105
    97106  !! AS: to save time in computing continuum (see bilinearbig)
     
    101110  ENDIF
    102111
    103   ! Some initialisation beacause there's a pb with disr_haze at the limits (nw=1)
     112  ! Some initialisation because there's a pb with disr_haze at the limits (nw=1)
    104113  ! I should check this - For now we set vars to zero : better than nans - JVO 2017
    105  
    106   dhaze_t(:,:) = 0.
    107   ssa_t(:,:) = 0.
    108   asf_t(:,:) = 0.
     114  DHAZE_T(:,:) = 0.0
     115  SSA_T(:,:)   = 0.0
     116  ASF_T(:,:)   = 0.0
     117
     118  ! Load tabulated haze optical properties if needed.
     119  ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     120  IF (firstcall .AND. callmufi .AND. (.NOT. uncoupl_optic_haze)) THEN
     121     OPEN(12,file=TRIM(haze_opt_file),form='formatted') ! The file has been inquired in physiq_mod firstcall
     122     READ(12,*) ! dummy header
     123     DO NW=1,L_NSPECTI
     124       READ(12,*) dumch, dumwvl, rhoaer_f(nw), ssa_f(nw), asf_f(nw), rhoaer_s(nw), ssa_s(nw), asf_s(nw)
     125     ENDDO
     126     CLOSE(12)
     127  ENDIF
    109128
    110129  !=======================================================================
     
    118137  do K=2,L_LEVELS
    119138 
    120      ilay = k / 2 ! int. arithmetic => gives the gcm layer index
     139     ilay = L_NLAYRAD+1 - k/2 ! int. arithmetic => gives the gcm layer index (reversed)
    121140     
    122141     DPR(k) = PLEV(K)-PLEV(K-1)
     
    137156     do K=2,L_LEVELS
    138157     
    139         ilay = k / 2 ! int. arithmetic => gives the gcm layer index
     158        ilay = L_NLAYRAD+1 - k/2 ! int. arithmetic => gives the gcm layer index (reversed)
    140159       
    141         ! Optical coupling of YAMMS is plugged but inactivated for now
    142         ! as long as the microphysics only isn't fully debugged -- JVO 01/18
    143160        IF (callmufi .AND. (.NOT. uncoupl_optic_haze)) THEN
    144           m0as = pqmo(ilay,1)
    145           m3as = pqmo(ilay,2)
    146           m0af = pqmo(ilay,3)
    147           m3af = pqmo(ilay,4)
    148 
    149           IF (.NOT.mmp_sph_optics_ir(m0as,m3as,nw,ext_s,sca_s,ssa_s,asf_s)) &
    150           CALL abort_gcm("optcv", "Fatal error in mmp_sph_optics_ir", 12)
    151           IF (.NOT.mmp_fra_optics_ir(m0af,m3af,nw,ext_f,sca_f,ssa_f,asf_f)) &
    152           CALL abort_gcm("optcv", "Fatal error in mmp_fra_optics_ir", 12)
    153           dhaze_T(k,nw) = ext_s+ext_f
    154           SSA_T(k,nw)   = (sca_s+sca_f)/dhaze_T(k,nw)
    155           ASF_T(k,nw)   = (asf_s*sca_s + asf_f*sca_f) /(sca_s+sca_f)
     161          m3as = pqmo(ilay,2) / 2.0
     162          m3af = pqmo(ilay,4) / 2.0
     163         
     164          IF ( ilay .lt. 18 ) THEN
     165            m3as = pqmo(18,2) / 2.0 *dz(k)/dz(18)
     166            m3af = pqmo(18,4) / 2.0 *dz(k)/dz(18)
     167          ENDIF
     168
     169          dtauaer_s     = m3as*rhoaer_s(nw)
     170          dtauaer_f     = m3af*rhoaer_f(nw)
     171          DHAZE_T(k,nw) = dtauaer_s + dtauaer_f
     172         
     173          IF ( dtauaer_s + dtauaer_f .GT. 1.D-30 ) THEN
     174            SSA_T(k,nw)   = ( dtauaer_s*ssa_s(nw) + dtauaer_f*ssa_f(nw) ) / ( dtauaer_s+dtauaer_f )
     175            ASF_T(k,nw)   = ( dtauaer_s*ssa_s(nw)*asf_s(nw) + dtauaer_f*ssa_f(nw)*asf_f(nw) )  &
     176                            / ( ssa_s(nw)*dtauaer_s + ssa_f(nw)*dtauaer_f )
     177          ELSE
     178             DHAZE_T(k,nw) = 0.D0
     179             SSA_T(k,nw)   = 1.0
     180             ASF_T(k,nw)   = 1.0
     181          ENDIF
     182         
    156183          IF (callclouds.and.firstcall) &
    157184            WRITE(*,*) 'WARNING: In optci, optical properties &
     
    159186        ELSE
    160187          ! Call fixed vertical haze profile of extinction - same for all columns
    161           call disr_haze(dz(k),plev(k),wnoi(nw),dhaze_T(k,nw),SSA_T(k,nw),ASF_T(k,nw))
    162           if (seashaze) dhaze_T(k,nw) = dhaze_T(k,nw)*seashazefact(k)
     188          call disr_haze(dz(k),plev(k),wnoi(nw),DHAZE_T(k,nw),SSA_T(k,nw),ASF_T(k,nw))
     189          if (seashaze) DHAZE_T(k,nw) = DHAZE_T(k,nw)*seashazefact(k)
    163190        ENDIF
    164191
Note: See TracChangeset for help on using the changeset viewer.