Changeset 1773 in lmdz_wrf


Ignore:
Timestamp:
Feb 12, 2018, 6:09:39 PM (7 years ago)
Author:
lfita
Message:

Adding `zmla_generic': Computation of boundary layer height following a generic method from Nielsen-Gammon et al., 2008 J. Appl. Meteor. Clim. applied also in Garcia-Diez et al., 2013, QJRMS

Location:
trunk/tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r1762 r1773  
    349349    return cape, cin, zlfc, plfc, li, psldims, pslvdims
    350350
     351
     352
    351353def var_clt(cfra):
    352354    """ Function to compute the total cloud fraction following 'newmicro.F90' from
     
    867869
    868870    return psl, psldims, pslvdims
     871
     872def Forcompute_zmla_gen(theta, qratio, zpl, hgt, dimns, dimvns):
     873    """ Function to compute the boundary layer height following a generic method
     874      with Fortran
     875    Forcompute_zmla_gen(theta, qratio, zpl, hgt, zmla, dimns, dimvns)
     876      [theta]= potential air-temperature values (assuming [[t],z,y,x]) [K]
     877      [qratio]= water mixing ratio (assuming [[t],z,y,x]) [kgkg-1]
     878      [zpl]= height from sea level (assuming [[t],z,y,x]) [m]
     879      [hgt]= topographical height (assuming [m]
     880      [zmla]= boundary layer height [m]
     881      [dimns]= list of the name of the dimensions of [theta]
     882      [dimvns]= list of the name of the variables with the values of the
     883        dimensions of [theta]
     884    """
     885    fname = 'Forcompute_zmla_gen'
     886
     887    zmladims = dimns[:]
     888    zmlavdims = dimvns[:]
     889
     890    if len(theta.shape) == 4:
     891        zmla= np.zeros((theta.shape[0],theta.shape[2],theta.shape[3]), dtype=np.float)
     892
     893        dx = theta.shape[3]
     894        dy = theta.shape[2]
     895        dz = theta.shape[1]
     896        dt = theta.shape[0]
     897        zmladims.pop(1)
     898        zmlavdims.pop(1)
     899
     900        pzmla= fdin.module_fordiagnostics.compute_zmla_generic4d(                    \
     901          tpot=theta[:].transpose(), qratio=qratio[:].transpose(),                   \
     902          z=zpl[:].transpose(), hgt=hgt.transpose(), d1=dx, d2=dy, d3=dz, d4=dt)
     903        zmla = pzmla.transpose()
     904    else:
     905        print errormsg
     906        print '  ' + fname + ': rank', len(theta.shape), 'not ready !!'
     907        print '  it only computes 4D [t,z,y,x] rank values'
     908        quit(-1)
     909
     910    return zmla, zmladims, zmlavdims
     911
    869912
    870913def compute_OMEGAw(omega, p, t, dimns, dimvns):
  • trunk/tools/diagnostics.inf

    r1762 r1773  
    4444wssturb, turbulence, wss
    4545zg, WRFght, PH@PHB
     46zmla, WRFzmlagen, T@QVAPOR@WRFgeop@HGT
    4647
  • trunk/tools/diagnostics.py

    r1762 r1773  
    11041104        ncvar.insert_variable(ncobj, 'zhgtrel', diagout, dnames, diagoutvd, newnc)
    11051105
     1106# WRFzmla_gen generic boundary layer hieght computation from WRF theta, QVAPOR, WRFgeop, HGT,
     1107    elif diagn == 'WRFzmlagen':
     1108        var0 = ncobj.variables[depvars[0]][:]+300.
     1109        var1 = ncobj.variables[depvars[1]][:]
     1110        dimz = var0.shape[1]
     1111        var2 = WRFgeop[:,1:dimz+1,:,:]/9.8
     1112        var3 = ncobj.variables[depvars[3]][0,:,:]
     1113
     1114        diagout, diagoutd, diagoutvd = diag.Forcompute_zmla_gen(var0,var1,var2,var3, \
     1115          dnames,dvnames)
     1116
     1117        # Removing the nonChecking variable-dimensions from the initial list
     1118        varsadd = []
     1119        for nonvd in NONchkvardims:
     1120            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
     1121            varsadd.append(nonvd)
     1122
     1123        ncvar.insert_variable(ncobj, 'zmla', diagout, diagoutd, diagoutvd, newnc)
     1124
    11061125    else:
    11071126        print errormsg
  • trunk/tools/module_ForDiagnostics.f90

    r1769 r1773  
    2727! compute_vertint1D: Subroutine to vertically integrate a 1D variable in any vertical coordinates
    2828! compute_zint4D: Subroutine to vertically integrate a 4D variable in any vertical coordinates
     29! compute_zmla_generic4D: Subroutine to compute pbl-height following a generic method
     30
    2931!!!
    3032! Calculations
     
    597599  END SUBROUTINE compute_cape_afwa4D
    598600
     601  SUBROUTINE compute_zmla_generic4D(tpot, qratio, z, hgt, zmla3D, d1, d2, d3, d4)
     602! Subroutine to compute pbl-height following a generic method
     603!    from Nielsen-Gammon et al., 2008 J. Appl. Meteor. Clim.
     604!    applied also in Garcia-Diez et al., 2013, QJRMS
     605!   where
     606!     "The technique identifies the ML height as a threshold increase of potential temperature from
     607!       its minimum value within the boundary layer."
     608!   here applied similarly to Garcia-Diez et al. where
     609!      zmla = "...first level where potential temperature exceeds the minimum potential temperature
     610!        reached in the mixed layer by more than 1.5 K"
     611
     612    IMPLICIT NONE
     613
     614    INTEGER, INTENT(in)                                  :: d1, d2, d3, d4
     615    REAL(r_k), DIMENSION(d1,d2,d3,d4), INTENT(in)        :: tpot, qratio, z
     616    REAL(r_k), DIMENSION(d1,d2), INTENT(in)              :: hgt
     617    REAL(r_k), DIMENSION(d1,d2,d4), INTENT(out)          :: zmla3D
     618 
     619! Local
     620    INTEGER                                              :: i, j, it
     621
     622!!!!!!! Variables
     623! tpot: potential air temperature [K]
     624! qratio: water vapour mixing ratio [kgkg-1]
     625! z: height above sea level [m]
     626! hgt: terrain height [m]
     627! zmla3D: boundary layer height from surface [m]
     628
     629    fname = 'compute_zmla_generic4D'
     630
     631    DO i=1, d1
     632      DO j=1, d2
     633        DO it=1, d4
     634          CALL var_zmla_generic(d3, qratio(i,j,:,it), tpot(i,j,:,it), z(i,j,:,it), hgt(i,j),          &
     635            zmla3D(i,j,it))
     636        END DO
     637      END DO
     638    END DO
     639
     640    RETURN
     641
     642  END SUBROUTINE compute_zmla_generic4D
     643
     644
    599645END MODULE module_ForDiagnostics
  • trunk/tools/module_ForDiagnosticsVars.f90

    r1769 r1773  
    1111
    1212  IMPLICIT NONE
    13 
    14   REAL(r_k), PARAMETER                                   :: ZEPSEC=1.0D-12
    15 ! Low limit pressure for medium clouds [Pa]
    16   REAL(r_k), PARAMETER                                   :: prmhc = 44000.d0
    17 ! Low limit pressure for High clouds [Pa]
    18   REAL(r_k), PARAMETER                                   :: prmlc = 68000.d0
    1913
    2014  CONTAINS
     
    3428! var_cllmh: low, medium, high-cloud [0,1]
    3529! var_clt: total cloudiness [0,1]
     30! var_zmla_generic: Subroutine to compute pbl-height following a generic method
    3631! VirtualTemp1D: Function for 1D calculation of virtual temperaure
    3732! VirtualTemperature: WRF's AFWA method to compute virtual temperature
     
    967962! ---- END modified from module_diag_afwa.F ---- !
    968963
     964  SUBROUTINE var_zmla_generic(dz, qv, tpot, z, topo, zmla)
     965!  Subroutine to compute pbl-height following a generic method
     966!    from Nielsen-Gammon et al., 2008 J. Appl. Meteor. Clim.
     967!    applied also in Garcia-Diez et al., 2013, QJRMS
     968!   where
     969!     "The technique identifies the ML height as a threshold increase of potential temperature from
     970!       its minimum value within the boundary layer."
     971!   here applied similarly to Garcia-Diez et al. where
     972!      zmla = "...first level where potential temperature exceeds the minimum potential temperature
     973!        reached in the mixed layer by more than 1.5 K"
     974
     975    IMPLICIT NONE
     976
     977    INTEGER, INTENT(in)                                  :: dz
     978    REAL(r_k), DIMENSION(dz), INTENT(in)                 :: qv, tpot, z
     979    REAL(r_k), INTENT(in)                                :: topo
     980    REAL(r_k), INTENT(out)                               :: zmla
     981
     982! Local
     983    INTEGER                                              :: i
     984    INTEGER                                              :: mldlev, bllev
     985    REAL(r_k)                                            :: dqvar, tpotmin, refdt
     986
     987!!!!!!! Variables
     988! qv: water vapour mixing ratio
     989! tpot: potential temperature [K]
     990! z: height above sea level [m]
     991! topo: topographic height [m]
     992! zmla: boundary layer height [m]
     993
     994    fname = 'var_zmla_generic'
     995
     996    ! Pecentage of difference of mixing ratio used to determine Mixed layer depth
     997    dqvar = 0.1
     998
     999    ! MLD = Mixed layer with no substantial variation of mixing ratio /\qv < 10% ?
     1000    !PRINT *,'  Mixed layer mixing ratios qv[1] lev qv[lev] dqvar% _______'
     1001    DO mldlev = 2, dz
     1002      IF (ABS(qv(mldlev)-qv(1))/qv(1) > dqvar ) EXIT
     1003    !  PRINT *,qv(1), mldlev, qv(mldlev), ABS(qv(mldlev)-qv(1))/qv(1)
     1004    END DO
     1005
     1006    ! Looking for the minimum potential temperature within the MLD [tpotmin = min(tpot)_0^MLD]
     1007    tpotmin = MINVAL(tpot(1:mldlev))
     1008
     1009    ! Change in temperature to determine boundary layer height
     1010    refdt = 1.5
     1011
     1012    ! Determine the first level where tpot > tpotmin + 1.5 K
     1013    !PRINT *,'  Mixed layer tpotmin lev tpotmin[lev] dtpot _______'
     1014    DO bllev = 1, dz
     1015      IF (ABS(tpot(bllev)-tpotmin) > refdt ) EXIT
     1016    !  PRINT *,tpotmin, bllev, tpot(bllev), ABS(tpot(bllev)-tpotmin)
     1017    END DO
     1018   
     1019    !PRINT *,'   height end MLD:', z(mldlev)
     1020    !PRINT *,'   pbl height:', z(bllev)
     1021
     1022    zmla = z(bllev) - topo
     1023
     1024    RETURN
     1025
     1026  END SUBROUTINE var_zmla_generic
    9691027
    9701028END MODULE module_ForDiagnosticsVars
  • trunk/tools/module_definitions.f90

    r1759 r1773  
    2525
    2626! Scientific constants
     27!!
     28
     29  REAL(r_k), PARAMETER                                   :: ZEPSEC=1.0D-12
     30! Low limit pressure for medium clouds [Pa]
     31  REAL(r_k), PARAMETER                                   :: prmhc = 44000.d0
     32! Low limit pressure for High clouds [Pa]
     33  REAL(r_k), PARAMETER                                   :: prmlc = 68000.d0
     34
    2735  REAL(r_k), PARAMETER                                   :: grav = 9.81 ! gravity [ms-1]
    2836  REAL(r_k), PARAMETER                                   :: Cpmol = 29.07 ! Molar gas heat capacity at constant pressure [Jmol-1K-1]
Note: See TracChangeset for help on using the changeset viewer.