Ignore:
Timestamp:
Aug 25, 2017, 2:06:32 AM (7 years ago)
Author:
aslmd
Message:

LES. corrected module_initialize_les so that it works again on Mars, while hopefully keeping it in version suitable for Venus and prescribed. The latter is to be checked, but the former gives similar results to 1438 on an InSight? test case. Adopted logp interpolation for Mars (does not change a lot, only to something like 5th digit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE/LMD_MM_MARS/SRC/LES/modif_mars/module_initialize_les.F

    r1749 r1767  
    126126      !INTEGER :: hypsometric_opt = 2 ! Wee et al. 2012 correction
    127127
     128      LOGICAL :: logp = .true. ! use logp to interpolate (and not p)
    128129
    129130#ifdef DM_PARALLEL
    130131#    include <data_calls.inc>
    131132#endif
     133
    132134
    133135   SELECT CASE ( model_data_order )
     
    171173   END SELECT
    172174
    173 
    174    !stretch_grid = .false.
    175 !  FOR LES, set stretch to false
    176    stretch_grid = .true.
     175   IF (planet == "mars") THEN
     176     stretch_grid = .false.
     177     !! FOR LES, set stretch to false
     178   ELSE
     179     stretch_grid = .true. !! VENUS
     180   ENDIF
    177181   delt = 3.
    178182!   z_scale = .50
     
    242246   grid%step_number = 0
    243247
    244 !! set up the grid
    245 !
     248! set up the grid
     249
    246250   IF (stretch_grid) THEN ! exponential stretch for eta (nearly constant dz)
    247251     DO k=1, kde
     
    249253                                (1.-exp(-1./z_scale))
    250254     ENDDO
    251    ELSE
    252 !
    253 !!!!MARS
    254 !grid%znw(1)=1.000
    255 !grid%znw(2)=0.9995 !5m
    256 !grid%znw(3)=0.9980 !20m
    257 !grid%znw(4)=0.9950 !55m
    258 !DO k=5, kde
    259 !   grid%znw(k) = grid%znw(4) * ( 1. - float(k-4)/float(kde-4) )
    260 !ENDDO
    261 !!!!!MARS
    262 !!!
    263 !!     DO k=1, kde
    264 !!      grid%znw(k) = 1. - float(k-1)/float(kde-1)
    265 !!     ENDDO
    266 !
    267 !   ENDIF
    268 
    269 !!MARS
    270 !!MARS
    271   open(unit=12,file='levels',form='formatted',status='old')
    272   rewind(12)
    273   DO k=1, kde
    274   read(12,*) grid%znw(k)
    275   write(6,*) 'read level ', k,grid%znw(k)
    276   ENDDO
    277   close(12)
    278 !!MARS
    279 !!MARS
    280      ENDIF
     255   ENDIF
     256   !ELSE
     257   !  !DO k=1, kde
     258   !  ! grid%znw(k) = 1. - float(k-1)/float(kde-1)
     259   !  !ENDDO
     260
     261
     262   IF (planet == "mars") THEN
     263     !!!MARS
     264     grid%znw(1)=1.000
     265     grid%znw(2)=0.9995 !5m
     266     grid%znw(3)=0.9980 !20m
     267     grid%znw(4)=0.9950 !55m
     268     DO k=5, kde
     269       grid%znw(k) = grid%znw(4) * ( 1. - float(k-4)/float(kde-4) )
     270     ENDDO
     271!!!MARS
     272!!!MARS
     273!  open(unit=12,file='levels',form='formatted',status='old')
     274!  rewind(12)
     275!  DO k=1, kde
     276!  read(12,*) grid%znw(k)
     277!  write(6,*) 'read level ', k,grid%znw(k)
     278!  ENDDO
     279!  close(12)
     280!!!MARS
     281!!!MARS
     282   ENDIF
     283
    281284
    282285   DO k=1, kde-1
     
    422425  ENDDO
    423426
     427  IF (.not.logp) THEN
     428    write(6,*) 'interpolate in p'
     429  ELSE
     430    write(6,*) 'interpolate in logp'
     431  ENDIF
     432
    424433  DO J = jts, jte
    425434  DO I = its, ite
     
    434443      p_level = grid%znu(k)*(p_surf - grid%p_top) + grid%p_top
    435444      grid%pb(i,k,j) = p_level
     445     IF (.not.logp) THEN
     446      grid%t_init(i,k,j) = interp_0( theta, p_in, p_level, nl_in ) - t0
     447     ELSE
    436448      grid%t_init(i,k,j) = interp_0_log( theta, p_in, p_level, nl_in ) - t0
     449     ENDIF
    437450      grid%alb(i,k,j) = (r_d/p1000mb)*(grid%t_init(i,k,j)+t0)*(grid%pb(i,k,j)/p1000mb)**cvpm
    438451    ENDDO
     
    489502
    490503      p_level = grid%znu(k)*(pd_surf - grid%p_top) + grid%p_top
    491 
     504     IF (.not.logp) THEN
     505      moist(i,k,j,P_QV) = interp_0( qv, pd_in, p_level, nl_in )
     506      grid%t_1(i,k,j)          = interp_0( theta, pd_in, p_level, nl_in ) - t0
     507     ELSE
    492508      moist(i,k,j,P_QV) = interp_0_log( qv, pd_in, p_level, nl_in )
    493509      grid%t_1(i,k,j)          = interp_0_log( theta, pd_in, p_level, nl_in ) - t0
     510     ENDIF
    494511      grid%t_2(i,k,j)          = grid%t_1(i,k,j)
    495512     
     
    693710    DO K = 1, kte-1
    694711      p_level = grid%znu(k)*(p_surf - grid%p_top) + grid%p_top
     712     IF (.not.logp) THEN
     713      grid%v_1(i,k,j) = interp_0( v, p_in, p_level, nl_in )
     714     ELSE
    695715      grid%v_1(i,k,j) = interp_0_log( v, p_in, p_level, nl_in )
     716     ENDIF
    696717      grid%v_2(i,k,j) = grid%v_1(i,k,j)
    697718    ENDDO
     
    717738    DO K = 1, kte-1
    718739      p_level = grid%znu(k)*(p_surf - grid%p_top) + grid%p_top
     740     IF (.not.logp) THEN
     741      grid%u_1(i,k,j) = interp_0( u, p_in, p_level, nl_in )
     742     ELSE
    719743      grid%u_1(i,k,j) = interp_0_log( u, p_in, p_level, nl_in )
     744     ENDIF
    720745      grid%u_2(i,k,j) = grid%u_1(i,k,j)
    721746    ENDDO
     
    846871      DO k=1,kte-1
    847872         p_level = grid%znu(k)*(pd_surf - grid%p_top) + grid%p_top
     873        IF (.not.logp) THEN
     874         scalar(its:ite,k,jts:jte,2) = interp_0( qv, pd_in, p_level, nl_in )
     875        ELSE
    848876         scalar(its:ite,k,jts:jte,2) = interp_0_log( qv, pd_in, p_level, nl_in )
     877        ENDIF
    849878         scalar(its:ite,k,jts:jte,3) = 0.
    850879           !! water ice is set to 0 (was put into water vapor when building prof from MCD)
     
    861890      DO k=1,kte-1
    862891         p_level = grid%znu(k)*(pd_surf - grid%p_top) + grid%p_top
     892        IF (.not.logp) THEN
     893         scalar(its:ite,k,jts:jte,4) = interp_0( profdustq, pd_in, p_level,nl_in )
     894         scalar(its:ite,k,jts:jte,5) = interp_0( profdustn, pd_in, p_level,nl_in )
     895        ELSE
    863896         scalar(its:ite,k,jts:jte,4) = interp_0_log( profdustq, pd_in, p_level, nl_in )
    864897         scalar(its:ite,k,jts:jte,5) = interp_0_log( profdustn, pd_in, p_level, nl_in )
     898        ENDIF
    865899      ENDDO
    866900      print *, "DUST Q", scalar(its,:,jts,4)
     
    875909!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    876910!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     911   IF (planet .ne. "mars") THEN
    877912    call read_dust(profdustq,profdustn,nl_in)
    878913    DO k=1,kte!-1
     
    888923       !print*,k,grid%m_q2(1,k,1)
    889924    ENDDO
     925   ENDIF
    890926
    891927    IF (planet.eq."prescribed") Then
     
    917953      ENDDO
    918954      close(unit=20)
    919     ENDIF
    920955
    921956    open(unit=21,file="altitude.txt",action="write")
     
    926961    ENDDO
    927962    close(unit=21)
     963    ENDIF
    928964
    929965!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    10021038      real qvf, qvf1, dz
    10031039
    1004       LOGICAL :: direct_from_file = .true.
     1040      LOGICAL :: direct_from_file
     1041
     1042      IF (planet == "mars") THEN
     1043        direct_from_file = .false.
     1044      ELSE
     1045        direct_from_file = .true.
     1046      ENDIF
    10051047
    10061048!  first, read the sounding
Note: See TracChangeset for help on using the changeset viewer.