Changeset 2675 in lmdz_wrf for trunk


Ignore:
Timestamp:
Jul 12, 2019, 10:31:58 PM (5 years ago)
Author:
lfita
Message:

Adding:

  • 'frontogenesis': Calculation of the frontogenesis diagnostics
Location:
trunk/tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r2674 r2675  
    16001600
    16011601    if len(theta.shape) == 4:
    1602         dx = tas.shape[3]
    1603         dy = tas.shape[2]
    1604         dz = tas.shape[1]
    1605         dt = tas.shape[0]
     1602        dx = theta.shape[3]
     1603        dy = theta.shape[2]
     1604        dz = theta.shape[1]
     1605        dt = theta.shape[0]
    16061606
    16071607        xdiab = np.zeros((dt,dz,dy,dx), dtype=np.float)
     
    16231623        dxst = dxs.transpose()
    16241624        dyst = dys.transpose()
    1625         dzst = dzs.transpose()
     1625
     1626        print '  ' + fname + ' Lluis shapes dzs', dzs.shape, 'dz:', dz
    16261627 
    16271628        pxdiab, pydiab, pzdiab, pxdef, pydef, pzdef, pxtilt, pytilt, pzdiv, pf =     \
    16281629          fdin.module_fordiagnostics.compute_frontogenesis(theta=thetat, ua=uat,     \
    1629           va=vat, wa=wat, press=presst, dsx=dxst, dsy=dyst, dsz=dzst, dst=dts, d1=dx,\
     1630          va=vat, wa=wat, press=presst, dsx=dxst, dsy=dyst, dsz=dzs, dst=dts, d1=dx, \
    16301631          d2=dy, d3=dz, d4=dt)
    16311632        xdiab = pxdiab.transpose()
  • trunk/tools/diagnostics.inf

    r2655 r2675  
    1818fog, fog_RUC, Q2@T2@PSFC
    1919front, front_R04, T2@U10@V10@WRFdx@WRFdy@params:1.:0.0001
     20frontogenesis, frontogenesis, WRFt@UNua@UNva@UNwa@WRFp@WRFdx@WRFdy@WRFdz@WRFtime
    2021hur, LMDZrh, pres@t@r
    2122hur, WRFrh, WRFrh@T@P@PB
  • trunk/tools/diagnostics.py

    r2674 r2675  
    106106  'WRFbils',  'WRFbnds',                                                             \
    107107  'WRFclivi', 'WRFclwvi', 'WRFdens', 'WRFdx', 'WRFdxdy', 'WRFdxdywps', 'WRFdy',      \
    108   'WRFgeop', 'WRFp', 'WRFtd',                                                        \
     108  'WRFdz', 'WRFgeop', 'WRFp', 'WRFtd',                                               \
    109109  'WRFpos', 'WRFprc', 'WRFprls', 'WRFrh', 'LMDZrh', 'LMDZrhs',                       \
    110110  'WRFrhs', 'WRFrvors',                                                              \
     
    173173WRFdxdywps_compute = False
    174174LONLATdxdy_compute = False
     175UNua_compute = False
     176UNva_compute = False
     177UNwa_compute = False
    175178
    176179# File creation
     
    486489    print '  ' + main + ': Retrieving dz: real distance between grid points ' +      \
    487490      'from WRF as dz=PHB(k+1)+PH(k+1)-(PHB(k)+PH(k))'
     491    PH = ncobj.variables['PH'][:]
     492    PHB = ncobj.variables['PHB'][:]
     493
    488494    dimv = ncobj.variables['PH'].shape
    489495
     
    876882    elif diagn == 'frontogenesis':
    877883           
    878         var0 = ncobj.variables[depvars[0]][:]
     884        if depvars[0] == 'WRFt': var0 = WRFt
     885        else: var0 = ncobj.variables[depvars[0]][:]
     886        dx = var0.shape[3]
     887        dy = var0.shape[2]
     888        dz = var0.shape[1]
     889        dt = var0.shape[0]
    879890        var1 = ncobj.variables[depvars[1]][:]
    880891        var2 = ncobj.variables[depvars[2]][:]
    881         if depvars[3] == 'WRFpress': var3 = WRFpress
    882         else: var3 = ncobj.variables[depvars[3]]
    883         if depvars[4] == 'WRFdx': var4 = WRFdx
     892        var3 = ncobj.variables[depvars[3]][:]
     893        if depvars[4] == 'WRFp': var4 = WRFp
    884894        else: var4 = ncobj.variables[depvars[4]]
    885         if depvars[5] == 'WRFdy': var5 = WRFdy
     895        if depvars[5] == 'WRFdx': var5 = WRFdx
    886896        else: var5 = ncobj.variables[depvars[5]]
    887         if depvars[6] == 'WRFdz': var6 = WRFdz[0,:,0,0]
     897        if depvars[6] == 'WRFdy': var6 = WRFdy
    888898        else: var6 = ncobj.variables[depvars[6]]
    889         if depvars[7] == 'WRFtime': var7 = WRFtime
     899        if depvars[7] == 'WRFdz': var7 = WRFdz[0,0:dz,0,0]
    890900        else: var7 = ncobj.variables[depvars[7]]
     901        if depvars[8] == 'WRFtime': var08 = WRFtime
     902        else: var08 = ncobj.variables[depvars[8]]
     903
     904        # Assuming monotonic time-axis...
     905        var8 = var08[1] - var08[0]
    891906
    892907        diag1, diag2, diag3, diag4, diag5, diag6, diag7, diag8, diag9, diag10,       \
    893908          diagoutd, diagoutvd = diag.Forcompute_frontogenesis(var0, var1, var2, var3,\
    894           var4, var5, var6, var7, dnames,dvnames)
     909          var4, var5, var6, var7, var8, dnames, dvnames)
    895910
    896911        ncvar.insert_variable(ncobj, 'diabh', diag1, diagoutd, diagoutvd, newnc,     \
  • trunk/tools/module_ForDiagnostics.f90

    r2674 r2675  
    15961596    INTEGER, INTENT(in)                                  :: d1, d2, d3, d4
    15971597    REAL(r_k), DIMENSION(d1,d2,d3,d4), INTENT(in)        :: theta, ua, va, wa, press
    1598     REAL(r_k), DIMENSION(d1,d2), INTENT(in)              :: dsx, dsy, dsz, dst
     1598    REAL(r_k), INTENT(in)                                :: dst
     1599    REAL(r_k), DIMENSION(d1,d2), INTENT(in)              :: dsx, dsy
     1600    REAL(r_k), DIMENSION(d3), INTENT(in)                 :: dsz
    15991601    REAL(r_k), DIMENSION(d1,d2,d3,d4), INTENT(out)       :: xdiab, ydiab, zdiab, xdef, ydef, zdef,    &
    1600       xtilt, ytilt, zdiv, f
     1602      xtilt, ytilt, zdiv
    16011603    REAL(r_k), DIMENSION(d1,d2,d3,d4,3), INTENT(out)     :: f
    16021604 
     
    16231625
    16241626    DO it=1, d4
    1625       CALL var_Frontogenesis(dx, dy, dz, theta(:,:,:,it), ua(:,:,:,it), va(:,:,:,it), wa(:,:,:,it),   &
    1626         press(:,:,:,it), ddx, ddy, ddz, ddt, xdiab(:,:,:,it), ydiab(:,:,:,it), zdiab(:,:,:,it),       &
     1627      CALL var_Frontogenesis(d1, d2, d3, theta(:,:,:,it), ua(:,:,:,it), va(:,:,:,it), wa(:,:,:,it),   &
     1628        press(:,:,:,it), dsx, dsy, dsz, dst, xdiab(:,:,:,it), ydiab(:,:,:,it), zdiab(:,:,:,it),       &
    16271629        xdef(:,:,:,it), ydef(:,:,:,it), zdef(:,:,:,it), xtilt(:,:,:,it), ytilt(:,:,:,it),             &
    16281630        zdiv(:,:,:,it), f(:,:,:,it,:))
     
    16311633    RETURN
    16321634
    1633   END SUBROUTINE compute_front_R04d3
     1635  END SUBROUTINE compute_frontogenesis
    16341636
    16351637END MODULE module_ForDiagnostics
  • trunk/tools/module_ForDiagnosticsVars.f90

    r2674 r2675  
    20592059    REAL(r_k), DIMENSION(dx,dy), INTENT(in)              :: ddx,ddy
    20602060    REAL(r_k), DIMENSION(dz), INTENT(in)                 :: ddz
    2061     REAL(r_k), DIMENSION(dx,dy,dz,), INTENT(in)          :: theta, ua, va, wa, press
    2062     REAL(r_k), DIMENSION(dx,dy,dz,), INTENT(out)         :: xdiab, ydiab, zdiab
    2063     REAL(r_k), DIMENSION(dx,dy,dz,), INTENT(out)         :: xdef, ydef, zdef
    2064     REAL(r_k), DIMENSION(dx,dy,dz,), INTENT(out)         :: xtilt, ytilt, zdiv
     2061    REAL(r_k), DIMENSION(dx,dy,dz), INTENT(in)           :: theta, ua, va, wa, press
     2062    REAL(r_k), DIMENSION(dx,dy,dz), INTENT(out)          :: xdiab, ydiab, zdiab
     2063    REAL(r_k), DIMENSION(dx,dy,dz), INTENT(out)          :: xdef, ydef, zdef
     2064    REAL(r_k), DIMENSION(dx,dy,dz), INTENT(out)          :: xtilt, ytilt, zdiv
    20652065    REAL(r_k), DIMENSION(dx,dy,dz,3), INTENT(out)        :: f
    20662066
     
    21102110    zdiv(:,:,:) = thetatilt(:,:,:,3)
    21112111
    2112     f(:,:,:,1) = 1./modthteagrad*thetagrad(:,:,:,1)*(xdiab(:,:,:) + xdef(:,:,:) +          &
    2113       xtilt(:,:,:))
     2112    f(:,:,:,1) = 1./modthetagrad*thetagrad(:,:,:,1)*(xdiab(:,:,:) + xdef(:,:,:) + xtilt(:,:,:))
    21142113    f(:,:,:,2) = thetagrad(:,:,:,2)*(ydiab(:,:,:) + ydef(:,:,:) + ytilt(:,:,:))
    21152114    f(:,:,:,3) = thetagrad(:,:,:,3)*(zdiab(:,:,:) + zdef(:,:,:) + zdiv(:,:,:))
  • trunk/tools/module_scientific.f90

    r2674 r2675  
    79237923  END FUNCTION vecmodule3D
    79247924
    7925   SUBROUTINE FUNCTION matmodule3D(d1, d2, d3, mat, matmodule)
     7925  SUBROUTINE matmodule3D(d1, d2, d3, mat, matmodule)
    79267926  ! Subroutine to compute the module of a 3D matrix with 3 components
    79277927
    79287928    IMPLICIT NONE
    79297929
     7930    INTEGER, INTENT(in)                                  :: d1,d2,d3
    79307931    REAL(r_k), DIMENSION(d1,d2,d3,3), INTENT(in)         :: mat
    79317932    REAL(r_k), DIMENSION(d1,d2,d3), INTENT(out)          :: matmodule
     
    79337934    fname = 'matmodule3D'
    79347935
    7935     matmodule3D = SQRT(vec(:,:,:,1)*vec(:,:,:,1) + vec(:,:,:,2)*vec(:,:,:,2) +                        &
    7936       vec(:,:,:,3)*vec(:,:,:,3))
     7936    matmodule = SQRT(mat(:,:,:,1)*mat(:,:,:,1) + mat(:,:,:,2)*mat(:,:,:,2) + mat(:,:,:,3)*mat(:,:,:,3))
    79377937
    79387938  END SUBROUTINE matmodule3D
     
    79607960    def = fillval64
    79617961
    7962     def(:,:,:,1) = - uagrad(:,:,:,1)*vargrad(:,:,:1) - vagrad(:,:,:,1)*vargrad(:,:,:2)
    7963     def(:,:,:,2) = - uagrad(:,:,:,2)*vargrad(:,:,:1) - vagrad(:,:,:,2)*vargrad(:,:,:2)
    7964     def(:,:,:,3) = - uagrad(:,:,:,3)*vargrad(:,:,:1) - vagrad(:,:,:,3)*vargrad(:,:,:2)
     7962    def(:,:,:,1) = -uagrad(:,:,:,1)*vargrad(:,:,:,1) -vagrad(:,:,:,1)*vargrad(:,:,:,2)
     7963    def(:,:,:,2) = -uagrad(:,:,:,2)*vargrad(:,:,:,1) -vagrad(:,:,:,2)*vargrad(:,:,:,2)
     7964    def(:,:,:,3) = -uagrad(:,:,:,3)*vargrad(:,:,:,1) -vagrad(:,:,:,3)*vargrad(:,:,:,2)
    79657965
    79667966  END SUBROUTINE deformation3D
     
    79887988    tilt = fillval64
    79897989
    7990     tilt(:,:,:,1) = - uagrad(:,:,:,1)*vargrad(:,:,:3)
    7991     tilt(:,:,:,2) = - vagrad(:,:,:,2)*vargrad(:,:,:3)
    7992     tilt(:,:,:,3) = - wagrad(:,:,:,3)*vargrad(:,:,:3)
     7990    tilt(:,:,:,1) = -wagrad(:,:,:,1)*vargrad(:,:,:,3)
     7991    tilt(:,:,:,2) = -wagrad(:,:,:,2)*vargrad(:,:,:,3)
     7992    tilt(:,:,:,3) = -wagrad(:,:,:,3)*vargrad(:,:,:,3)
    79937993
    79947994  END SUBROUTINE tilting3D
     
    80008000
    80018001    INTEGER, INTENT(in)                                  :: dx, dy, dz, dt
    8002     REAL(r_k), DIMENSION(dx,dy,dz,dt), INTENT(in)        :: vargrad
     8002    REAL(r_k), INTENT(in)                                :: ddt
     8003    REAL(r_k), DIMENSION(dx,dy,dz,dt), INTENT(in)        :: var
    80038004    CHARACTER(LEN=*), INTENT(in)                         :: dtkind
    80048005    REAL(r_k), DIMENSION(dx,dy,dz,dt), INTENT(out)       :: vardt
     
    80398040    END IF   
    80408041
    8041   END SUBROUTINE tilting3D
     8042  END SUBROUTINE deltat3D
    80428043
    80438044END MODULE module_scientific
Note: See TracChangeset for help on using the changeset viewer.