Ignore:
Timestamp:
Feb 4, 2019, 3:22:38 PM (6 years ago)
Author:
mlefevre
Message:

MESOSCALE. Argurment of lmd_driver was called twice and a interpolation function was missing

Location:
trunk/MESOSCALE/LMD_MM_MARS/SRC
Files:
2 edited

Legend:

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

    r2018 r2088  
    672672     &       ,LATENT_HF=grid%LATENT_HF  &
    673673     &       ,SWDOWNZ=grid%SWDOWNZ   &
    674      &       ,SWDOWNZ=grid%SWDOWNZ   &
    675674     &       ,TAU_DUST=grid%TAU_DUST   &
    676675     &       ,RDUST=grid%RDUST   &
  • trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/dyn_em/module_init_utilities.F

    r1724 r2088  
    179179 END FUNCTION interp_0_log
    180180
     181 real function interp_0_log2( v_in,  &
     182                         p_in, p_out, nz_in  )
     183 implicit none
     184 integer nz_in, nz_out
     185 real*8  v_in(nz_in)
     186 real*8  p_in(nz_in)
     187 real*8  p_out
     188
     189 integer kp, k, im, ip
     190 logical interp, increasing_z
     191 real    height, w1, w2
     192 logical debug
     193 parameter ( debug = .false. )
     194
     195! does vertical coordinate increase or decrease with increasing k?
     196! set offset appropriately
     197
     198 height = p_out
     199
     200 if(debug) write(6,*) ' height in interp_0 ',height
     201
     202 if (p_in(nz_in) .gt. p_in(1)) then
     203
     204    if(debug) write(6,*) ' monotonic increase in z in interp_0 '
     205    IF (height > p_in(nz_in)) then
     206      if(debug) write(6,*) ' point 1 in interp_0 '
     207      w2 = log(p_in(nz_in)/height)/log(p_in(nz_in)/p_in(nz_in-1))
     208      w1 = 1.-w2
     209      interp_0_log2 = w1*v_in(nz_in) + w2*v_in(nz_in-1)
     210    ELSE IF (height < p_in(1)) then
     211      if(debug) write(6,*) ' point 2 in interp_0 '
     212      w2 = log(p_in(2)/height)/log(p_in(2)/p_in(1))
     213      w1 = 1.-w2
     214      interp_0_log2 = w1*v_in(2) + w2*v_in(1)
     215    ELSE
     216      if(debug) write(6,*) ' point 3 in interp_0 '
     217      interp = .false.
     218      kp = nz_in
     219      DO WHILE ( (interp .eqv. .false.) .and. (kp .ge. 2) )
     220        IF(   ((p_in(kp)   .ge. height) .and.     &
     221               (p_in(kp-1) .le. height))        )   THEN
     222          w2 = log(height/p_in(kp))/log(p_in(kp-1)/p_in(kp))
     223          w1 = 1.-w2
     224          interp_0_log2 = w1*v_in(kp) + w2*v_in(kp-1)
     225          if(debug) write(6,*) ' interp data, kp, w1, w2 ',kp, w1, w2
     226          if(debug) write(6,*) ' interp data, v_in(kp), v_in(kp-1), interp_0_p', &
     227                     v_in(kp), v_in(kp-1), interp_0_log2
     228          interp = .true.
     229        END IF
     230        kp = kp-1
     231      ENDDO
     232    ENDIF
     233
     234 else
     235
     236    if(debug) write(6,*) ' monotonic decrease in z in interp_0 '
     237
     238    IF (height < p_in(nz_in)) then
     239      if(debug) write(6,*) ' point 1 in interp_0 '
     240      w2 = log(p_in(nz_in)/height)/log(p_in(nz_in)/p_in(nz_in-1))
     241      w1 = 1.-w2
     242      interp_0_log2 = w1*v_in(nz_in) + w2*v_in(nz_in-1)
     243    ELSE IF (height > p_in(1)) then
     244      if(debug) write(6,*) ' point 2 in interp_0 '
     245      w2 = log(p_in(2)/height)/log(p_in(2)/p_in(1))
     246      w1 = 1.-w2
     247      interp_0_log2 = w1*v_in(2) + w2*v_in(1)
     248    ELSE
     249      if(debug) write(6,*) ' point 3 in interp_0 '
     250      interp = .false.
     251      kp = nz_in
     252      height = p_out
     253      DO WHILE ( (interp .eqv. .false.) .and. (kp .ge. 2) )
     254        IF(   ((p_in(kp)   .le. height) .and.     &
     255               (p_in(kp-1) .ge. height))             )   THEN
     256          w2 = log(height/p_in(kp))/log(p_in(kp-1)/p_in(kp))
     257          w1 = 1.-w2
     258          interp_0_log2 = w1*v_in(kp) + w2*v_in(kp-1)
     259          interp = .true.
     260        END IF
     261        kp = kp-1
     262      ENDDO
     263    ENDIF
     264
     265 end if
     266
     267 return
     268 END FUNCTION interp_0_log2
     269
    181270END MODULE module_init_utilities
    182271
Note: See TracChangeset for help on using the changeset viewer.