Changeset 1804 in lmdz_wrf


Ignore:
Timestamp:
Mar 15, 2018, 5:54:49 PM (7 years ago)
Author:
lfita
Message:

Adding:

  • `evspsblpot': potential evapotranspiration following Penman-Monteith formulation implemented in ORCHIDEE
Location:
trunk/tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diag_tools.py

    r1795 r1804  
    2929# compute_WRFuasvas: Fucntion to compute geographical rotated WRF 2-meter winds
    3030# derivate_centered: Function to compute the centered derivate of a given field
    31 # Forcompute_cllmh: Function to compute cllmh: low/medium/hight cloud fraction following newmicro.F90 from LMDZ via Fortran subroutine
    32 # Forcompute_clt: Function to compute the total cloud fraction following 'newmicro.F90' from LMDZ via a Fortran module
    33 # Forcompute_psl_ptarget: Function to compute the sea-level pressure following target_pressure value found in `p_interp.F'
    34 # Forcompute_zmla_gen: Function to compute the boundary layer height following a generic method with Fortran
    35 # Forcompute_zwind: Function to compute the wind at a given height following the power law method
    36 # Forcompute_zwind_log: Function to compute the wind at a given height following the logarithmic law method
    37 # Forcompute_zwindMO: Function to compute the wind at a given height following the Monin-Obukhov theory
     31# Forcompute_cllmh: Function to compute cllmh: low/medium/hight cloud fraction
     32#   following newmicro.F90 from LMDZ via Fortran subroutine
     33# Forcompute_clt: Function to compute the total cloud fraction following
     34#   'newmicro.F90' from LMDZ via a Fortran module
     35# Forcompute_potevap_orPM: Function to compute potential evapotranspiration following
     36#   Penman-Monteith formulation implemented in ORCHIDEE
     37# Forcompute_psl_ptarget: Function to compute the sea-level pressure following
     38#   target_pressure value found in `p_interp.F'
     39# Forcompute_zmla_gen: Function to compute the boundary layer height following a
     40#   generic method with Fortran
     41# Forcompute_zwind: Function to compute the wind at a given height following the
     42#   power law method
     43# Forcompute_zwind_log: Function to compute the wind at a given height following the
     44#   logarithmic law method
     45# Forcompute_zwindMO: Function to compute the wind at a given height following the
     46#   Monin-Obukhov theory
    3847# W_diagnostic: Class to compute WRF diagnostics variables
    3948
    4049# Others just providing variable values
    4150# var_cllmh: Fcuntion to compute cllmh on a 1D column
    42 # var_clt: Function to compute the total cloud fraction following 'newmicro.F90' from LMDZ using 1D vertical column values
    43 # var_hur: Function to compute relative humidity following 'August - Roche - Magnus' formula
    44 # var_hur_Uhus: Function to compute relative humidity following 'August - Roche - Magnus' formula using hus
     51# var_clt: Function to compute the total cloud fraction following 'newmicro.F90' from
     52#   LMDZ using 1D vertical column values
     53# var_hur: Function to compute relative humidity following 'August - Roche - Magnus'
     54#   formula
     55# var_hur_Uhus: Function to compute relative humidity following 'August-Roche-Magnus'
     56#   formula using hus
    4557# var_mslp: Fcuntion to compute mean sea-level pressure
    46 # var_td: Function to compute dew-point air temperature from temperature and pressure values
    47 # var_td_Uhus: Function to compute dew-point air temperature from temperature and pressure values using hus
     58# var_td: Function to compute dew-point air temperature from temperature and pressure
     59#   values
     60# var_td_Uhus: Function to compute dew-point air temperature from temperature and
     61#   pressure values using hus
    4862# var_virtualTemp: This function returns virtual temperature in K,
    4963# var_WRFtime: Function to copmute CFtimes from WRFtime variable
     
    5165# var_wd: Function to compute the wind speed
    5266# rotational_z: z-component of the rotatinoal of horizontal vectorial field
    53 # turbulence_var: Function to compute the Taylor's decomposition turbulence term from a a given variable
     67# turbulence_var: Function to compute the Taylor's decomposition turbulence term from
     68#   a a given variable
    5469
    5570import numpy as np
     
    10791094
    10801095    return var1, var2, vardims, varvdims
     1096
     1097def Forcompute_potevap_orPM(rho1, ust, uas, vas, tas, ps, qv1, dimns, dimvns):
     1098    """ Function to compute potential evapotranspiration following Penman-Monteith
     1099      formulation implemented in ORCHIDEE
     1100    Forcompute_potevap_orPM(rho1, uas, vas, tas, ps, qv2, qv1, dimns, dimvns)
     1101      [rho1]= air-density at the first layer (assuming [[t],y,m]) [kgm-3]
     1102      [ust]= u* in similarity theory (assuming [[t],y,x]) [ms-1]
     1103      [uas]= x-component of unstaggered 10 m wind (assuming [[t],y,x]) [ms-1]
     1104      [vas]= y-component of unstaggered 10 m wind (assuming [[t],y,x]) [ms-1]
     1105      [tas]= 2m air temperature [K]
     1106      [ps]= surface pressure [Pa]
     1107      [qv1]= mixing ratio at the first atmospheric layer [kgkg-1]
     1108      [dimns]= list of the name of the dimensions of [uas]
     1109      [dimvns]= list of the name of the variables with the values of the
     1110        dimensions of [uas]
     1111    """
     1112    fname = 'Forcompute_potevap_orPM'
     1113
     1114    vardims = dimns[:]
     1115    varvdims = dimvns[:]
     1116
     1117    if len(uas.shape) == 3:
     1118        var1= np.zeros((uas.shape[0],uas.shape[1],uas.shape[2]), dtype=np.float)
     1119        var2= np.zeros((uas.shape[0],uas.shape[1],uas.shape[2]), dtype=np.float)
     1120
     1121        dx = uas.shape[2]
     1122        dy = uas.shape[1]
     1123        dt = uas.shape[0]
     1124
     1125        pvar = fdin.module_fordiagnostics.compute_potevap_orpm3d(                    \
     1126          rho1=rho1.transpose(), ust=ust.transpose(), uas=uas.transpose(),           \
     1127          vas=vas.transpose(), tas=tas.transpose(), ps=ps.transpose(),               \
     1128          qv1=qv1.transpose(), d1=dx, d2=dy, d3=dt)
     1129        var = pvar.transpose()
     1130    else:
     1131        print errormsg
     1132        print '  ' + fname + ': rank', len(uas.shape), 'not ready !!'
     1133        print '  it only computes 3D [t,y,x] rank values'
     1134        quit(-1)
     1135
     1136    return var, vardims, varvdims
     1137
     1138####### ###### ##### #### ### ## # END Fortran diagnostics
    10811139
    10821140def compute_OMEGAw(omega, p, t, dimns, dimvns):
  • trunk/tools/diagnostics.inf

    r1803 r1804  
    1818mrso, WRFmrso,  SMOIS@DZS
    1919p, WRFp, P@PB
     20evspsblpot, WRFpotevap_orPM, WRFdens@UST@U10@V10@T2@PSFC@QVAPOR
    2021pr, RAINTOT, RAINC@RAINNC@WRFtime
    2122pracc, ACRAINTOT, RAINC@RAINNC@WRFtime
  • trunk/tools/diagnostics.py

    r1803 r1804  
    871871        ncvar.insert_variable(ncobj, 'zg', diagout, dnames, diagoutvd, newnc)
    872872
     873# WRFpotevap_orPM potential evapotranspiration following Penman-Monteith formulation
     874#   implemented in ORCHIDEE as: WRFdens, UST, U10, V10, T2, PSFC, QVAPOR
     875    elif diagn == 'WRFpotevap_orPM':
     876        var0 = WRFdens[:,0,:,:]
     877        var1 = ncobj.variables[depvars[1]][:]
     878        var2 = ncobj.variables[depvars[2]][:]
     879        var3 = ncobj.variables[depvars[3]][:]
     880        var4 = ncobj.variables[depvars[4]][:]
     881        var5 = ncobj.variables[depvars[5]][:]
     882        var6 = ncobj.variables[depvars[6]][:,0,:,:]
     883
     884        dnamesvar = list(ncobj.variables[depvars[1]].dimensions)
     885        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     886
     887        diagout = np.zeros(var1.shape, dtype=np.float)
     888        diagout, diagoutd, diagoutvd = diag.Forcompute_potevap_orPM(var0, var1, var2,\
     889          var3, var4, var5, var6, dnamesvar, dvnamesvar)
     890
     891        # Removing the nonChecking variable-dimensions from the initial list
     892        varsadd = []
     893        for nonvd in NONchkvardims:
     894            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
     895            varsadd.append(nonvd)
     896
     897        ncvar.insert_variable(ncobj, 'evspsblpot', diagout, diagoutd, diagoutvd, newnc)
     898
    873899# WRFmslp_ptarget sea-level pressure following ECMWF method as PSFC, HGT, WRFt, WRFp, ZNU, ZNW
    874900    elif diagn == 'WRFpsl_ecmwf':
  • trunk/tools/module_ForDiagnostics.f90

    r1795 r1804  
    795795  END SUBROUTINE compute_zwindMO3D
    796796
     797  SUBROUTINE compute_potevap_orPM3D(d1, d2, d3, rho1, ust, uas, vas, tas, ps, qv1, potevap)
     798! Subroutine to compute potential evapotranspiration Penman-Monteith formulation implemented in
     799!   ORCHIDEE
     800
     801    IMPLICIT NONE
     802
     803    INTEGER, INTENT(in)                                  :: d1, d2, d3
     804    REAL(r_k), DIMENSION(d1,d2,d3), INTENT(in)           :: rho1, ust, uas, vas, tas, ps, qv1
     805    REAL(r_k), DIMENSION(d1,d2,d3), INTENT(out)          :: potevap
     806 
     807! Local
     808    INTEGER                                              :: i, j, it
     809
     810!!!!!!! Variables
     811! rho1: atsmophere density at the first layer [kgm-3]
     812! ust: u* in similarity theory [ms-1]
     813! uas: x-component 10-m wind speed [ms-1]
     814! vas: y-component 10-m wind speed [ms-1]
     815! tas: 2-m atmosphere temperature [K]
     816! ps: surface pressure [Pa]
     817! qv1: 1st layer atmospheric mixing ratio [kgkg-1]
     818! potevap: potential evapo transpiration [kgm-2s-1]
     819
     820    fname = 'compute_potevap_orPM3D'
     821
     822    DO i=1, d1
     823      DO j=1, d2
     824        DO it=1, d3
     825          CALL var_potevap_orPM(rho1(i,j,it), ust(i,j,it), uas(i,j,it), vas(i,j,it), tas(i,j,it),     &
     826            ps(i,j,it), qv1(i,j,it), potevap(i,j,it))
     827        END DO
     828      END DO
     829    END DO
     830
     831    RETURN
     832
     833  END SUBROUTINE compute_potevap_orPM3D
     834
    797835END MODULE module_ForDiagnostics
  • trunk/tools/module_ForDiagnosticsVars.f90

    r1795 r1804  
    1515
    1616!!!!!!! Variables
     17! Cdrag_0: Fuction to compute a first order generic approximation of the drag coefficient
    1718! compute_psl_ptarget4d2: Compute sea level pressure using a target pressure. Similar to the Benjamin
    1819!   and Miller (1990). Method found in p_interp.F90
     
    2829! var_cllmh: low, medium, high-cloud [0,1]
    2930! var_clt: total cloudiness [0,1]
     31! var_potevap_orPM: potential evapotranspiration following Penman-Monteith formulation implemented in ORCHIDEE
    3032! var_psl_ecmwf: sea level pressure using ECMWF method following Mats Hamrud and Philippe Courtier [Pa]
    3133! var_zmla_generic: Subroutine to compute pbl-height following a generic method
     
    12791281  !   Springer (p376-383)
    12801282  ! Only usefull for newz < 80. m
     1283  ! Ackonwledgement: M. A. Jimenez, UIB
    12811284
    12821285    IMPLICIT NONE
     
    13781381  END SUBROUTINE stabfunc_businger
    13791382
     1383  REAL(r_k) FUNCTION Cdrag_0(ust,uas,vas)
     1384! Fuction to compute a first order generic approximation of the drag coefficient as
     1385!   CD = (ust/wss)**2
     1386!  after, Garratt, J.R., 1992.: The Atmospheric Boundary Layer. Cambridge Univ. Press,
     1387!    Cambridge, U.K., 316 pp
     1388! Ackonwledgement: M. A. Jimenez, UIB
     1389!
     1390    IMPLICIT NONE
     1391
     1392    REAL(r_k), INTENT(in)                                :: ust, uas, vas
     1393
     1394!!!!!!! Variables
     1395! ust: u* in similarity theory [ms-1]
     1396! uas, vas: x/y-components of wind at 10 m
     1397
     1398    fname = 'Cdrag_0'
     1399
     1400    Cdrag_0 = ust**2/(uas**2+vas**2)
     1401
     1402  END FUNCTION Cdrag_0
     1403
     1404  SUBROUTINE var_potevap_orPM(rho1, ust, uas, vas, tas, ps, qv1, potevap)
     1405! Subroutine to compute the potential evapotranspiration following Penman-Monteith formulation
     1406!   implemented in ORCHIDEE
     1407!      potevap = dt*rho1*qc*(q2sat-qv1)
     1408
     1409    IMPLICIT NONE
     1410
     1411    REAL(r_k), INTENT(in)                                :: rho1, ust, uas, vas, tas, ps, qv1
     1412    REAL(r_k), INTENT(out)                               :: potevap
     1413
     1414! Local
     1415    REAL(r_k)                                            :: q2sat, Cd, qc
     1416
     1417!!!!!!! Variables
     1418! rho1: atsmophere density at the first layer [kgm-3]
     1419! ust: u* in similarity theory [ms-1]
     1420! uas, vas: x/y-components of 10-m wind [ms-1]
     1421! tas: 2-m atmosphere temperature [K]
     1422! ps: surface pressure [Pa]
     1423! qv1: 1st layer atmospheric mixing ratio [kgkg-1]
     1424! potevap: potential evapo transpiration [kgm-2s-1]
     1425  fname = 'var_potevap_orPM'
     1426
     1427  ! q2sat: Saturated air at 2m (can be assumed to be q2 == qsfc?)
     1428  q2sat = SaturationMixingRatio(tas, ps)
     1429
     1430  ! Cd: drag coeffiecient
     1431  Cd = Cdrag_0(ust, uas, vas)
     1432
     1433  ! qc: surface drag coefficient
     1434  qc = SQRT(uas**2 + vas**2)*Cd
     1435
     1436  potevap = MAX(zeroRK, rho1*qc*(q2sat - qv1))
     1437
     1438  END SUBROUTINE var_potevap_orPM
     1439
    13801440END MODULE module_ForDiagnosticsVars
  • trunk/tools/variables_values.dat

    r1803 r1804  
    159159evspsbl, evspsblac, water_evaporation_flux_ac, 0., 1.5e-4, accumulated|water|evaporation|flux, kgm-2, Blues, $evspsbl^{ac}$, evspsblac
    160160SFCEVPde, evspsblac, water_evaporation_flux_ac, 0., 1.5e-4, accumulated|water|evaporation|flux, kgm-2, Blues, $evspsbl^{ac}$, evspsblac
     161evspsblpot, evspsblpot, potential_water_evapotranspiration_flux, 0., 1.5e-4, potential|evapotranspiration|flux, kgm-2s-1, Blues, $evspsblpot$, evspsblpot
     162EVSPSBLPOT, evspsblpot, potential_water_evapotranspiration_flux, 0., 1.5e-4, potential|evapotranspiration|flux, kgm-2s-1, Blues, $evspsblpot$, evspsblpot
    161163g, g, grauepl_mixing_ratio, 0., 0.0003, graupel|mixing|ratio, kgkg-1, Purples, $qg$, qg
    162164QGRAUP, g, grauepl_mixing_ratio, 0., 0.0003, graupel|mixing|ratio, kgkg-1, Purples, $qg$, qg
Note: See TracChangeset for help on using the changeset viewer.